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

Moduleeffectful-core-2.3.0.1Haskell2010

Effectful.Internal.Unlift

Implementation of sequential and concurrent unlifts.

This module is intended for internal use only, and may change without warning in subsequent releases.

  • 3 types
  • 2 values

Unlifting strategies

3 declarations
datadata UnliftStrategy
#

The strategy to use when unlifting Eff computations via withEffToIO or the localUnlift family.

Constructors

  • SeqUnlift

    The sequential strategy is the fastest and a default setting for IOE. Any attempt of calling the unlifting function in threads distinct from its creator will result in a runtime error.

  • ConcUnlift !Persistence !Limit

    The concurrent strategy makes it possible for the unlifting function to be called in threads distinct from its creator. See Persistence and Limit settings for more information.

Instances5Eq, Ord, Show, Generic, Rep
datadata Persistence
#

Persistence setting for the ConcUnlift strategy.

Different functions require different persistence strategies. Examples:

  • Lifting pooledMapConcurrentlyN from the unliftio library requires the Ephemeral strategy as we don't want jobs to share environment changes made by previous jobs run in the same worker thread.

  • Lifting forkIOWithUnmask requires the Persistent strategy, otherwise the unmasking function would start with a fresh environment each time it's called.

Constructors

  • Ephemeral

    Don't persist the environment between calls to the unlifting function in threads distinct from its creator.

  • Persistent

    Persist the environment between calls to the unlifting function within a particular thread.

Instances5Eq, Ord, Show, Generic, Rep
datadata Limit
#

Limit setting for the ConcUnlift strategy.

Constructors

  • Limited !Int

    Behavior dependent on the Persistence setting.

    For Ephemeral, it limits the amount of uses of the unlifting function in threads distinct from its creator to N. The unlifting function will create N copies of the environment when called N times and K+1 copies when called K < N times.

    For Persistent, it limits the amount of threads, distinct from the creator of the unlifting function, it can be called in to N. The amount of calls to the unlifting function within a particular threads is unlimited. The unlifting function will create N copies of the environment when called in N threads and K+1 copies when called in K < N threads.

  • Unlimited

    Unlimited use of the unlifting function.

Instances5Eq, Ord, Show, Generic, Rep

Unlifting functions

2 declarations