Monads in Haskell

http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html

says that

“If you hadn’t guessed, this is about monads as they appear in pure functional programming languages like Haskell. They are closely related to the monads of category theory, but are not exactly the same because Haskell doesn’t enforce the identities satisfied by categorical monads.”

What is the point of Haskell monads then, if they do not enforce the monad laws?

As I see, some of them do admit monad laws. But what happens when I use an almost-monad? Do I lose some guarantees?

You probably don’t use an almost-monad. Haskell doesn’t check the monad laws but you’ll pretty much never find a Monad implementation that doesn’t satisfy them.

1 Like

Or at least every monad you use should satisfy the laws up to their public interface, see Haskell Unfolder 8: Laws at around 23:37, they discuss such a case.

@maxigit thanks indeed, that’s instructive