[Haskell-beginners] Lambda Functions

Andrew Wagner wagner.andrew at gmail.com
Thu Feb 26 18:01:31 EST 2009


Excellent list. It seems like every time I hear about a problem with the
MMR, I go "wow, how come I never ran across that? oh yeah, because I write
type signatures..."
On Thu, Feb 26, 2009 at 5:51 PM, Felipe Lessa <felipe.lessa at gmail.com>wrote:

> On Thu, Feb 26, 2009 at 7:25 PM, Thomas Davie <tom.davie at gmail.com> wrote:
> > I'm not 100% certain here, so someone may correct me, but I think this is
> > what's going on:
> [snip]
>
> Yep, that's right. Is it just me or the monomorphism restriction
> suddenly became the hot topic here on beginners?
>
> > Another way to write it ofc would simply be uncurry (==).
>
> Better yet, write a type signature. I highly recommend writing type
> signatures for *all* top-level definitions, including non-exported
> ones:
>
> - You avoid most cases where the monomorphism restriction would bother you.
>
> - You avoid type errors on other functions (sometimes you make a
> mistake but the code type checks with a wrong signature, and the type
> error shows up only when you use the function elsewhere).
>
> - It gives you some insights before implementing, and helps whoever
> reads your code.
>
> - It allows you to specialize the code when polymorphism is not needed.
>
> Probably there are other reasons as well, but these are the most prominent.
>
> --
> Felipe.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090226/8c993f12/attachment.htm


More information about the Beginners mailing list