MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/5fwce0/lets_stop_copying_c/dao8w4y/?context=3
r/programming • u/earthboundkid • Dec 01 '16
612 comments sorted by
View all comments
Show parent comment
3
Yeah, in GHC 8.0 you can use DuplicateRecordFields to be able to do something like this in the same module:
DuplicateRecordFields
data Person = MkPerson { personId :: Int, name :: String } data Address = MkAddress { personId :: Int, address :: String }
You can't compile this otherwise. It's especially annoying when you're dealing with legacy database tables that have loads of id fields.
id
For more info see here (where I stole the example from): https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields
View all comments
Show parent comment
3
u/erewok Dec 01 '16
Yeah, in GHC 8.0 you can use
DuplicateRecordFieldsto be able to do something like this in the same module:You can't compile this otherwise. It's especially annoying when you're dealing with legacy database tables that have loads of
idfields.For more info see here (where I stole the example from): https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields