Niklas,
My rationale is as follows. With the introduction of GADTs, we now
have two ways to write datatype declarations, the old simple way and
the GADTs way. The GADTs way fits better syntactically with Haskell's
other syntactic constructs, in all ways. The general style is
(somewhat
On Sat, Jun 27, 2009 at 10:51:12AM -0400, Isaac Dupree wrote:
Niklas Broberg wrote:
data Foo =
forall a . Show a = Foo a
which uses ExistentialQuantification syntax, could be written as
data Foo where
Foo :: forall a . Show a = a - Foo
The downside is that we lose one level
That's why one should really be allowed to group constructor's in a type's
definition:
data Colour :: * where
Red, Green, Blue :: Colour
This is consistent with what is allowed for type signatures for functions.
Totally agreed, and that should be rather trivial to implement too.
More
Niklas,
In other words, in your 2x3 grid of syntactic x expressiveness, I want
the two points corresponding to classic syntax x {existential
quantification, GADTs} to be removed from the language. My second
semi-proposal also makes each of the three points corresponding to the
new cool syntax a
In other words, in your 2x3 grid of syntactic x expressiveness, I want
the two points corresponding to classic syntax x {existential
quantification, GADTs} to be removed from the language. My second
semi-proposal also makes each of the three points corresponding to the
new cool syntax a
I agree. But ;-) since it's obvious not possible to get rid of the classic
syntax completely, I see no harm in having it support existentials and GADTs
as well. In an ideal word, in which there wasn't a single Haskell program
written yet, I'd indeed like to throw the classic syntax out
Niklas,
What you really want or mean when you use
the classic syntax with existential quantification is
data Foo = Foo (exists a . (Show a) = a)
Having that would make a lot more sense, and would fit well together
with the intuition of the classic syntax.
How would you then define
data
What you really want or mean when you use
the classic syntax with existential quantification is
data Foo = Foo (exists a . (Show a) = a)
Having that would make a lot more sense, and would fit well together
with the intuition of the classic syntax.
How would you then define
data Foo ::