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

Clashing constructors #70

Closed
aleator opened this issue Jun 24, 2019 · 3 comments · Fixed by #85
Closed

Clashing constructors #70

aleator opened this issue Jun 24, 2019 · 3 comments · Fixed by #85
Assignees
Labels
question Further information is requested

Comments

@aleator
Copy link

aleator commented Jun 24, 2019

If I have a Haskell type with constructor "Ok", the resulting decoder will fail to compile due to clashing with Result.Ok.

Could using qualified import help here?

@chshersh chshersh added the question Further information is requested label Jun 25, 2019
@chshersh
Copy link
Contributor

@aleator I think it should be possible to use a qualified name. However, I would rather rename Ok constructor from the Haskell side to something else. Result data type and its constructors are standard in the Elm ecosystem. For me personally, it would be confusing to see two different Oks.

@vrom911
Copy link
Contributor

vrom911 commented Sep 3, 2019

Sorry for not coming back to this earlier. I have a question to understand the problem: what imports should be qualified? Do you mean imports of Types in Encoder and Decoder modules?

@chshersh
Copy link
Contributor

chshersh commented Sep 3, 2019

I believe that adding a qualified import of a module with data types and using all generated constructors in a qualified manner will help to resolve the issue with clashing constructors. For example, here

"Visitor" -> D.field "contents" <| D.map Visitor D.string

It could be Types.Visitor instead (or something like that).

@vrom911 vrom911 self-assigned this Sep 3, 2019
vrom911 added a commit that referenced this issue Sep 3, 2019
vrom911 added a commit that referenced this issue Sep 4, 2019
chshersh pushed a commit that referenced this issue Sep 4, 2019
* [#70] Use qualified imports for Types module

Resolves #70

* Add clashing constructor names check in generated files

* Fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants