[Haskell-beginners] Num instnace for [Double]

Nathan Hüsken nathan.huesken
Wed Oct 2 12:47:10 UTC 2013


Hey,

I am working a lot with timeseries (with instances at discrete moments) 
of doubles.
So I use [Double].
Now I want to be able to do stuff like

timeSeries3 = timeSeries1 + timeSeries2

So I was thinking, I create a newtype

newtype TimeSeries a  = TimeSeries [a]

Now, can I somehow autoderive List, Monad, MonadPlus for TimeSeries?

Also I would like to derive from Num. Most of the things can be done 
pointwise!
What about fromInteger??? Should that just be a list with one element? 
Or does it simple not make sense?

Thanks!
Nathan



More information about the Beginners mailing list