diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-09-17 11:54:20 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-09-18 17:30:15 +0100 |
commit | 58470fb7b4a25c49b567e08740dc8df01a6c3710 (patch) | |
tree | 727201b8e30dd42cbb53d15e03571c3bcbb43b79 /compiler/main/PprTyThing.hs | |
parent | af7cc9953217d74e88d4d21512e957edd8e97ec9 (diff) | |
download | haskell-58470fb7b4a25c49b567e08740dc8df01a6c3710.tar.gz |
Make a start towards eta-rules and injective families
* Make Any into a type family (which it should always have been)
This is to support the future introduction of eta rules for
product types (see email on ghc-users title "PolyKind issue"
early Sept 2012)
* Add the *internal* data type support for
(a) closed type families [so that you can't give
type instance for 'Any']
(b) injective type families [because Any is really
injective]
This amounts to two boolean flags on the SynFamilyTyCon
constructor of TyCon.SynTyConRhs.
There is some knock-on effect, but all of a routine nature.
It remains to offer source syntax for either closed or
injective families.
Diffstat (limited to 'compiler/main/PprTyThing.hs')
-rw-r--r-- | compiler/main/PprTyThing.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/main/PprTyThing.hs b/compiler/main/PprTyThing.hs index 1ee18f84e3..0fa7bdff52 100644 --- a/compiler/main/PprTyThing.hs +++ b/compiler/main/PprTyThing.hs @@ -165,13 +165,13 @@ pprTypeForUser print_foralls ty pprTyCon :: PrintExplicitForalls -> ShowSub -> TyCon -> SDoc pprTyCon pefas ss tyCon - | GHC.isSynTyCon tyCon - = if GHC.isFamilyTyCon tyCon - then pprTyConHdr pefas tyCon <+> dcolon <+> - pprTypeForUser pefas (GHC.synTyConResKind tyCon) - else - let rhs_type = GHC.synTyConType tyCon - in hang (pprTyConHdr pefas tyCon <+> equals) 2 (pprTypeForUser pefas rhs_type) + | Just syn_rhs <- GHC.synTyConRhs_maybe tyCon + = case syn_rhs of + SynFamilyTyCon {} -> pprTyConHdr pefas tyCon <+> dcolon <+> + pprTypeForUser pefas (GHC.synTyConResKind tyCon) + SynonymTyCon rhs_ty -> hang (pprTyConHdr pefas tyCon <+> equals) + 2 (pprTypeForUser pefas rhs_ty) + | Just cls <- GHC.tyConClass_maybe tyCon = pprClass pefas ss cls | otherwise |