diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2006-12-28 01:03:48 +0000 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2006-12-28 01:03:48 +0000 |
commit | 654a1ba16e47d3ddabeb74b809ee6097c0770d35 (patch) | |
tree | 770e472fc1dbe386a5ee0c122192f8f42f5d218c /compiler/rename | |
parent | ae52214482136fdeaaf9d741cf1211cf3cdce5c6 (diff) | |
download | haskell-654a1ba16e47d3ddabeb74b809ee6097c0770d35.tar.gz |
Parse and desugar equational constraints
- With -findexed-types, equational constraints can appear in contexts
wherever class predicates are allowed.
- The two argument types need to be boxed and rank 0.
Diffstat (limited to 'compiler/rename')
-rw-r--r-- | compiler/rename/RnHsSyn.lhs | 2 | ||||
-rw-r--r-- | compiler/rename/RnTypes.lhs | 20 |
2 files changed, 15 insertions, 7 deletions
diff --git a/compiler/rename/RnHsSyn.lhs b/compiler/rename/RnHsSyn.lhs index 53f04e2ba2..8774b40625 100644 --- a/compiler/rename/RnHsSyn.lhs +++ b/compiler/rename/RnHsSyn.lhs @@ -87,6 +87,8 @@ extractHsCtxtTyNames (L _ ctxt) -- so don't mention the IP names extractHsPredTyNames (HsClassP cls tys) = unitNameSet cls `unionNameSets` extractHsTyNames_s tys +extractHsPredTyNames (HsEqualP ty1 ty2) + = extractHsTyNames ty1 `unionNameSets` extractHsTyNames ty2 extractHsPredTyNames (HsIParam n ty) = extractHsTyNames ty \end{code} diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs index fe51c1af32..8dbf8878b3 100644 --- a/compiler/rename/RnTypes.lhs +++ b/compiler/rename/RnTypes.lhs @@ -505,14 +505,20 @@ rnLPred :: SDoc -> LHsPred RdrName -> RnM (LHsPred Name) rnLPred doc = wrapLocM (rnPred doc) rnPred doc (HsClassP clas tys) - = lookupOccRn clas `thenM` \ clas_name -> - rnLHsTypes doc tys `thenM` \ tys' -> - returnM (HsClassP clas_name tys') - + = do { clas_name <- lookupOccRn clas + ; tys' <- rnLHsTypes doc tys + ; returnM (HsClassP clas_name tys') + } +rnPred doc (HsEqualP ty1 ty2) + = do { ty1' <- rnLHsType doc ty1 + ; ty2' <- rnLHsType doc ty2 + ; returnM (HsEqualP ty1' ty2') + } rnPred doc (HsIParam n ty) - = newIPNameRn n `thenM` \ name -> - rnLHsType doc ty `thenM` \ ty' -> - returnM (HsIParam name ty') + = do { name <- newIPNameRn n + ; ty' <- rnLHsType doc ty + ; returnM (HsIParam name ty') + } \end{code} |