Re: [Haskell-cafe] Monoids and newtypes

2009-01-27 Thread Derek Elkins
On Tue, 2009-01-27 at 08:51 -0800, Anish Muttreja wrote: > On Thu, 22 Jan 2009 09:46:19 -0800, Derek Elkins > wrote: > > > > >The old wiki had an excellent page that has not been replicated either > > verbatim or in spirit in the new wiki. > > http://web.archive.org/web/20060831090007/http://www

Re: [Haskell-cafe] Monoids and newtypes

2009-01-27 Thread Anish Muttreja
On Thu, 22 Jan 2009 09:46:19 -0800, Derek Elkins wrote: The old wiki had an excellent page that has not been replicated either verbatim or in spirit in the new wiki. http://web.archive.org/web/20060831090007/http://www.haskell.org/hawiki/CommonHaskellIdioms Thanks, this is really useful. T

Re: [Haskell-cafe] Monoids and newtypes

2009-01-22 Thread David Menendez
On Thu, Jan 22, 2009 at 10:11 AM, Ketil Malde wrote: > > I was just wondering if not phantom types might serve here as an > alternative way to go about that. Here's a small example illustrating > it: ... > *Monoids> mconcat [1,2::Foo Additive] > Foo 3 > *Monoids> mconcat [1,2::Foo Multiplicative]

Re: [Haskell-cafe] Monoids and newtypes

2009-01-22 Thread Derek Elkins
On Thu, 2009-01-22 at 16:11 +0100, Ketil Malde wrote: > One wart that was briefly mentioned during the Great Monoid Naming > Thread of 2009 is the need to wrap types in newtypes to provide multiple > instances of the same class with different semantics -- the archetypical > example being Integer as

[Haskell-cafe] Monoids and newtypes

2009-01-22 Thread Ketil Malde
One wart that was briefly mentioned during the Great Monoid Naming Thread of 2009 is the need to wrap types in newtypes to provide multiple instances of the same class with different semantics -- the archetypical example being Integer as a monoid over addition as well as multiplication. I was ju