Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I keep getting back to, ... do a lot ... without evoking the IO monad. Well yes. But they all involve some kind of side-effect. Using the IO monad for examples is just a simplification. The examples could be adapted to apply to any of the others equally. Indeed, that is exactly what the category theory allows (I think), is that they can all be categorised together, characterised by the same set of rules, and manipulated using the same set of primitives. Take STM for example: this is a way of sharing information across threads. Basically a variable--the imperative sense of the word--plus some sequence information about who read what value when. Ie. State. And the 'action' (side-effect) of using the STM is the reading, setting and rolling back of that state. With Haskell, ... you are encouraged to do more in other monads, or in pure functions. The description of a Perl program as 'one big IO monad' is a simplification. That's why I stuck to "Every Perl program ... lives inside a Monad". It is perfectly possible to write Perl scripts that never use IO, in which case the monad those programs would live inside would not be an IO monad. Equally, it is perfectly possible to write 'pure' functions in Perl (debatable given aliasing :). Perhaps, Haskell just has more science than other languages for the uncertain to hide behind. In any case, I wouldn't call them idiots. Or maybe you weren't talking about them. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In reply to Re^9: Is it worth using Monads in Perl ? and what the Monads are ?
by BrowserUk
|
|