Commit 05046b36 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Add `@since` annotations

parent 0d7328e2
......@@ -104,6 +104,7 @@ instance MonadCont (ContT r m) where
instance (Error e, MonadCont m) => MonadCont (ErrorT e m) where
callCC = Error.liftCallCC callCC
{- | @since 2.2 -}
instance MonadCont m => MonadCont (ExceptT e m) where
callCC = Except.liftCallCC callCC
......
......@@ -112,6 +112,8 @@ Lifts an @'Either' e@ into any @'MonadError' e@.
> do { val <- liftEither =<< action1; action2 }
where @action1@ returns an 'Either' to represent errors.
@since 2.2.2
-}
liftEither :: MonadError e m => Either e a -> m a
liftEither = either throwError return
......@@ -120,6 +122,7 @@ instance MonadError IOException IO where
throwError = ioError
catchError = catch
{- | @since 2.2.2 -}
instance MonadError () Maybe where
throwError () = Nothing
catchError Nothing f = f ()
......@@ -137,6 +140,7 @@ instance (Monad m, Error e) => MonadError e (ErrorT e m) where
throwError = ErrorT.throwError
catchError = ErrorT.catchError
{- | @since 2.2 -}
instance Monad m => MonadError e (ExceptT e m) where
throwError = ExceptT.throwE
catchError = ExceptT.catchE
......
......@@ -22,6 +22,8 @@ or using exception handling to structure error handling.
[Example type:] @'Either' String a@
The Error monad (also called the Exception monad).
@since 2.2.1
-}
{-
......
......@@ -57,6 +57,7 @@ instance (Monoid w, Monad m) => MonadRWS r w s (Strict.RWST r w s m)
-- All of these instances need UndecidableInstances,
-- because they do not satisfy the coverage condition.
-- | @since 2.2
instance MonadRWS r w s m => MonadRWS r w s (ExceptT e m)
instance (Error e, MonadRWS r w s m) => MonadRWS r w s (ErrorT e m)
instance MonadRWS r w s m => MonadRWS r w s (IdentityT m)
......
......@@ -137,6 +137,7 @@ instance (Error e, MonadReader r m) => MonadReader r (ErrorT e m) where
local = mapErrorT . local
reader = lift . reader
{- | @since 2.2 -}
instance MonadReader r m => MonadReader r (ExceptT e m) where
ask = lift ask
local = mapExceptT . local
......
......@@ -89,6 +89,8 @@ modify f = state (\s -> ((), f s))
-- | A variant of 'modify' in which the computation is strict in the
-- new state.
--
-- @since 2.2
modify' :: MonadState s m => (s -> s) -> m ()
modify' f = do
s' <- get
......@@ -137,6 +139,7 @@ instance (Error e, MonadState s m) => MonadState s (ErrorT e m) where
put = lift . put
state = lift . state
-- | @since 2.2
instance MonadState s m => MonadState s (ExceptT e m) where
get = lift get
put = lift . put
......
......@@ -104,6 +104,9 @@ censor f m = pass $ do
return (a, f)
#if MIN_VERSION_base(4,9,0)
-- | __NOTE__: This instance is only defined for @base >= 4.9.0@.
--
-- @since 2.2.2
instance (Monoid w) => MonadWriter w ((,) w) where
writer ~(a, w) = (w, a)
tell w = (w, ())
......@@ -147,6 +150,7 @@ instance (Error e, MonadWriter w m) => MonadWriter w (ErrorT e m) where
listen = Error.liftListen listen
pass = Error.liftPass pass
-- | @since 2.2
instance MonadWriter w m => MonadWriter w (ExceptT e m) where
writer = lift . writer
tell = lift . tell
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment