[Haskell-cafe] Proposal to allow {} instead of () in contexts

Brian Hulley brianh at metamilk.com
Wed Aug 23 10:52:23 EDT 2006


Hi -
Disregarding my last proposal which involved the use of {} in types, I am 
wondering if anyone would agree with me that it would be a good idea to use 
{} instead of () when writing out the context ie:

    foo :: (Num a, Bar a) => a -> a

would become:

    foo :: {Num a, Bar a} => a -> a

and the same for every other situation in the language where a context 
appears.

My reasons are twofold:

1) The context is supposed to be understood (afaiu) as a *set* of 
constraints not a *tuple* of constraints (ie what relevance does the 
ordering implied by the tuple notation have here?), so the using of set 
braces seems mathematically more appropriate

2) It would allow an editor to give the correct fontification for an 
incomplete type expression. At the moment, if you'd just typed:

    foo :: (Bar

the editor would have no way of knowing if "Bar" is a classcon or a tycon, 
whereas with:

    foo :: {Bar

the opening brace immediately informs the editor that the following text 
should be parsed as a context and so it could fontify Bar appropriately.

For backwards compatibility the use of () could still be supported - braces 
don't occur in H98 in the positions I'm proposing to allow them so nothing 
would be broken.

Regards, Brian.
-- 
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.

http://www.metamilk.com 



More information about the Haskell-Cafe mailing list