michael rice <nowgate <at> yahoo.com> writes:

> 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


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to