Skip to content
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

Add helper methods to Yaml{Encodr, Decoder, Codec} #303

Merged
merged 3 commits into from
May 31, 2024

Conversation

sideeffffect
Copy link
Contributor

No description provided.

@sideeffffect
Copy link
Contributor Author

One more 🙂 @lbialy @tgodzik

Copy link
Contributor

@lbialy lbialy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iemap will need a better name, I think

def imap[T1](f: T => T1)(g: T1 => T): YamlCodec[T1] =
YamlCodec.from(self.map(f), self.contramap(g))

def iemap[T1](f: T => Either[ConstructError, T1])(g: T1 => T): YamlCodec[T1] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a better name for this shape of iso map? iemap is actively hostile (imap is too, tbh) if you're not familiar with ct and/or haskell

@lbialy
Copy link
Contributor

lbialy commented May 31, 2024

Some tests would be nice too, I know that it's basically if it compiles, it works kind of a change but still - let's say it's just for breakage detection

@sideeffffect sideeffffect requested a review from lbialy May 31, 2024 16:15
@sideeffffect sideeffffect changed the title Apply helper methods Yaml{Encodr, Decoder, Codec} Add helper methods to Yaml{Encodr, Decoder, Codec} May 31, 2024
@lbialy lbialy merged commit c78ba30 into VirtusLab:main May 31, 2024
6 checks passed
@sideeffffect sideeffffect deleted the apply-helper branch June 7, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants