aboutsummaryrefslogtreecommitdiff
path: root/tea-cleaner/TeaCleaner/Options.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-12-25 21:19:22 +0100
committerEugen Wissner <belka@caraus.de>2025-12-25 21:19:22 +0100
commit92ee723d139a9e1bdfd559464b716ba8f0714221 (patch)
tree913179c9eaf32525ee24fc0aa892da2e4bca01ab /tea-cleaner/TeaCleaner/Options.hs
parent4fc36be9dc8a64cafe694335dff972d5ee29ee57 (diff)
downloadkazbek-92ee723d139a9e1bdfd559464b716ba8f0714221.tar.gz
Use builtin camelTo2 function
Diffstat (limited to 'tea-cleaner/TeaCleaner/Options.hs')
-rw-r--r--tea-cleaner/TeaCleaner/Options.hs18
1 files changed, 2 insertions, 16 deletions
diff --git a/tea-cleaner/TeaCleaner/Options.hs b/tea-cleaner/TeaCleaner/Options.hs
index 7965a97..b1b6372 100644
--- a/tea-cleaner/TeaCleaner/Options.hs
+++ b/tea-cleaner/TeaCleaner/Options.hs
@@ -6,23 +6,9 @@ module TeaCleaner.Options
( jsonOptions
) where
-import qualified Data.Aeson.TH as Aeson
-import Prelude hiding (id)
-import Data.Char
-
-applyFirst :: (Char -> Char) -> String -> String
-applyFirst _ [] = []
-applyFirst f [x] = [f x]
-applyFirst f (x:xs) = f x: xs
-
--- | Generic casing for symbol separated names
-symbCase :: String -> String
-symbCase = u . applyFirst toLower
- where u [] = []
- u (x:xs) | isUpper x = '_' : toLower x : u xs
- | otherwise = x : u xs
+import qualified Data.Aeson as Aeson
jsonOptions :: Aeson.Options
jsonOptions = Aeson.defaultOptions
- { Aeson.fieldLabelModifier = symbCase
+ { Aeson.fieldLabelModifier = Aeson.camelTo2 '_'
}