[Haskell-beginners] how monomorphism restriction effects eta reduction

Song Zhang 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...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120618/d507517c/attachment.htm>

More information about the Beginners mailing list