persistent-2.17.1.0: Type-safe, multi-backend data serialization.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Persist.Quasi.Internal.TypeParser

Synopsis

Documentation

data TypeExpr Source #

A parsed type expression.

Since: 2.17.1.0

Instances

Instances details
Show TypeExpr Source # 
Instance details

Defined in Database.Persist.Quasi.Internal.TypeParser

Methods

showsPrec :: Int -> TypeExpr -> ShowS

show :: TypeExpr -> String

showList :: [TypeExpr] -> ShowS

Eq TypeExpr Source # 
Instance details

Defined in Database.Persist.Quasi.Internal.TypeParser

Methods

(==) :: TypeExpr -> TypeExpr -> Bool

(/=) :: TypeExpr -> TypeExpr -> Bool

data TypeConstructor Source #

A parsed type constructor.

Since: 2.17.1.0

Constructors

ListConstructor 
TypeConstructor String 

Instances

Instances details
Show TypeConstructor Source # 
Instance details

Defined in Database.Persist.Quasi.Internal.TypeParser

Methods

showsPrec :: Int -> TypeConstructor -> ShowS

show :: TypeConstructor -> String

showList :: [TypeConstructor] -> ShowS

Eq TypeConstructor Source # 
Instance details

Defined in Database.Persist.Quasi.Internal.TypeParser

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:

  1. Syntactic sugar is not currently supported for constructing types other than List.
  2. Only certain typelevel literals are supported: Strings, Ints, and promoted type constructors.
  3. 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