3 ms·
What's wrong with `data Foo = Bar | Baz { a :: Int }` ? I'm not a day-to-day Haskeller, but I find the record syntax very nice and succinct.
by strager 15y ago
What's wrong with `data Foo = Bar | Baz { a :: Int }` ? I'm not a day-to-day Haskeller, but I find the record syntax very nice and succinct.
- Locke1689 15y agoOne major problem is that a then falls into the module namespace and is not reusable. Having a record namespace as in GHC is preferable i.e., Foo.a.
- strager 15y agoAh; I definitely understand that (and I've felt the pain).
- vq 15y agoThere is nothing wrong with the definition syntax. The only problem I have with those are the "namespace-pollution" problem where you must have them in a separate module to isolate field names (which is kind of a small issue to me). What I have a bigger problem with is the syntax for updating fields is so clumsy. It doesn't go very well with the rest of the language and I usually end up writing helper functions for updating specific combination of fields.