{-|
Module      : GHCup.Types.JSON.Utils
Description : Utils for TH splices
Copyright   : (c) Julian Ospald, 2020
License     : LGPL-3.0
Maintainer  : hasufell@hasufell.de
Stability   : experimental
Portability : portable
-}

module GHCup.Types.JSON.Utils where

import qualified Data.Text                     as T

removeLensFieldLabel :: String -> String
removeLensFieldLabel :: String -> String
removeLensFieldLabel String
str' =
  String -> (Text -> String) -> Maybe Text -> String
forall b a. b -> (a -> b) -> Maybe a -> b
maybe String
str' Text -> String
T.unpack (Maybe Text -> String)
-> (String -> Maybe Text) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> Maybe Text
T.stripPrefix (String -> Text
T.pack String
"_") (Text -> Maybe Text) -> (String -> Text) -> String -> Maybe Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ String
str'