Reto Kramer  committed 07dc61f

Modernizing the TH example.

  • Participants
  • Parent commits 68c1c64

Comments (0)

Files changed (1)

File examples/TemplateHaskell.hs

 {-# LANGUAGE OverloadedStrings #-}
 import Data.Aeson (decode, encode)
-import Data.Aeson.TH (deriveJSON)
+import Data.Aeson.TH (deriveJSON, defaultOptions)
 import qualified Data.ByteString.Lazy.Char8 as BL
 data Coord = Coord { x :: Double, y :: Double }
 -- names of the type's fields.  We don't want to transform them, so we
 -- use the identity function.
-$(deriveJSON id ''Coord)
+$(deriveJSON defaultOptions ''Coord)
 main :: IO ()
 main = do