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.


In reply to Re^12: Is it worth using Monads in Perl ? and what the Monads are ? by Errto
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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.