3 ms·
The trick seems to be how to implement this kind of idea in a composable way, so we can still have a clear, modular design and write generic, reusable code even
by Chris_Newton 6y ago
The trick seems to be how to implement this kind of idea in a composable way, so we can still have a clear, modular design and write generic, reusable code even in the presence of several different types of effect. IMHO, the research into type and effect systems in recent years has been promising, but also shows that this is not an easy problem to solve. I’m hoping that in a few more years we might see a new generation of programming languages that incorporate this kind of “effect safety” as easily and naturally as many developers use const and qualifiers and resource management idioms today.
- sullyj3 6y agoUnison's ability system (an implementation of algebraic effects) is looking promising as an ergonomic method of tracking effects.
- pwm 6y agoI haven't yet looked much into effect systems so can't really talk about them but I think even with something like MTL you can achieve a decent level composability/modularity where you build up a library of capabilities that you can then use to pick and choose effects from, eg.: type FooContext m = (GetTime m, GenUUID m, Log m, Auth m, ReadDB m, WriteS3 m, BarApi m, etc...) foo :: (FooContext m) => UUID -> m Foo The main downside is ergonomics, ie. the amount of boilerplate needed, but personally I don't think that's a high price to pay.