4 ms·
Monads can be useful as an abstraction; it's more than just a somewhat convoluted way to do I/O. Look at a parser written with Parsec, or the JIT code generatio
by ramchip 17y ago
Monads can be useful as an abstraction; it's more than just a somewhat convoluted way to do I/O. Look at a parser written with Parsec, or the JIT code generation that Harpy offers with monads and combinators. It's very concise and readable. I also think a major strong point of Haskell that you omitted is the type system. I've never had so few runtime errors. Which might not be saying much, since I usually program in C++ ;) but after, I admit it, a fair time spent fighting with the compiler, my experience is that when I finally get it to compile the code is correct. The purity also allows for some clever optimizations; with native code generation, Haskell is very fast. Especially if you include the JVM start time, it feels much snappier than Clojure/Java.
- a-priori 17y agoHere's an example of a parser I wrote using Parsec: http://github.com/michaelmelanson/cminus-compiler/blob/master/Compiler/Parser.hs http://github.com/michaelmelanson/cminus-compiler/blob/maste...