diff package:rebase
This lets you use a difference list of a
Semigroup as a
Monoid.
Example:
>>> let hello = diff "Hello, "
>>> appEndo hello "World!"
"Hello, World!"
>>> appEndo (hello <> mempty) "World!"
"Hello, World!"
>>> appEndo (mempty <> hello) "World!"
"Hello, World!"
>>> let world = diff "World"
>>> let excl = diff "!"
>>> appEndo (hello <> (world <> excl)) mempty
"Hello, World!"
>>> appEndo ((hello <> world) <> excl) mempty
"Hello, World!"
Calendrical difference, with as many whole months as possible
diffLocalTime a b = a - b
Get the number of picoseconds in a
DiffTime.
This is a length of time, as measured by a clock. Conversion functions
such as
fromInteger and
realToFrac will treat it as
seconds. For example,
(0.010 :: DiffTime) corresponds to 10
milliseconds.
It has a precision of one picosecond (= 10^-12 s). Enumeration
functions will treat it as picoseconds.
This is a length of time, as measured by UTC. It has a precision of
10^-12 s.
Conversion functions such as
fromInteger and
realToFrac
will treat it as seconds. For example,
(0.010 ::
NominalDiffTime) corresponds to 10 milliseconds.
It has a precision of one picosecond (= 10^-12 s). Enumeration
functions will treat it as picoseconds.
It ignores leap-seconds, so it's not necessarily a fixed amount of
clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime =
01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
dayOfWeekDiff a b = a - b in range 0 to 6. The number of days
from b to the next a.
Create a
DiffTime from a number of picoseconds.
Scale by a factor. Note that scaleCalendarDiffDays (-1) will
not perfectly invert a duration, due to variable month lengths.
Scale by a factor. Note that scaleCalendarDiffTime (-1) will
not perfectly invert a duration, due to variable month lengths.
Create a
DiffTime which represents an integral number of
seconds.