3 ms·
Haskell record syntax with lenses is workable: import Control.Lens data MyRecord = MyRecord { _a :: Int, _b :: MyRecord } makeLenses ''MyRecord Then yo
by Peaker 8y ago
Haskell record syntax with lenses is workable:
import Control.Lens
data MyRecord = MyRecord { _a :: Int, _b :: MyRecord }
makeLenses ''MyRecord
Then you can use it nested like:
over (b . b . a) (+5) myRecord
- tome 8y agoClojure people use the untyped equivalent of row types, i.e. being able to arbitrarily add and remove fields to and from a record. That would be nice to have in Haskell (though personally it's nowhere near a dealbreaker for me).
- Peaker 8y agoHaskell has reasonable implementations of row types as well.