Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some languages and uses for monads

According to you, which language do you 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

like image 613
Ishihara Avatar asked Sep 22 '10 12:09

Ishihara


People also ask

What are monads used for?

A monad is an algebraic structure in category theory, and in Haskell it is used to describe computations as sequences of steps, and to handle side effects such as state and IO. Monads are abstract, and they have many useful concrete instances. Monads provide a way to structure a program.

What are monads in Python?

Monads are a very interesting and powerful design pattern in Functional languages that can be applied in Python to enable things such as elegant error handling or turning your code into lazily evaluated pipelines with no changes to the code itself.

What is a monad C++?

The key idea of a monad is that a monad encapsulates a simple type in an enriched type and supports the compositions of functions on these enriched types. Therefore, the monad needs a function for lifting the simple type into an enriched type.


1 Answers

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.

like image 117
Vasil Remeniuk Avatar answered Oct 19 '22 04:10

Vasil Remeniuk