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

Phantom types issues: Code generation of custom types should be based on constructors, not on typevars #23

Open
Janiczek opened this issue Nov 3, 2024 · 0 comments

Comments

@Janiczek
Copy link

Janiczek commented Nov 3, 2024

I have this type:

type Password a
    = Password String

and this is roughly what gets generated:

passwordCodec : Codec a -> Codec (Password a)
passwordCodec a =
    Codec.custom
        (\passwordEncoder value ->
            case value of
                Auth.Password arg0 ->
                    passwordEncoder arg0
        )
        |> Codec.variant1 "Password" Password Codec.string
        |> Codec.buildCustom

There shouldn't be any Codec a argument, as the a is a phantom typevar.

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