Copyright | (c) 2019-2023 The Polysemy Lounge (c) 2023 Yamada Ryo |
---|---|
License | MPL-2.0 (see the file LICENSE) |
Maintainer | ymdfield@outlook.jp |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Data.Effect.Resource
Description
An effect capable of providing bracket semantics.
Synopsis
- data Resource f a where
- Bracket :: f a -> (a -> f ()) -> (a -> f b) -> Resource f b
- BracketOnExcept :: f a -> (a -> f ()) -> (a -> f b) -> Resource f b
- bracketOnExcept'' :: forall key (a :: Type) (b :: Type) f. SendSigBy key Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b
- bracketOnExcept' :: forall tag (a :: Type) (b :: Type) f. SendSig (TagH Resource tag) f => f a -> (a -> f ()) -> (a -> f b) -> f b
- bracketOnExcept :: forall (a :: Type) (b :: Type) f. SendSig Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b
- bracket'' :: forall key (a :: Type) (b :: Type) f. SendSigBy key Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b
- bracket' :: forall tag (a :: Type) (b :: Type) f. SendSig (TagH Resource tag) f => f a -> (a -> f ()) -> (a -> f b) -> f b
- bracket :: forall (a :: Type) (b :: Type) f. SendSig Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b
- bracket_ :: (Resource <<: f, Functor f) => f a -> f b -> f c -> f c
- bracketOnExcept_ :: (Resource <<: f, Functor f) => f a -> f b -> f c -> f c
- finally :: (Resource <<: f, Applicative f) => f a -> f () -> f a
- finally_ :: (Resource <<: f, Applicative f) => f a -> f b -> f a
- onException :: (Resource <<: f, Applicative f) => f a -> f () -> f a
- onException_ :: (Resource <<: f, Applicative f) => f a -> f b -> f a
Documentation
data Resource f a where Source #
An effect capable of providing bracket semantics.
Constructors
Bracket :: f a -> (a -> f ()) -> (a -> f b) -> Resource f b | Allocate a resource, use it, and clean it up afterwards. |
BracketOnExcept :: f a -> (a -> f ()) -> (a -> f b) -> Resource f b | Allocate a resource, use it, and clean it up afterwards if an error occurred. |
bracketOnExcept'' :: forall key (a :: Type) (b :: Type) f. SendSigBy key Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b Source #
Allocate a resource, use it, and clean it up afterwards if an error occurred.
bracketOnExcept' :: forall tag (a :: Type) (b :: Type) f. SendSig (TagH Resource tag) f => f a -> (a -> f ()) -> (a -> f b) -> f b Source #
Allocate a resource, use it, and clean it up afterwards if an error occurred.
bracketOnExcept :: forall (a :: Type) (b :: Type) f. SendSig Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b Source #
Allocate a resource, use it, and clean it up afterwards if an error occurred.
bracket'' :: forall key (a :: Type) (b :: Type) f. SendSigBy key Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b Source #
Allocate a resource, use it, and clean it up afterwards.
bracket' :: forall tag (a :: Type) (b :: Type) f. SendSig (TagH Resource tag) f => f a -> (a -> f ()) -> (a -> f b) -> f b Source #
Allocate a resource, use it, and clean it up afterwards.
bracket :: forall (a :: Type) (b :: Type) f. SendSig Resource f => f a -> (a -> f ()) -> (a -> f b) -> f b Source #
Allocate a resource, use it, and clean it up afterwards.
onException :: (Resource <<: f, Applicative f) => f a -> f () -> f a Source #
onException_ :: (Resource <<: f, Applicative f) => f a -> f b -> f a Source #