Safe Haskell | None |
---|---|
Language | Haskell2010 |
module Internal. : Data.Basic.TH.Types Description : Data types and utility function used during TH generation phase License : MIT
This module Internal.contains helper functions that are used in code generation process.
- liftError :: Throws ParseError m => Either ParseErrorExtra a -> m a
- listToTypeLevel :: [Type] -> Type
- addFields :: Exp -> Int -> Exp
- addField :: Exp -> Exp
- standardizeName :: Text -> Text
- quasyPlural :: Text -> Text
- nameUnnamedConstraints :: Throws ParseError m => EntityInfo -> m EntityInfo
- nameUnnamedConstraint :: Throws ParseError m => EntityInfo -> Constraint -> m Constraint
- nameConstraint :: Text -> [NameComponent] -> Text
- getName :: Name -> Text
- getOptionalColumns :: ParseContext -> EntityInfo -> [ColumnInfo]
- getEntityByName :: Throws ParseError m => Name -> [EntityInfo] -> m EntityInfo
- getEntityBySQLName :: Throws ParseError m => Name -> [EntityInfo] -> m EntityInfo
- getColumn :: Throws ParseError m => EntityInfo -> Text -> m ColumnInfo
- lowerFirst :: Text -> Text
- upperFirst :: Text -> Text
- getEntityPrimaryKey :: ParseContext -> EntityInfo -> Maybe PrimaryKeyConstraint
- columnNameToLensName :: Text -> Text
Documentation
liftError :: Throws ParseError m => Either ParseErrorExtra a -> m a Source #
listToTypeLevel :: [Type] -> Type Source #
lifts a list of types to a type level (i.e. typelevel list) e.g. `listToTypeLeve [Int, String, Double] = '[ Int, String, Double ]`
standardizeName :: Text -> Text Source #
quasyPlural :: Text -> Text Source #
returns a plural of a known noun.
Basically just appends s
or es
nameUnnamedConstraints :: Throws ParseError m => EntityInfo -> m EntityInfo Source #
Tries to name multiples constraints
nameUnnamedConstraint :: Throws ParseError m => EntityInfo -> Constraint -> m Constraint Source #
Mechanism for naming unnamed constraints. If a constraint cannot be named, an error is trown
nameConstraint :: Text -> [NameComponent] -> Text Source #
Provides default naming scheme for constraints
getOptionalColumns :: ParseContext -> EntityInfo -> [ColumnInfo] Source #
Retrieves a list of optional columns in an entity
getEntityByName :: Throws ParseError m => Name -> [EntityInfo] -> m EntityInfo Source #
Tries to retrieve entity information. If an entity with that name doesn't exist an error is thrown.
getEntityBySQLName :: Throws ParseError m => Name -> [EntityInfo] -> m EntityInfo Source #
Tries to retrieve entity information. If an entity with that name doesn't exist an error is thrown.
getColumn :: Throws ParseError m => EntityInfo -> Text -> m ColumnInfo Source #
Tries to retrieve column information from entity. If a column with that name doesn't exist an error is thrown.
lowerFirst :: Text -> Text Source #
upperFirst :: Text -> Text Source #
getEntityPrimaryKey :: ParseContext -> EntityInfo -> Maybe PrimaryKeyConstraint Source #
Retrieves the primary key for an entity from ParseContext
columnNameToLensName :: Text -> Text Source #
Generates name for the column lens (i.e. lowercases first letter)