4 ms·
This kind of comment kind of misses the point. The monadic style of threading error values is perfectly compatible with imperative programming if only language
by theaeolist 14y ago
This kind of comment kind of misses the point. The monadic style of threading error values is perfectly compatible with imperative programming if only language designers knew about it.
- nostrademons 14y agoProblem is that you then have to explain monads to average programmers who'll be using the language. I love monads (I love arrows more, but that's another issue). I'm a language design geek. My level of expertise is different from someone who has just been hired into a new job and wants to get things done. I suspect that most language designers know about monads - I'm not sure Rob Pike did, but it's pretty common knowledge among folks who do this stuff. Until you can explain them to the folks who'll be using the language in a way that doesn't make them seem like arcane black magic, though, you'll find programmers will just say "I don't get this" and use what they're familiar with.
- flyinRyan 14y ago>Problem is that you then have to explain monads to average programmers who'll be using the language. No you don't, this is exactly what you don't need to do. Do we explain the finer points of stream implementation to would-be C++ programmers? No, when they need to do something non-standard with a stream/monad, that's the time to talk about them. For the majority of programmers it's just "when you need to write to a file you do it like this".
- morphyn 14y agoThe Either type described in the first comment is also a Monad. They are more important in Haskell than just "when you need to write to a file..." and I don't think you can totally grasp the error handling method without understanding them.
- flyinRyan 14y agoI couldn't disagree more. The Either type may have a Monad interface, but it's a Sum type and languages that don't have thousands of Monad tutorials also have Sum types. There's no need to explain Monad theory to someone just to explain Sum types or even why chaining do expressions doesn't do unnecessary computations in the face of errors. Just show them the code for join and >> and they'll see why it works. No need to bring up Monads.
- Evbn 14y agoI don't know what a thread is, but I can still use Executors in Java.
- Evbn 14y agoYou can write Haskell programs entirely in IO, and the result looks and works almost exactly like Python, but type safe. The dangerous part of Haskell, like Scala and C++, is that it also has super scary dark magical parts.