Allow record patterns that are not headed by constructors
I would like record patterns that are not headed by constructors to be accepted. For example:
data D
= Mk1
| Mk2 { fld1 :: Int, fld2 :: Bool, fld3 :: Int }
| Mk3 { fld1 :: Int }
-- no pattern match warnings
f :: D -> Int
f (_ { fld1 = x }) = x -- matches both Mk2 and Mk3
f Mk1 = 0
-- pattern match warning: constructor not matched: 'Mk3'
g :: D -> Int
g (r { fld1 = x, fld2 = y }) = if y then x else x + fld3 r -- matches only Mk2
g Mk1 = 0
That is, a record pattern can be headed by an underscore or variable name instead of a constructor name, and the constructors matched by that pattern are precisely those that have all of the required fields.