3 ms·
Yes. There's also the possibilities to have open data types in Haskell. Also type classes, and being able to add instances for any type are closely related to
by eru 17y ago
Yes. There's also the possibilities to have open data types in Haskell.
Also type classes, and being able to add instances for any type are closely related to your examples.
- jules 17y agoThat's interesting. I've read a paper about it, but I don't remember exactly. Is it implemented in GHC? Type classes are more powerful in some ways, but much less powerful in other ways. There is some overlap, but type classes dispatch only on the compile time type whereas this dispatches on run time predicates.
- eru 17y agoI agree. About more powerful: The static approach allows you to dispatch not only on argument types, but also on return type. A quick search reveals that there is some support for open data types in GHC, but I am not sure if it's more than an experimental feature.