News for hackers. Stuff that matters.
Re:Haskell IO for Imperative Programmers by jrockway on Monday November 09, 2009 @09:52AM (#930960)
Monads are a great academic hallelujah and I hope they lead to the discovery of some new, unfamiliar programming paradigm that benefits all programmers.

No they're not. They are a very simple abstraction; instead of sequencing computations implicitly with syntax like ";", you sequence them by calling a function. The result of the previous line of code becomes the input to the next line of code.

All programs logically flow this way, and "monads" merely let you take advantage of this property in arbitrary code.

Finally, because I want to be able to write tests for my programs, my procedural IO code looks very similar to the Haskell version. Arbitrary IO right inside your application logic is going to create an untestable nightmare. ("Oh, I know! Mock STDIN and STDOUT!" No thanks.)

There are no comments on this comment yet.