Re: Proposal: Num instance for tuples

2012-11-01 Thread Twan van Laarhoven
On 18/10/12 11:58, Twan van Laarhoven wrote: Dear list, One piece of utility code that I find myself writing over and over again is the pointwise Num instance for tuples, i.e. Discussion period: 2 weeks, ends 2012-11-01. The discussion period is over, and it seems that most people are again

Re: Proposal: Num instance for tuples

2012-10-24 Thread Conal Elliott
I use these instances and similar ones from NumInstances [1] quite a bit. I also frequently use another pattern for applicative functors, via applicative-numbers [2]. I don't mind pulling these instances from a package, though they are orphans. It does trouble me a bit that the two patterns overla

Re: Proposal: Num instance for tuples

2012-10-19 Thread Simon Marlow
On 18/10/2012 11:07, Henning Thielemann wrote: On Thu, 18 Oct 2012, Twan van Laarhoven wrote: One piece of utility code that I find myself writing over and over again is the pointwise Num instance for tuples, i.e. For my taste, writing 2 :: (Int, Integer) abs (x,y) should yield a co

Re: Proposal: Num instance for tuples

2012-10-18 Thread Simon Hengel
On Thu, Oct 18, 2012 at 11:58:17AM +0200, Twan van Laarhoven wrote: > Dear list, > > > One piece of utility code that I find myself writing over and over > again is the pointwise Num instance for tuples, i.e. > > instance (Num a, Num b) => Num (a,b) where > fromInteger x = (fromInteg

Re: Proposal: Num instance for tuples

2012-10-18 Thread Henning Thielemann
On Thu, 18 Oct 2012, Twan van Laarhoven wrote: One piece of utility code that I find myself writing over and over again is the pointwise Num instance for tuples, i.e. For my taste, writing 2 :: (Int, Integer) abs (x,y) should yield a compiler error and the compiler should not try to in

Proposal: Num instance for tuples

2012-10-18 Thread Twan van Laarhoven
Dear list, One piece of utility code that I find myself writing over and over again is the pointwise Num instance for tuples, i.e. instance (Num a, Num b) => Num (a,b) where fromInteger x = (fromInteger x, fromInteger x) (a,b) + (a',b') = (a + a', b + b') (a,b) - (