
Dan Doel wrote:
For instance: what effects does disciple support? Mutation and IO? You can create your own top-level effects which interfere will all others, for example:
effect !Network; effect !File; readFile :: String -(!e)> String :- !e = !File Now any function that calls readFile will also have a !File effect.
What if I want non-determinism, or continuations, etc.? How do I as a user add those effects to the effect system, and specify how they should interact with the other effects? As far as I know, there aren't yet any provisions for this, so presumably you'll end up with effect system for effects supported by the compiler, and monads for effects you're writing yourself.
Yep. In Disciple, a computation has an effect if its evaluation cannot safely be reordered with others having the same effect. That is, computations have effects if they might "interfere" with others. One of the goals of the work has been to perform compiler optimisations without having to use IO-monad style state threading. "IO" is very coarse grained, and using the IO monad for everything tends to introduce more data-dependencies than strictly needed, which limits what optimisations you can do. Non-determinism and continuations are tricker things than the simple notion of "effects-as-interference", which I haven't got a good solution for. Ben.