Earlier quoted context omitted.
Like Erik Meijer said in his course : there is nothing special or magic about monads. They don't deserve all the fuzz arround them. If you don't get why monads are so awesome, maybe that's a proof that you understood them. Because there is nothing special !! A monad is just a type with 2 functions defined. Like an interface with two methods in OO langages. The 2 functions have to respect some laws but you can imagine…
> You could invent a total different implementation for the list monad, for the maybe monad, etc (if you respect the laws). Could you show such a different implementation for either list or maybe?
newtype HeadList a = HeadList { getHeadList :: [a] }
instance Monad HeadList where
return a = HeadList [a]
m >>= f = HeadList $ fmap (head . getHeadList . f) (getHeadList m)
This is a list instance that only keeps the head of function result, so it's basically just a map.But you could imagine putting any function that returns one result. min max avg normalize, etc