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

[#311] Reimplement custom State #316

Merged
merged 2 commits into from
May 19, 2020

Conversation

vrom911
Copy link
Member

@vrom911 vrom911 commented May 19, 2020

Resolves #311

@vrom911 vrom911 added the codec Conversion between TOML and custom user data types label May 19, 2020
@vrom911 vrom911 requested a review from chshersh as a code owner May 19, 2020 16:39
@vrom911 vrom911 self-assigned this May 19, 2020
Copy link
Contributor

@hint-man hint-man bot left a comment

Choose a reason for hiding this comment

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

Do you know why your PR is still not approved? Because I chose not to approve it. But they will.

src/Toml/Codec/Types.hs Show resolved Hide resolved
Copy link
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

That's very nice! Final touch: can we now reimplement diwrap using single coerce? 🙂

-- | @since 1.3.0.0
instance Applicative TomlState where
pure :: a -> TomlState a
pure a = TomlState (Just a,)
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a very elegant implementation!

src/Toml/Codec/Types.hs Show resolved Hide resolved
Copy link
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

Amazing work!

@@ -136,7 +136,7 @@ diwrap
(Coercible a b)
=> TomlCodec a
-> TomlCodec b
diwrap = dimap coerce coerce
diwrap = coerce
Copy link
Contributor

Choose a reason for hiding this comment

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

Current mood: reimplementing mtl just to use coerce 🤣

Copy link
Member Author

Choose a reason for hiding this comment

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

:bad_guys: 🤣

@chshersh chshersh merged commit c270a36 into master May 19, 2020
@chshersh chshersh deleted the vrom911/311-Reimplement-custom-State branch May 19, 2020 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codec Conversion between TOML and custom user data types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reimplement custom State
2 participants