Haskell/Solutions/Type basics
From Wikibooks, open books for an open world
| Exercises |
|---|
|
- "H" is a
Stringwith just one element. - 'Hello World' is invalid because
Chars consist of only one character.
| 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.
This page may need to be