Commit 3d002087 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Add commnent about binder order

...provoked by Trac #15308
parent 5865e9a7
...@@ -559,9 +559,7 @@ This table summarises the visibility rules: ...@@ -559,9 +559,7 @@ This table summarises the visibility rules:
optional kind applications, thus (T @*), but we have not optional kind applications, thus (T @*), but we have not
yet implemented that 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 * Inferred. Function defn, with no signature: f1 x = x
We infer f1 :: forall {a}. a -> a, with 'a' Inferred We infer f1 :: forall {a}. a -> a, with 'a' Inferred
...@@ -592,7 +590,7 @@ In term declarations: ...@@ -592,7 +590,7 @@ In term declarations:
Inferred - from inferred types (e.g. no pattern type signature) Inferred - from inferred types (e.g. no pattern type signature)
- or from inferred kind polymorphism - or from inferred kind polymorphism
In type declarations: ---- In type declarations ----
* Inferred (k) * Inferred (k)
data T1 a b = MkT1 (a b) data T1 a b = MkT1 (a b)
...@@ -621,6 +619,19 @@ In type declarations: ...@@ -621,6 +619,19 @@ In type declarations:
So 'k' is Specified, because it appears explicitly, So 'k' is Specified, because it appears explicitly,
but 'k1' is Inferred, because it does not 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 ----- ---- Printing -----
We print forall types with enough syntax to tell you their visibility We print forall types with enough syntax to tell you their visibility
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment