| ... | ... | @@ -2,6 +2,7 @@ |
|
|
|
allow extensential type synonyms, so if you had something like the
|
|
|
|
following,
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
data Type a = ....
|
|
|
|
```
|
| ... | ... | @@ -9,6 +10,7 @@ data Type a = .... |
|
|
|
|
|
|
|
you could declare a synonym such as
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
type AnyType = exists a . Type a
|
|
|
|
```
|
| ... | ... | @@ -16,6 +18,7 @@ type AnyType = exists a . Type a |
|
|
|
|
|
|
|
so you can create functions such as
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
areSame :: AnyType -> AnyType -> Bool
|
|
|
|
```
|
| ... | ... | @@ -23,6 +26,7 @@ areSame :: AnyType -> AnyType -> Bool |
|
|
|
|
|
|
|
which would expand to
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
areSame :: forall a b . Type a -> Type b -> Bool
|
|
|
|
```
|
| ... | ... | @@ -30,6 +34,7 @@ areSame :: forall a b . Type a -> Type b -> Bool |
|
|
|
|
|
|
|
this is not to be confused with the currently allowed in ghc
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
type AllTypes = forall a . Type a
|
|
|
|
|
| ... | ... | @@ -40,6 +45,7 @@ oddFunc :: AllTypes -> AllTypes -> Bool |
|
|
|
|
|
|
|
which expands to the rank 2 type
|
|
|
|
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
oddFunc :: (forall a . Type a) -> (forall b . Type b) -> Bool
|
|
|
|
```
|
| ... | ... | @@ -48,6 +54,8 @@ oddFunc :: (forall a . Type a) -> (forall b . Type b) -> Bool |
|
|
|
which means something quite different.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pro
|
|
|
|
|
|
|
|
|
|
|
|
- if we use 'exists' for existential types, this seems like a natural use of said keyword too. |