in reply to Re^11: Is it worth using Monads in Perl ? and what the Monads are ?
in thread Is it worth using Monads in Perl ? and what the Monads are ?
One way of reading it is that Haskell defaults to assuming that all functions are pure unless a monad is used, in which case they aren't.
I have some modest Haskell experience myself, and I admit I learned about monads the "wrong" way (starting "as a way to do IO"), but I've come to look at it a bit differently. To my mind, monads let you compose code in a more procedural-esque style without worrying so much about the stuff going on in the background, or whether that stuff involves side effects or not. The thing is, most Haskell monads actually are purely functional in that when you actually expand them out and evaluate them they boil down to simple computations that don't touch the state of the outside world - arguments in, return value out, nothing more to it.
This does mean, to my mind, that Perl is fairly unlikely to benefit much from monads, because there's no need for that sort of simulation. And I agree with you that absent static type-checking, the fact that a monad's very existence constrains the operations allowed within it becomes less useful.
|
|---|