Changes between Version 11 and Version 12 of Records/OverloadedRecordFields


Ignore:
Timestamp:
Jan 15, 2012 8:05:12 PM (3 years ago)
Author:
strake888
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields

    v11 v12  
    358358 * Not overloaded, so you can't abstract over it. 
    359359 
     360== Alternative Proposal == 
     361 
     362{{{ 
     363class Has r k v where select :: r -> k -> v; 
     364class Quasifunctor r s k u v where qfmap :: k -> (u -> v) -> r -> s; 
     365}}} 
     366 
     367Then, for example: 
     368{{{ 
     369data R a = R { x :: a }; 
     370 
     371-- automatically-generated instances 
     372instance Has (R a) "x" a where ... 
     373instance Quasifunctor (R a) (R b) "x" a b where ... 
     374 
     375r = R { x = 256 }; 
     376-- assign value 3 to r.x 
     377let s = qfmap (undefined :: "x") (const 3) r in ... 
     378}}} 
    360379 
    361380------------------------