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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Toml/Codec/Di.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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: 🤣

{-# INLINE diwrap #-}

{- | Bidirectional converter for @sum types@. For example, given the data
Expand Down
9 changes: 9 additions & 0 deletions src/Toml/Codec/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ f <!> g = \a -> f a <|> g a
{-# INLINE (<!>) #-}

{- | Mutable context for TOML conversion.
vrom911 marked this conversation as resolved.
Show resolved Hide resolved
We are introducing our own implemetation of state with 'MonadState' instance due
to some limitation in the design connected to the usage of State.

This newtype is equivalent to the following transformer:

@
MaybeT (State TOML)
@


@since 1.3.0.0
-}
Expand Down