-
Notifications
You must be signed in to change notification settings - Fork 47
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
Implements support for algebraic sum types #34
base: devel
Are you sure you want to change the base?
Conversation
Alright, I've made a pretty cool Elm <-> ghcjs Aeson conversion test in my elm-marshall-example repository. That repository contains a website running both Elm and ghcjs. When you press a button called Notes:
|
Hi @FPtje, thanks for getting started on this. I haven't had a chance to review the code in detail, but here are a couple of admin items that will help move this forward:
Open questions, cc @krisajenkins:
|
The branch has been rebased on devel. I've squashed a bunch of commits to make it look a bit nicer. The generated code now matches elm-export, both the encoders and decoders. To answer your questions:
That should also answer your second question: Yes, aeson does make sure Do we care? Not sure. |
just to chime in, this looks great. i tested against a sum constructor with one and two constructor fields (so something like |
Fixed compilation warnings.
works great (would be awesome if you could merge this and release another version) one remark though: AFAIK elm-format is using two empty lines between top-level functions but that's probably a general problem with elm-export |
Is anyone actively shepherding this PR or this repo or has it all been orphaned ? |
I've decided against using this in my own projects, since Miso is a really nice Haskell alternative to Elm. I haven't looked at this since. |
Add support for Natural.
Add support for non-empty lists (ElmType).
Fix the Date encoder.
Hey when is this going to be merged? |
I also wonder, what is the status of PR and when it's going to be merged? |
Please review before merging. Some things were done quickly, and I haven't tested aeson compatibility yet, which I still plan to do.
[update] Aeson compatibility has now been tested. See next post.
See #6
Things done
Monstrosity
, which revealed some bugs in the original implementation (and in my implementation of encoders and decoders)Some background
As you mentioned in this issue comment, Aeson is very specific about the json structure it generates. Differences depend on the following factors:
Really annoying, but the code in this PR should be compatible with it, though I've yet to test that. I do know, however, that the generated code compiles with Elm 0.18 and is correctly typed. That I did test.