
28 May
2009
28 May
'09
5:19 a.m.
michael rice
I've been digging into this stuff for months and it's still tripping me up.
For exploration use GHCi. It can tell you the type of thing you have written. It has command to tell you type of thing, the ":t". See here: Prelude> let double x = Just (x + x) Prelude> :t double double :: (Num a) => a -> Maybe a Prelude> let iota n = [1..n] Prelude> :t iota iota :: (Num t, Enum t) => t -> [t] Prelude> [3,4,5] >>= iota [1,2,3,1,2,3,4,1,2,3,4,5] You don't have to guess then, Haskell compiler can do the guessing for you. It is called type inference. -- Gracjan