[Haskell-beginners] Fwd: My first functioning haskell project - a steganography utility

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Tue Jul 13 14:11:28 EDT 2010


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

On 7/13/10 11:20 , Tim Cowlishaw wrote:
> actually, looking at it again, it'd be something like
> 
> maybeMonoid :: (Monoid a) =>  Maybe a -> Maybe a -> a
> maybeMonoid ::  x y = (fromMaybe mempty x) `mappend` (fromMaybe mempty y)

Which in turn can be written as:

> maybeMonoid = mappend `on` (fromMaybe mempty)

("on" is in Data.Function:  "g `on` f" expresses the "\x y -> (f x) `g` (f
y)" idiom.)

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw8rE8ACgkQIn7hlCsL25XrugCdFLhDalZflo2P8h4XkdCODqAw
tcEAn0siZ8CK0+NKay0dz991kBxkvEjh
=Actk
-----END PGP SIGNATURE-----


More information about the Beginners mailing list