On Wednesday 17 November 2010 20:19:17, Ryan Ingram wrote: > Now of course, the followup question is "what the heck is a > monomorphism restriction and why would I want it?" > > Here is a simple example: <snip> > > But if you give g the more general type signature, the > expensiveComputation has to get run *every time g is called*. This is > because there's no way to create a single storage cell for c; there's > a possible answer for every single type that is an instance of Num. > > f makes it clear; c does not get evaluated until the arguments are > saturated and is locally allocated. So it's alright to give it the > polymorphic type. > > -- ryan
That's a most excellent example, thanks. I hope I find it the next time the topic comes up. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
