3 ms·
Started learning Haskell just a couple of weeks ago. My only complaint with the language so far is that I cannot have the same name for a field in two records i
by kinkdr 10y ago
Started learning Haskell just a couple of weeks ago. My only complaint with the language so far is that I cannot have the same name for a field in two records in the same module.
Other than that it is amazing the confidence it gives me; if it compiles it works (r).
- sdegutis 10y agoThis may help you: https://www.reddit.com/r/haskell/comments/2z248l/language_extensions/ https://www.reddit.com/r/haskell/comments/2z248l/language_ex...
- kinkdr 10y agoThanks!
- harpocrates 10y agoIf you are using GHC, the newest version (8.0.1) actually supports duplicate record fields with the [DuplicateRecordFields](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#duplicate-record-fields https://downloads.haskell.org/~ghc/latest/docs/html/users_gu...) extension. Check it out!
- kinkdr 10y agoAhh awesome! Thanks!
- pyrale 10y agoNice ! Does it work well with lenses ?
- rfergie 10y agoSo you can do something like this: data Foo = Foo { _bar :: String } data Buzz = Buzz {_bar :: String} And derive lenses? I think it doesn't - this is more than just a duplicate record name, you also end up with a duplicate `bar` lens