2 ms·
Vale and Koka do the same thing as far as I understand it. I think Koka looks the most interesting of the three - its effects system seems like it lets you have
by IshKebab 5y ago
Vale and Koka do the same thing as far as I understand it. I think Koka looks the most interesting of the three - its effects system seems like it lets you have purity without the annoying "can't I just add a liiiittle printf debugging here without rewriting my entire program?"
- cb321 5y agoIt may be only "little" not "liiiittle" :-), but Nim lets you explicitly bypass the effects system locally for cases like this: {.cast(noSideEffect).}: echo "GOT TO THIS LOGIC with a=", a
- renox 5y agoSerious question which language doesn't have this 'escape hatch'? AFAIK even Haskell has unsafePerformIO to allow this..
- wk_end 5y agoMost languages don't encode purity in the type system, so they don't need an "escape hatch" - there's nothing to escape from. Unlike `unsafePerformIO`, Koka's approach isn't really an "escape hatch" - effects are a safe, principled part of the language. And, if I understand them correctly, even though they're more ergonomic than monads, they also come with friction of their own (maybe needless to say, otherwise they couldn't be enforcing anything) - adding logging to a function will add the `console` effect to the function's type, which bubbles up to callers and might cause issues if any callers are declared as `total` (and indeed, that's the default for function type annotations). But at least, unlike Haskell, you wouldn't need to add `return` and `lift`s everywhere to fix things; and the changes you'll need to make to your signatures are usually quite a bit more straightforward I think.