Closed jtdaugherty closed 6 years ago
Hunh... I don't get that with GHC 8.2
This is related to the RebindableSyntax
extension. You can turn it off and I think it should compile then; you'll just get slightly worse error messages from the typechecker.
I'm not sure why the standard ifThenElse
combinator isn't in scope already...
I'm going to try GHC 8.2. With RebindableSyntax
disabled, I now get:
src/TLC/TypeCheck.hs:153:15: error:
• Ambiguous type variable ‘m0’ arising from a use of ‘throwError’
prevents the constraint ‘(MonadError String m0)’ from being solved.
Relevant bindings include
fail :: String -> m0 a0 (bound at src/TLC/TypeCheck.hs:153:4)
Probable fix: use a type annotation to specify what ‘m0’ should be.
These potential instances exist:
instance [safe] MonadError e (Either e)
-- Defined in ‘Control.Monad.Error.Class’
instance [safe] Monad m => MonadError e (ExceptT e m)
-- Defined in ‘Control.Monad.Error.Class’
...plus 11 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression:
throwError $ unlines ["Error during typechecking", show tm, msg]
In an equation for ‘fail’:
fail msg
= throwError $ unlines ["Error during typechecking", show tm, msg]
In an equation for ‘verifyTyping’:
verifyTyping scope env tm
= case tm of {
TmVar nm
-> case elemIndex nm scope of {
Just i -> ...
Nothing -> throwError $ unwords ... }
TmInt n -> return $ TCResult AST.IntRepr (AST.TmInt n)
TmBool b -> return $ TCResult AST.BoolRepr (AST.TmBool b)
TmLe x y
-> do { TCResult AST.IntRepr x' <- verifyTyping scope env x;
.... }
TmAdd x y
-> do { TCResult AST.IntRepr x' <- verifyTyping scope env x;
.... }
TmNeg x
-> do { TCResult xtp x' <- verifyTyping scope env x;
.... }
TmIte c x y
-> do { TCResult AST.BoolRepr c' <- verifyTyping scope env c;
.... }
TmApp x y
-> do { TCResult (AST.ArrowRepr argTy outTy) x' <- verifyTyping
scope env x;
.... }
TmAbs nm tp x
-> do { Some argTy <- return $ typeToRepr tp;
.... }
TmFix nm tp x
-> do { Some argTy <- return $ typeToRepr tp;
.... } }
where
fail msg = throwError $ unlines ["Error during typechecking", ....]
I get the above error also on GHC 8.2.2.
Even stranger... I just rebuilt with 8.0.2 and I can't reproduce this error
I am running
param-tlc
at f6db52fdf6a3ce74a05717c2b68c2bf046ff481e
parameterized-utils
at 1279b108ca6ce482dff1532e166aa0788a50db16
In the meantime, you can probably just comment out the fail
definition. It has an ambuguous type because its not being used with RebindableSyntax turned off
Oh, sorry - I forgot to re-enable that once I moved to 8.2.2. Once I reinstated that extension, it built. Thanks!
On GHC 8.0.1,
cabal-install
2.0.0.1: