From 0773c6f70a7b46b243a6a47fe371fe1654a8e1b2 Mon Sep 17 00:00:00 2001 From: simonpj Date: Tue, 6 May 2003 14:48:12 +0000 Subject: [PATCH] [project @ 2003-05-06 14:48:12 by simonpj] Note about context in data type decls --- ghc/docs/users_guide/bugs.sgml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ghc/docs/users_guide/bugs.sgml b/ghc/docs/users_guide/bugs.sgml index de507e9..60cadd5 100644 --- a/ghc/docs/users_guide/bugs.sgml +++ b/ghc/docs/users_guide/bugs.sgml @@ -283,6 +283,23 @@ main = print (array (1,1) [(1,2), (1,3)]) + 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 MkT'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. + + + GHCi does not respect the default declaration in the module whose scope you are in. Instead, for expressions typed at the command line, you always get the -- 1.7.10.4