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.


So I propose to add a clarifying sentence somewhere to make
it clear that this *is* ok.   Unless someone yells.

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.

Simon
 


Reply via email to