Monad Maybe?

Ken Shan ken@digitas.harvard.edu
Sat, 21 Sep 2002 18:37:53 -0400


--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2002-09-21T12:56:13-0700, Russell O'Connor wrote:
> case (number g) of
>  Just n -> Just (show n)
>  Nothing ->
>   case (fraction g) of
>    Just n -> Just (show n)
>    Nothing ->
>     case (nimber g) of
>      Just n -> Just ("*"++(show n))
>      Nothing -> Nothing

How about something like:

    msum [ liftM show (number g)
	 , liftM show (fraction g)
	 , liftM (("*"++).show) (nimber g) ]

--=20
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
So the choice which Lomborg presents us with, of whether to save a drowning
Tuvaluan (climate change) or a dying Somalian (water and sanitation) is not=
=20
a choice at all -- in fact we need to do both, and not least because one is
unlikely to be successful without the other.   http://www.anti-lomborg.com/

--45Z9DzgjV8m4Oswq
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9jPTAzjAc4f+uuBURAurxAKD8SSuUzXx2D3ZsLkYb9ZPY+mZgkgCfUhc0
hVfK4vjO/jQfvgXwyqSvG+o=
=MHO1
-----END PGP SIGNATURE-----

--45Z9DzgjV8m4Oswq--