Re:Two Years of OCaml
by ernst_klim on Tuesday May 02, 2023 @07:04AM
(#35785745)
> modules are worst
I think the opposite, modules are vastly superior to typeclasses in regards to, well, modularity.
> In Haskell, the type class database is global and there is no duplication.
That's not a bug, but a feature of module system.
> This lets you naturally compose implementations: for example, you can make it so that if a type A implements the equality type class Eq, and a type B also implements Eq, then the tuple (A, B) implements Eq in the obvious way.
Unless you want a totally different ordering for A, which happens a lot in programming and even in math, where you can define many groups for the same set.
I think the opposite, modules are vastly superior to typeclasses in regards to, well, modularity.
> In Haskell, the type class database is global and there is no duplication.
That's not a bug, but a feature of module system.
> This lets you naturally compose implementations: for example, you can make it so that if a type A implements the equality type class Eq, and a type B also implements Eq, then the tuple (A, B) implements Eq in the obvious way.
Unless you want a totally different ordering for A, which happens a lot in programming and even in math, where you can define many groups for the same set.
https://existentialtype.wordpress.com/2011/04/16/modules-mat...