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

Modulepolysemy-several-0.1.1.0Haskell2010

Polysemy.Several

  • 1 type
  • 1 value
datadata HList (a :: [Type]) where
#

A list capable of storing values of different types. Creating an HList looks like.

1 ::: "test" ::: True ::: HNil

Constructors

familytype family TypeMap (f :: a -> b) (xs :: [a]) :: [b] where
#

A map function over type level lists. For example, the following two lines are equivalent:

TypeMap Reader [Int, String, False]
[Reader Int, Reader String, Reader Bool]

Equations

familytype family Append (a :: [t]) (b :: [t]) :: [t] where
#

Type-level append.

Append [Int, String] [Bool]
[Int, String, Bool]

Equations

valuerunSeveral
  1. :: forall (r' :: [Effect]) k x. k -> Sem (e k ': r') x -> Sem r' x
  2. -> HList t
  3. -> Sem (Append (TypeMap e t) r) a
  4. -> Sem r a
#

A helper function for building new runners which accept HLists intsead of individual elements. If you would normally write

f 5 . f "Text" . f True

then this function can turn that into

runSeveral f (True ::: "Text" ::: 5 ::: HNil)

For example, a runReaders function could be implemented as:

runReaders :: HList t -> Sem (TypeConcat (TypeMap Reader t) r) a -> Sem r a
runReaders = runSeveral runReader