summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-06 15:22:37 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-06 15:22:41 -0800
commit2f115a13a0fab84f6bc384c9b6159f29ea038d36 (patch)
treed035bb1fa9fa9048ffcc01715253a3d58de50541 /docs
parentcd9c7094756e5f479afd718b08b2d82d6b78e6f0 (diff)
downloadhaskell-2f115a13a0fab84f6bc384c9b6159f29ea038d36.tar.gz
A few remarks on role subtyping in the manual.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/separate_compilation.rst10
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst
index 743822f4fc..a140d46341 100644
--- a/docs/users_guide/separate_compilation.rst
+++ b/docs/users_guide/separate_compilation.rst
@@ -917,11 +917,17 @@ to ``hs-boot`` files, but with some slight changes:
relation ``phantom < representational < nominal``: for example,
an abstract type with a nominal type parameter can be implemented
using a concrete type with a representational type parameter.
+ Merging respects this subtyping relation (e.g., ``nominal``
+ merged with ``representational`` is ``representational``.)
Roles in signatures default to ``nominal``, which gives maximum
flexibility on the implementor's side. You should only need to
give an explicit role annotation if a client of the signature
would like to coerce the abstract type in a type parameter (in which case you
- should specify ``representational`` explicitly.)
+ should specify ``representational`` explicitly.) Unlike
+ regular data types, we do *not* assume that abstract
+ data types are representationally injective: if we have
+ ``Coercible (T a) (T b)``, and ``T`` has role ``nominal``,
+ this does not imply that ``a ~ b``.
- A class declarations can either be abstract or concrete. An
abstract class is one with no superclasses or class methods::
@@ -990,6 +996,8 @@ to ``hs-boot`` files, but with some slight changes:
Known limitations:
+- Pattern synonyms are not supported.
+
- Algebraic data types specified in a signature cannot be implemented using
pattern synonyms. See :ghc-ticket:`12717`