help from the community?
Simon Peyton-Jones
simonpj at microsoft.com
Tue Jan 30 11:27:18 EST 2007
| > I can also imagine predicates that do not mention locally-quantified
| > variables - the assumption must be that they mention variables bound on
| > the LHS of the datatype decl instead? e.g. the Show predicate here:
| >
| > data Foo a b = Foo a b
| > | Bar (forall c . (Show b, Relation b c) => (b,c))
| >
| > Hmm, maybe a simpler version of this example would illustrate what you
| > mean by the proposal (first of the three bullets) to allow an empty
| > quantifier list:
| >
| > data Foo a b = Foo a b
| > | Bar (forall . Show b => b)
| >
| > In which case, does this even count as a polymorphic component at all?
| > Is it not rather GADT-like instead?
| >
| > data Foo a b where
| > Foo :: a -> b -> Foo a b
| > Bar :: Show b => b -> Foo a b
|
| I was thinking that we should allow those special cases because I
| could not see a reason to disallow them (rather then having a
| compelling example to use them). You make a good point though, that
| some of them might indicate an error in the program. So, I guess, the
| main decision is: do we want to make them illegal (i.e., require an
| error) or suggest that implementations report a warning? I have no
| strong feelings either way, but I guess we need to pick something.
I think I know what we should do on this particular point. I've even documented it here:
http://www.haskell.org/ghc/dist/current/docs/users_guide/data-type-extensions.html#gadt-style
I would like to urge this design, or one close to it, for Haskell'. Note that this is *not* the same as adopting GADTs.
Simon
More information about the Haskell-prime
mailing list