Question: Help with Haskell Please (a) Which two of the three types are the same, (1)Int -> Bool -> Int, (2)Int -> (Bool ->Int), and (3)(Int
Help with Haskell Please
(a) Which two of the three types are the same, (1)Int -> Bool -> Int, (2)Int -> (Bool ->Int), and (3)(Int -> Bool) -> Int? Justify your answer.
(b) What is the type of the expression map length?
(c) Recall the function composition operation(.)that takes in two functions and returns a new function. It is defined as follows.(.) f g x = f (g x)Which of the following type (types) can be assigned to(.)? Justify your answer.(1) (a -> b) -> (b -> c) -> c(2) (b -> c) -> (a -> b) -> (a -> c)(3) (a -> b) -> (b -> c) -> a -> c(4) (b -> c) -> (a -> b) -> a -> c
(d) Remember that the type of tailis[a] -> [a]. Can we say that its type is[String] ->String? Justify your answer.
(e) Assume the expression f has the type(Int -> Int) -> Int -> Bool. What is the type of the expression f succ? Justify your answer. In particular, write down the parameter type and return type of relevant functions and the type of the argument.
(f) Assume the expression f has the type(Int -> Int) -> Int -> Bool. What is the type of the expression f (succ 3)? Justify your answer. In particular, write down the parameter type andreturn type of relevant functions and the type of the argument.
(g) Assume the expression f has the type Int -> Int -> Int -> Bool. What is the type of the expression f succ? Justify your answer. In particular, write down the parameter type and return type of relevant functions and the type of the argument.
(h) Assume the expression f has the type Int -> Int -> Int -> Bool. What is the type of the expression f (succ 3)? Justify your answer. In particular, write down the parameter type and return type of relevant functions and the type of the argument.
(i) What is the type of the expressionfoldr (\x y -> sum x + y) 0? Justify your answer. You may assume that 0 has the typeInt.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
