-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoC: config reading with state v2 #92
Conversation
Typeclass with ability to read configs with state (default values for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poslegm i like it, though need more time to read and understand. can you clarify: are you solving just the .add
case for lists (or possibly maps), or will this also work for scalafmt's presets?
My main task here is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no rush on your end to get this functionality merged, would it be OK if you give me some time to try and draft an alternative solution that avoids breaking changes and also unblocks other use-cases besides defaults? I'm not convinced it's the best way forward to use the design in this PR. I would love to have a solution that is more general that doesn't require the same advanced implicit machinery. |
Yes, of course! |
@olafurpg are you still thinking about an alternative? i saw a comment about your focus in |
My next attempt to implement config reading with state. Based on #88 and @kitbellew's
ConfigDecoderFactory
idea.Now it presents independent
ConfigReaderDecoder
typeclass with main APIwhere
S
is state provided on decoder construction (like default values for collections).It still has priority implicits magic but with improvements:
ConfDecoderReader
without state lossConfDecoder
API and already created decodersConfDecoder
I defined
ConfDecoderReader
instances forMap[String, A]
andIterable[A]
with ability to.add
to defaults. It's possible to implement.remove
also.S
type parameter allows users to provide rich states to custom decoders. If you think this is an unnecessary overcomplication, I don't mind replacing it with default only.What do you think?