On Tue, May 26, 2015 at 12:31 AM, Clinton Mead <clintonmead@gmail.com> wrote:
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@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net