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

2009-05-28 Thread Gracjan Polak
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


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

2009-05-28 Thread Lee Duhem
On Thu, May 28, 2009 at 5:19 PM, Gracjan Polak gracjanpo...@gmail.com wrote:
 You don't have to guess then, Haskell compiler can do the guessing for you.

It isn't guess, Haskell compiler (like GHC) gets these types by (type)
inference, as you said :-)

lee

 It is called type inference.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe