module Control.Monad.MultiPass.Instrument.Delay
( Delay
, delay
)
where
import Control.Monad.MultiPass
data Delay p1 p2 (tc :: *)
= Delay { delayInternal :: !(forall (a :: *). p1 a -> p2 a) }
delay :: Delay p1 p2 tc -> p1 a -> p2 a
delay =
delayInternal
instance Instrument tc () () (Delay Off Off tc) where
createInstrument _ _ () =
wrapInstrument $ Delay $ \Off -> Off
instance Instrument tc () () (Delay On Off tc) where
createInstrument _ _ () =
wrapInstrument $ Delay $ \(On _) -> Off
instance Instrument tc () () (Delay On On tc) where
createInstrument _ _ () =
wrapInstrument $ Delay $ id