Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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
in thread Is it worth using Monads in Perl ? and what the Monads are ? by rootcho

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-23 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found