[Haskell-cafe] Comments from OCaml Hacker Brian Hurt
bugfact at gmail.com
Thu Jan 15 16:08:11 EST 2009
Graphic composition using painters algorithm can be seen as a monoid.
data Graphic = Empty
| Graphic `Over` Graphic
| Ellipse Bounds
instance Monoid Graphic where
mempty = Empty
mappend = Over
So all functions that operate on monoids can be used on Graphic as well,
like mconcat that converts a [Graphic] into a Graphic
On Thu, Jan 15, 2009 at 9:51 PM, Don Stewart <dons at galois.com> wrote:
> > On Thu, 2009-01-15 at 19:46 +0000, Andrew Coppin wrote:
> > > PS. As a small aside... Is the Monoid class actually used *anywhere* in
> > > all of Haskell?
> > Yes.
> > They're used quite a lot in Cabal. Package databases are monoids.
> > Configuration files are monoids. Command line flags and sets of command
> > line flags are monoids. Package build information is a monoid.
> > It is also used in the Foldable class which is a nice interface for
> > traversing/visiting structures. Binary serialisation is also a monoid.
> Also, xmonad configuration hooks are monoidal. So all those xmonad users
> gluing together keybindings are using the Monoid class.
> -- Don
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe