Changes between Version 13 and Version 14 of Records/OverloadedRecordFields


Ignore:
Timestamp:
Jan 16, 2012 9:59:53 AM (2 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields

    v13 v14  
    1 = Overloaded record fields: a design proposal  = 
     1= Simple Overloaded Record Fields (SORF)  = 
    22 
    33This page summarises a possible design that would allow 
     
    185185On the contrary, one might want a pragma to generate the  
    186186two lines of boilerplate. 
     187 
     188== Unboxed fields == 
     189 
     190The mechanism does not work at all for records with unboxed fields: 
     191{{{ 
     192data T = MkT { x :: Int# } 
     193}}} 
     194Reason: type-class constraints can only be instantiate with lifted types.  There is a good reason for this restriction, because unboxed types can have varying widths, so you can't generate code that works uniformly for boxed and unboxed types. 
     195 
     196This is a real problem, but it is one that we might be willing to live with.  In particular, it's fine to have UNPACKed fields: 
     197{{{ 
     198data T = MkT { x :: {-# UNPACK #-} Int } 
     199}}} 
     200So you can have efficiently-represented records without having to expose the unboxed types. 
    187201 
    188202