strange behavior of let in ghci

Antoine Latter aslatter at gmail.com
Fri Jan 20 06:10:09 CET 2012


On Thu, Jan 19, 2012 at 10:55 PM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> Hello,
>
> I met strange behavior of let in ghci 7.0.4. The following works well.
>

You're running into the monomorphism restriction:
http://www.haskell.org/haskellwiki/Monomorphism_restriction

>
>> let chooseMax = maximumBy compFst

If you re-define this to be:

> let chooseMax x = maximumBy compFst x

you'll get around it in the easiest way.

You can also turn off the restriction at the command-line with the
argument '-XNoMonomorphismRestriction', I think.

Antoine



More information about the Glasgow-haskell-users mailing list