Comment by captaincrowbar
8 hours ago
‘Non-IO functions can't call IO functions.’
How do you handle logging then? If f() calls g(), how can I add logging to g() without having to change or recompile f() (and everything in the call stack above it)? ‘You can’t’ is not an acceptable answer.
Not sure why people are saying "you can't" when it seems to me the whole point of algebraic effects that you can. You can define g so that it has no ability to do "general IO", all it can do is yield log messages. Then f can call g in a way that turns the log messages into writes to stdout. For example, here's how you would do it in Bluefin:
"You can't" is simpler, because the inevitable reply is "but how do I do actual logging inside g"
"Actual logging" as in direct access to IO?
1 reply →
Don't declare it as non-logging.
You can’t is an acceptable answer. The entitle point of such a feature is to prevent people from doing that.