News for hackers. Stuff that matters.
Re:From design patterns to category theory by sandGorgon on Thursday October 05, 2017 @10:56AM (#15409657)
this is a super interesting reply - you kind of translated these monadic concepts to python.

Is there a resource for this ? or good old intuition ?

Re:From design patterns to category theory by crimsonalucard on Thursday October 05, 2017 @11:21AM (#15409886)
Nah no single resource, it took me a lot of time to understand monads, going over many resources.

Just remember Absolutely ANY design pattern / data structure can be a monad as long as you can get an internal value out of that abstraction and define a bind operator to compose monads together.

This rule tells it all:

  (>>=)            :: m a -> (a -> m b) -> m b
m is the abstraction wrapper and a is the internal thing that is wrapped. You can wrap it in a type string, a list. Even like a binary tree can be a monad.

You can define the bind operator to do whatever you want, it just needs to follow the type signature above and be associative.

Re:From design patterns to category theory by crimsonalucard on Thursday October 05, 2017 @01:53PM (#15411069)
Oh and nothing was translated. A monad is a general concept applicable to almost any language. Deep understanding of a monad is to understand it outside of the haskell ecosystem.