## Help a C# developer understand: What is a monad?

There is a lot of talk about monads these days. I have read a few articles / blog posts, but I can’t go far enough with their examples to fully grasp the concept. The reason is that monads are a …

Technical knowledge for tech readers and developers

monads

There is a lot of talk about monads these days. I have read a few articles / blog posts, but I can’t go far enough with their examples to fully grasp the concept. The reason is that monads are a …

The paper “Programming and reasoning with algebraic effects and dependent types” by Edwin C. Brady on effects in Idris contains the (unreferenced) claim that:

Although [effects and monad …

I have a list of strings, and tried this:

ls = [ “banana”, “mango”, “orange” ]

main = do

map PutStrLn list_of_strings

That didn’t work, and I can’t understand why.

ghc print-list.hs

print-…

I’m attempting to use HSlogger to get some information about my program. So I add the following line to my function

import Data.Word

import qualified Data.ByteString as B

import qualified Data….

I’m learning monads, this is my first working one (aside from the trivial monad). Feel free to criticize everything in it ruthlessly. I’m especially interested in “more idiomatic” and “more elegant” …

Like many a foolhardy pioneer before me, I’m endeavoring to cross the trackless wasteland that is Understanding Monads.

I’m still staggering through, but I can’t help noticing a certain monad-like …

Can anyone explain (better with an example in plain English) what a list monad can do to model non-deterministic calculations? Namely what the problem is and what solution a list monad can offer.

an example use case:

def div2(i: Int): Validation[String, Int] =

if (i%2 == 0) Validation.success(i/2)

else Validation.failure(“odd”)

def div4(i: Int) = for {

a <- div2(i)
b <-...

Okay, so I am not a Haskell programmer, but I am absolutely intrigued by a lot of the ideas behind Haskell and am looking into learning it. But I’m stuck at square one: I can’t seem to wrap my head …

If you wish to append two functions of type (a -> m b) so you get only one function of the same type appending both results, you could use Kleisli to do so:

instance (Monad m, Monoid b) => Monoid (…