« Previous | Next » 

Revision c2e136e2

Parent 1d4febbd
Child 58b37916

Added by Petr Pudlak almost 7 years ago

Enhance DictObject and refactor loading/saving TH functions

Since there is already `DictObject` type class which could share code
with generated instances of `showJSON`, the generated code is split into
two parts: One that converts between `[(String, JSValue)]` and the data
type and another that uses `DictObject` instance to implement `showJSON`
and `readJSON`.

This removes code duplication between the two and naturally adds
`fromDict` to `DictObject`.

Also let loading functions be of type `Q Exp` instead of less flexible
`Q (Name, Stmt)`.

While at it, fix also `map (uncurry ..) (zip ..)` into `zipWith` at
several places.

Signed-off-by: Petr Pudlak <>
Reviewed-by: Klaus Aehlig <>


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences