[haskell-llvm] (StructFields s) vs. IsType (Struct s)
Henning Thielemann
lemming at henning-thielemann.de
Wed Sep 28 11:51:58 BST 2011
On Wed, 28 Sep 2011, Henning Thielemann wrote:
> Maybe this is a logical problem:
>
> GHC says
>
> Could not deduce (llvm-0.10.0.0:LLVM.Core.Type.StructFields s)
> from the context (IsType (Struct s), ...)
> ...
> Possible fix:
> add (llvm-0.10.0.0:LLVM.Core.Type.StructFields s) to the context ...
>
>
> I could just add the (StructFields s) constraint, but StructFields is not
> exported. I thought that adding (IsType (Struct s)) is also ok, since the
> llvm package exports the instance:
> StructFields s => IsType (Struct s)
Ok, the problem was, that IsFirstClass (Struct s) was needed and there is
an instance:
StructFields s => IsFirstClass (Struct s)
Thus GHC suggested (StructFields s).
I think that GHC does not deduce (StructFields s) from IsType (Struct s),
because there might be overlapping instances. If it would, it could derive
IsType (Struct s) -> StructFields s -> IsFirstClass (Struct s)
More information about the Haskell-llvm
mailing list