
27 Oct
2015
27 Oct
'15
1:53 p.m.
Hello all If I define an Instant as a point in Time and an Interval as the difference between two Instants, and I also want to use (+) and (-), how can I do this. My initial thought making them instances of the Num class, but that does not work. (-) is okay on Intervals, but on Instant it returns a different type (Interval). Is it possible at all to define a typeclass with (-) :: Instant -> Instant -> Interval without using language extensions?