in reply to Re^8: 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 ?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Is it worth using Monads in Perl ? and what the Monads are ?
by gaal (Parson) on Jun 14, 2007 at 20:52 UTC | |
by BrowserUk (Patriarch) on Jun 15, 2007 at 10:29 UTC | |
by Errto (Vicar) on Jun 15, 2007 at 23:49 UTC | |
by gaal (Parson) on Jun 15, 2007 at 16:36 UTC | |
by BrowserUk (Patriarch) on Jun 15, 2007 at 19:44 UTC | |
by gaal (Parson) on Jun 15, 2007 at 21:56 UTC | |
by BrowserUk (Patriarch) on Jun 15, 2007 at 22:26 UTC |