summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-11-09 23:23:35 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-10 18:19:37 -0500
commit1540f556a4501056056eec7d45d3c9246e8213d9 (patch)
tree10b836f740100da5d47932e4c7b6df766a35ba64 /docs
parentdfb9913c530d9132700fd5252c763e43976ece45 (diff)
downloadhaskell-1540f556a4501056056eec7d45d3c9246e8213d9.tar.gz
Clarify hs-boot file default method restrictions
The user guide wrongly stated that default methods should not be included in hs-boot files. In fact, if the class is not left abstract (no methods, no superclass constraints, ...) then the defaults must be provided and match with those given in the .hs file. We add some tests for this, as there were no tests in the testsuite that gave rise to the "missing default methods" error. Fixes #20588
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/separate_compilation.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst
index c6e9b7d0b6..b580c9ab18 100644
--- a/docs/users_guide/separate_compilation.rst
+++ b/docs/users_guide/separate_compilation.rst
@@ -864,10 +864,12 @@ A hs-boot file is written in a subset of Haskell:
You cannot use ``deriving`` on a data type declaration; write an
``instance`` declaration instead.
-- Class declarations is exactly as in Haskell, except that you may not
- put default method declarations. You can also omit all the
- superclasses and class methods entirely; but you must either omit
- them all or put them all in.
+- Class declarations can either be given in full, exactly as in Haskell,
+ or they can be given abstractly by omitting everything other than the
+ instance head: no superclasses, no class methods, no associated types.
+ If the class declaration is given in full, the default delarations
+ must also match; this applies to both default methods and default
+ declarations for associated types.
- You can include instance declarations just as in Haskell; but omit
the "where" part.