
16 Jun
2008
16 Jun
'08
5:22 p.m.
On 6/11/08, Jonathan Cast
This doesn't apply to f, though --- it has a function type, so the user presumably already knows it won't be subject to updating, no? Distinguishing functions from variables by the form of declaration, rather than the type, seems somewhat questionable to me.
Not necessarily, contrast these two definitions: f = foldr (+) 0 f_expensive = let n = head $ drop 100000 $ fibs 1 1 in foldr (+) n With the monomorphism restriction in place, f_expensive only calculates n once. Without, it gets calculated each time f is instantiated. -- ryan