If only that fucker McBride hadn’t noticed that Applicative was a useful generalization of Monad, we’d still be pretending that Monads weren’t Functors. Yes, it’s my fault. Yes, it hurts. Yes, you asked for it.
Conversation
It serves a useful purpose nevertheless: pointing out that how we build our libraries is brittle (not just in Haskell). Hierarchies of any kind don't tend to survive having a new member added 'in the middle'. This is dumb engineering.
2
1
11
Some of my work on generating library code has been linked to that problem. My solutions are not good ones, BUT at least I show that solutions do exist. As a faint hope that others would take up the cause and find better solutions. I'm still waiting.
1
4
I'd love to see a future where we can make use of these solutions! I'd love to live in a world where we can evolve libraries in a less brittle way than seems to be possible with type classes.
1
1
Well, clarifying: type classes as they exist in languages like Haskell and Rust. Not sure how module systems compare for these kinds of changes? I'd imagine there are still issues?
1
2
type classes (and module types and traits) are all variants of interfaces along with extra rules for conformance and/or resolution. The first step is to revisit interfaces and how to build & compose them. In fact, interfaces should be first class, but they aren't (yet).
2
1
3
Would you consider things like first class modules as being first class interfaces? If not, what are they missing?
1
1
When people talk about first class modules, they usually mean the *implementation* part (i.e. 'module struct' in ML) rather than interfaces (i.e. 'module sig'). That's the operational bias kicking in again, favouring the stuff that runs over the stuff that declares intent.
1
4
Ahh gotcha, that makes sense! Yeah I do wish for nicer ways to work with module types (or dependent record types) as first class things.
1
1
Exactly. I want well-'typed' programs that manipulate modules types and/or dependent record types. The same way we can work magic with first class functions.
1
3
But then I get annoyed about how curried functions are so tied to argument order. I kind of want them to be a bit more like records in a way. 😅
Semantically, it's "trivial". AxB is isomorphic to (x : Fin 2) -> F x, where F : Fin 2 -> Type, F 0 = A, F 1 = B. Generalize this to using some index set I instead of the (ordered!) Fin k. The problem is coming up with a pleasant syntax.
3


