help from the community?

Benjamin Franksen benjamin.franksen at bessy.de
Tue Jan 30 16:23:03 EST 2007


Andres Loeh wrote:
>> >I cannot see how an empty list of tyvars is useful or desirable in
>> >practice:
>> >    data Foo = Foo (forall . Int)
>> >is equivalent to just
>> >    data Foo = Foo Int
>> >so why bother to permit the former?  It probably indicates some error in
>> >the thinking of the programmer, so the compiler should bring it to her
>> >attention.
> 
> The only reasons that I could see in favor of allowing empty "forall"s
> is that it might be easier to automatically generate code. Haskell
> seems to be a bit inconsistent in how it treats empty constructs. For
> example, empty let and empty where seems to be allowed, but not an
> empty case?

Just a little remark on the side: 'If' and 'case' demand exactly one
expression. In such cases allowing zero expressions is not a generalization
but an unnecessary complication. 'Let' and 'where' allow any number of
bindings, so allowing zero bindings (instead of demanding at least one) is
a simplification.

Upshot: everywhere the syntax allows a 'list' of things, one should consider
allowing the empty list, too.

Cheers
Ben



More information about the Haskell-prime mailing list