git.iko.soy/typeable/stackage2nix
on master help sign in
23 lines 534 B history raw
1module Stack.Config.TH where
3import Data.Aeson.TH
4import Data.Char as C
5import Data.List as L
6import Data.Text as T
7import Text.Inflections as TI
9toDashedField :: String -> String
10toDashedField = toDashed' . dropPrefix
12toDashed' :: String -> String
13toDashed' = either (const $ error "toDashed failed") T.unpack
14 . TI.toDashed
15 . T.pack
17dropPrefix :: String -> String
18dropPrefix = L.dropWhile (not . C.isUpper)
20jsonOpts :: Options
21jsonOpts = defaultOptions
22 { fieldLabelModifier = toDashedField
23 , omitNothingFields = True }