Changes between Version 13 and Version 14 of ExistingRecords


Ignore:
Timestamp:
Jul 16, 2009 4:27:06 PM (6 years ago)
Author:
simonpj@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExistingRecords

    v13 v14  
    3636This would mitigate the problems caused by accessors being partial functions since you can use a simple case statement to get the effect of an accesor that returns its result in a Maybe.
    3737
    38 Note from Simon.  I hate that the above defn of 'f' has just one argument (val {x="foo")),
     38'''Note from Simon'''.  I hate that the above defn of 'f' has just one argument (val {x="foo")),
    3939whereas it looks as if it has two.  (This is a problem with existing Haskell.)  It looks
    4040like 'f' has an argument 'val' and another arguement that is a free-standing record,
     
    6969Note the change in the type of the stored field.
    7070At the moment, such a record update must be written using the data constructor, not the update syntax.
     71
     72'''SLPJ:''' That isn't true.  Haskell 98 already supports what you suggest here, and the code above compiles with GHC without flags. 
     73
     74However I would like to argue for ''removing'' this feature.  It causes a quite unreasonable amount of
     75pain in the type checker, especially once we start thinking about GADTs and existentials.  And I think the benefit is modest at best.  I don't think programmers generally expect record update to be a type-changing operation.
     76
     77
    7178== 'Open' statement ==
    7279