Николай Кудасов wrote:
Problem becomes much more complex when I want to add function calls into
my language. Type class CallArgs has an instance CallArgs (IO a)
(CodeGenFunction r (Value a)), which can't be given as a constraint in
typed AST because of free variable r. For a long time I have had no idea
of how I can add function calls into my language.
RankNTypes?
First I was also annoyed by this 'r' type parameter. But I think it is
there in order to assert that LLVM code blocks have the same return type
in 'ret' instructions when composing them.
The only solution I see at the moment is to reject high-level llvm
interface provided by llvm library and use directly FFI bindings to C.
I have not tried, but I would also think that the strongly typed llvm
binding makes writing a compiler hard. However I enjoy it for
just-in-time compilation and building an embedded domain specific
language. For writing a compiler you might prefer the LLVM bindings that
are created by David Terei for GHC's LLVM backend.
PS: Also posted to haskell-llvm mailing list.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe