
26 Jul
2010
26 Jul
'10
4:33 a.m.
Hi Johann,
On Mon, Jul 26, 2010 at 10:20 AM, Johann Bach
I am reading "typeclassopedia" and got curious about how the monoid instances First or Last could be applied to a real problem. Any suggestions for improvement would be welcome.
The code looks fine to me. The Last monoid is useful when parsing command line flags and you want the last mention of a flag to have precedence. You can further extend this to allow for default values of flags and flag definitions in config files. See Duncan's explanation of how this is used in Cabal: http://www.mail-archive.com/cabal-devel@haskell.org/msg01492.html Cheers, Johan