[Haskell-beginners] how monomorphism restriction effects eta reduction
vxanica at gmail.com
Sun Jun 17 18:22:40 CEST 2012
I think monomorphism restriction is for shared evaluation.like following
f xs = let len = genericLength xs in (len, len) from haskell wiki
under monomorphism the type is Num t => [b] -> (t, t), if it no
monomorphism restriction the type will be (Num t, Num t1) => [b] -> (t, t1)
which lead to twice evaluation of len. However I didn't see how the
restriction effects eta reduction, when define function like f = show, g =
(==) or f = \x -> show x, g = \x -> \y -> (x==y). anyone can explain it to
me? Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners