Monad equivalent in Ruby

后端 未结 4 1526
野性不改
野性不改 2021-01-30 03:31

What would an equivalent construct of a monad be in Ruby?

4条回答
  •  终归单人心
    2021-01-30 04:01

    To add my two cents, I'd say that hzap has misunderstood the concept of monads. It's not only a « type interface » or a « structure providing some specific functions », it's muck more than that. It's an abstract structure providing operations (bind (>>=) and unit (return)) which follow, as Ken and Apocalisp said, strict rules.

    If you're interested by monads and want to know more about them than the few things said in these answers, I strongly advise you to read : Monads for functional programming (pdf), by Wadler.

    See ya!

    PS: I see I don't directly answer your question, but Apocalisp already did, and I think (at least hope) that my precisions were worth it

提交回复
热议问题