michael rice wrote:
Yeah, I went back and tried double again, though I'd swear I got the dang thing
to compile (and run) w/o errors.
I guess I meant Num. So Num is a class and Int and Integer are types? What are
the other classes? Docs?
Unification, for me, is pattern matching ala Prolog.
wrote:
From: wren ng thornton w...@freegeek.org
Subject: Re: [Haskell-cafe] What's the problem with iota's type signature?
To: Haskell-cafe haskell-cafe@haskell.org
Date: Thursday, May 28, 2009, 11:14 PM
michael rice wrote:
Yeah, I went back and tried double again, though I'd swear I got the dang
Still exploring monads. I don't understand why the type signature for double is
OK, but not the one for iota.
Michael
=
--double :: (Int a) = a - Maybe b
--double x = Just (x + x)
iota :: (Int a) = a - [b]
iota n = [1..n]
--usage: [3,4,5] = iota
--should produce
On 28/05/2009 04:33, michael rice wrote:
Still exploring monads. I don't understand why the type signature for
double is OK, but not the one for iota.
Michael
=
--double :: (Int a) = a - Maybe b
--double x = Just (x + x)
iota :: (Int a) = a - [b]
iota n = [1..n]
--usage:
On Wed, May 27, 2009 at 7:33 PM, michael rice nowg...@yahoo.com wrote:
Still exploring monads. I don't understand why the type signature for
double is OK, but not the one for iota.
Michael
=
--double :: (Int a) = a - Maybe b
--double x = Just (x + x)
iota :: (Int a) = a
On Thu, May 28, 2009 at 10:33 AM, michael rice nowg...@yahoo.com wrote:
Still exploring monads. I don't understand why the type signature for double
is OK, but not the one for iota.
Michael
=
--double :: (Int a) = a - Maybe b
--double x = Just (x + x)
Prelude let double x
michael rice wrote:
Still exploring monads. I don't understand why the type signature for double is
OK,
It isn't. The |a| and |b| variables must unify:
Prelude :t \x - Just (x+x)
\x - Just (x+x) :: (Num a) = a - Maybe a
Prelude :t (\x - Just (x+x)) :: Num a = a - Maybe b
in
Haskell? Docs?
I've been digging into this stuff for months and it's still tripping me up.
Very frustrating.
Thanks.
Michael
--- On Thu, 5/28/09, wren ng thornton w...@freegeek.org wrote:
From: wren ng thornton w...@freegeek.org
Subject: Re: [Haskell-cafe] What's the problem with iota's type