[haskell-llvm] [Haskell-cafe] Problems with high-level interface to LLVM

Henning Thielemann lemming at henning-thielemann.de
Wed May 18 18:36:21 BST 2011


On Wed, 18 May 2011, Николай Кудасов wrote:

> Oops, sorry. I meant something like:
> 
> > class (CallArgs (RetIO a) (RetCG a)) => CFunction a where
> >     type RetIO a
> >     type RetCG a
> 
> > instance CFunction Int32 where
> >     type RetIO Int32 = IO Int32
> >     type RetCG Int32 = (forall r. CodeGenFunction r Int32)
> 
> > ExprVar :: (CFunction a) => Ident -> Expr a
> 
> This should work fine for me, but polymorphic types are not allowed in type functions or
> super-classes.

Do you need a (forall r) on the right-hand side? I think

> forall r. a -> b -> CodeGenFunction r c

will do it. That is, you may extend CFunction to a multi-parameter type 
class, where 'r' is one parameter. This is also the way, the type classes 
in 'llvm' are designed.



More information about the Haskell-llvm mailing list