HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleselective-0.7.0.1Haskell2010

Control.Selective.Free

This is a library for selective applicative functors, or just selective functors for short, an abstraction between applicative functors and monads, introduced in this paper: https://dl.acm.org/doi/10.1145/3341694.

This module defines free selective functors using the ideas from the Sjoerd Visscher's package 'free-functors': https://hackage.haskell.org/package/free-functors-1.0.1/docs/Data-Functor-HFree.html.

  • 1 type
  • 6 values

Free selective functors

2 declarations
newtypenewtype Select (f :: Type -> Type) a
#

Free selective functors.

Constructors

Instances3Functor, Applicative, Selective
valueliftSelect :: f a -> Select f a
#

Lift a functor into a free selective computation.

Static analysis

5 declarations
valuegetPure :: Select f a -> Maybe a
#

Extract the resulting value if there are no necessary effects.

valuegetEffects :: Functor f => Select f a -> [f ()]
#

Collect all possible effects in the order they appear in a free selective computation.

valuerunSelect :: Selective g => (forall x. f x -> g x) -> Select f a -> g a
#

Given a natural transformation from f to g, this gives a canonical natural transformation from Select f to g. Note that here we rely on the fact that g is a lawful selective functor.

valuefoldSelect :: Monoid m => (forall x. f x -> m) -> Select f a -> m
#

Concatenate all effects of a free selective computation.