]>
On Tue, Oct 06, 2009 at 01:38:20PM +0100, Jon Harrop wrote:
> On Tuesday 06 October 2009 13:19:58 Philippe Wang wrote:
> > Hello,
> >
> > I don't know the actual reason, but I guess it's simply a choice of
> > semantics.
> >
> > It woud be weird to be able to deconstruct (Bar 42) while not be able
> > to deconstruct (Bar) as it's not constructed.
> > I mean we can write (match x with Bar y -> y).
> > If partial construction were accepted we may like to write
> > (match x with Bar -> x) but we couldn't because Bar is like a function
> > then.
> >
> > With type t = A | B of int
> > what would be the error warning for
> > (match x with A -> 42 | B -> 43) ?
> >
> > Well, then I guess the reason is that it would be complicated to
> > choose some sound enough semantics for partial application of
> > constructors, since the solution of having to write (fun x -> Bar x)
> > is much simpler.
>
> Can you not just say that Bar in an expression is a function (fun x -> Bar x)?
This is what standard ML seems to do.
Rich.
--
Richard Jones
Red Hat