HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulepolysemy-1.9.2.0Haskell2010

Polysemy.Resource

Contents
  1. Effect
  2. Actions
  3. Interpretations
Synopsis
  • Packagepolysemy-1.9.2.0
  • Exports8
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceResource.hs

Effect

datadata Resource (m :: Type -> Type) a where

An effect capable of providing bracket semantics. Interpreters for this will successfully run the deallocation action even in the presence of other short-circuiting effects.

Constructors

  • Bracket :: m a -> (a -> m c) -> (a -> m b) -> Resource m a

    Allocate a resource, use it, and clean it up afterwards.

  • BracketOnError :: m a -> (a -> m c) -> (a -> m b) -> Resource m a

    Allocate a resource, use it, and clean it up afterwards if an error occurred.

Actions

valuefinally
  1. :: Member Resource r
  2. => Sem r a

    computation to run first

  3. -> Sem r b

    computation to run afterward (even if an exception was raised)

  4. -> Sem r a

Like bracket, but for the simple case of one computation to run afterward.

Interpretations