diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2014-02-26 10:17:45 -0500 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2014-02-26 11:10:16 -0500 |
commit | 98b6756b09194352aa2ccfbb624992150a7a3520 (patch) | |
tree | a64fe19ac5e32a60dc5461e9ff1785500d6e692d /compiler/deSugar | |
parent | 018676c7f883886b388652c913c99a10d2591b0b (diff) | |
download | haskell-98b6756b09194352aa2ccfbb624992150a7a3520.tar.gz |
Fix #8807.
It turns out that the enhanced repPred function in DsMeta assumed
that the head of any constraint would be a tycon. This assumption
is false. Happily, the solution involved *deleting* code. I
just removed repPred in favor of repTy, and added the HsEqTy case
to repTy, where it should be anyway.
Diffstat (limited to 'compiler/deSugar')
-rw-r--r-- | compiler/deSugar/DsMeta.hs | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 7fe77c5d2b..6df92af517 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -754,41 +754,9 @@ repLContext :: LHsContext Name -> DsM (Core TH.CxtQ) repLContext (L _ ctxt) = repContext ctxt repContext :: HsContext Name -> DsM (Core TH.CxtQ) -repContext ctxt = do preds <- repList predQTyConName repLPred ctxt +repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds --- represent a type predicate --- -repLPred :: LHsType Name -> DsM (Core TH.PredQ) -repLPred (L _ p) = repPred p - -repPred :: HsType Name -> DsM (Core TH.PredQ) -repPred (HsParTy ty) - = repLPred ty -repPred ty - | Just (cls, tys) <- splitHsClassTy_maybe ty - -- works even when cls is not a class (ConstraintKinds) - = do - cls1 <- lookupOcc cls - tyco <- repNamedTyCon cls1 - tys' <- mapM repLTy tys - repTapps tyco tys' -repPred (HsEqTy tyleft tyright) - = do - tyleft1 <- repLTy tyleft - tyright1 <- repLTy tyright - eq <- repTequality - repTapps eq [tyleft1, tyright1] -repPred (HsTupleTy _ lps) - = do - tupTy <- repTupleTyCon size - tys' <- mapM repLTy lps - repTapps tupTy tys' - where - size = length lps -repPred ty - = notHandled "Exotic predicate type" (ppr ty) - -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] @@ -843,6 +811,11 @@ repTy (HsTupleTy _ tys) = do tys1 <- repLTys tys repTy (HsOpTy ty1 (_, n) ty2) = repLTy ((nlHsTyVar (unLoc n) `nlHsAppTy` ty1) `nlHsAppTy` ty2) repTy (HsParTy t) = repLTy t +repTy (HsEqTy t1 t2) = do + t1' <- repLTy t1 + t2' <- repLTy t2 + eq <- repTequality + repTapps eq [t1', t2'] repTy (HsKindSig t k) = do t1 <- repLTy t k1 <- repLKind k @@ -858,6 +831,7 @@ repTy (HsExplicitTupleTy _ tys) = do repTy (HsTyLit lit) = do lit' <- repTyLit lit repTLit lit' + repTy ty = notHandled "Exotic form of type" (ppr ty) repTyLit :: HsTyLit -> DsM (Core TH.TyLitQ) |