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

Database.Persist.Quasi.Internal.TypeParser

Synopsis

Documentation

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