[commit: ghc] master: Document overlapping instances more clearly (ea53d9c)
Simon Peyton Jones
simonpj at microsoft.com
Fri Jan 18 18:07:38 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/ea53d9c2fdf6c8be33b743c3f8d7cd70432471de
>---------------------------------------------------------------
commit ea53d9c2fdf6c8be33b743c3f8d7cd70432471de
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Jan 18 17:07:04 2013 +0000
Document overlapping instances more clearly
>---------------------------------------------------------------
docs/users_guide/glasgow_exts.xml | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 98c43c2..1191a16 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -4397,6 +4397,12 @@ The constraint <literal>C Int [Int]</literal> matches instances (A),
most-specific match, the program is rejected.
</para>
<para>
+An instance declaration is <emphasis>more specific</emphasis> than another iff
+the head of former is a substitution instance of the latter. For example
+(D) is "more specific" than (C) because you can get from (C) to (D) by
+substituting <literal>a:=Int</literal>.
+</para>
+<para>
However, GHC is conservative about committing to an overlapping instance. For example:
<programlisting>
f :: [b] -> [b]
More information about the ghc-commits
mailing list