Use TemplateHaskell instead of hand-coded instances
This patch replaces the current hard-coded JSON instances (all alike, just manual conversion to/from string) with auto-generated code based on Template Haskell (http://www.haskell.org/haskellwiki/Template_Haskell ). The reduction in code line is not big, as the helper module is well documented and thus overall we gain about 70 code lines; however, if we ignore comments we're in good shape, and any future addition of such data types will be much simpler and less error-prone. Signed-off-by:Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
Showing
- Makefile.am 2 additions, 1 deletionMakefile.am
- htools/Ganeti/HTools/Types.hs 24 additions, 83 deletionshtools/Ganeti/HTools/Types.hs
- htools/Ganeti/Jobs.hs 23 additions, 58 deletionshtools/Ganeti/Jobs.hs
- htools/Ganeti/OpCodes.hs 12 additions, 18 deletionshtools/Ganeti/OpCodes.hs
- htools/Ganeti/THH.hs 186 additions, 0 deletionshtools/Ganeti/THH.hs
Loading
Please register or sign in to comment