[Prev][Next][Index][Thread]
Re: Laws for Monads with zero and plus
-
From: Philip Wadler <wadler@research.bell-labs.com>
-
Subject: Re: Laws for Monads with zero and plus
-
Date: Wed, 14 May 1997 09:46:25 -0400
-
To: Koen Claessen <kcclaess@cse.ogi.edu>, haskell@dcs.gla.ac.uk
-
In-reply-to: Your message of "Tue, 13 May 1997 12:44:04 EDT." <Pine.SUN.3.95.970513120702.4299D-100000@huckle.cse.ogi.edu>
-
Old-Received: from sicily.dcs.gla.ac.uk (actually host sicily) by vanuata with SMTP (MMTA); Wed, 14 May 1997 14:51:07 +0100
-
Old-Received: by sicily.dcs.gla.ac.uk (SMI-8.6/Dumb) id OAA23609; Wed, 14 May 1997 14:51:04 +0100
-
Old-Received: from dirty.research.bell-labs.com by vanuata with SMTP (MMTA); Wed, 14 May 1997 14:48:24 +0100
-
Old-Received: from slocum.cs.bell-labs.com ([135.104.70.9]) by dirty; Wed May 14 09:46:23 EDT 1997
-
Old-Received: from slocum.cs.bell-labs.com by slocum; Wed May 14 09:46:25 EDT 1997
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