Closed bartavelle closed 8 years ago
For some reason the cabal file was modifier to dos line endings. This should be fixed now.
I have stumbled into an issue with aeson 0.10.0.0, so I locked it to 0.9 until a new version is released.
Looks good! We should probably also have a function to write out the Helpers.elm file or at least it should be added to the extra-source-files:
cabal section. What do you think?
I wondered what you would feel about including that file. Another option would be to just include it in the output of the helper functions that formats a whole module file. Yet another option would be to create an Elm package.
If you think it is a good idea to have helper functions (instead of directly generating the whole code in the derived functions), then I think the best course for users might be to publish the module, as it is the simplest thing for integrating with the Elm workflow.
It's probably a good idea to create an elm package... These functions might be useful to anyone else writing their json parsers by hand. I'll merge this now and I will give you maintainer access to this repo.
Wow great, I will look into it once I have used it a bit on my side and checked it is stable.
Patch description
This is a large patch that is intended to make derivations as close as those from Data.Aeson as possible.
It replaces the custom settings from
elm-bridge
with that ofaeson
.The derived elm code currently requires a few helper functions that reside in the
examples/Helpers.elm
file. This was decided to make the template Haskell code simpler and easier to generate and to have quick results.This patch also introduces a big
QuickCheck
based test to increase confidence in the quality of the code. It generates an Elm file that runs tests.Notes
This is my first foray with template Haskell, and I started with
elm
two days ago, so expect non optimal solutions... I don't know what happened with the cabal file, and will look into it.Meanwhile, please give me some feedback on this change. It surely is invasive, and I am not happy with what I did in the TH code (why did I need to write the
optSumType
function ?).I am however pretty happy with the
EndToEnd
test approach, and will try to add more use cases to it. If you have an idea on how to check encoding in a non-hacky way, I am all ears (there are differences betweenaeson
andJson.Encode
with the ordering of dictionary keys).