can-i-haz alternatives and similar packages
Based on the "Control" category.
Alternatively, view can-i-haz alternatives based on common mentions on social networks and blogs.
-
transient
A full stack, reactive architecture for general purpose programming. Algebraic and monadically composable primitives for concurrency, parallelism, event handling, transactions, multithreading, Web, and distributed computing with complete de-inversion of control (No callbacks, no blocking, pure state) -
recursion-schemes
Generalized bananas, lenses and barbed wire -
distributed-closure
Serializable closures for distributed programming. -
extensible-effects
Extensible Effects: An Alternative to Monad Transformers -
classy-prelude-yesod
Type classes for mapping, folding, and traversing monomorphic containers -
auto
Haskell DSL and platform providing denotational, compositional api for discrete-step, locally stateful, interactive programs, games & automations. http://hackage.haskell.org/package/auto -
selective
Selective Applicative Functors: Declare Your Effects Statically, Select Which to Execute Dynamically -
classy-prelude
Type classes for mapping, folding, and traversing monomorphic containers -
abstract-par
Type classes generalizing the functionality of the 'monad-par' library. -
these
An either-or-both data type, with corresponding hybrid error/writer monad transformer. -
hask
Category theory for Haskell with a lens flavor (you need GHC 7.8.3, not 7.8.2 to build this!) -
ComonadSheet
A library for expressing "spreadsheet-like" computations with absolute and relative references, using fixed-points of n-dimensional comonads. -
transient-universe
A Cloud monad based on transient for the creation of Web and reactive distributed applications that are fully composable, where Web browsers are first class nodes in the cloud -
cloud-haskell
This is an umbrella development repository for Cloud Haskell -
distributed-process-platform
DEPRECATED (Cloud Haskell Platform) in favor of distributed-process-extras, distributed-process-async, distributed-process-client-server, distributed-process-registry, distributed-process-supervisor, distributed-process-task and distributed-process-execution -
distributed-fork
A distributed data processing framework in Haskell. -
monad-validate
(NOTE: REPOSITORY MOVED TO NEW OWNER: https://github.com/lexi-lambda/monad-validate) A Haskell monad transformer library for data validation -
monad-control
Lift control operations, like exception catching, through monad transformers -
ixmonad
Provides 'graded monads' and 'parameterised monads' to Haskell, enabling fine-grained reasoning about effects. -
effect-monad
Provides 'graded monads' and 'parameterised monads' to Haskell, enabling fine-grained reasoning about effects. -
freer-effects
An implementation of "Freer Monads, More Extensible Effects". -
operational
Implement monads by specifying instructions and their desired operational semantics. -
monad-time
Type class for monads which carry the notion of the current time.
Access the most powerful time series database as a service
Do you think we are missing an alternative of can-i-haz or a related project?
README
can-i-haz
Generic
implementation of the Has-pattern (mostly useful with MonadReader
and MonadState
)
and its dual CoHas
(mostly useful with MonadError
).
Motivation
Assume there are two types representing the MonadReader
environments
for different parts of an app:
data DbConfig = DbConfig { .. }
data WebConfig = WebConfig { .. }
as well as a single type containing both of those:
data AppEnv = AppEnv
{ dbConfig :: DbConfig
, webConfig :: WebConfig
}
What should be the MonadReader
constraint of the DB module and web module respectively?
- It could be
MonadReader AppEnv m
for both, introducing unnecessary coupling. - Or it could be
MonadReader DbConfig m
for the DB module andMonadReader WebConfig m
for the web module respectively, but combining them becomes a pain.
Or, it could be MonadReader r m, Has DbConfig r
for the DB module,
where Has
class allows projecting DbConfig
out of some r
,
and similarly for the web module!
This approach keeps both modules decoupled, while allowing using them in the same monad stack.
The only downside is that now one has to define the Has
class
and write tediuos instances for the AppEnv
type
(and potentially other types in case of tests).
The solution
This library saves you from this unnecessary boilerplate!
The only thing you have to do is to append the deriving
-clause:
data AppEnv = AppEnv
{ dbConfig :: DbConfig
, webConfig :: WebConfig
} deriving (Generic, Has DbConfig, Has WebConfig)
and use ask extract
instead of ask
(but this is something you'd have to do anyway).
Reversing the arrows: CoHas
There is a dual (but arguably less frequent) problem of combining different parts of an application
living in different MonadError
environments.
The duality is due to us now wanting to inject values of a type into a "wider" sum type
(as opposed to projecting values out of some product type).
The CoHas
class serves exactly this purpose.
Documentation
Perhaps the best source is the Haddock docs.
Acknowledgements
Thanks lyxia @ #haskell for the type families-based derivation of the GHas
instance.