Haskell/Solutions/Type basics
From Wikibooks, the open-content textbooks collection
| Exercises |
|---|
|
Finding types for functions is a basic Haskell skill that you should become very familiar with. What are the types of the following functions?
For any functions hereafter involving numbers, you can just assume the numbers are Ints.
|
negate :: Int -> Int&& :: Bool -> Bool -> Bool|| :: Bool -> Bool -> Bool
And in the second round:
f :: Bool -> Bool -> Boolg :: Int -> Inth :: Int -> a -> b -> Char. The usage ofaandbis explained in the next section. In this case the function doesn't use y or z, so the types can be anything.