acme-iot 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+5/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- acme-iot.cabal +1/−1
- src/Control/Monad/Trans/IO.hs +4/−4
acme-iot.cabal view
@@ -1,5 +1,5 @@ name: acme-iot-version: 0.1.0.0+version: 0.1.0.1 synopsis: IO monad transformer description: IO transformer capable of adding IO capabilities to any monad. license: MIT
src/Control/Monad/Trans/IO.hs view
@@ -70,19 +70,19 @@ mzero = IOT# $ \s# -> mzero mplus (IOT# fa) (IOT# fb) = IOT# $ \s# -> mplus (fa s#) (fb s#) --- Run an IO computation. Note that this might return an interleaved result.+-- | Run an IO computation. Note that this might return an interleaved result. runIOT :: Functor m => IOT m a -> IO (m a) runIOT (IOT# f) = IO $ \s# -> (# s#, fmap (\(IORet# (# s#, x #)) -> x) $ f s# #) --- Change the underlying monad in an IO computation. If @MagicHash@ is not in use, a natural transformation could be supplied, or the 'Functor' instance of 'IORet#' could be made use of.+-- | Change the underlying monad in an IO computation. If @MagicHash@ is not in use, a natural transformation could be supplied, or the 'Functor' instance of 'IORet#' could be made use of. hoistIOT :: (m (IORet# a) -> n (IORet# b)) -> IOT m a -> IOT n b hoistIOT f m = IOT# $ \s# -> f (getIOT# m s#) --- Create an IO computation from an IO of a monadic computation.+-- | Create an IO computation from an IO of a monadic computation. fromIO :: Functor m => IO (m a) -> IOT m a fromIO (IO i) = IOT# $ \s# -> case i s# of (# s#, mx #) -> fmap (\x -> IORet# (# s#, x #)) mx --- Create an IO computation from a monadic computation of IO.+-- | Create an IO computation from a monadic computation of IO. sequenceIO :: Functor m => m (IO a) -> IOT m a sequenceIO mx = IOT# $ \s# -> fmap (\(IO i) -> IORet# (i s#)) mx