Fix more nits, release 0.1.0.1
Fix documentation nits
Final nits
If you need to (de)serialise JSON from/to a dependent sum (from the
dependent-sum
package), this library provides newtype
wrappers which you can use
with the
-XDerivingVia
language extension. You might want to do this if:
f
parameter provided by DSum
.data CharacterClass a where
Fighter :: CharacterClass Fighter
Rogue :: CharacterClass Rogue
Wizard :: CharacterClass Wizard
-- From the "constraints-extras" package:
$(deriveArgDict ''CharacterClass)
-- From the "dependent-sum-template" package. Not required, but useful:
$(deriveGShow ''CharacterClass)
$(deriveGEq ''CharacterClass)
$(deriveGCompare ''CharacterClass)
-- The derived `FromJSON`/`ToJSON` instances work on JSON objects like this:
-- {
-- "class": "fighter", -- or "rogue", or "wizard"
-- "data": { ... } -- the exact fields differ depending on the value at "class".
-- }
newtype Character = Character (DSum CharacterClass Identity)
deriving (FromJSON, ToJSON)
via (TaggedObject "Character" "class" "data" CharacterClass Identity)