HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulepersistent-2.18.1.0Haskell2010

Database.Persist.Quasi.Internal.TypeParser

  • 2 types
  • 3 values
valuetypeExpr :: MonadParsec e String m => m TypeExpr
#

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

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.