[Haskell-cafe] Re: What's the problem with iota's type signature?

Gracjan Polak gracjanpolak at gmail.com
Thu May 28 05:19:33 EDT 2009

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

You don't have to guess then, Haskell compiler can do the guessing for you. It
is called type inference.


More information about the Haskell-Cafe mailing list