On Fri, Dec 21, 2001 at 01:35:37AM -0800, Simon Peyton-Jones wrote: > [Note to the Haskell list. The question this thread is discussing > is whether the H98 rule that all the functions in a mutually > recursive group must have the same context, is a show stopper.] > > [...] > > So it looks to me that, in the presence of existentials, the H98 > rule goes from being moot to being throughly awkward.
It's not moot -- it steers the following (admittedly artificial) example into the monomorphism restriction: foo :: Eq a => a -> Bool foo x = x == x && bar -- bar :: Bool bar = foo 'a' With the declaration, it fails the "identical context" rule (though Hugs then accepts it in violation of H98). The definition of "declaration group" could have been relaxed when explicit type signatures were added: if a variable has one, then bindings using the variable should depend on the type signature, not the binding of the variable, so in the above example would be analysed as three declaration groups: (1) foo :: Eq a => a -> Bool (2) bar = foo 'a' -- depends on (1) (3) foo x = x == x && bar -- depends on (2) As it is, some extra language was tacked on to exempt variables with explicit signatures from the mutual type inference, as well as to impose this restriction. H98 glitch: the phrase "declaration group" is used in 4.4.2 with a different meaning to that defined in 4.5.1. "sequence of declarations"? _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell