summaryrefslogtreecommitdiff
path: root/lib/Data/Aeson/TH/Extended.hs
diff options
context:
space:
mode:
authorJasperVanDerJeugt <>2019-10-09 15:10:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-10-09 15:10:00 (GMT)
commit843663f9e31b1dac40b3090f848715b2fd334587 (patch)
tree61f6553efd128a85282c70d179fb005ef3d52eb4 /lib/Data/Aeson/TH/Extended.hs
parentc78dda812788f59bdff0a50281abee00039bc333 (diff)
version 0.8.4.00.8.4.0
Diffstat (limited to 'lib/Data/Aeson/TH/Extended.hs')
-rw-r--r--lib/Data/Aeson/TH/Extended.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Data/Aeson/TH/Extended.hs b/lib/Data/Aeson/TH/Extended.hs
new file mode 100644
index 0000000..0fa5487
--- /dev/null
+++ b/lib/Data/Aeson/TH/Extended.hs
@@ -0,0 +1,21 @@
+--------------------------------------------------------------------------------
+module Data.Aeson.TH.Extended
+ ( module Data.Aeson.TH
+ , dropPrefixOptions
+ ) where
+
+
+--------------------------------------------------------------------------------
+import Data.Aeson.TH
+import Data.Char (isUpper, toLower)
+
+
+--------------------------------------------------------------------------------
+dropPrefixOptions :: Options
+dropPrefixOptions = defaultOptions
+ { fieldLabelModifier = dropPrefix
+ }
+ where
+ dropPrefix str = case break isUpper str of
+ (_, (y : ys)) -> toLower y : ys
+ _ -> str