{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
module Wire.Sem.Now.IO
( nowToIOAction,
nowToIO,
)
where
import Data.Time
import Imports
import Polysemy
import Wire.Sem.Now
nowToIOAction ::
forall r a.
(Member (Embed IO) r) =>
IO UTCTime ->
Sem (Now ': r) a ->
Sem r a
nowToIOAction :: forall (r :: EffectRow) a.
Member (Embed IO) r =>
IO UTCTime -> Sem (Now : r) a -> Sem r a
nowToIOAction IO UTCTime
ioTime = (forall (rInitial :: EffectRow) x. Now (Sem rInitial) x -> Sem r x)
-> Sem (Now : r) a -> Sem r a
forall (e :: (* -> *) -> * -> *) (r :: EffectRow) a.
FirstOrder e "interpret" =>
(forall (rInitial :: EffectRow) x. e (Sem rInitial) x -> Sem r x)
-> Sem (e : r) a -> Sem r a
interpret ((forall (rInitial :: EffectRow) x.
Now (Sem rInitial) x -> Sem r x)
-> Sem (Now : r) a -> Sem r a)
-> (forall (rInitial :: EffectRow) x.
Now (Sem rInitial) x -> Sem r x)
-> Sem (Now : r) a
-> Sem r a
forall a b. (a -> b) -> a -> b
$ \case Now (Sem rInitial) x
Get -> forall (m :: * -> *) (r :: EffectRow) a.
Member (Embed m) r =>
m a -> Sem r a
embed @IO IO x
IO UTCTime
ioTime
nowToIO ::
forall r a.
(Member (Embed IO) r) =>
Sem (Now ': r) a ->
Sem r a
nowToIO :: forall (r :: EffectRow) a.
Member (Embed IO) r =>
Sem (Now : r) a -> Sem r a
nowToIO = IO UTCTime -> Sem (Now : r) a -> Sem r a
forall (r :: EffectRow) a.
Member (Embed IO) r =>
IO UTCTime -> Sem (Now : r) a -> Sem r a
nowToIOAction IO UTCTime
getCurrentTime