Hacker News new | past | comments | ask | show | jobs | submit login

Here is Haskell's Monad:

    class Monad m where
      (>>=)  :: m a -> (  a -> m b) -> m b
      (>>)   :: m a ->  m b         -> m b
      return ::   a                 -> m a
and these functions must obey the properties

    return a >>= k                  =  k a
    m        >>= return             =  m
    m        >>= (\x -> k x >>= h)  =  (m >>= k) >>= h
Anything other than the definition I gave is an analogy that will only work for certain examples, that is, unless you can mathematically prove that your analogy is isomorphic to this definition



Yeah, my definition works for all those examples.


How does your "definition" (I will take that to mean "an abstract wrapper for some properties that you can apply sequential transforms on" from your first comment) apply to e.g. the monad whose algebras are monoids?


Okay, then prove that your definition of a monad is isomorphic to the given definition




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: