[project @ 2003-05-06 14:48:12 by simonpj]
authorsimonpj <unknown>
Tue, 6 May 2003 14:48:12 +0000 (14:48 +0000)
committersimonpj <unknown>
Tue, 6 May 2003 14:48:12 +0000 (14:48 +0000)
Note about context in data type decls

ghc/docs/users_guide/bugs.sgml

index de507e9..60cadd5 100644 (file)
@@ -283,6 +283,23 @@ main = print (array (1,1) [(1,2), (1,3)])</programlisting>
       </listitem>
     
       <listitem>
+       <para>GHC does not allow you to have a data type with a context 
+          that mentions type variables that are not data type parameters.
+         For example:
+<programlisting>
+  data C a b => T a = MkT a
+</programlisting>
+         so that <literal>MkT</literal>'s type is
+<programlisting>
+  MkT :: forall a b. C a b => a -> T a
+</programlisting>
+        In principle, with a suitable class declaration with a functional dependency,
+        it's possible that this type is not ambiguous; but GHC nevertheless rejects
+         it.  The type variables mentioned in the context of the data type declaration must
+       be among the type parameters of the data type.</para>
+      </listitem>
+
+      <listitem>
        <para>GHCi does not respect the <literal>default</literal>
         declaration in the module whose scope you are in.  Instead,
         for expressions typed at the command line, you always get the