[haskell-llvm] Beginner - Anonymous Functions
Henning Thielemann
lemming at henning-thielemann.de
Sun Nov 6 22:53:51 GMT 2011
On Sun, 6 Nov 2011, Elliott Pace wrote:
> I'm a beginner to using Haskell-LLVM and when trying to pull together some toy functions, I came across
> the following problem. I've looked at the examples but I cannot find something that does this.
>
> The idea is to create a curried function (and therefore an anonymous function) ala:
>
> plus x y = x + y;
>
> My attempt is as below:
>
> data Mod = Mod { mplus :: Function (Word32 -> IO (Function (Word32 -> IO Word32)))
>
>
> }
How shall this work on the machine level? It would mean, that 'mplus'
actually compiles a new function of type (Word32 -> IO Word32) at
run-time.
For a real application there are certainly ways to achieve what you want
in a different way.
More information about the Haskell-llvm
mailing list