Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Database.Persist.Quasi.Internal.TypeParser
Synopsis
- data TypeExpr
- data TypeConstructor
- typeExpr :: MonadParsec e String m => m TypeExpr
- innerTypeExpr :: MonadParsec e String m => m TypeExpr
- typeExprContent :: TypeExpr -> Text
Documentation
A parsed type expression.
Since: 2.17.1.0
Constructors
TypeApplication TypeExpr [TypeExpr] | |
TypeConstructorExpr TypeConstructor | |
TypeLitString String | |
TypeLitInt String | |
TypeLitPromotedConstructor TypeConstructor |
data TypeConstructor Source #
A parsed type constructor.
Since: 2.17.1.0
Constructors
ListConstructor | |
TypeConstructor String |
Instances
Show TypeConstructor Source # | |
Defined in Database.Persist.Quasi.Internal.TypeParser Methods showsPrec :: Int -> TypeConstructor -> ShowS # show :: TypeConstructor -> String # showList :: [TypeConstructor] -> ShowS # | |
Eq TypeConstructor Source # | |
Defined in Database.Persist.Quasi.Internal.TypeParser Methods (==) :: TypeConstructor -> TypeConstructor -> Bool # (/=) :: TypeConstructor -> TypeConstructor -> Bool # |
typeExpr :: MonadParsec e String m => m TypeExpr Source #
Parses a Persistent-style type expression. Persistent's type expressions are largely similar to Haskell's, but with a few differences:
- Syntactic sugar is not currently supported for constructing types other than List.
- Only certain typelevel literals are supported: Strings, Ints, and promoted type constructors.
- Because they must be parsed as part of an entity field definition, top-level applications of non-nullary type constructors (except for the sugary List constructor) must be parenthesized.
VALID: Int VALID: [Maybe Int] VALID: (Maybe Int) INVALID: Maybe Int
Since: 2.17.1.0
innerTypeExpr :: MonadParsec e String m => m TypeExpr Source #
Parses a type expression in non-top-level contexts, where an unparenthesized type constructor application is acceptable.
Since: 2.17.1.0
typeExprContent :: TypeExpr -> Text Source #
Given a TypeExpr, renders it back to a String in a canonical form that looks normal to humans and is re-parseable when making an UnboundEntityDef that uses it.
Since: 2.17.1.0