[Haskell] GADT: call for proper terminology
Brian Hulley
brianh at metamilk.com
Wed Oct 11 19:35:34 EDT 2006
Doaitse Swierstra wrote:
> I would prefer notation like:
>
> data Parser a | Alt (Parser a) (Parser a)
> | Map ( b -> a) (Parser b)
> | Succ a
> Parser (a,b) | Seq (Parser a) (Parser b)
> Parser String | Lit (String -> Bool)
> Parser [a] | Many (Parser a)
>
> This takes away the noise in the heading of the current GHC notation
> (which is just plain confusing), and enables e.g. grouping of common
> alternatives,
The above is very similar to Bulat's proposal
http://www.haskell.org/pipermail/haskell/2006-September/018466.html ie
(adding the idea of using another layout block to group alternatives on the
rhs):
data
Parser a =
Alt (Parser a) (Parser a)
Map ( b -> a) (Parser b)
Succ a
Parser (a,b) = Seq (Parser a) (Parser b)
Parser String = Lit (String -> Bool)
Parser [a] = Many (Parser a)
I don't think there's a good reason to use | to separate alternatives when
we've already got {;} to form blocks of things, and to put things on the
same line you'd just use:
data {Hi Int = {One; Two; Three}; Hi a = Foo a}
This would also make it easier to replace the => syntax at some future point
with the "guard-like" | syntax used in Clean (also suggested by Bulat in the
above post).
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
mailing list