开发者

Some languages and uses for monads

开发者 https://www.devze.com 2023-01-17 07:35 出处:网络
According to you, which language do you 开发者_C百科think would be the best for implementing monads (Python/Ruby/LISP)?,also can anyone tell me some possible uses of monads (please give examples),like

According to you, which language do you 开发者_C百科think would be the best for implementing monads (Python/Ruby/LISP)?,also can anyone tell me some possible uses of monads (please give examples),like exceptions?

Thanks in advance


All About Monads - legendary tutorial that lists all the standard monads and gives a lot of real-world examples.

Popular monads that you can meet even in the mainstream languages are Maybe, List and Continuation. Some people also think that jQuery itself is a monad (as it follows the monadic axioms).

As for the language choice, Haskell and its derivatives are using monads as a fundamental concept, however, as an option, constructing monads is possible in a lot of modern languages. In order to familiarize with the monad concept I'd better choose the language I'm the most comfortable with.


In order of preference:

  1. Haskell
  2. F#
  3. Scala
  4. C#

Monads in order of decreasing simplicity:

  1. Maybe (Exception)
  2. Reader
  3. Writer
  4. State
  5. Parser
  6. Async


Here are some tutorial that use clojure. Monads are implemented in a library.

  • http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
  • http://onclojure.com/2009/03/06/a-monad-tutorial-for-clojure-programmers-part-2/
  • http://onclojure.com/2009/03/23/a-monad-tutorial-for-clojure-programmers-part-3/


For examples, see Philip Wadler, "Monads for functional programming".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号