4 ms·
look dude, you're right. monads are freaking awesome. it's because a lot of things in CS can be shown to "be monads", it's called turing completeness. http://en
by rian 15y ago
look dude, you're right. monads are freaking awesome. it's because a lot of things in CS can be shown to "be monads", it's called turing completeness. http://en.wikipedia.org/wiki/Turing_completeness http://en.wikipedia.org/wiki/Turing_completeness
unix pipes as monads: http://okmij.org/ftp/Computation/monadic-shell.html http://okmij.org/ftp/Computation/monadic-shell.html
cpp as a monad: http://conal.net/blog/posts/the-c-language-is-purely-functional/ http://conal.net/blog/posts/the-c-language-is-purely-functio...
monads invented for IO / functional impurity: http://homepages.inf.ed.ac.uk/wadler/papers/monads/monads.ps.gz http://homepages.inf.ed.ac.uk/wadler/papers/monads/monads.ps...
"This is not a "neat observation" -- it is something people routinely use, plentifully." ...in haskell
and who are you to say that integers are not usefully equivalent to exceptions??? have you ever heard of errno? i don't have exceptions or monads in bf, just pointers. i need an equivalence so that i can feel smarter when i code bf. and if you dare say that bf isn't a useful programming language then you better stop coding in java...
- Peaker 15y agoMonads and Turing Completeness have very little to do with each other. Unix pipes as monads is trying to create an analogy (an imprecise one) between unix pipe operations and monadic operations. The monadic laws do not hold with unix pipes, so the analogy is pretty weak. You might want to re-read Conal's "the c language is purely functional" because it makes no claim about cpp being a monad, at all. Let's look at the monad instances/examples listed by the Wadler paper, in order: * The identity monad * The strictness monad * The state monad * Filters (MonadZero) * Monad Morphisms Under "More Monads": * Parsers * Exceptions * Input and Output Are you trying to use this paper to establish that monads were invented exclusively for I/O and now perverted to describe exceptions? Note how exceptions are listed as an example use of monads before I/O. > and who are you to say that integers are not usefully equivalent to exceptions??? have you ever heard of errno? errno is not an exception mechanism. You have to indicate, in-band, that there's an error result, then check for that result, and then use errno as well, to implement exceptions. Whereas the Either monad itself implements both the in-band encoding of errors, and the caller's error-check and propagation.