[commit: ghc] ghc-8.6: Add commnent about binder order (4239611)
git at git.haskell.org
git at git.haskell.org
Thu Jul 12 21:07:13 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/423961132e9d19850e290b38df15006c607744d1/ghc
>---------------------------------------------------------------
commit 423961132e9d19850e290b38df15006c607744d1
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Jun 26 15:44:12 2018 +0100
Add commnent about binder order
...provoked by Trac #15308
(cherry picked from commit 3d002087dce9c61932dd17047902baa83581f4df)
>---------------------------------------------------------------
423961132e9d19850e290b38df15006c607744d1
compiler/types/TyCoRep.hs | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index 9a5bfdb..7923369 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -559,9 +559,7 @@ This table summarises the visibility rules:
optional kind applications, thus (T @*), but we have not
yet implemented that
----- Examples of where the different visibilities come from -----
-
-In term declarations:
+---- In term declarations ----
* Inferred. Function defn, with no signature: f1 x = x
We infer f1 :: forall {a}. a -> a, with 'a' Inferred
@@ -592,7 +590,7 @@ In term declarations:
Inferred - from inferred types (e.g. no pattern type signature)
- or from inferred kind polymorphism
-In type declarations:
+---- In type declarations ----
* Inferred (k)
data T1 a b = MkT1 (a b)
@@ -621,6 +619,19 @@ In type declarations:
So 'k' is Specified, because it appears explicitly,
but 'k1' is Inferred, because it does not
+Generally, in the list of TyConBinders for a TyCon,
+
+* Inferred arguments always come first
+* Specified, Anon and Required can be mixed
+
+e.g.
+ data Foo (a :: Type) :: forall b. (a -> b -> Type) -> Type where ...
+
+Here Foo's TyConBinders are
+ [Required 'a', Specified 'b', Anon]
+and its kind prints as
+ Foo :: forall a -> forall b. (a -> b -> Type) -> Type
+
---- Printing -----
We print forall types with enough syntax to tell you their visibility
More information about the ghc-commits
mailing list