data structure for assembling components.
This library provides a Registry
which is a data structure containing a list of functions and values representing dependencies in a directed acyclic graph. A make
function can then be used to create a value of a specific type out of the registry. You can start with the README for a full description of the library.
Registry
It's functions all the way down
Presentation
This library provides a data structure, a "Registry", to control the creation of functions from other functions. You can use this technique to:
- create applications out of software components ("dependency injection")
- fine tune encoders/decoders (see the
registry-aeson
and theregistry-messagepack
projects) - create composable data generators for nested datatypes (see the
registry-hedgehog
and theregistry-hedgehog-aeson
projects)
You can watch a video presenting the main ideas behind the library here.
The following sections introduce in more details the problem that this library is addressing, the concepts behind the solution and various use-cases which can arise on real projects:
- what is the problem?
- the concept of a Registry and the resolution algorithm
- how does this compare to monad transformers and effects?
Tutorials
- tutorial: use a
Registry
to create applications and define components - use a
Registry
to compose Hedgehog generators - workshop: implement your own simplified registry and understand the basic concepts behind it
How-tos
- how to install this library?
- how to do mocking?
- how to specialize some values in some contexts?
- how to control effects occurring when creating a component (like a connection pool)?
- how to allocate resources which must be finalized?
- how to extract a dot graph from the registry in an application?
- how to interact with a library using monad transformers?
- how to remove boilerplate due to parameter passing?
- how to create a typeclass from a record of functions?
- how to read type errors?