Changes between Version 4 and Version 5 of ExistingRecords


Ignore:
Timestamp:
Dec 6, 2005 12:48:50 AM (10 years ago)
Author:
john@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExistingRecords

    v4 v5  
    6363}}}
    6464
     65== open statement ==
     66
     67having the ability to 'open' a record bringing all its values into scope would be useful for techniques such as first class modules when combined with PolymorphicComponents. a proposal is
     68
     69{{{
     70
     71data Record = Record { foo :: Int, bar :: String }
     72
     73f :: Record -> Int
     74f x = ... where
     75   open x
     76   ans = ...
     77
     78will desugar to
     79
     80f x = ... where
     81   Record { foo = foo } = x
     82   Record { bar = bar } = x
     83   ans = ...
     84
     85}}}
     86
     87open x would be allowed at the top level, in a let binding, or in a where binding.
    6588
    6689
     90}}}
     91
     92