HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulemonad-peel-0.3Haskell2010

Control.Monad.IO.Peel

This module defines the class MonadPeelIO of IO-based monads into which control operations on IO (such as exception catching; see Control.Exception.Peel) can be lifted.

liftIOOp and liftIOOp_ enable convenient lifting of two common special cases of control operation types.

  • 1 class
  • 2 values
  • Packagemonad-peel-0.3
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePeel.hs
classclass MonadIO m => MonadPeelIO (m :: Type -> Type) where
#

MonadPeelIO is the class of IO-based monads supporting an extra operation peelIO, enabling control operations on IO to be lifted into the monad.

Methods

  • peelIO :: m (m a -> IO (m a))

    peelIO is a version of peel that operates through an arbitrary stack of monad transformers directly to an inner IO (analagously to how liftIO is a version of lift). So it can be used with liftIO to lift control operations on IO into any monad in MonadPeelIO. For example:

       foo :: IO a -> IO a
       foo' :: MonadPeelIO m => m a -> m a
       foo' a = do
         k <- peelIO  -- k :: m a -> IO (m a)
         join $ liftIO $ foo (k a)  -- uses foo :: IO (m a) -> IO (m a)
    

    Note that the "obvious" term of this type (peelIO = return return) does not work correctly. Instances of MonadPeelIO should be constructed via MonadTransPeel, using peelIO = liftPeel peelIO.

Instances11MonadPeelIO, …