Commit 0773c6f7 authored by simonpj's avatar simonpj

[project @ 2003-05-06 14:48:12 by simonpj]

Note about context in data type decls
parent 1e2d0557
......@@ -282,6 +282,23 @@ main = print (array (1,1) [(1,2), (1,3)])</programlisting>
<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:
data C a b => T a = MkT a
so that <literal>MkT</literal>'s type is
MkT :: forall a b. C a b => a -> T a
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>
<para>GHCi does not respect the <literal>default</literal>
declaration in the module whose scope you are in. Instead,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment