Re: Another Haskell 98 question

1999-05-10 Thread Laszlo Nemeth

> 
> A question about Haskell 98: is this legal:
>
>   data T = T1 Int Int Int
>| T2 Float Float Float
>
>   f (T1 {}) = True
>   f (T2 {}) = False
>
>The point is that T is not declared using
>record syntax, but f nevertheless uses record
>syntax in the pattern match to mean "T1 with any arguments".
>This is less clumsy than writing
>
>   f (T1 _ _ _) = True
>   f (T2 _ _ _) = False
>
>Some people, it turns out, use this a lot.  Hugs accepts it.
>GHC didn't until recently.  But is it Haskell 98.
>
>The Haskell 98 report, interpreted literally, certainly does
>not prohibit it, though I certainly didn't have this example in mind.

>As ever, this will go on the "Typos" page (I have two or three
>things to add there).  

>This is hardly a big deal, but I'm in the habit of publishing
>proposals before implementing them.

Will this change be compatible with the first class (extensible?)
records work?
I know that first class records will not be part of Haskell98, but
it would be nice if Haskell2000 (or whatever) could be close to the
stable language of H98. 

Can we expect first class records in the near future?

Laszlo Nemeth





RE: Another Haskell 98 question

1999-05-10 Thread Simon Peyton-Jones


> Will this change be compatible with the first class (extensible?)
> records work?
> I know that first class records will not be part of Haskell98, but
> it would be nice if Haskell2000 (or whatever) could be close to the
> stable language of H98. 
> 
> Can we expect first class records in the near future?

Haskell 98's records are just syntactic sugar.  The proposed clarification
makes things neither better nor worse.

TREX-style records are in Hugs but not GHC.  I'm hoping to work towards
a design that's well enough agreed that we can both implement them with
the same syntax.  Probably that design should replace (rather than co-exist
with) the existing record stuff.

Simon