Modulepolysemy-zoo-0.8.2.0Haskell2010
Polysemy.Several
- 1 type
- 1 value
- Packagepolysemy-zoo-0.8.2.0
- Exports4
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceSeveral.hs
Data
4 declarationsLike ++ but at the type level. The following two lines are equivalent:
TypeConcat [Int, String] [Bool]
[Int, String, Bool]Equations
TypeConcat '[] b = bTypeConcat (a ': as) b = a ': TypeConcat as b
A helper function for building new runners which accept HLists intsead of individual elements. If you would normally write
f 5 . f "Text" . f Truethen 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 runReaderLikewise, runStates could be the following if you didn't want the returned state:
runStates :: HList t -> Sem (TypeConcat (TypeMap State t) r) a -> Sem r a
runStates = runSeveral (fmap (fmap snd) . runState)