[Haskell-cafe] (Why) must this function remain nameless?
allbery.b at gmail.com
Thu May 28 19:29:06 UTC 2015
On Tue, May 26, 2015 at 12:31 AM, Clinton Mead <clintonmead at gmail.com>
> The following code (somewhat contrived) code compiles on GHC without
> issue, and towards the end repeatedly uses the lambda function "(\fn (D x)
> -> f fn x)". But when I simply try to give it a name, like so:
> h = (\fn (D x) -> f fn x)
> I then get a compile error.
That's inviting the monomorphism restriction to become involved, as a top
level binding without a parameter (the parameter is explicitly part of its
value). If that is the issue, writing it as
h fn (D x) = f fn x
would work better.
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe