shomei-core-0.2.0.0: src/Shomei/Time/Store.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
-- | The clock port: the current wall-clock time. Abstracting it lets tests fix or
-- advance time deterministically.
module Shomei.Time.Store
( Clock (..),
now,
)
where
import Effectful (Dispatch (..), DispatchOf, Eff, Effect, (:>))
import Effectful.Dispatch.Dynamic (send)
import Shomei.Prelude
data Clock :: Effect where
Now :: Clock m UTCTime
type instance DispatchOf Clock = Dynamic
now :: (Clock :> es) => Eff es UTCTime
now = send Now