News for hackers. Stuff that matters.
Re:From design patterns to category theory by tome on Saturday October 07, 2017 @06:19PM (#15426007)
> A list is not a monad

Huh? List is very much a monad.

Re:From design patterns to category theory by runeks on Sunday October 08, 2017 @10:16AM (#15428282)
You're completely right. I had no idea.

But I can't make sense of the definition of >>= for the list in Haskell, which is:

    xs >>= f = [y | x <- xs, y <- f x]
It seems to imply that I get a list in return when I do xs >>= f, but I need to do the following in order for it to work:

    [1,2,3] >>= return . (+1)
Re:From design patterns to category theory by crimsonalucard on Monday October 09, 2017 @02:38PM (#15436315)
You're probably use to Monads that wrap a single object, like the maybe monad. Monads can wrap multiple objects or anything. This is the case for a list.
Re:From design patterns to category theory by tome on Sunday October 08, 2017 @02:39PM (#15429361)
Perhaps this might help (or perhaps not!)

    > [1,-2,3] >>= (\x -> replicate (abs x) x)
    [1,-2,-2,3,3,3]