Monad Maybe?

Russell O'Connor roconnor@Math.Berkeley.EDU
Sat, 21 Sep 2002 12:56:13 -0700 (PDT)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[To: haskell-cafe@haskell.org]

Is there a nicer way of writing the following sort of code?

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

- --
Russell O'Connor                           roconnor@math.berkeley.edu
           <http://www.math.berkeley.edu/~roconnor/>
``Any time you skip a commercial [...] you're actually stealing the
programming'' -- Jamie Kellner, CEO of TBS

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (SunOS)
Comment: For info see http://www.gnupg.org

iD8DBQE9jM7juZUa0PWVyWQRAjmlAJ9+YDXUEXEhLTtb2huBZKskJ9JvegCgjPb2
iGb/vYYLK7I+UdfijtEePyQ=
=6UZh
-----END PGP SIGNATURE-----