[haskell-llvm] some trouble getting started

Henning Thielemann lemming at henning-thielemann.de
Thu Apr 28 15:33:28 BST 2011

On Wed, 27 Apr 2011, Keith Sheppard wrote:

> Fibonacci/Fibonacci.hs:66:13:
>    No instance for (ABinOp a Word32 (v c))
>      arising from a use of `and' at Fibonacci/Fibonacci.hs:66:13-31
>    Possible fix:
>      add an instance declaration for (ABinOp a Word32 (v c))
>    In a stmt of a 'do' expression: a <- and x (1 :: Word32)
>    In the expression:
>        do l1 <- newBasicBlock
>           l2 <- newBasicBlock
>           l3 <- newBasicBlock
>           a <- and x (1 :: Word32)
>           ....
>    In the second argument of `($)', namely
>        `\ x y
>             -> do l1 <- newBasicBlock
>                   l2 <- newBasicBlock
>                   ....'

Note that the way, how arithmetic operators are defined, the type 
inference does not work. That is, usually you have to tell LLVM the type 
of both operands. It cannot infer the operand types from the result type 
or one operand type from the other operand. This is, because the 
arithmetic operators support mixes of Value and ConstValue and Word. If 
you are happy with all operands being Value and want type inference, then 
you might try:

You may also use latest llvm from code.haskell.org/llvm repository since 
this contains some fixes with respect to LLVM-2.8.

More information about the Haskell-llvm mailing list