On Fri, 2009-06-12 at 15:00 +0100, Paul Keir wrote:
> Thanks Ryan, I'm slowly becoming aware of the effects of Monomorphism.
> I'll look
> again at Neil Mitchell's blog post.
> 
> I guess it's the same thing when I try:
> 
> > let a = 1
> > a + 1.0
> 
> I'm taking the "mono" as a clue that the type inferencing will
> complete after each ghci carriage return; once only. In this example
> when "a" is set, it is to an Integer. One might imagine ghci could
> wait until I use "a" somewhere, but that's not how things are.

Or be explicit about it and give it a polymorphic type:

Prelude> let a :: Num a => a; a = 1
Prelude> :t a
a :: (Num a) => a
Prelude> a + 1.0
2.0

Duncan

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

Reply via email to