server/src/JSON.hs

22 lines
405 B
Haskell

module JSON (
defaultOptions
, singleLCField
) where
import Data.Char (toLower)
import Data.Aeson (
Options(..)
, SumEncoding(..)
, defaultOptions
)
first :: (a -> a) -> [a] -> [a]
first _ [] = []
first f (x:xs) = f x:xs
singleLCField :: Options
singleLCField = defaultOptions {
constructorTagModifier = (toLower `first`)
, sumEncoding = ObjectWithSingleField
}