[Haskell-cafe] implicit parameters THANK YOU!

Thomas Jäger thjaeger at gmail.com
Tue Mar 22 07:10:41 EST 2005


Hello again,

Sorry, I made a little mistake.

> > a :: Int
> > a = let ?foo = 0 in b where
> >   b :: (?foo :: Int) => Int
> >   b = let ?foo = 1 in c where
> >     c = ?foo
> The meaning of this code depends on the flag
> -f(no)-monomorphism-restriction since with the monomorphism turned on,
> `c' gets the monomorphic type `Int', and the `?foo' in the definition
> of `c' refers to the implicit parameter of `b', so `a' evaluates to
> `0'. On the other hand, without the monomorphism restriction, the type
> of `c' becomes `(?foo :: Int) => Int', and it is easy to see that `a'
> evaluates to `0'.
In this case, `a' of course evaluates to `1'.

Thomas


More information about the Haskell-Cafe mailing list