danidiaz / cauldron Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Could be an operator.
Endo
.
A general way of checking some misplaced Endo
s as primary beans, and maybe useful for other things.
For startup/shutdown actions and the like.
Detect it and fail at runtime.
For a decorator of Foo
, why bother with Endo
at all? Just take the original Foo
as a normal parameter, and return another Foo
.
You'll still need to maintain the order of decorators however, because it's significant.
Mainly for the logger thing.
Currently, the allowed shape of constructors is
makeServer :: IO (Logger -> Repository -> Server)
A constructor might have effects before receiving its dependencies. Those effects can be composed applicatively because they don't depend on the result of other initializations.
We can also do something like
makeServer :: IO (Logger -> Repository -> (Initializer,Server))
Where Initializer
is some effectful action which is accumulated accross all beans that produce it, and invoked later by the user, after the wiring has been performed.
But there seems to be the need for another type of initialization. Consider newPool
from the resource-pool package:
newPool :: PoolConfig a -> IO (Pool a)
Suppose we had PoolConfig
as a separate bean (we could get the configuration and create the bean together, but let's not do that in this example). In the current version of the library, there's no place to fit the IO
action that creates the pool. I guess we could define a wrapper type with an IORef
indirection that gets initialized in an Initializer
, but that would be roundabout and awkard.
So perhaps we should also allow monadic effects that can know about previous dependencies (that's what would make them monadic). Something like
makeServer :: IO (Logger -> Repository -> IO Server)
or
makeServer :: IO (Logger -> Repository -> IO (Initializer,Server))
They don't trigger MissingDependencies
by themselves, but they're on the message, which could be potentially confusing.
Example:
MissingDependencies [] (fromList [(Logger,fromList []),(Runner,fromList [RunnerConf]),(JsonConf IO,fromList []),(CommentsServer,fromList [])])
I guess they're useful for getting instrumented self-invocations, but they're an awkward exception to the "no cycles allowed" principle.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.