summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-10-15 23:09:39 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-17 14:06:46 -0400
commit81740ce83976e9d6b68594f8a4b489452cca56e5 (patch)
tree7b41d1529975c2f78eaced81e26e4722d34c212f /docs
parent65bf3992aebb3c08f0c4e13a3fb89dd5620015a9 (diff)
downloadhaskell-81740ce83976e9d6b68594f8a4b489452cca56e5.tar.gz
Introduce Concrete# for representation polymorphism checks
PHASE 1: we never rewrite Concrete# evidence. This patch migrates all the representation polymorphism checks to the typechecker, using a new constraint form Concrete# :: forall k. k -> TupleRep '[] Whenever a type `ty` must be representation-polymorphic (e.g. it is the type of an argument to a function), we emit a new `Concrete# ty` Wanted constraint. If this constraint goes unsolved, we report a representation-polymorphism error to the user. The 'FRROrigin' datatype keeps track of the context of the representation-polymorphism check, for more informative error messages. This paves the way for further improvements, such as allowing type families in RuntimeReps and improving the soundness of typed Template Haskell. This is left as future work (PHASE 2). fixes #17907 #20277 #20330 #20423 #20426 updates haddock submodule ------------------------- Metric Decrease: T5642 -------------------------
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/9.4.1-notes.rst3
-rw-r--r--docs/users_guide/exts/defer_type_errors.rst7
2 files changed, 9 insertions, 1 deletions
diff --git a/docs/users_guide/9.4.1-notes.rst b/docs/users_guide/9.4.1-notes.rst
index ce70b8e98d..0e776672eb 100644
--- a/docs/users_guide/9.4.1-notes.rst
+++ b/docs/users_guide/9.4.1-notes.rst
@@ -13,6 +13,9 @@ Compiler
defaults for ambiguous variables that would otherwise cause errors
just like the built-in defaulting mechanism.
+- The way GHC checks for representation polymorphism has been overhauled:
+ all the checks are now done during typechecking. The error messages
+ now contain more detailed information about the specific check that was performed.
``base`` library
~~~~~~~~~~~~~~~~
diff --git a/docs/users_guide/exts/defer_type_errors.rst b/docs/users_guide/exts/defer_type_errors.rst
index c9e4accb13..8d502d3708 100644
--- a/docs/users_guide/exts/defer_type_errors.rst
+++ b/docs/users_guide/exts/defer_type_errors.rst
@@ -107,7 +107,7 @@ example, an ill-kinded type signature, an instance declaration that is
non-terminating or ill-formed, a type-family instance that does not
obey the declared injectivity constraints, etc etc.
-In a few cases, equality constraints cannot be deferred. Specifically:
+In a few cases, some constraints cannot be deferred. Specifically:
- Kind errors in a type or kind signature, partial type signatures, or pattern signature.
e.g. ::
@@ -130,3 +130,8 @@ In a few cases, equality constraints cannot be deferred. Specifically:
f :: a %1 -> a
f _ = ()
+
+- Illegal representation polymorphism, e.g. ::
+
+ f :: forall rep (a :: TYPE rep). a -> a
+ f a = a