Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
OpenAPI.Generate.Internal.Util
Description
Utility functions for the OpenAPI code generator
Synopsis
- haskellifyText :: Bool -> Bool -> Text -> Text
- haskellifyName :: Bool -> Bool -> Text -> Name
- haskellifyNameM :: Bool -> Text -> Generator Name
- transformToModuleName :: Text -> Text
- uppercaseFirstText :: Text -> Text
- mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]
- liftedAppend :: (Applicative f, Semigroup a) => f a -> f a -> f a
- joinWithPoint :: [String] -> String
- joinWith :: Monoid a => a -> [a] -> a
Documentation
Arguments
:: Bool | Should the identifier be transformed to CamelCase? |
-> Bool | Should the first character of the identifier be uppercase? |
-> Text | The identifier to transform |
-> Text | The resulting identifier |
Transform an identifier to ensure it is a valid Haskell identifier Additionally, this function applies style settings according to the need of the consumer.
haskellifyName :: Bool -> Bool -> Text -> Name Source #
The same as haskellifyText
but transform the result to a Name
haskellifyNameM :: Bool -> Text -> Generator Name Source #
Generator
version of haskellifyName
transformToModuleName :: Text -> Text Source #
Transform a module name to ensure it is valid for file names
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] Source #
A version of mapMaybe
that works with a monadic predicate.
from https://hackage.haskell.org/package/extra-1.7.1/docs/src/Control.Monad.Extra.html#mapMaybeM copied
liftedAppend :: (Applicative f, Semigroup a) => f a -> f a -> f a Source #
Lifted version of <>
which can be used with Semigroup
s inside Applicative
s
joinWithPoint :: [String] -> String Source #
Concat a list of strings with a point
>>>
joinWithPoint ["a", "b", "c"]
"a.b.c"