module Data.Aeson.Config.Util where

import           Data.Aeson.Types (camelTo2)

hyphenize :: String -> String -> String
hyphenize :: String -> String -> String
hyphenize String
name = Char -> String -> String
camelTo2 Char
'-' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {a}. [a] -> [a]
dropPrefix forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> Bool) -> [a] -> [a]
dropWhile (forall a. Eq a => a -> a -> Bool
== Char
'_')
  where
    dropPrefix :: [a] -> [a]
dropPrefix = forall a. Int -> [a] -> [a]
drop (forall (t :: * -> *) a. Foldable t => t a -> Int
length (forall a. (a -> Bool) -> [a] -> [a]
dropWhile (forall a. Eq a => a -> a -> Bool
== Char
'_') forall a b. (a -> b) -> a -> b
$ forall {a}. [a] -> [a]
reverse String
name))