module Polysemy.Time.Json where
import qualified Data.Aeson as Aeson
import Data.Aeson.TH (deriveJSON)
import Data.List (dropWhileEnd)
import qualified Language.Haskell.TH.Syntax as TH
basicOptions :: Aeson.Options
basicOptions :: Options
basicOptions =
Options
Aeson.defaultOptions { fieldLabelModifier :: String -> String
Aeson.fieldLabelModifier = forall a. (a -> Bool) -> [a] -> [a]
dropWhileEnd (Char
'_' forall a. Eq a => a -> a -> Bool
==) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> Bool) -> [a] -> [a]
dropWhile (Char
'_' forall a. Eq a => a -> a -> Bool
==) }
json :: TH.Name -> TH.Q [TH.Dec]
json :: Name -> Q [Dec]
json =
Options -> Name -> Q [Dec]
deriveJSON Options
basicOptions { unwrapUnaryRecords :: Bool
Aeson.unwrapUnaryRecords = Bool
True }
unaryJson :: TH.Name -> TH.Q [TH.Dec]
unaryJson :: Name -> Q [Dec]
unaryJson =
Options -> Name -> Q [Dec]
deriveJSON Options
basicOptions