3 ms·
What if you'd have a way to disambiguate in such cases, just like you do with method overriding? Tie the type definition to the point where the data is created
by TuringTest 11y ago
What if you'd have a way to disambiguate in such cases, just like you do with method overriding?
Tie the type definition to the point where the data is created. Default to the local definition, but have a way to select the other one if you need some particular interaction between modules. Wouldn't that solve the conflict?
- merijnv 11y agoBut then my ability to insert elements into a Set depends on the location where those elements were created...that sounds awful.
- marcosdumay 11y agoThat's exactly the same problem you have with every other Haskell name. Have you got much trouble with those on function names?
- merijnv 11y agoThe origin of a name is statically known in the location (i.e. file, expression, whatever). The origin of data is dynamic and can vary at runtime based on arbitrary previous evaluations. Unless you're going to propose making types unique (i.e., not compatible) depending on their origin and enforce never mixing them in the compiler. At which point you have basically reinvented "newtype"