4 ms·
> No standard and easy way of implementing interfaces. > In Haskell, this is done with typeclasses ... > In OCaml there’s no way to do this. I have to explici
by manymanydots 3y ago
> No standard and easy way of implementing interfaces.
> In Haskell, this is done with typeclasses ...
> In OCaml there’s no way to do this. I have to explicitly pass functions along with my values, maybe in a product type, or with a functor, or as an argument.
Haskell is a mixed community / paradigm language too.
I routinely program in "Braindead Haskell" (keep stuff simple and direct as much as possible). Funnily, in that programming style, using typeclasses for _all_ interface types is bad style.
Instead, the Handle pattern [0] can be used. Which really is just shoveling functions in a product type. And imagine - it works worderfully.
Everyone has to find their own style I guess.
[0]: https://jaspervdj.be/posts/2018-03-08-handle-pattern.html https://jaspervdj.be/posts/2018-03-08-handle-pattern.html
- Jeff_Brown 3y ago> the Handle pattern I love this so much.