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

Instead of producing {{Module}}.Auto module, append encoder/decoders inside {{Module}} file itself #4

Open
choonkeat opened this issue Apr 25, 2021 · 0 comments

Comments

@choonkeat
Copy link
Owner

choonkeat commented Apr 25, 2021

Upside 👍 we don't force the hand of the developers to expose the innards of the types

module Example exposing (Opaque)

type Opaque = Opaque String Int

... more code

-- SPECIAL COMMENT
-- EVERYTHING BELOW IS AUTO GENERATED

autoDecodeOpaque : Json.Decode.Decoder Opaque
autoDecodeOpaque = ... more code

autoEncodeOpaque : Opaque -> Json.Encode.Value
autoEncodeOpaque a = ... more code

Downside 👎 developers will have unignorable diff in their code commits
(instead of inlining, standard encoder decoders should be published as elm package for import to reduce the noise here)

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

No branches or pull requests

1 participant