[Prev][Next][Index][Thread]

Re: Laws for Monads with zero and plus



For sets and bags we have

	zero >>= k		=  zero
	m >>= \x -> zero	=  zero
	(m ++ n) >>= k		=  m >>= k ++ n >>= k
	m >>= \x -> k x ++ h x	=  m >>= k ++ n >>= k.

But the fourth law does not hold for lists, and the second law does
not hold if we consider the case where m is bottom.  I would usually
insist on at least the first and third laws for monad zero and plus,
and in addition that they form a monoid.  -- P




Post to "haskell": haskell@dcs.gla.ac.uk