module Polysemy.Time.Diff where

import Torsor (Torsor, difference)

import Polysemy.Time.Class.Instant (Instant, dateTime)
import Polysemy.Time.Data.TimeUnit (TimeUnit, convert)

diff ::
   dt u i1 i2 .
  TimeUnit u =>
  Torsor dt u =>
  Instant i1 dt =>
  Instant i2 dt =>
  i1 ->
  i2 ->
  u
diff :: i1 -> i2 -> u
diff i1
i1 i2
i2 =
  u -> u
forall a b. (TimeUnit a, TimeUnit b) => a -> b
convert (dt -> dt -> u
forall p v. Torsor p v => p -> p -> v
difference (i1 -> dt
forall i dt. Instant i dt => i -> dt
dateTime i1
i1) (i2 -> dt
forall i dt. Instant i dt => i -> dt
dateTime i2
i2))