From bc5756d062bbc5cad5d4fa60798435ed020c518e Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 11 Feb 2014 11:52:48 +0100 Subject: Improve display of poly-kinded type operators This now displays them as (==) k a b c ... to mirror GHC's behavior, instead of the old (k == a) b c ... which was just wrong. Signed-off-by: Mateusz Kowalczyk --- src/Haddock/Convert.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Haddock/Convert.hs') diff --git a/src/Haddock/Convert.hs b/src/Haddock/Convert.hs index d9bb0fcf..3670473d 100644 --- a/src/Haddock/Convert.hs +++ b/src/Haddock/Convert.hs @@ -21,7 +21,7 @@ import HsSyn import TcType ( tcSplitSigmaTy ) import TypeRep import Type(isStrLitTy) -import Kind ( splitKindFunTys, synTyConResKind ) +import Kind ( splitKindFunTys, synTyConResKind, isKind ) import Name import Var import Class @@ -371,18 +371,22 @@ synifyKindSig :: Kind -> LHsKind Name synifyKindSig k = synifyType WithinType k synifyInstHead :: ([TyVar], [PredType], Class, [Type]) -> InstHead Name -synifyInstHead (_, preds, cls, ts) = +synifyInstHead (_, preds, cls, types) = ( getName cls + , map (unLoc . synifyType WithinType) ks , map (unLoc . synifyType WithinType) ts , ClassInst $ map (unLoc . synifyType WithinType) preds ) + where (ks,ts) = break (not . isKind) types -- Convert a family instance, this could be a type family or data family synifyFamInst :: FamInst -> InstHead Name synifyFamInst fi = ( fi_fam fi - , map (unLoc . synifyType WithinType) $ fi_tys fi + , map (unLoc . synifyType WithinType) ks + , map (unLoc . synifyType WithinType) ts , case fi_flavor fi of SynFamilyInst -> TypeInst . unLoc . synifyType WithinType $ fi_rhs fi DataFamilyInst c -> DataInst $ synifyTyCon (Just $ famInstAxiom fi) c ) + where (ks,ts) = break (not . isKind) $ fi_tys fi -- cgit v1.2.3