
17 Jun
2012
17 Jun
'12
4:22 p.m.
I think monomorphism restriction is for shared evaluation.like following function 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.