aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Convert.hs
diff options
context:
space:
mode:
authornand <git@nand.wakku.to>2014-02-11 11:52:48 +0100
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-02-11 15:53:50 +0000
commitbc5756d062bbc5cad5d4fa60798435ed020c518e (patch)
tree27735d5534d623d74cd9feef8c2306538f3e9e44 /src/Haddock/Convert.hs
parente0718f203f2448ba2029e70d14aed075860b7fac (diff)
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 <fuuzetsu@fuuzetsu.co.uk>
Diffstat (limited to 'src/Haddock/Convert.hs')
-rw-r--r--src/Haddock/Convert.hs10
1 files changed, 7 insertions, 3 deletions
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