[commit: ghc] master: Add commnent about binder order (3d00208)

git at git.haskell.org git at git.haskell.org
Tue Jun 26 14:45:09 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3d002087dce9c61932dd17047902baa83581f4df/ghc

>---------------------------------------------------------------

commit 3d002087dce9c61932dd17047902baa83581f4df
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


>---------------------------------------------------------------

3d002087dce9c61932dd17047902baa83581f4df
 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