You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was working on another package that required use of ghc 7.8 features but also depended on llvm. In attempting to compile llvm I ran into several issues. The experience may be helpful to others. Taking things in the order that they occurred:
llvm-base
LLVM/ST.hs:535:15:
Could not deduce (MonadMG m0)
arising from the ambiguity check for ‘runCodeGen’
from the context (Monad (m c s), MonadMG m)
bound by the type signature for
runCodeGen :: (Monad (m c s), MonadMG m) =>
STValue c s -> CodeGen c s a -> ModuleGen c s a
at LLVM/ST.hs:(535,15)-(536,61)
The type variable ‘m0’ is ambiguous
In the ambiguity check for:
forall c s a (m :: * -> * -> * -> *).
(Monad (m c s), MonadMG m) =>
STValue c s -> CodeGen c s a -> ModuleGen c s a
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature for ‘runCodeGen’:
runCodeGen :: (Monad (m c s), MonadMG m) =>
STValue c s -> CodeGen c s a -> ModuleGen c s a
Following the suggestion to enable the AllowAmbiguousTypes extension allowed successful compilation and installation of llvm-base.
type-level
llvm depends on type-level. The type-level package will not compile with ghc 7.8.2 due to stricter checking of coverage in instance declarations. The problem is exemplified by:
src/Data/TypeLevel/Num/Ops.hs:90:10:
Illegal instance declaration for ‘Succ' (x, x) (x, x) D0 D0 True’
The liberal coverage condition fails in class ‘Succ'’
for functional dependency: ‘yh yl yz -> xh xl’
Reason: lhs types ‘D0’, ‘D0’, ‘True’
do not jointly determine rhs types ‘(x, x)’, ‘(x, x)’
In the instance declaration for ‘Succ' (x, x) (x, x) D0 D0 True’
Similar Illegal instance errors occur on lines 254, 255, 256, 266, and 336 of Ops.hs. As a workaround, built a version of Ops.hs that simply did not have these instances declared -- it is not clear to me how to really fix the problem. llvm seems not to depend on any of these instances, but it is certainly not a general solution. I'll file a separate issue report for type-level, but if you just want to get llvm working, the workaround appears to be sufficient. Ops.h also requires the AllowAmbiguousTypes extension to be enabled.
llvm itself
llvm also has illegal instance problems:
LLVM/Util/Arithmetic.hs:250:10:
Illegal instance declaration for
‘ArithFunction (CodeGenFunction r a) (CodeGenFunction r ())’
The liberal coverage condition fails in class ‘ArithFunction’
for functional dependency: ‘b -> a’
Reason: lhs type ‘CodeGenFunction r ()’
does not determine rhs type ‘CodeGenFunction r a’
In the instance declaration for
‘ArithFunction (CodeGenFunction r a) (CodeGenFunction r ())’
Again non knowing what else to do, I simply removed the problematic instance declarations -- on lines 250, 253, 280 and 286 of Arithmetic.hs. My use of LLVM did not require any of them, but once again it's only a workaround and not a fix.
The text was updated successfully, but these errors were encountered:
I was working on another package that required use of ghc 7.8 features but also depended on llvm. In attempting to compile llvm I ran into several issues. The experience may be helpful to others. Taking things in the order that they occurred:
llvm-base
Following the suggestion to enable the AllowAmbiguousTypes extension allowed successful compilation and installation of llvm-base.
type-level
llvm depends on type-level. The type-level package will not compile with ghc 7.8.2 due to stricter checking of coverage in instance declarations. The problem is exemplified by:
Similar Illegal instance errors occur on lines 254, 255, 256, 266, and 336 of Ops.hs. As a workaround, built a version of Ops.hs that simply did not have these instances declared -- it is not clear to me how to really fix the problem. llvm seems not to depend on any of these instances, but it is certainly not a general solution. I'll file a separate issue report for type-level, but if you just want to get llvm working, the workaround appears to be sufficient. Ops.h also requires the AllowAmbiguousTypes extension to be enabled.
llvm itself
llvm also has illegal instance problems:
Again non knowing what else to do, I simply removed the problematic instance declarations -- on lines 250, 253, 280 and 286 of Arithmetic.hs. My use of LLVM did not require any of them, but once again it's only a workaround and not a fix.
The text was updated successfully, but these errors were encountered: