diff options
author | Jose Pedro Magalhaes <jpm@cs.uu.nl> | 2011-11-11 09:07:39 +0000 |
---|---|---|
committer | Jose Pedro Magalhaes <jpm@cs.uu.nl> | 2011-11-11 09:07:39 +0000 |
commit | 96154b6154c6e7556a92695428d0fc8ddf015d2a (patch) | |
tree | 66e9ea53712153c3b86675210df5bd0b1b0c0855 /src/Haddock/Interface | |
parent | 2a8f4845d919c5508452f30ffc419646d8841841 (diff) |
New kind-polymorphic core
This big patch implements a kind-polymorphic core for GHC. The current
implementation focuses on making sure that all kind-monomorphic programs still
work in the new core; it is not yet guaranteed that kind-polymorphic programs
(using the new -XPolyKinds flag) will work.
For more information, see http://haskell.org/haskellwiki/GHC/Kinds
Diffstat (limited to 'src/Haddock/Interface')
-rw-r--r-- | src/Haddock/Interface/Rename.hs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index 546ba62b..88e64cfa 100644 --- a/src/Haddock/Interface/Rename.hs +++ b/src/Haddock/Interface/Rename.hs @@ -211,6 +211,12 @@ renameFnArgsDoc = mapM renameDoc renameLType :: LHsType Name -> RnM (LHsType DocName) renameLType = mapM renameType +renameLKind :: LHsKind Name -> RnM (LHsKind DocName) +renameLKind = renameLType + +renameMaybeLKind :: Maybe (LHsKind Name) -> RnM (Maybe (LHsKind DocName)) +renameMaybeLKind Nothing = return Nothing +renameMaybeLKind (Just ki) = renameLKind ki >>= return . Just renameType :: HsType Name -> RnM (HsType DocName) renameType t = case t of @@ -240,17 +246,18 @@ renameType t = case t of HsTupleTy b ts -> return . HsTupleTy b =<< mapM renameLType ts - HsOpTy a (L loc op) b -> do + HsOpTy a (w, (L loc op)) b -> do op' <- rename op a' <- renameLType a b' <- renameLType b - return (HsOpTy a' (L loc op') b') + return (HsOpTy a' (w, (L loc op')) b') HsParTy ty -> return . HsParTy =<< renameLType ty HsKindSig ty k -> do ty' <- renameLType ty - return (HsKindSig ty' k) + k' <- renameLKind k + return (HsKindSig ty' k') HsDocTy ty doc -> do ty' <- renameLType ty @@ -263,7 +270,8 @@ renameType t = case t of renameLTyVarBndr :: LHsTyVarBndr Name -> RnM (LHsTyVarBndr DocName) renameLTyVarBndr (L loc tv) = do name' <- rename (hsTyVarName tv) - return $ L loc (replaceTyVarName tv name') + tyvar' <- replaceTyVarName tv name' renameLKind + return $ L loc tyvar' renameLContext :: Located [LHsType Name] -> RnM (Located [LHsType DocName]) @@ -311,19 +319,24 @@ renameTyClD d = case d of lname' <- renameL lname return (ForeignType lname' b) - TyFamily flav lname ltyvars kind -> do +-- TyFamily flav lname ltyvars kind tckind -> do + TyFamily flav lname ltyvars tckind -> do lname' <- renameL lname ltyvars' <- mapM renameLTyVarBndr ltyvars - return (TyFamily flav lname' ltyvars' kind) +-- kind' <- renameMaybeLKind kind + tckind' <- renameMaybeLKind tckind +-- return (TyFamily flav lname' ltyvars' kind' tckind) + return (TyFamily flav lname' ltyvars' tckind') TyData x lcontext lname ltyvars typats k cons _ -> do lcontext' <- renameLContext lcontext lname' <- renameL lname ltyvars' <- mapM renameLTyVarBndr ltyvars typats' <- mapM (mapM renameLType) typats + k' <- renameMaybeLKind k cons' <- mapM renameLCon cons -- I don't think we need the derivings, so we return Nothing - return (TyData x lcontext' lname' ltyvars' typats' k cons' Nothing) + return (TyData x lcontext' lname' ltyvars' typats' k' cons' Nothing) TySynonym lname ltyvars typats ltype -> do lname' <- renameL lname |