3 ms·
Why are Haskell type classes identified as non compositional in this post when interfaces are talked about as necessary for compositionality?
by sriku 8y ago
Why are Haskell type classes identified as non compositional in this post when interfaces are talked about as necessary for compositionality?
- lgas 8y agoI think maybe he's not saying that type classes themselves aren't composable but rather they interfere with the composability of more fundamental things like functions which are easier to compose in the absence of type class constraints. For example it's easy to compose two functions of type a -> b and b -> c but two functions of type MonadX m => a -> m b and MonadY m => b -> m c suddenly require you to weave together something that provides the full context. And obviously in practice the tangle of constraints can be more complex... especially with (even common and useful) complications like MultiParamTypeClasses.
- js8 8y agoI think he uses the word "interface" in more general sense than e.g. Java interfaces, that is as thing that you interact with when you're using the component.