<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Yeah, I went back and tried double again, though I'd swear I got the dang thing to compile (and run) w/o errors.<br><br>I guess I meant Num. So Num is a class and Int and Integer are types? What are the other classes? Docs?<br><br>Unification, for me, is pattern matching ala Prolog. What's the meaning in Haskell? Docs?<br><br>I've been digging into this stuff for months and it's still tripping me up. Very frustrating.<br><br>Thanks.<br><br>Michael<br><br><br>--- On <b>Thu, 5/28/09, wren ng thornton <i><wren@freegeek.org></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: wren ng thornton <wren@freegeek.org><br>Subject: Re: [Haskell-cafe] What's the problem with iota's type signature?<br>To: "Haskell-cafe" <haskell-cafe@haskell.org><br>Date: Thursday, May 28, 2009,
12:40 AM<br><br><div class="plainMail">michael rice wrote:<br>> Still exploring monads. I don't understand why the type signature for double is OK,<br><br>It isn't. The |a| and |b| variables must unify:<br><br> Prelude> :t \x -> Just (x+x)<br> \x -> Just (x+x) :: (Num a) => a -> Maybe a<br><br> Prelude> :t (\x -> Just (x+x)) :: Num a => a -> Maybe b<br> <interactive>:1:13:<br> Couldn't match expected type `b' against inferred type `a'<br> `b' is a rigid type variable bound by<br> the polymorphic type `forall a b. (Num a) => a -> Maybe b'<br> at <interactive>:1:0<br> `a' is a rigid type variable bound by<br> the
polymorphic type `forall a b. (Num a) => a -> Maybe b'<br> at <interactive>:1:0<br> In the first argument of `Just', namely `(x + x)'<br> In the expression: Just (x + x)<br><br><br>> but not the one for iota.<br><br>Again the |a| and |b| must unify.<br>Also, Int isn't a type class (did you mean Num?)<br>Also, the use of (..) requires the Enum class.<br><br> Prelude> :t \n -> [1..n]<br> \n -> [1..n] :: (Enum t, Num t) => t -> [t]<br><br> Prelude> [3,4,5] >>= (\n -> [1..n])<br> [1,2,3,1,2,3,4,1,2,3,4,5]<br><br>-- Live well,<br>~wren<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a
href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></blockquote></td></tr></table><br>