[Haskell-cafe] ghci and applicative
Brent Yorgey
byorgey at seas.upenn.edu
Fri Jun 12 15:30:45 EDT 2009
On Fri, Jun 12, 2009 at 03:00:12PM +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.
It can wait. You just have to turn off the monomorphism restriction (recommended).
Prelude> :set -XNoMonomorphismRestriction
Prelude> let a = 1
Prelude> a + 2.0
3.0
You can even add
:set -XNoMonomorphismRestriction
to your .ghci file so that it is always turned off in ghci.
-Brent
More information about the Haskell-Cafe
mailing list