module DomainCore.Text where import DomainCore.Prelude import Data.Text import qualified Data.Char as Char recordField :: Bool -> Bool -> Text -> Text -> Text recordField Bool underscore Bool prefixWithTypeName Text a Text b = forall a. a -> a -> Bool -> a bool forall a. Monoid a => a mempty Text "_" Bool underscore forall a. Semigroup a => a -> a -> a <> forall a. a -> a -> Bool -> a bool Text b (Text -> Text lcFirst Text a forall a. Semigroup a => a -> a -> a <> Text -> Text ucFirst Text b) Bool prefixWithTypeName sumConstructor :: Text -> Text -> Text sumConstructor Text a Text b = Text -> Text ucFirst Text b forall a. Semigroup a => a -> a -> a <> Text a mapFirstChar :: (Char -> Char) -> Text -> Text mapFirstChar Char -> Char fn = forall (t :: * -> *) m a. (Foldable t, Monoid m) => (a -> m) -> t a -> m foldMap (\ (Char a, Text b) -> Char -> Text -> Text cons (Char -> Char fn Char a) Text b) forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . Text -> Maybe (Char, Text) uncons ucFirst :: Text -> Text ucFirst = (Char -> Char) -> Text -> Text mapFirstChar Char -> Char Char.toUpper lcFirst :: Text -> Text lcFirst = (Char -> Char) -> Text -> Text mapFirstChar Char -> Char Char.toLower