Revert comments/README.

main
Joshua Potter 2022-04-02 22:17:04 -04:00
parent c699bee3df
commit be5f86bc03
3 changed files with 18 additions and 16 deletions

View File

@ -1,6 +1,8 @@
# fused-effects-exceptions
[![Hackage](https://img.shields.io/hackage/v/fused-effects-exceptions.svg)](https://hackage.haskell.org/package/fused-effects-exceptions)
[![BSD3 license](https://img.shields.io/badge/license-BSD3-blue.svg)](LICENSE)
[![Build Status](https://action-badges.now.sh/fused-effects/fused-effects-exceptions)](https://github.com/fused-effects/fused-effects-exceptions/actions)
<!--
Setup, hidden from the rendered markdown.
@ -18,7 +20,7 @@ main = pure ()
-->
This fork provides `Control.Effect.Exception[.UnliftIO]`, a module that wraps the [`Control.Exception`](http://hackage.haskell.org/package/base/docs/Control-Exception.html) and [`UnliftIO.Exception`](https://hackage.haskell.org/package/unliftio-0.2.21.0/docs/UnliftIO-Exception.html) API from `base` with the vocabulary provided by the [`fused-effects`](http://hackage.haskell.org/package/fused-effects) library. These functions interact with GHC's support for dynamic exceptions, including functions like `catch` for exception handling and `bracket` for resource management.
This package provides `Control.Effect.Exception`, a module that wraps the [`Control.Exception`](http://hackage.haskell.org/package/base/docs/Control-Exception.html) API from `base` with the vocabulary provided by the [`fused-effects`](http://hackage.haskell.org/package/fused-effects) library. These functions interact with GHC's support for dynamic exceptions, including functions like `catch` for exception handling and `bracket` for resource management.
Please be aware that injudicious use of these functions may provoke surprising interactions with carriers that thread a monadic state as a parameter, à la the `Control.Carrier.State` types provided by `fused-effects`. For example, a function like `finally`, which does not thread any state from its body to its handler block, may discard state writes in cleanup handlers:

View File

@ -3,7 +3,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
-- | Operations from "Control.Exception" and "UnliftIO.Exception" lifted into effectful contexts using 'Control.Effect.Lift.Lift'.
-- | Operations from "Control.Exception" lifted into effectful contexts using 'Control.Effect.Lift.Lift'.
--
-- @since 1.0.0.0
module Control.Effect.Exception
@ -93,19 +93,19 @@ ioError = U.ioError @IO
throwTo :: (Exc.Exception e, Has (Lift IO) sig m) => ThreadId -> e -> m ()
throwTo = U.throwTo @IO
-- | See @"UnliftIO.Exception".catch@.
-- | See @"Control.Exception".catch@.
--
-- @since 1.0.0.0
catch :: (Exc.Exception e, Has (Lift IO) sig m) => m a -> (e -> m a) -> m a
catch = U.catch @IO
-- | See @"UnliftIO.Exception".catches@.
-- | See @"Control.Exception".catches@.
--
-- @since 1.0.0.0
catches :: Has (Lift IO) sig m => m a -> [U.Handler m a] -> m a
catches = U.catches @IO
-- | See @"UnliftIO.Exception".catchJust@.
-- | See @"Control.Exception".catchJust@.
--
-- @since 1.0.0.0
catchJust
@ -145,13 +145,13 @@ try = U.try @IO
tryJust :: (Exc.Exception e, Has (Lift IO) sig m) => (e -> Maybe b) -> m a -> m (Either b a)
tryJust = U.tryJust @IO
-- | See @"UnliftIO.Exception".evaluate@.
-- | See @"Control.Exception".evaluate@.
--
-- @since 1.0.0.0
evaluate :: Has (Lift IO) sig m => a -> m a
evaluate = U.evaluate @IO
-- | See @"UnliftIO.Exception".mask@.
-- | See @"Control.Exception".mask@.
--
-- @since 1.0.0.0
mask :: Has (Lift IO) sig m => ((forall a . m a -> m a) -> m b) -> m b
@ -163,7 +163,7 @@ mask = U.mask @IO
mask_ :: Has (Lift IO) sig m => m a -> m a
mask_ = U.mask_ @IO
-- | See @"UnliftIO.Exception".uninterruptibleMask@.
-- | See @"Control.Exception".uninterruptibleMask@.
--
-- @since 1.0.0.0
uninterruptibleMask :: Has (Lift IO) sig m => ((forall a . m a -> m a) -> m b) -> m b

View File

@ -5,7 +5,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
-- | Operations from "Control.Exception" and "UnliftIO.Exception" lifted into effectful contexts using 'Control.Effect.Lift.Lift'.
-- | Operations from "Control.Exception" lifted into effectful contexts using 'Control.Effect.Lift.Lift'.
--
-- @since 1.1.2.0
module Control.Effect.Exception.UnliftIO
@ -78,7 +78,7 @@ import qualified Control.Exception as EUnsafe
import Control.Monad.IO.Unlift (MonadIO, MonadUnliftIO, liftIO, withRunInIO)
import Prelude hiding (ioError)
-- | See @"Unlift.Exception".throwIO@.
-- | See @"Control.Exception".throwIO@.
--
-- @since 1.1.2.0
throwIO
@ -109,7 +109,7 @@ throwTo
-> m ()
throwTo thread = sendM @n . liftIO . EUnsafe.throwTo thread
-- | See @"UnliftIO.Exception".catch@.
-- | See @"Control.Exception".catch@.
--
-- @since 1.1.2.0
catch
@ -121,7 +121,7 @@ catch
catch m h = liftWith @n $
\run ctx -> run (m <$ ctx) `Exc.catch` (run . (<$ ctx) . h)
-- | See @"UnliftIO.Exception".catches@.
-- | See @"Control.Exception".catches@.
--
-- @since 1.1.2.0
catches
@ -143,7 +143,7 @@ data Handler m a
deriving instance Functor m => Functor (Handler m)
-- | See @"UnliftIO.Exception".catchJust@.
-- | See @"Control.Exception".catchJust@.
--
-- @since 1.1.2.0
catchJust
@ -200,13 +200,13 @@ tryJust
-> m (Either b a)
tryJust p m = catchJust @n p (Right <$> m) (pure . Left)
-- | See @"UnliftIO.Exception".evaluate@.
-- | See @"Control.Exception".evaluate@.
--
-- @since 1.1.2.0
evaluate :: forall n sig m a. (MonadUnliftIO n, Has (Lift n) sig m) => a -> m a
evaluate = sendM @n . Exc.evaluate
-- | See @"UnliftIO.Exception".mask@.
-- | See @"Control.Exception".mask@.
--
-- @since 1.1.2.0
mask
@ -227,7 +227,7 @@ mask_
-> m a
mask_ m = mask @n (const m)
-- | See @"UnliftIO.Exception".uninterruptibleMask@.
-- | See @"Control.Exception".uninterruptibleMask@.
--
-- @since 1.1.2.0
uninterruptibleMask