I’m glad to announce 0.1-SNASHOT version of https://github.com/itkpi/cakeless
Cakeless is library providing better reader monad for well-known cake pattern. It’s implemented using cats and shapeless.
The main abstraction cakeless provides is CakeT
monad.
The library automaticaly infers abstract def
s and val
s (e.g. dependencies that should be provided) of the component stack, picks them up on the typelevel (as HList
) and wraps them into CakeT
monad.
You can combine several cakes using flatMap
. It will merge cakes dependencies using shapeless.ops.hlist.Union
.
Dependencies from different cakes will be accumulated along with computaitons
Repeating dependencies (with same compile-time type) will be merged into one.
Addionally cakeless contains 2 separate modules:
- integration with
cats-effect
for safe components allocation and releasing resources (using bracket) - module for managing component lifecycle (preStart, postStart like in akka actors)
If you’re bored by instantiating cakes by hands and planning to use other dependency injection library, Cakeless will allow you to do so quickly without rewriting existing components!
New contributors are also welcome =)