You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IOSim s Monad has the same instances as Codensity (SimA s) except with oneShot. Could be added to the Codensity instances, giving the compiler better hints and allowing the io-sim library to derive via Codensity.
newtypeIOSimsa=IOSim{unIOSim::forallr. (a->SimAsr) ->SimAsr}instanceFunctor (IOSims) where
{-# INLINE fmap #-}
fmap f =\d ->IOSim$ oneShot $\k -> unIOSim d (k . f)
instanceApplicative (IOSims) where
{-# INLINE pure #-}
{-# INLINE (<*>) #-}
{-# INLINE (*>) #-}
pure=\x ->IOSim$ oneShot $\k -> k x
(<*>)=\df dx ->IOSim$ oneShot $\k -> unIOSim df (\f -> unIOSim dx (\x -> k (f x)))
(*>)=\dm dn ->IOSim$ oneShot $\k -> unIOSim dm (\_ -> unIOSim dn k)
instanceMonad (IOSims) where
{-# INLINE (>>=) #-}
{-# INLINE (>>) #-}
return=pure(>>=)=\dm f ->IOSim$ oneShot $\k -> unIOSim dm (\m -> unIOSim (f m) k)
(>>)=(*>)
The text was updated successfully, but these errors were encountered:
The
IOSim s
Monad has the same instances asCodensity (SimA s)
except withoneShot
. Could be added to theCodensity
instances, giving the compiler better hints and allowing the io-sim library to derive viaCodensity
.The text was updated successfully, but these errors were encountered: