Page 1 of 1

Suppose we define Haskell functions with the following types: data Locale = Farm Integer Zoo Float (Bool, Char) | Park (

Posted: Thu May 05, 2022 12:42 pm
by answerhappygod
Suppose We Define Haskell Functions With The Following Types Data Locale Farm Integer Zoo Float Bool Char Park 1
Suppose We Define Haskell Functions With The Following Types Data Locale Farm Integer Zoo Float Bool Char Park 1 (227.93 KiB) Viewed 35 times
Suppose we define Haskell functions with the following types: data Locale = Farm Integer Zoo Float (Bool, Char) | Park (a, Int) [a] cheetah a -> (Char, a) -> String jaguar (Char -> Integer) -> Float -> [Bool] lion String -> Locale panther Float -> Bool tiger (Int, Bool) -> Integer For each of the following expressions, determine whether or not it is well-typed. • If it has a type, then then give its most general type. • If it is not well-typed (i.e., a type error would arise), then briefly explain the source of the type error. 1. cheetah (tiger (7,False)) 2. filter panther [] 3. jaguar 'R' 17 4. (lion,"cub", True) 5. map tiger 6. Park (panther, 7)
7. [lion, lion, lion] 8. Zoo