brandonchinn178 / aeson-schemas

Easily consume JSON data on-demand with type-safety
http://hackage.haskell.org/package/aeson-schemas
BSD 3-Clause "New" or "Revised" License
52 stars 1 forks source link

Consolidate type-level and value-level constructors #44

Closed brandon-leapyear closed 3 years ago

brandon-leapyear commented 4 years ago

:sparkles: This is an old work account. Please reference @brandonchinn178 for all future communication :sparkles:


Instead of two separate SchemaType types (one in Schema.Internal, one in Schema.Show), we'll have one SchemaType' parametrized type. Same for SchemaKey (one in Schema.Internal, one in Schema.Key).

With this consolidation, we can refactor quasiquoters like schema, where instead of going directly from parsed value -> TypeQ, we'll go parsed value -> SchemaV -> TypeQ, which will give us more power in inspecting things.

This does result in a slight decrease in performance due to the intermediate step, and also because we're now reifying included schemas rather than just passing them along. But we get the ability to implement features that would be difficult to do before. For example, we can't currently unwrap into an included schema, but now we can, treating an included schema as more of a shortcut for copy/paste and less of a special case.

codecov-commenter commented 4 years ago

Codecov Report

Merging #44 into master will decrease coverage by 0.40%. The diff coverage is 85.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
- Coverage   87.76%   87.36%   -0.41%     
==========================================
  Files          12       12              
  Lines         417      451      +34     
  Branches       27       17      -10     
==========================================
+ Hits          366      394      +28     
- Misses         41       50       +9     
+ Partials       10        7       -3     
Impacted Files Coverage Δ
src/Data/Aeson/Schema/TH/Get.hs 85.10% <60.00%> (-7.00%) :arrow_down:
src/Data/Aeson/Schema/TH/Utils.hs 68.96% <67.85%> (-5.00%) :arrow_down:
src/Data/Aeson/Schema/TH/Parse.hs 94.73% <88.57%> (-0.14%) :arrow_down:
src/Data/Aeson/Schema/Type.hs 92.30% <92.30%> (ø)
src/Data/Aeson/Schema/Key.hs 93.75% <93.75%> (-6.25%) :arrow_down:
src/Data/Aeson/Schema/TH/Unwrap.hs 90.74% <96.00%> (+20.74%) :arrow_up:
src/Data/Aeson/Schema/TH/Schema.hs 92.59% <97.67%> (+1.68%) :arrow_up:
src/Data/Aeson/Schema/Internal.hs 100.00% <100.00%> (+2.77%) :arrow_up:
src/Data/Aeson/Schema/TH/Getter.hs 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 46d2f78...81a42c5. Read the comment docs.