| The report says "The expression F {}, where F is a data constructor,
is
| legal whether or not F was declared with record syntax, provided F has
no
| strict fields: it denotes F _|_1 ... _|_n where n is the arity of F."
| 
| It unclear to me why there needs to be this provision for records with
| strict fields -- just let them be undefined -- but that
notwithstanding,
| GHC seems to do the wrong thing:

I spoke too soon.  Consider

data F = F Int !Int

data S = S { x::Int, y::!Int }

According to the words above
        F {} is illegal
but what about this one?
        S {}

It would be very odd if that were illegal, because S { x=3 } is
certainly not illegal, and is just as much bottom as S {} is.  So it
would be really odd if S {} were illegal.  But that's what the words
imply.

This changes the situation from "maybe this could be better" to "there's
an inconsistency here".  So we have to fix it somehow.

Solutions:
        a) omit the clause "provided F has no strict fields"
        b) make it clear that F {} is always legal if F is declared with
record syntax
                regardless of field strictness; but if F was not
declared with record
                syntax it's only legal if F has no strict fields
        c) make F {} illegal if F has any strict fields, regardless of
how F is declared.

(c) seems stupid, because then S{x=3} is legal but S{} is not.
(b) seems simply grotesque when written out.

So I now propose to adopt (a) as Hal wanted, despite my earlier
reluctance to make any change at all.  I don't think this decision is
destablising.

Simon
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to