[Haskell-cafe] Re: Multiparamater class type-inference error
Yitzchak Gale
gale at sefer.org
Mon Jan 29 03:08:25 EST 2007
Alfonso Acosta wrote:
> fstSY = mapSY fst
> No instance for (Synchronous s ((a, b) -> a) (a, b) a)...
> ...no error arises if I explicitly give the type
> signature of fstSY
> fstSY :: Signal (a,b) -> Signal a
This is the notorious Monomorphism Restriction.
See
http://www.haskell.org/haskellwiki/Monomorphism_restriction
You can get around it either by specifying the type,
as you discovered, or by using the -fno-monomorphism-restriction
flag for ghc or ghci. In ghci you can also specify
this as a :set command, hence also in your .ghci file
if you'd like.
Hope this helps,
Yitz
More information about the Haskell-Cafe
mailing list