dhall-1.41.2: A configuration language guaranteed to terminate

Safe Haskell | Safe-Inferred
Language | Haskell2010

Dhall.Core

Contents

- Syntax
- Normalization
- Pretty-printing
- Optics
- Let-blocks
- Miscellaneous

Description

This module contains the core calculus for the Dhall language.

Dhall is essentially a fork of the `morte` compiler but with more built-in functionality, better error messages, and Haskell integration

Synopsis

- data Const
  - = Type
  - | Kind
  - | Sort
- newtype Directory = Directory {
  - components :: [Text]
  }
- data File = File {
  - directory :: Directory
  - file :: Text
  }
- data FilePrefix
  - = Absolute
  - | Here
  - | Parent
  - | Home
- data Import = Import {
  - importHashed :: ImportHashed
  - importMode :: ImportMode
  }
- data ImportHashed = ImportHashed {
  - hash :: Maybe SHA256Digest
  - importType :: ImportType
  }
- data ImportMode
  - = Code
  - | RawText
  - | Location
- data ImportType
  - = Local FilePrefix File
  - | Remote URL
  - | Env Text
  - | Missing
- data URL = URL {
  - scheme :: Scheme
  - authority :: Text
  - path :: File
  - query :: Maybe Text
  - headers :: Maybe (Expr Src Import)
  }
- data Scheme
  - = HTTP
  - | HTTPS
- newtype DhallDouble = DhallDouble {
  - getDhallDouble :: Double
  }
- data Var = V Text !Int
- data Binding s a = Binding {
  - bindingSrc0 :: Maybe s
  - variable :: Text
  - bindingSrc1 :: Maybe s
  - annotation :: Maybe (Maybe s, Expr s a)
  - bindingSrc2 :: Maybe s
  - value :: Expr s a
  }
- makeBinding :: Text -> Expr s a -> Binding s a
- data Chunks s a = Chunks [(Text, Expr s a)] Text
- data PreferAnnotation s a
  - = PreferFromSource
  - | PreferFromWith (Expr s a)
  - | PreferFromCompletion
- data RecordField s a = RecordField {
  - recordFieldSrc0 :: Maybe s
  - recordFieldValue :: Expr s a
  - recordFieldSrc1 :: Maybe s
  - recordFieldSrc2 :: Maybe s
  }
- makeRecordField :: Expr s a -> RecordField s a
- data FunctionBinding s a = FunctionBinding {
  - functionBindingSrc0 :: Maybe s
  - functionBindingVariable :: Text
  - functionBindingSrc1 :: Maybe s
  - functionBindingSrc2 :: Maybe s
  - functionBindingAnnotation :: Expr s a
  }
- makeFunctionBinding :: Text -> Expr s a -> FunctionBinding s a
- data FieldSelection s = FieldSelection {
  - fieldSelectionSrc0 :: Maybe s
  - fieldSelectionLabel :: !Text
  - fieldSelectionSrc1 :: Maybe s
  }
- makeFieldSelection :: Text -> FieldSelection s
- data WithComponent
  - = WithLabel Text
  - | WithQuestion
- data Expr s a
  - = Const Const
  - | Var Var
  - | Lam (Maybe CharacterSet) (FunctionBinding s a) (Expr s a)
  - | Pi (Maybe CharacterSet) Text (Expr s a) (Expr s a)
  - | App (Expr s a) (Expr s a)
  - | Let (Binding s a) (Expr s a)
  - | Annot (Expr s a) (Expr s a)
  - | Bool
  - | BoolLit Bool
  - | BoolAnd (Expr s a) (Expr s a)
  - | BoolOr (Expr s a) (Expr s a)
  - | BoolEQ (Expr s a) (Expr s a)
  - | BoolNE (Expr s a) (Expr s a)
  - | BoolIf (Expr s a) (Expr s a) (Expr s a)
  - | Natural
  - | NaturalLit Natural
  - | NaturalFold
  - | NaturalBuild
  - | NaturalIsZero
  - | NaturalEven
  - | NaturalOdd
  - | NaturalToInteger
  - | NaturalShow
  - | NaturalSubtract
  - | NaturalPlus (Expr s a) (Expr s a)
  - | NaturalTimes (Expr s a) (Expr s a)
  - | Integer
  - | IntegerLit Integer
  - | IntegerClamp
  - | IntegerNegate
  - | IntegerShow
  - | IntegerToDouble
  - | Double
  - | DoubleLit DhallDouble
  - | DoubleShow
  - | Text
  - | TextLit (Chunks s a)
  - | TextAppend (Expr s a) (Expr s a)
  - | TextReplace
  - | TextShow
  - | Date
  - | DateLiteral Day
  - | Time
  - | TimeLiteral TimeOfDay Word
  - | TimeZone
  - | TimeZoneLiteral TimeZone
  - | List
  - | ListLit (Maybe (Expr s a)) (Seq (Expr s a))
  - | ListAppend (Expr s a) (Expr s a)
  - | ListBuild
  - | ListFold
  - | ListLength
  - | ListHead
  - | ListLast
  - | ListIndexed
  - | ListReverse
  - | Optional
  - | Some (Expr s a)
  - | None
  - | Record (Map Text (RecordField s a))
  - | RecordLit (Map Text (RecordField s a))
  - | Union (Map Text (Maybe (Expr s a)))
  - | Combine (Maybe CharacterSet) (Maybe Text) (Expr s a) (Expr s a)
  - | CombineTypes (Maybe CharacterSet) (Expr s a) (Expr s a)
  - | Prefer (Maybe CharacterSet) (PreferAnnotation s a) (Expr s a) (Expr s a)
  - | RecordCompletion (Expr s a) (Expr s a)
  - | Merge (Expr s a) (Expr s a) (Maybe (Expr s a))
  - | ToMap (Expr s a) (Maybe (Expr s a))
  - | ShowConstructor (Expr s a)
  - | Field (Expr s a) (FieldSelection s)
  - | Project (Expr s a) (Either [Text] (Expr s a))
  - | Assert (Expr s a)
  - | Equivalent (Maybe CharacterSet) (Expr s a) (Expr s a)
  - | With (Expr s a) (NonEmpty WithComponent) (Expr s a)
  - | Note s (Expr s a)
  - | ImportAlt (Expr s a) (Expr s a)
  - | Embed a
- alphaNormalize :: Expr s a -> Expr s a
- normalize :: Eq a => Expr s a -> Expr t a
- normalizeWith :: Eq a => Maybe (ReifiedNormalizer a) -> Expr s a -> Expr t a
- normalizeWithM :: (Monad m, Eq a) => NormalizerM m a -> Expr s a -> m (Expr t a)
- type Normalizer a = NormalizerM Identity a
- type NormalizerM m a = forall s. Expr s a -> m (Maybe (Expr s a))
- newtype ReifiedNormalizer a = ReifiedNormalizer {
  - getReifiedNormalizer :: Normalizer a
  }
- judgmentallyEqual :: Eq a => Expr s a -> Expr t a -> Bool
- subst :: Var -> Expr s a -> Expr s a -> Expr s a
- shift :: Int -> Var -> Expr s a -> Expr s a
- isNormalized :: Eq a => Expr s a -> Bool
- isNormalizedWith :: (Eq s, Eq a) => Normalizer a -> Expr s a -> Bool
- denote :: Expr s a -> Expr t a
- renote :: Expr Void a -> Expr s a
- shallowDenote :: Expr s a -> Expr s a
- freeIn :: Eq a => Var -> Expr s a -> Bool
- pretty :: Pretty a => a -> Text
- subExpressions :: Applicative f => (Expr s a -> f (Expr s a)) -> Expr s a -> f (Expr s a)
- subExpressionsWith :: Applicative f => (a -> f (Expr s b)) -> (Expr s a -> f (Expr s b)) -> Expr s a -> f (Expr s b)
- chunkExprs :: Applicative f => (Expr s a -> f (Expr t b)) -> Chunks s a -> f (Chunks t b)
- bindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> Binding s a -> f (Binding s b)
- recordFieldExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> RecordField s a -> f (RecordField s b)
- functionBindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> FunctionBinding s a -> f (FunctionBinding s b)
- multiLet :: Binding s a -> Expr s a -> MultiLet s a
- wrapInLets :: Foldable f => f (Binding s a) -> Expr s a -> Expr s a
- data MultiLet s a = MultiLet (NonEmpty (Binding s a)) (Expr s a)
- internalError :: Text -> forall b. b
- reservedIdentifiers :: HashSet Text
- escapeText :: Text -> Text
- pathCharacter :: Char -> Bool
- throws :: (Exception e, MonadIO io) => Either e a -> io a
- textShow :: Text -> Text
- censorExpression :: Expr Src a -> Expr Src a
- censorText :: Text -> Text

# Syntax

data Const Source #

Constants for a pure type system

The axioms are:

    ⊦ Type : Kind
    ⊦ Kind : Sort

... and the valid rule pairs are:

    ⊦ Type ↝ Type : Type  -- Functions from terms to terms (ordinary functions)
    ⊦ Kind ↝ Type : Type  -- Functions from types to terms (type-polymorphic functions)
    ⊦ Sort ↝ Type : Type  -- Functions from kinds to terms
    ⊦ Kind ↝ Kind : Kind  -- Functions from types to types (type-level functions)
    ⊦ Sort ↝ Kind : Sort  -- Functions from kinds to types (kind-polymorphic functions)
    ⊦ Sort ↝ Sort : Sort  -- Functions from kinds to kinds (kind-level functions)

Note that Dhall does not support functions from terms to types and therefore Dhall is not a dependently typed language

Constructors

Type |
Kind |
Sort |

#### Instances

Instances details

Data Const Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Const -> c Const Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Const Source #

toConstr :: Const -> Constr Source #

dataTypeOf :: Const -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Const) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Const) Source #

gmapT :: (forall b. Data b => b -> b) -> Const -> Const Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Const -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Const -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Const -> m Const Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Const -> m Const Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Const -> m Const Source #

Bounded Const Source # |
Instance details Defined in Dhall.Syntax Methods minBound :: Const Source # maxBound :: Const Source #
Enum Const Source # |
Instance details Defined in Dhall.Syntax Methods succ :: Const -> Const Source # pred :: Const -> Const Source # toEnum :: Int -> Const Source # fromEnum :: Const -> Int Source # enumFrom :: Const -> [Const] Source # enumFromThen :: Const -> Const -> [Const] Source # enumFromTo :: Const -> Const -> [Const] Source # enumFromThenTo :: Const -> Const -> Const -> [Const] Source #
Generic Const Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep Const :: Type -> Type Source # Methods from :: Const -> Rep Const x Source # to :: Rep Const x -> Const Source #
Show Const Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Const -> ShowS Source # show :: Const -> String Source # showList :: [Const] -> ShowS Source #
NFData Const Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Const -> () Source #
Eq Const Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Const -> Const -> Bool Source # (/=) :: Const -> Const -> Bool Source #
Ord Const Source # |
Instance details Defined in Dhall.Syntax Methods compare :: Const -> Const -> Ordering Source # (<) :: Const -> Const -> Bool Source # (<=) :: Const -> Const -> Bool Source # (>) :: Const -> Const -> Bool Source # (>=) :: Const -> Const -> Bool Source # max :: Const -> Const -> Const Source # min :: Const -> Const -> Const Source #
Pretty Const Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: Const -> Doc ann Source # prettyList :: [Const] -> Doc ann Source #
Lift Const Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => Const -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Const -> Code m Const Source #
type Rep Const Source # |
Instance details Defined in Dhall.Syntax type Rep Const = D1 ('MetaData "Const" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "Type" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Kind" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Sort" 'PrefixI 'False) (U1 :: Type -> Type)))

newtype Directory Source #

Internal representation of a directory that stores the path components in reverse order

In other words, the directory `/foo/bar/baz` is encoded as `Directory { components = [ "baz", "bar", "foo" ] }`

Constructors

Directory |

Fields

- components :: [Text]

#### Instances

Instances details

Semigroup Directory Source # |
Instance details Defined in Dhall.Syntax Methods (<>) :: Directory -> Directory -> Directory Source # sconcat :: NonEmpty Directory -> Directory Source # stimes :: Integral b => b -> Directory -> Directory Source #
Generic Directory Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep Directory :: Type -> Type Source # Methods from :: Directory -> Rep Directory x Source # to :: Rep Directory x -> Directory Source #
Show Directory Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Directory -> ShowS Source # show :: Directory -> String Source # showList :: [Directory] -> ShowS Source #
NFData Directory Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Directory -> () Source #
Eq Directory Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Directory -> Directory -> Bool Source # (/=) :: Directory -> Directory -> Bool Source #
Ord Directory Source # |
Instance details Defined in Dhall.Syntax Methods compare :: Directory -> Directory -> Ordering Source # (<) :: Directory -> Directory -> Bool Source # (<=) :: Directory -> Directory -> Bool Source # (>) :: Directory -> Directory -> Bool Source # (>=) :: Directory -> Directory -> Bool Source # max :: Directory -> Directory -> Directory Source # min :: Directory -> Directory -> Directory Source #
Pretty Directory Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: Directory -> Doc ann Source # prettyList :: [Directory] -> Doc ann Source #
type Rep Directory Source # |
Instance details Defined in Dhall.Syntax type Rep Directory = D1 ('MetaData "Directory" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'True) (C1 ('MetaCons "Directory" 'PrefixI 'True) (S1 ('MetaSel ('Just "components") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

data File Source #

A `File` is a `directory` followed by one additional path component representing the `file` name

Constructors

File |

Fields

- directory :: Directory
- file :: Text

#### Instances

Instances details

Semigroup File Source # |
Instance details Defined in Dhall.Syntax Methods (<>) :: File -> File -> File Source # sconcat :: NonEmpty File -> File Source # stimes :: Integral b => b -> File -> File Source #
Generic File Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep File :: Type -> Type Source # Methods from :: File -> Rep File x Source # to :: Rep File x -> File Source #
Show File Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> File -> ShowS Source # show :: File -> String Source # showList :: [File] -> ShowS Source #
NFData File Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: File -> () Source #
Eq File Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: File -> File -> Bool Source # (/=) :: File -> File -> Bool Source #
Ord File Source # |
Instance details Defined in Dhall.Syntax Methods compare :: File -> File -> Ordering Source # (<) :: File -> File -> Bool Source # (<=) :: File -> File -> Bool Source # (>) :: File -> File -> Bool Source # (>=) :: File -> File -> Bool Source # max :: File -> File -> File Source # min :: File -> File -> File Source #
Pretty File Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: File -> Doc ann Source # prettyList :: [File] -> Doc ann Source #
type Rep File Source # |
Instance details Defined in Dhall.Syntax type Rep File = D1 ('MetaData "File" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "File" 'PrefixI 'True) (S1 ('MetaSel ('Just "directory") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Directory) :*: S1 ('MetaSel ('Just "file") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data FilePrefix Source #

The beginning of a file path which anchors subsequent path components

Constructors

Absolute | Absolute path
Here | Path relative to `.`
Parent | Path relative to `..`
Home | Path relative to `~`

#### Instances

Instances details

Generic FilePrefix Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep FilePrefix :: Type -> Type Source # Methods from :: FilePrefix -> Rep FilePrefix x Source # to :: Rep FilePrefix x -> FilePrefix Source #
Show FilePrefix Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> FilePrefix -> ShowS Source # show :: FilePrefix -> String Source # showList :: [FilePrefix] -> ShowS Source #
NFData FilePrefix Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: FilePrefix -> () Source #
Eq FilePrefix Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: FilePrefix -> FilePrefix -> Bool Source # (/=) :: FilePrefix -> FilePrefix -> Bool Source #
Ord FilePrefix Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: FilePrefix -> FilePrefix -> Ordering Source #

(<) :: FilePrefix -> FilePrefix -> Bool Source #

(<=) :: FilePrefix -> FilePrefix -> Bool Source #

(>) :: FilePrefix -> FilePrefix -> Bool Source #

(>=) :: FilePrefix -> FilePrefix -> Bool Source #

max :: FilePrefix -> FilePrefix -> FilePrefix Source #

min :: FilePrefix -> FilePrefix -> FilePrefix Source #

Pretty FilePrefix Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: FilePrefix -> Doc ann Source # prettyList :: [FilePrefix] -> Doc ann Source #
type Rep FilePrefix Source # |

Instance details

Defined in Dhall.Syntax

type Rep FilePrefix = D1 ('MetaData "FilePrefix" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) ((C1 ('MetaCons "Absolute" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Here" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Parent" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Home" 'PrefixI 'False) (U1 :: Type -> Type)))

data Import Source #

Reference to an external resource

Constructors

Import |

Fields

- importHashed :: ImportHashed
- importMode :: ImportMode

#### Instances

Instances details

Semigroup Import Source # |
Instance details Defined in Dhall.Syntax Methods (<>) :: Import -> Import -> Import Source # sconcat :: NonEmpty Import -> Import Source # stimes :: Integral b => b -> Import -> Import Source #
Generic Import Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep Import :: Type -> Type Source # Methods from :: Import -> Rep Import x Source # to :: Rep Import x -> Import Source #
Show Import Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Import -> ShowS Source # show :: Import -> String Source # showList :: [Import] -> ShowS Source #
NFData Import Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Import -> () Source #
Eq Import Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Import -> Import -> Bool Source # (/=) :: Import -> Import -> Bool Source #
Ord Import Source # |
Instance details Defined in Dhall.Syntax Methods compare :: Import -> Import -> Ordering Source # (<) :: Import -> Import -> Bool Source # (<=) :: Import -> Import -> Bool Source # (>) :: Import -> Import -> Bool Source # (>=) :: Import -> Import -> Bool Source # max :: Import -> Import -> Import Source # min :: Import -> Import -> Import Source #
Pretty Import Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: Import -> Doc ann Source # prettyList :: [Import] -> Doc ann Source #
Serialise (Expr Void Import) Source # |
Instance details Defined in Dhall.Binary Methods encode :: Expr Void Import -> Encoding Source # decode :: Decoder s (Expr Void Import) Source # encodeList :: [Expr Void Import] -> Encoding Source # decodeList :: Decoder s [Expr Void Import] Source #
type Rep Import Source # |

Instance details

Defined in Dhall.Syntax

type Rep Import = D1 ('MetaData "Import" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "Import" 'PrefixI 'True) (S1 ('MetaSel ('Just "importHashed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImportHashed) :*: S1 ('MetaSel ('Just "importMode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImportMode)))

data ImportHashed Source #

A `ImportType` extended with an optional hash for semantic integrity checks

Constructors

ImportHashed |

Fields

- hash :: Maybe SHA256Digest
- importType :: ImportType

#### Instances

Instances details

Semigroup ImportHashed Source # |
Instance details Defined in Dhall.Syntax Methods (<>) :: ImportHashed -> ImportHashed -> ImportHashed Source # sconcat :: NonEmpty ImportHashed -> ImportHashed Source # stimes :: Integral b => b -> ImportHashed -> ImportHashed Source #
Generic ImportHashed Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep ImportHashed :: Type -> Type Source # Methods from :: ImportHashed -> Rep ImportHashed x Source # to :: Rep ImportHashed x -> ImportHashed Source #
Show ImportHashed Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> ImportHashed -> ShowS Source # show :: ImportHashed -> String Source # showList :: [ImportHashed] -> ShowS Source #
NFData ImportHashed Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: ImportHashed -> () Source #
Eq ImportHashed Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: ImportHashed -> ImportHashed -> Bool Source # (/=) :: ImportHashed -> ImportHashed -> Bool Source #
Ord ImportHashed Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: ImportHashed -> ImportHashed -> Ordering Source #

(<) :: ImportHashed -> ImportHashed -> Bool Source #

(<=) :: ImportHashed -> ImportHashed -> Bool Source #

(>) :: ImportHashed -> ImportHashed -> Bool Source #

(>=) :: ImportHashed -> ImportHashed -> Bool Source #

max :: ImportHashed -> ImportHashed -> ImportHashed Source #

min :: ImportHashed -> ImportHashed -> ImportHashed Source #

Pretty ImportHashed Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: ImportHashed -> Doc ann Source # prettyList :: [ImportHashed] -> Doc ann Source #
type Rep ImportHashed Source # |

Instance details

Defined in Dhall.Syntax

type Rep ImportHashed = D1 ('MetaData "ImportHashed" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "ImportHashed" 'PrefixI 'True) (S1 ('MetaSel ('Just "hash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe SHA256Digest)) :*: S1 ('MetaSel ('Just "importType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImportType)))

data ImportMode Source #

How to interpret the import's contents (i.e. as Dhall code or raw text)

Constructors

Code |
RawText |
Location |

#### Instances

Instances details

Generic ImportMode Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep ImportMode :: Type -> Type Source # Methods from :: ImportMode -> Rep ImportMode x Source # to :: Rep ImportMode x -> ImportMode Source #
Show ImportMode Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> ImportMode -> ShowS Source # show :: ImportMode -> String Source # showList :: [ImportMode] -> ShowS Source #
NFData ImportMode Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: ImportMode -> () Source #
Eq ImportMode Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: ImportMode -> ImportMode -> Bool Source # (/=) :: ImportMode -> ImportMode -> Bool Source #
Ord ImportMode Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: ImportMode -> ImportMode -> Ordering Source #

(<) :: ImportMode -> ImportMode -> Bool Source #

(<=) :: ImportMode -> ImportMode -> Bool Source #

(>) :: ImportMode -> ImportMode -> Bool Source #

(>=) :: ImportMode -> ImportMode -> Bool Source #

max :: ImportMode -> ImportMode -> ImportMode Source #

min :: ImportMode -> ImportMode -> ImportMode Source #

type Rep ImportMode Source # |
Instance details Defined in Dhall.Syntax type Rep ImportMode = D1 ('MetaData "ImportMode" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "Code" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RawText" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Location" 'PrefixI 'False) (U1 :: Type -> Type)))

data ImportType Source #

The type of import (i.e. local vs. remote vs. environment)

Constructors

Local FilePrefix File | Local path
Remote URL | URL of remote resource and optional headers stored in an import
Env Text | Environment variable
Missing |

#### Instances

Instances details

Semigroup ImportType Source # |
Instance details Defined in Dhall.Syntax Methods (<>) :: ImportType -> ImportType -> ImportType Source # sconcat :: NonEmpty ImportType -> ImportType Source # stimes :: Integral b => b -> ImportType -> ImportType Source #
Generic ImportType Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep ImportType :: Type -> Type Source # Methods from :: ImportType -> Rep ImportType x Source # to :: Rep ImportType x -> ImportType Source #
Show ImportType Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> ImportType -> ShowS Source # show :: ImportType -> String Source # showList :: [ImportType] -> ShowS Source #
NFData ImportType Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: ImportType -> () Source #
Eq ImportType Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: ImportType -> ImportType -> Bool Source # (/=) :: ImportType -> ImportType -> Bool Source #
Ord ImportType Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: ImportType -> ImportType -> Ordering Source #

(<) :: ImportType -> ImportType -> Bool Source #

(<=) :: ImportType -> ImportType -> Bool Source #

(>) :: ImportType -> ImportType -> Bool Source #

(>=) :: ImportType -> ImportType -> Bool Source #

max :: ImportType -> ImportType -> ImportType Source #

min :: ImportType -> ImportType -> ImportType Source #

Pretty ImportType Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: ImportType -> Doc ann Source # prettyList :: [ImportType] -> Doc ann Source #
type Rep ImportType Source # |

Instance details

Defined in Dhall.Syntax

type Rep ImportType = D1 ('MetaData "ImportType" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) ((C1 ('MetaCons "Local" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePrefix) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 File)) :+: C1 ('MetaCons "Remote" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 URL))) :+: (C1 ('MetaCons "Env" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "Missing" 'PrefixI 'False) (U1 :: Type -> Type)))

data URL Source #

This type stores all of the components of a remote import

Constructors

URL |

Fields

- scheme :: Scheme
- authority :: Text
- path :: File
- query :: Maybe Text
- headers :: Maybe (Expr Src Import)

#### Instances

Instances details

Generic URL Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep URL :: Type -> Type Source # Methods from :: URL -> Rep URL x Source # to :: Rep URL x -> URL Source #
Show URL Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> URL -> ShowS Source # show :: URL -> String Source # showList :: [URL] -> ShowS Source #
NFData URL Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: URL -> () Source #
Eq URL Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: URL -> URL -> Bool Source # (/=) :: URL -> URL -> Bool Source #
Ord URL Source # |
Instance details Defined in Dhall.Syntax Methods compare :: URL -> URL -> Ordering Source # (<) :: URL -> URL -> Bool Source # (<=) :: URL -> URL -> Bool Source # (>) :: URL -> URL -> Bool Source # (>=) :: URL -> URL -> Bool Source # max :: URL -> URL -> URL Source # min :: URL -> URL -> URL Source #
Pretty URL Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: URL -> Doc ann Source # prettyList :: [URL] -> Doc ann Source #
type Rep URL Source # |

Instance details

Defined in Dhall.Syntax

type Rep URL = D1 ('MetaData "URL" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "URL" 'PrefixI 'True) ((S1 ('MetaSel ('Just "scheme") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Scheme) :*: S1 ('MetaSel ('Just "authority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "path") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 File) :*: (S1 ('MetaSel ('Just "query") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "headers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Expr Src Import)))))))

data Scheme Source #

The URI scheme

Constructors

HTTP |
HTTPS |

#### Instances

Instances details

Generic Scheme Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep Scheme :: Type -> Type Source # Methods from :: Scheme -> Rep Scheme x Source # to :: Rep Scheme x -> Scheme Source #
Show Scheme Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Scheme -> ShowS Source # show :: Scheme -> String Source # showList :: [Scheme] -> ShowS Source #
NFData Scheme Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Scheme -> () Source #
Eq Scheme Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Scheme -> Scheme -> Bool Source # (/=) :: Scheme -> Scheme -> Bool Source #
Ord Scheme Source # |
Instance details Defined in Dhall.Syntax Methods compare :: Scheme -> Scheme -> Ordering Source # (<) :: Scheme -> Scheme -> Bool Source # (<=) :: Scheme -> Scheme -> Bool Source # (>) :: Scheme -> Scheme -> Bool Source # (>=) :: Scheme -> Scheme -> Bool Source # max :: Scheme -> Scheme -> Scheme Source # min :: Scheme -> Scheme -> Scheme Source #
type Rep Scheme Source # |
Instance details Defined in Dhall.Syntax type Rep Scheme = D1 ('MetaData "Scheme" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "HTTP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HTTPS" 'PrefixI 'False) (U1 :: Type -> Type))

newtype DhallDouble Source #

This wrapper around `Double` exists for its `Eq` instance which is defined via the binary encoding of Dhall `Double`s.

Constructors

DhallDouble |

Fields

- getDhallDouble :: Double

#### Instances

Instances details

Data DhallDouble Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DhallDouble -> c DhallDouble Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DhallDouble Source #

toConstr :: DhallDouble -> Constr Source #

dataTypeOf :: DhallDouble -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DhallDouble) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DhallDouble) Source #

gmapT :: (forall b. Data b => b -> b) -> DhallDouble -> DhallDouble Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DhallDouble -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DhallDouble -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> DhallDouble -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> DhallDouble -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> DhallDouble -> m DhallDouble Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DhallDouble -> m DhallDouble Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DhallDouble -> m DhallDouble Source #

Generic DhallDouble Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep DhallDouble :: Type -> Type Source # Methods from :: DhallDouble -> Rep DhallDouble x Source # to :: Rep DhallDouble x -> DhallDouble Source #
Show DhallDouble Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> DhallDouble -> ShowS Source # show :: DhallDouble -> String Source # showList :: [DhallDouble] -> ShowS Source #
NFData DhallDouble Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: DhallDouble -> () Source #

Eq DhallDouble Source #

This instance satisfies all the customary `Eq` laws except substitutivity.

In particular:

    >>> nan = DhallDouble (0/0)
    >>> nan == nan
    True

This instance is also consistent with with the binary encoding of Dhall `Double`s:

    >>> toBytes n = Dhall.Binary.encodeExpression (DoubleLit n :: Expr Void Import)

    \a b -> (a == b) == (toBytes a == toBytes b)

Instance details Defined in Dhall.Syntax Methods (==) :: DhallDouble -> DhallDouble -> Bool Source # (/=) :: DhallDouble -> DhallDouble -> Bool Source #
Ord DhallDouble Source # | This instance relies on the `Eq` instance for `DhallDouble` but cannot satisfy the customary `Ord` laws when `NaN` is involved.

Instance details

Defined in Dhall.Syntax

Methods

compare :: DhallDouble -> DhallDouble -> Ordering Source #

(<) :: DhallDouble -> DhallDouble -> Bool Source #

(<=) :: DhallDouble -> DhallDouble -> Bool Source #

(>) :: DhallDouble -> DhallDouble -> Bool Source #

(>=) :: DhallDouble -> DhallDouble -> Bool Source #

max :: DhallDouble -> DhallDouble -> DhallDouble Source #

min :: DhallDouble -> DhallDouble -> DhallDouble Source #

Lift DhallDouble Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => DhallDouble -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => DhallDouble -> Code m DhallDouble Source #
type Rep DhallDouble Source # |
Instance details Defined in Dhall.Syntax type Rep DhallDouble = D1 ('MetaData "DhallDouble" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'True) (C1 ('MetaCons "DhallDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDhallDouble") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))

data Var Source #

Label for a bound variable

The `Text` field is the variable's name (i.e. "`x`").

The `Int` field disambiguates variables with the same name if there are multiple bound variables of the same name in scope. Zero refers to the nearest bound variable and the index increases by one for each bound variable of the same name going outward. The following diagram may help:

                                  ┌──refers to──┐
                                  │             │
                                  v             │
    λ(x : Type) → λ(y : Type) → λ(x : Type) → x@0

    ┌─────────────────refers to─────────────────┐
    │                                           │
    v                                           │
    λ(x : Type) → λ(y : Type) → λ(x : Type) → x@1

This `Int` behaves like a De Bruijn index in the special case where all variables have the same name.

You can optionally omit the index if it is `0`:

                                  ┌─refers to─┐
                                  │           │
                                  v           │
    λ(x : Type) → λ(y : Type) → λ(x : Type) → x

Zero indices are omitted when pretty-printing `Var`s and non-zero indices appear as a numeric suffix.

Constructors

V Text !Int |

#### Instances

Instances details

Data Var Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source #

toConstr :: Var -> Constr Source #

dataTypeOf :: Var -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source #

gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

IsString Var Source # |
Instance details Defined in Dhall.Syntax Methods fromString :: String -> Var Source #
Generic Var Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep Var :: Type -> Type Source # Methods from :: Var -> Rep Var x Source # to :: Rep Var x -> Var Source #
Show Var Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Var -> ShowS Source # show :: Var -> String Source # showList :: [Var] -> ShowS Source #
NFData Var Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Var -> () Source #
Eq Var Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Var -> Var -> Bool Source # (/=) :: Var -> Var -> Bool Source #
Ord Var Source # |
Instance details Defined in Dhall.Syntax Methods compare :: Var -> Var -> Ordering Source # (<) :: Var -> Var -> Bool Source # (<=) :: Var -> Var -> Bool Source # (>) :: Var -> Var -> Bool Source # (>=) :: Var -> Var -> Bool Source # max :: Var -> Var -> Var Source # min :: Var -> Var -> Var Source #
Pretty Var Source # |
Instance details Defined in Dhall.Syntax Methods pretty :: Var -> Doc ann Source # prettyList :: [Var] -> Doc ann Source #
Lift Var Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => Var -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Var -> Code m Var Source #
type Rep Var Source # |
Instance details Defined in Dhall.Syntax type Rep Var = D1 ('MetaData "Var" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "V" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))

data Binding s a Source #

Record the binding part of a `let` expression.

For example,

    let {- A -} x {- B -} : {- C -} Bool = {- D -} True in x

… will be instantiated as follows:

- `bindingSrc0` corresponds to the `A` comment.
- `variable` is `"x"`
- `bindingSrc1` corresponds to the `B` comment.
- `annotation` is `Just` a pair, corresponding to the `C` comment and `Bool`.
- `bindingSrc2` corresponds to the `D` comment.
- `value` corresponds to `True`.

Constructors

Binding |

Fields

- bindingSrc0 :: Maybe s
- variable :: Text
- bindingSrc1 :: Maybe s
- annotation :: Maybe (Maybe s, Expr s a)
- bindingSrc2 :: Maybe s
- value :: Expr s a

#### Instances

Instances details

Bifunctor Binding Source # |
Instance details Defined in Dhall.Syntax Methods bimap :: (a -> b) -> (c -> d) -> Binding a c -> Binding b d Source # first :: (a -> b) -> Binding a c -> Binding b c Source # second :: (b -> c) -> Binding a b -> Binding a c Source #
(Lift s, Lift a) => Lift (Binding s a :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => Binding s a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Binding s a -> Code m (Binding s a) Source #
Foldable (Binding s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => Binding s m -> m Source #

foldMap :: Monoid m => (a -> m) -> Binding s a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Binding s a -> m Source #

foldr :: (a -> b -> b) -> b -> Binding s a -> b Source #

foldr' :: (a -> b -> b) -> b -> Binding s a -> b Source #

foldl :: (b -> a -> b) -> b -> Binding s a -> b Source #

foldl' :: (b -> a -> b) -> b -> Binding s a -> b Source #

foldr1 :: (a -> a -> a) -> Binding s a -> a Source #

foldl1 :: (a -> a -> a) -> Binding s a -> a Source #

toList :: Binding s a -> [a] Source #

null :: Binding s a -> Bool Source #

length :: Binding s a -> Int Source #

elem :: Eq a => a -> Binding s a -> Bool Source #

maximum :: Ord a => Binding s a -> a Source #

minimum :: Ord a => Binding s a -> a Source #

sum :: Num a => Binding s a -> a Source #

product :: Num a => Binding s a -> a Source #

Traversable (Binding s) Source # |
Instance details Defined in Dhall.Syntax Methods traverse :: Applicative f => (a -> f b) -> Binding s a -> f (Binding s b) Source # sequenceA :: Applicative f => Binding s (f a) -> f (Binding s a) Source # mapM :: Monad m => (a -> m b) -> Binding s a -> m (Binding s b) Source # sequence :: Monad m => Binding s (m a) -> m (Binding s a) Source #
Functor (Binding s) Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> Binding s a -> Binding s b Source # (<$) :: a -> Binding s b -> Binding s a Source #
(Data s, Data a) => Data (Binding s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Binding s a -> c (Binding s a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Binding s a) Source #

toConstr :: Binding s a -> Constr Source #

dataTypeOf :: Binding s a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Binding s a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Binding s a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Binding s a -> Binding s a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Binding s a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Binding s a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Binding s a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Binding s a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Binding s a -> m (Binding s a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Binding s a -> m (Binding s a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Binding s a -> m (Binding s a) Source #

Generic (Binding s a) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (Binding s a) :: Type -> Type Source # Methods from :: Binding s a -> Rep (Binding s a) x Source # to :: Rep (Binding s a) x -> Binding s a Source #
(Show s, Show a) => Show (Binding s a) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Binding s a -> ShowS Source # show :: Binding s a -> String Source # showList :: [Binding s a] -> ShowS Source #
(NFData s, NFData a) => NFData (Binding s a) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Binding s a -> () Source #
(Eq s, Eq a) => Eq (Binding s a) Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Binding s a -> Binding s a -> Bool Source # (/=) :: Binding s a -> Binding s a -> Bool Source #
(Ord s, Ord a) => Ord (Binding s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: Binding s a -> Binding s a -> Ordering Source #

(<) :: Binding s a -> Binding s a -> Bool Source #

(<=) :: Binding s a -> Binding s a -> Bool Source #

(>) :: Binding s a -> Binding s a -> Bool Source #

(>=) :: Binding s a -> Binding s a -> Bool Source #

max :: Binding s a -> Binding s a -> Binding s a Source #

min :: Binding s a -> Binding s a -> Binding s a Source #

type Rep (Binding s a) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (Binding s a) = D1 ('MetaData "Binding" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "Binding" 'PrefixI 'True) ((S1 ('MetaSel ('Just "bindingSrc0") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: (S1 ('MetaSel ('Just "variable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "bindingSrc1") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)))) :*: (S1 ('MetaSel ('Just "annotation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Maybe s, Expr s a))) :*: (S1 ('MetaSel ('Just "bindingSrc2") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: S1 ('MetaSel ('Just "value") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))))))

makeBinding :: Text -> Expr s a -> Binding s a Source #

Construct a `Binding` with no source information and no type annotation.

data Chunks s a Source #

The body of an interpolated `Text` literal

Constructors

Chunks [(Text, Expr s a)] Text |

#### Instances

Instances details

(Lift s, Lift a) => Lift (Chunks s a :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => Chunks s a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Chunks s a -> Code m (Chunks s a) Source #
Foldable (Chunks s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => Chunks s m -> m Source #

foldMap :: Monoid m => (a -> m) -> Chunks s a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Chunks s a -> m Source #

foldr :: (a -> b -> b) -> b -> Chunks s a -> b Source #

foldr' :: (a -> b -> b) -> b -> Chunks s a -> b Source #

foldl :: (b -> a -> b) -> b -> Chunks s a -> b Source #

foldl' :: (b -> a -> b) -> b -> Chunks s a -> b Source #

foldr1 :: (a -> a -> a) -> Chunks s a -> a Source #

foldl1 :: (a -> a -> a) -> Chunks s a -> a Source #

toList :: Chunks s a -> [a] Source #

null :: Chunks s a -> Bool Source #

length :: Chunks s a -> Int Source #

elem :: Eq a => a -> Chunks s a -> Bool Source #

maximum :: Ord a => Chunks s a -> a Source #

minimum :: Ord a => Chunks s a -> a Source #

sum :: Num a => Chunks s a -> a Source #

product :: Num a => Chunks s a -> a Source #

Traversable (Chunks s) Source # |
Instance details Defined in Dhall.Syntax Methods traverse :: Applicative f => (a -> f b) -> Chunks s a -> f (Chunks s b) Source # sequenceA :: Applicative f => Chunks s (f a) -> f (Chunks s a) Source # mapM :: Monad m => (a -> m b) -> Chunks s a -> m (Chunks s b) Source # sequence :: Monad m => Chunks s (m a) -> m (Chunks s a) Source #
Functor (Chunks s) Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> Chunks s a -> Chunks s b Source # (<$) :: a -> Chunks s b -> Chunks s a Source #
(Data s, Data a) => Data (Chunks s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Chunks s a -> c (Chunks s a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Chunks s a) Source #

toConstr :: Chunks s a -> Constr Source #

dataTypeOf :: Chunks s a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Chunks s a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Chunks s a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Chunks s a -> Chunks s a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Chunks s a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Chunks s a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Chunks s a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Chunks s a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Chunks s a -> m (Chunks s a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Chunks s a -> m (Chunks s a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Chunks s a -> m (Chunks s a) Source #

IsString (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Methods fromString :: String -> Chunks s a Source #
Monoid (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Methods mempty :: Chunks s a Source # mappend :: Chunks s a -> Chunks s a -> Chunks s a Source # mconcat :: [Chunks s a] -> Chunks s a Source #
Semigroup (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Methods (<>) :: Chunks s a -> Chunks s a -> Chunks s a Source # sconcat :: NonEmpty (Chunks s a) -> Chunks s a Source # stimes :: Integral b => b -> Chunks s a -> Chunks s a Source #
Generic (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (Chunks s a) :: Type -> Type Source # Methods from :: Chunks s a -> Rep (Chunks s a) x Source # to :: Rep (Chunks s a) x -> Chunks s a Source #
(Show s, Show a) => Show (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Chunks s a -> ShowS Source # show :: Chunks s a -> String Source # showList :: [Chunks s a] -> ShowS Source #
(NFData s, NFData a) => NFData (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Chunks s a -> () Source #
(Eq s, Eq a) => Eq (Chunks s a) Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: Chunks s a -> Chunks s a -> Bool Source # (/=) :: Chunks s a -> Chunks s a -> Bool Source #
(Ord s, Ord a) => Ord (Chunks s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: Chunks s a -> Chunks s a -> Ordering Source #

(<) :: Chunks s a -> Chunks s a -> Bool Source #

(<=) :: Chunks s a -> Chunks s a -> Bool Source #

(>) :: Chunks s a -> Chunks s a -> Bool Source #

(>=) :: Chunks s a -> Chunks s a -> Bool Source #

max :: Chunks s a -> Chunks s a -> Chunks s a Source #

min :: Chunks s a -> Chunks s a -> Chunks s a Source #

type Rep (Chunks s a) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (Chunks s a) = D1 ('MetaData "Chunks" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "Chunks" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, Expr s a)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data PreferAnnotation s a Source #

Used to record the origin of a `//` operator (i.e. from source code or a product of desugaring)

Constructors

PreferFromSource |
PreferFromWith (Expr s a) | Stores the original `with` expression
PreferFromCompletion |

#### Instances

Instances details

Bifunctor PreferAnnotation Source # |
Instance details Defined in Dhall.Syntax Methods bimap :: (a -> b) -> (c -> d) -> PreferAnnotation a c -> PreferAnnotation b d Source # first :: (a -> b) -> PreferAnnotation a c -> PreferAnnotation b c Source # second :: (b -> c) -> PreferAnnotation a b -> PreferAnnotation a c Source #
(Lift s, Lift a) => Lift (PreferAnnotation s a :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => PreferAnnotation s a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => PreferAnnotation s a -> Code m (PreferAnnotation s a) Source #
Foldable (PreferAnnotation s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => PreferAnnotation s m -> m Source #

foldMap :: Monoid m => (a -> m) -> PreferAnnotation s a -> m Source #

foldMap' :: Monoid m => (a -> m) -> PreferAnnotation s a -> m Source #

foldr :: (a -> b -> b) -> b -> PreferAnnotation s a -> b Source #

foldr' :: (a -> b -> b) -> b -> PreferAnnotation s a -> b Source #

foldl :: (b -> a -> b) -> b -> PreferAnnotation s a -> b Source #

foldl' :: (b -> a -> b) -> b -> PreferAnnotation s a -> b Source #

foldr1 :: (a -> a -> a) -> PreferAnnotation s a -> a Source #

foldl1 :: (a -> a -> a) -> PreferAnnotation s a -> a Source #

toList :: PreferAnnotation s a -> [a] Source #

null :: PreferAnnotation s a -> Bool Source #

length :: PreferAnnotation s a -> Int Source #

elem :: Eq a => a -> PreferAnnotation s a -> Bool Source #

maximum :: Ord a => PreferAnnotation s a -> a Source #

minimum :: Ord a => PreferAnnotation s a -> a Source #

sum :: Num a => PreferAnnotation s a -> a Source #

product :: Num a => PreferAnnotation s a -> a Source #

Traversable (PreferAnnotation s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> PreferAnnotation s a -> f (PreferAnnotation s b) Source #

sequenceA :: Applicative f => PreferAnnotation s (f a) -> f (PreferAnnotation s a) Source #

mapM :: Monad m => (a -> m b) -> PreferAnnotation s a -> m (PreferAnnotation s b) Source #

sequence :: Monad m => PreferAnnotation s (m a) -> m (PreferAnnotation s a) Source #

Functor (PreferAnnotation s) Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> PreferAnnotation s a -> PreferAnnotation s b Source # (<$) :: a -> PreferAnnotation s b -> PreferAnnotation s a Source #
(Data s, Data a) => Data (PreferAnnotation s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PreferAnnotation s a -> c (PreferAnnotation s a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PreferAnnotation s a) Source #

toConstr :: PreferAnnotation s a -> Constr Source #

dataTypeOf :: PreferAnnotation s a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (PreferAnnotation s a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PreferAnnotation s a)) Source #

gmapT :: (forall b. Data b => b -> b) -> PreferAnnotation s a -> PreferAnnotation s a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PreferAnnotation s a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PreferAnnotation s a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PreferAnnotation s a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PreferAnnotation s a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PreferAnnotation s a -> m (PreferAnnotation s a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PreferAnnotation s a -> m (PreferAnnotation s a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PreferAnnotation s a -> m (PreferAnnotation s a) Source #

Generic (PreferAnnotation s a) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (PreferAnnotation s a) :: Type -> Type Source # Methods from :: PreferAnnotation s a -> Rep (PreferAnnotation s a) x Source # to :: Rep (PreferAnnotation s a) x -> PreferAnnotation s a Source #
(Show s, Show a) => Show (PreferAnnotation s a) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> PreferAnnotation s a -> ShowS Source # show :: PreferAnnotation s a -> String Source # showList :: [PreferAnnotation s a] -> ShowS Source #
(NFData s, NFData a) => NFData (PreferAnnotation s a) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: PreferAnnotation s a -> () Source #
(Eq s, Eq a) => Eq (PreferAnnotation s a) Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: PreferAnnotation s a -> PreferAnnotation s a -> Bool Source # (/=) :: PreferAnnotation s a -> PreferAnnotation s a -> Bool Source #
(Ord s, Ord a) => Ord (PreferAnnotation s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: PreferAnnotation s a -> PreferAnnotation s a -> Ordering Source #

(<) :: PreferAnnotation s a -> PreferAnnotation s a -> Bool Source #

(<=) :: PreferAnnotation s a -> PreferAnnotation s a -> Bool Source #

(>) :: PreferAnnotation s a -> PreferAnnotation s a -> Bool Source #

(>=) :: PreferAnnotation s a -> PreferAnnotation s a -> Bool Source #

max :: PreferAnnotation s a -> PreferAnnotation s a -> PreferAnnotation s a Source #

min :: PreferAnnotation s a -> PreferAnnotation s a -> PreferAnnotation s a Source #

type Rep (PreferAnnotation s a) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (PreferAnnotation s a) = D1 ('MetaData "PreferAnnotation" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "PreferFromSource" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PreferFromWith" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "PreferFromCompletion" 'PrefixI 'False) (U1 :: Type -> Type)))

data RecordField s a Source #

Record the field of a record-type and record-literal expression. The reason why we use the same ADT for both of them is because they store the same information.

For example,

    { {- A -} x {- B -} : {- C -} T }

... or

    { {- A -} x {- B -} = {- C -} T }

will be instantiated as follows:

- `recordFieldSrc0` corresponds to the `A` comment.
- `recordFieldValue` is `T`
- `recordFieldSrc1` corresponds to the `B` comment.
- `recordFieldSrc2` corresponds to the `C` comment.

Although the `A` comment isn't annotating the `T` Record Field, this is the best place to keep these comments.

Note that `recordFieldSrc2` is always `Nothing` when the `RecordField` is for a punned entry, because there is no `=` sign. For example,

    { {- A -} x {- B -} }

will be instantiated as follows:

- `recordFieldSrc0` corresponds to the `A` comment.
- `recordFieldValue` corresponds to `(Var "x")`
- `recordFieldSrc1` corresponds to the `B` comment.
- `recordFieldSrc2` will be `Nothing`

The labels involved in a record using dot-syntax like in this example:

    { {- A -} a {- B -} . {- C -} b {- D -} . {- E -} c {- F -} = {- G -} e }

will be instantiated as follows:

- For both the `a` and `b` field, `recordfieldSrc2` is `Nothing`
- For the `a` field:
- `recordFieldSrc0` corresponds to the `A` comment
- `recordFieldSrc1` corresponds to the `B` comment
- For the `b` field:
- `recordFieldSrc0` corresponds to the `C` comment
- `recordFieldSrc1` corresponds to the `D` comment
- For the `c` field:
- `recordFieldSrc0` corresponds to the `E` comment
- `recordFieldSrc1` corresponds to the `F` comment
- `recordFieldSrc2` corresponds to the `G` comment

That is, for every label except the last one the semantics of `recordFieldSrc0` and `recordFieldSrc1` are the same from a regular record label but `recordFieldSrc2` is always `Nothing`. For the last keyword, all srcs are `Just`

Constructors

RecordField |

Fields

- recordFieldSrc0 :: Maybe s
- recordFieldValue :: Expr s a
- recordFieldSrc1 :: Maybe s
- recordFieldSrc2 :: Maybe s

#### Instances

Instances details

Bifunctor RecordField Source # |
Instance details Defined in Dhall.Syntax Methods bimap :: (a -> b) -> (c -> d) -> RecordField a c -> RecordField b d Source # first :: (a -> b) -> RecordField a c -> RecordField b c Source # second :: (b -> c) -> RecordField a b -> RecordField a c Source #
(Lift s, Lift a) => Lift (RecordField s a :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => RecordField s a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => RecordField s a -> Code m (RecordField s a) Source #
Foldable (RecordField s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => RecordField s m -> m Source #

foldMap :: Monoid m => (a -> m) -> RecordField s a -> m Source #

foldMap' :: Monoid m => (a -> m) -> RecordField s a -> m Source #

foldr :: (a -> b -> b) -> b -> RecordField s a -> b Source #

foldr' :: (a -> b -> b) -> b -> RecordField s a -> b Source #

foldl :: (b -> a -> b) -> b -> RecordField s a -> b Source #

foldl' :: (b -> a -> b) -> b -> RecordField s a -> b Source #

foldr1 :: (a -> a -> a) -> RecordField s a -> a Source #

foldl1 :: (a -> a -> a) -> RecordField s a -> a Source #

toList :: RecordField s a -> [a] Source #

null :: RecordField s a -> Bool Source #

length :: RecordField s a -> Int Source #

elem :: Eq a => a -> RecordField s a -> Bool Source #

maximum :: Ord a => RecordField s a -> a Source #

minimum :: Ord a => RecordField s a -> a Source #

sum :: Num a => RecordField s a -> a Source #

product :: Num a => RecordField s a -> a Source #

Traversable (RecordField s) Source # |
Instance details Defined in Dhall.Syntax Methods traverse :: Applicative f => (a -> f b) -> RecordField s a -> f (RecordField s b) Source # sequenceA :: Applicative f => RecordField s (f a) -> f (RecordField s a) Source # mapM :: Monad m => (a -> m b) -> RecordField s a -> m (RecordField s b) Source # sequence :: Monad m => RecordField s (m a) -> m (RecordField s a) Source #
Functor (RecordField s) Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> RecordField s a -> RecordField s b Source # (<$) :: a -> RecordField s b -> RecordField s a Source #
(Data s, Data a) => Data (RecordField s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RecordField s a -> c (RecordField s a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (RecordField s a) Source #

toConstr :: RecordField s a -> Constr Source #

dataTypeOf :: RecordField s a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (RecordField s a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RecordField s a)) Source #

gmapT :: (forall b. Data b => b -> b) -> RecordField s a -> RecordField s a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RecordField s a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RecordField s a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> RecordField s a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RecordField s a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RecordField s a -> m (RecordField s a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RecordField s a -> m (RecordField s a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RecordField s a -> m (RecordField s a) Source #

Generic (RecordField s a) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (RecordField s a) :: Type -> Type Source # Methods from :: RecordField s a -> Rep (RecordField s a) x Source # to :: Rep (RecordField s a) x -> RecordField s a Source #
(Show s, Show a) => Show (RecordField s a) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> RecordField s a -> ShowS Source # show :: RecordField s a -> String Source # showList :: [RecordField s a] -> ShowS Source #
(NFData s, NFData a) => NFData (RecordField s a) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: RecordField s a -> () Source #
(Eq s, Eq a) => Eq (RecordField s a) Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: RecordField s a -> RecordField s a -> Bool Source # (/=) :: RecordField s a -> RecordField s a -> Bool Source #
(Ord s, Ord a) => Ord (RecordField s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: RecordField s a -> RecordField s a -> Ordering Source #

(<) :: RecordField s a -> RecordField s a -> Bool Source #

(<=) :: RecordField s a -> RecordField s a -> Bool Source #

(>) :: RecordField s a -> RecordField s a -> Bool Source #

(>=) :: RecordField s a -> RecordField s a -> Bool Source #

max :: RecordField s a -> RecordField s a -> RecordField s a Source #

min :: RecordField s a -> RecordField s a -> RecordField s a Source #

type Rep (RecordField s a) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (RecordField s a) = D1 ('MetaData "RecordField" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "RecordField" 'PrefixI 'True) ((S1 ('MetaSel ('Just "recordFieldSrc0") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: S1 ('MetaSel ('Just "recordFieldValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :*: (S1 ('MetaSel ('Just "recordFieldSrc1") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: S1 ('MetaSel ('Just "recordFieldSrc2") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)))))

makeRecordField :: Expr s a -> RecordField s a Source #

Construct a `RecordField` with no src information

data FunctionBinding s a Source #

Record the label of a function or a function-type expression

For example,

    λ({- A -} a {- B -} : {- C -} T) -> e

… will be instantiated as follows:

- `functionBindingSrc0` corresponds to the `A` comment
- `functionBindingVariable` is `a`
- `functionBindingSrc1` corresponds to the `B` comment
- `functionBindingSrc2` corresponds to the `C` comment
- `functionBindingAnnotation` is `T`

Constructors

FunctionBinding |

Fields

- functionBindingSrc0 :: Maybe s
- functionBindingVariable :: Text
- functionBindingSrc1 :: Maybe s
- functionBindingSrc2 :: Maybe s
- functionBindingAnnotation :: Expr s a

#### Instances

Instances details

Bifunctor FunctionBinding Source # |
Instance details Defined in Dhall.Syntax Methods bimap :: (a -> b) -> (c -> d) -> FunctionBinding a c -> FunctionBinding b d Source # first :: (a -> b) -> FunctionBinding a c -> FunctionBinding b c Source # second :: (b -> c) -> FunctionBinding a b -> FunctionBinding a c Source #
(Lift s, Lift a) => Lift (FunctionBinding s a :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => FunctionBinding s a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => FunctionBinding s a -> Code m (FunctionBinding s a) Source #
Foldable (FunctionBinding s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => FunctionBinding s m -> m Source #

foldMap :: Monoid m => (a -> m) -> FunctionBinding s a -> m Source #

foldMap' :: Monoid m => (a -> m) -> FunctionBinding s a -> m Source #

foldr :: (a -> b -> b) -> b -> FunctionBinding s a -> b Source #

foldr' :: (a -> b -> b) -> b -> FunctionBinding s a -> b Source #

foldl :: (b -> a -> b) -> b -> FunctionBinding s a -> b Source #

foldl' :: (b -> a -> b) -> b -> FunctionBinding s a -> b Source #

foldr1 :: (a -> a -> a) -> FunctionBinding s a -> a Source #

foldl1 :: (a -> a -> a) -> FunctionBinding s a -> a Source #

toList :: FunctionBinding s a -> [a] Source #

null :: FunctionBinding s a -> Bool Source #

length :: FunctionBinding s a -> Int Source #

elem :: Eq a => a -> FunctionBinding s a -> Bool Source #

maximum :: Ord a => FunctionBinding s a -> a Source #

minimum :: Ord a => FunctionBinding s a -> a Source #

sum :: Num a => FunctionBinding s a -> a Source #

product :: Num a => FunctionBinding s a -> a Source #

Traversable (FunctionBinding s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> FunctionBinding s a -> f (FunctionBinding s b) Source #

sequenceA :: Applicative f => FunctionBinding s (f a) -> f (FunctionBinding s a) Source #

mapM :: Monad m => (a -> m b) -> FunctionBinding s a -> m (FunctionBinding s b) Source #

sequence :: Monad m => FunctionBinding s (m a) -> m (FunctionBinding s a) Source #

Functor (FunctionBinding s) Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> FunctionBinding s a -> FunctionBinding s b Source # (<$) :: a -> FunctionBinding s b -> FunctionBinding s a Source #
(Data s, Data a) => Data (FunctionBinding s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FunctionBinding s a -> c (FunctionBinding s a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (FunctionBinding s a) Source #

toConstr :: FunctionBinding s a -> Constr Source #

dataTypeOf :: FunctionBinding s a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (FunctionBinding s a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (FunctionBinding s a)) Source #

gmapT :: (forall b. Data b => b -> b) -> FunctionBinding s a -> FunctionBinding s a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunctionBinding s a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunctionBinding s a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> FunctionBinding s a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FunctionBinding s a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FunctionBinding s a -> m (FunctionBinding s a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FunctionBinding s a -> m (FunctionBinding s a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FunctionBinding s a -> m (FunctionBinding s a) Source #

Generic (FunctionBinding s a) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (FunctionBinding s a) :: Type -> Type Source # Methods from :: FunctionBinding s a -> Rep (FunctionBinding s a) x Source # to :: Rep (FunctionBinding s a) x -> FunctionBinding s a Source #
(Show s, Show a) => Show (FunctionBinding s a) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> FunctionBinding s a -> ShowS Source # show :: FunctionBinding s a -> String Source # showList :: [FunctionBinding s a] -> ShowS Source #
(NFData s, NFData a) => NFData (FunctionBinding s a) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: FunctionBinding s a -> () Source #
(Eq s, Eq a) => Eq (FunctionBinding s a) Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: FunctionBinding s a -> FunctionBinding s a -> Bool Source # (/=) :: FunctionBinding s a -> FunctionBinding s a -> Bool Source #
(Ord s, Ord a) => Ord (FunctionBinding s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: FunctionBinding s a -> FunctionBinding s a -> Ordering Source #

(<) :: FunctionBinding s a -> FunctionBinding s a -> Bool Source #

(<=) :: FunctionBinding s a -> FunctionBinding s a -> Bool Source #

(>) :: FunctionBinding s a -> FunctionBinding s a -> Bool Source #

(>=) :: FunctionBinding s a -> FunctionBinding s a -> Bool Source #

max :: FunctionBinding s a -> FunctionBinding s a -> FunctionBinding s a Source #

min :: FunctionBinding s a -> FunctionBinding s a -> FunctionBinding s a Source #

type Rep (FunctionBinding s a) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (FunctionBinding s a) = D1 ('MetaData "FunctionBinding" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "FunctionBinding" 'PrefixI 'True) ((S1 ('MetaSel ('Just "functionBindingSrc0") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: S1 ('MetaSel ('Just "functionBindingVariable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "functionBindingSrc1") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: (S1 ('MetaSel ('Just "functionBindingSrc2") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: S1 ('MetaSel ('Just "functionBindingAnnotation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))))))

makeFunctionBinding :: Text -> Expr s a -> FunctionBinding s a Source #

Smart constructor for `FunctionBinding` with no src information

data FieldSelection s Source #

Record the field on a selector-expression

For example,

    e . {- A -} x {- B -}

… will be instantiated as follows:

- `fieldSelectionSrc0` corresponds to the `A` comment
- `fieldSelectionLabel` corresponds to `x`
- `fieldSelectionSrc1` corresponds to the `B` comment

Given our limitation that not all expressions recover their whitespaces, the purpose of `fieldSelectionSrc1` is to save the `SourcePos` where the `fieldSelectionLabel` ends, but we still use a 'Maybe Src' (`s = `Src``) to be consistent with similar data types such as `Binding`, for example.

Constructors

FieldSelection |

Fields

- fieldSelectionSrc0 :: Maybe s
- fieldSelectionLabel :: !Text
- fieldSelectionSrc1 :: Maybe s

#### Instances

Instances details

Foldable FieldSelection Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => FieldSelection m -> m Source #

foldMap :: Monoid m => (a -> m) -> FieldSelection a -> m Source #

foldMap' :: Monoid m => (a -> m) -> FieldSelection a -> m Source #

foldr :: (a -> b -> b) -> b -> FieldSelection a -> b Source #

foldr' :: (a -> b -> b) -> b -> FieldSelection a -> b Source #

foldl :: (b -> a -> b) -> b -> FieldSelection a -> b Source #

foldl' :: (b -> a -> b) -> b -> FieldSelection a -> b Source #

foldr1 :: (a -> a -> a) -> FieldSelection a -> a Source #

foldl1 :: (a -> a -> a) -> FieldSelection a -> a Source #

toList :: FieldSelection a -> [a] Source #

null :: FieldSelection a -> Bool Source #

length :: FieldSelection a -> Int Source #

elem :: Eq a => a -> FieldSelection a -> Bool Source #

maximum :: Ord a => FieldSelection a -> a Source #

minimum :: Ord a => FieldSelection a -> a Source #

sum :: Num a => FieldSelection a -> a Source #

product :: Num a => FieldSelection a -> a Source #

Traversable FieldSelection Source # |
Instance details Defined in Dhall.Syntax Methods traverse :: Applicative f => (a -> f b) -> FieldSelection a -> f (FieldSelection b) Source # sequenceA :: Applicative f => FieldSelection (f a) -> f (FieldSelection a) Source # mapM :: Monad m => (a -> m b) -> FieldSelection a -> m (FieldSelection b) Source # sequence :: Monad m => FieldSelection (m a) -> m (FieldSelection a) Source #
Functor FieldSelection Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> FieldSelection a -> FieldSelection b Source # (<$) :: a -> FieldSelection b -> FieldSelection a Source #
Lift s => Lift (FieldSelection s :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => FieldSelection s -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => FieldSelection s -> Code m (FieldSelection s) Source #
Data s => Data (FieldSelection s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FieldSelection s -> c (FieldSelection s) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (FieldSelection s) Source #

toConstr :: FieldSelection s -> Constr Source #

dataTypeOf :: FieldSelection s -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (FieldSelection s)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (FieldSelection s)) Source #

gmapT :: (forall b. Data b => b -> b) -> FieldSelection s -> FieldSelection s Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FieldSelection s -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FieldSelection s -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> FieldSelection s -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FieldSelection s -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FieldSelection s -> m (FieldSelection s) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldSelection s -> m (FieldSelection s) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldSelection s -> m (FieldSelection s) Source #

Generic (FieldSelection s) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (FieldSelection s) :: Type -> Type Source # Methods from :: FieldSelection s -> Rep (FieldSelection s) x Source # to :: Rep (FieldSelection s) x -> FieldSelection s Source #
Show s => Show (FieldSelection s) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> FieldSelection s -> ShowS Source # show :: FieldSelection s -> String Source # showList :: [FieldSelection s] -> ShowS Source #
NFData s => NFData (FieldSelection s) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: FieldSelection s -> () Source #
Eq s => Eq (FieldSelection s) Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: FieldSelection s -> FieldSelection s -> Bool Source # (/=) :: FieldSelection s -> FieldSelection s -> Bool Source #
Ord s => Ord (FieldSelection s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: FieldSelection s -> FieldSelection s -> Ordering Source #

(<) :: FieldSelection s -> FieldSelection s -> Bool Source #

(<=) :: FieldSelection s -> FieldSelection s -> Bool Source #

(>) :: FieldSelection s -> FieldSelection s -> Bool Source #

(>=) :: FieldSelection s -> FieldSelection s -> Bool Source #

max :: FieldSelection s -> FieldSelection s -> FieldSelection s Source #

min :: FieldSelection s -> FieldSelection s -> FieldSelection s Source #

type Rep (FieldSelection s) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (FieldSelection s) = D1 ('MetaData "FieldSelection" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "FieldSelection" 'PrefixI 'True) (S1 ('MetaSel ('Just "fieldSelectionSrc0") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)) :*: (S1 ('MetaSel ('Just "fieldSelectionLabel") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "fieldSelectionSrc1") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe s)))))

makeFieldSelection :: Text -> FieldSelection s Source #

Smart constructor for `FieldSelection` with no src information

data WithComponent Source #

A path component for a `with` expression

Constructors

WithLabel Text |
WithQuestion |

#### Instances

Instances details

Data WithComponent Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WithComponent -> c WithComponent Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WithComponent Source #

toConstr :: WithComponent -> Constr Source #

dataTypeOf :: WithComponent -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WithComponent) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WithComponent) Source #

gmapT :: (forall b. Data b => b -> b) -> WithComponent -> WithComponent Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WithComponent -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WithComponent -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> WithComponent -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WithComponent -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WithComponent -> m WithComponent Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WithComponent -> m WithComponent Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WithComponent -> m WithComponent Source #

Generic WithComponent Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep WithComponent :: Type -> Type Source # Methods from :: WithComponent -> Rep WithComponent x Source # to :: Rep WithComponent x -> WithComponent Source #
Show WithComponent Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> WithComponent -> ShowS Source # show :: WithComponent -> String Source # showList :: [WithComponent] -> ShowS Source #
NFData WithComponent Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: WithComponent -> () Source #
Eq WithComponent Source # |
Instance details Defined in Dhall.Syntax Methods (==) :: WithComponent -> WithComponent -> Bool Source # (/=) :: WithComponent -> WithComponent -> Bool Source #
Ord WithComponent Source # |

Instance details

Defined in Dhall.Syntax

Methods

compare :: WithComponent -> WithComponent -> Ordering Source #

(<) :: WithComponent -> WithComponent -> Bool Source #

(<=) :: WithComponent -> WithComponent -> Bool Source #

(>) :: WithComponent -> WithComponent -> Bool Source #

(>=) :: WithComponent -> WithComponent -> Bool Source #

max :: WithComponent -> WithComponent -> WithComponent Source #

min :: WithComponent -> WithComponent -> WithComponent Source #

Lift WithComponent Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => WithComponent -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => WithComponent -> Code m WithComponent Source #
type Rep WithComponent Source # |
Instance details Defined in Dhall.Syntax type Rep WithComponent = D1 ('MetaData "WithComponent" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "WithLabel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "WithQuestion" 'PrefixI 'False) (U1 :: Type -> Type))

data Expr s a Source #

Syntax tree for expressions

The `s` type parameter is used to track the presence or absence of `Src` spans:

- If `s = `Src`` then the code may contains `Src` spans (either in a `Note` constructor or inline within another constructor, like `Let`)
- If `s = `Void`` then the code has no `Src` spans

The `a` type parameter is used to track the presence or absence of imports

- If `a = `Import`` then the code may contain unresolved `Import`s
- If `a = `Void`` then the code has no `Import`s

Constructors

Const Const

    Const c                                  ~  c

Var Var

    Var (V x 0)                              ~  x
    Var (V x n)                              ~  x@n

Lam (Maybe CharacterSet) (FunctionBinding s a) (Expr s a)

    Lam _ (FunctionBinding _ "x" _ _ A) b    ~  λ(x : A) -> b

Pi (Maybe CharacterSet) Text (Expr s a) (Expr s a)

    Pi _ "_" A B                               ~        A  -> B
    Pi _ x   A B                               ~  ∀(x : A) -> B

App (Expr s a) (Expr s a)

    App f a                                  ~  f a

Let (Binding s a) (Expr s a)

    Let (Binding _ x _  Nothing  _ r) e      ~  let x     = r in e
    Let (Binding _ x _ (Just t ) _ r) e      ~  let x : t = r in e

The difference between

    let x = a    let y = b in e

and

    let x = a in let y = b in e

is only an additional `Note` around ``Let` "y" …` in the second example.

See `MultiLet` for a representation of let-blocks that mirrors the source code more closely.

Annot (Expr s a) (Expr s a)

    Annot x t                                ~  x : t

Bool

    Bool                                     ~  Bool

BoolLit Bool

    BoolLit b                                ~  b

BoolAnd (Expr s a) (Expr s a)

    BoolAnd x y                              ~  x && y

BoolOr (Expr s a) (Expr s a)

    BoolOr  x y                              ~  x || y

BoolEQ (Expr s a) (Expr s a)

    BoolEQ  x y                              ~  x == y

BoolNE (Expr s a) (Expr s a)

    BoolNE  x y                              ~  x != y

BoolIf (Expr s a) (Expr s a) (Expr s a)

    BoolIf x y z                             ~  if x then y else z

Natural

    Natural                                  ~  Natural

NaturalLit Natural

    NaturalLit n                             ~  n

NaturalFold

    NaturalFold                              ~  Natural/fold

NaturalBuild

    NaturalBuild                             ~  Natural/build

NaturalIsZero

    NaturalIsZero                            ~  Natural/isZero

NaturalEven

    NaturalEven                              ~  Natural/even

NaturalOdd

    NaturalOdd                               ~  Natural/odd

NaturalToInteger

    NaturalToInteger                         ~  Natural/toInteger

NaturalShow

    NaturalShow                              ~  Natural/show

NaturalSubtract

    NaturalSubtract                          ~  Natural/subtract

NaturalPlus (Expr s a) (Expr s a)

    NaturalPlus x y                          ~  x + y

NaturalTimes (Expr s a) (Expr s a)

    NaturalTimes x y                         ~  x * y

Integer

    Integer                                  ~  Integer

IntegerLit Integer

    IntegerLit n                             ~  ±n

IntegerClamp

    IntegerClamp                             ~  Integer/clamp

IntegerNegate

    IntegerNegate                            ~  Integer/negate

IntegerShow

    IntegerShow                              ~  Integer/show

IntegerToDouble

    IntegerToDouble                          ~  Integer/toDouble

Double

    Double                                   ~  Double

DoubleLit DhallDouble

    DoubleLit n                              ~  n

DoubleShow

    DoubleShow                               ~  Double/show

Text

    Text                                     ~  Text

TextLit (Chunks s a)

    TextLit (Chunks [(t1, e1), (t2, e2)] t3) ~  "t1${e1}t2${e2}t3"

TextAppend (Expr s a) (Expr s a)

    TextAppend x y                           ~  x ++ y

TextReplace

    TextReplace                              ~ Text/replace

TextShow

    TextShow                                 ~  Text/show

Date

    Date                                     ~  Date

DateLiteral Day

    DateLiteral (fromGregorian _YYYY _MM _DD) ~ YYYY-MM-DD

Time

    Time                                     ~  Time

TimeLiteral

    TimeLiteral (TimeOfDay hh mm ss) _       ~  hh:mm:ss

Fields

- TimeOfDay
- Word

  Precision | > TimeZone ~ TimeZone

TimeZone |

TimeZoneLiteral TimeZone

    TimeZoneLiteral (TimeZone ( 60 * _HH + _MM) _ _) ~ +HH:MM

| > TimeZoneLiteral (TimeZone (-60 * _HH + _MM) _ _) ~ -HH:MM

List

    List                                     ~  List

ListLit (Maybe (Expr s a)) (Seq (Expr s a))

    ListLit (Just t ) []                     ~  [] : t
    ListLit  Nothing  [x, y, z]              ~  [x, y, z]

Invariant: A non-empty list literal is always represented as `ListLit Nothing xs`.

When an annotated, non-empty list literal is parsed, it is represented as

    Annot (ListLit Nothing [x, y, z]) t      ~ [x, y, z] : t

ListAppend (Expr s a) (Expr s a)

    ListAppend x y                           ~  x # y

ListBuild

    ListBuild                                ~  List/build

ListFold

    ListFold                                 ~  List/fold

ListLength

    ListLength                               ~  List/length

ListHead

    ListHead                                 ~  List/head

ListLast

    ListLast                                 ~  List/last

ListIndexed

    ListIndexed                              ~  List/indexed

ListReverse

    ListReverse                              ~  List/reverse

Optional

    Optional                                 ~  Optional

Some (Expr s a)

    Some e                                   ~  Some e

None

    None                                     ~  None

Record (Map Text (RecordField s a))

    Record [ (k1, RecordField _ t1)          ~  { k1 : t1, k2 : t1 }
           , (k2, RecordField _ t2)
           ]

RecordLit (Map Text (RecordField s a))

    RecordLit [ (k1, RecordField _ v1)       ~  { k1 = v1, k2 = v2 }
              , (k2, RecordField _ v2)
              ]

Union (Map Text (Maybe (Expr s a)))

    Union        [(k1, Just t1), (k2, Nothing)] ~  < k1 : t1 | k2 >

Combine (Maybe CharacterSet) (Maybe Text) (Expr s a) (Expr s a)

    Combine _ Nothing x y                    ~  x ∧ y

The first field is a `Just` when the `Combine` operator is introduced as a result of desugaring duplicate record fields:

    RecordLit [ ( k                          ~ { k = x, k = y }
              , RecordField
                 _
                 (Combine (Just k) x y)
               )]

CombineTypes (Maybe CharacterSet) (Expr s a) (Expr s a)

    CombineTypes _ x y                       ~  x ⩓ y

Prefer (Maybe CharacterSet) (PreferAnnotation s a) (Expr s a) (Expr s a)

    Prefer _ False x y                       ~  x ⫽ y

The first field is a `True` when the `Prefer` operator is introduced as a result of desugaring a `with` expression

RecordCompletion (Expr s a) (Expr s a)

    RecordCompletion x y                     ~  x::y

Merge (Expr s a) (Expr s a) (Maybe (Expr s a))

    Merge x y (Just t )                      ~  merge x y : t
    Merge x y  Nothing                       ~  merge x y

ToMap (Expr s a) (Maybe (Expr s a))

    ToMap x (Just t)                         ~  toMap x : t
    ToMap x  Nothing                         ~  toMap x

ShowConstructor (Expr s a)

    ShowConstructor x                        ~  showConstructor x

Field (Expr s a) (FieldSelection s)

    Field e (FieldSelection _ x _)              ~  e.x

Project (Expr s a) (Either [Text] (Expr s a))

    Project e (Left xs)                      ~  e.{ xs }
    Project e (Right t)                      ~  e.(t)

Assert (Expr s a)

    Assert e                                 ~  assert : e

Equivalent (Maybe CharacterSet) (Expr s a) (Expr s a)

    Equivalent _ x y                           ~  x ≡ y

With (Expr s a) (NonEmpty WithComponent) (Expr s a)

    With x y e                               ~  x with y = e

Note s (Expr s a)

    Note s x                                 ~  e

ImportAlt (Expr s a) (Expr s a)

    ImportAlt                                ~  e1 ? e2

Embed a

    Embed import                             ~  import

#### Instances

Instances details

Bifunctor Expr Source # |
Instance details Defined in Dhall.Syntax Methods bimap :: (a -> b) -> (c -> d) -> Expr a c -> Expr b d Source # first :: (a -> b) -> Expr a c -> Expr b c Source # second :: (b -> c) -> Expr a b -> Expr a c Source #
(Lift s, Lift a) => Lift (Expr s a :: Type) Source # |
Instance details Defined in Dhall.Syntax Methods lift :: Quote m => Expr s a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Expr s a -> Code m (Expr s a) Source #
Foldable (Expr s) Source # |

Instance details

Defined in Dhall.Syntax

Methods

fold :: Monoid m => Expr s m -> m Source #

foldMap :: Monoid m => (a -> m) -> Expr s a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Expr s a -> m Source #

foldr :: (a -> b -> b) -> b -> Expr s a -> b Source #

foldr' :: (a -> b -> b) -> b -> Expr s a -> b Source #

foldl :: (b -> a -> b) -> b -> Expr s a -> b Source #

foldl' :: (b -> a -> b) -> b -> Expr s a -> b Source #

foldr1 :: (a -> a -> a) -> Expr s a -> a Source #

foldl1 :: (a -> a -> a) -> Expr s a -> a Source #

toList :: Expr s a -> [a] Source #

null :: Expr s a -> Bool Source #

length :: Expr s a -> Int Source #

elem :: Eq a => a -> Expr s a -> Bool Source #

maximum :: Ord a => Expr s a -> a Source #

minimum :: Ord a => Expr s a -> a Source #

sum :: Num a => Expr s a -> a Source #

product :: Num a => Expr s a -> a Source #

Traversable (Expr s) Source # |
Instance details Defined in Dhall.Syntax Methods traverse :: Applicative f => (a -> f b) -> Expr s a -> f (Expr s b) Source # sequenceA :: Applicative f => Expr s (f a) -> f (Expr s a) Source # mapM :: Monad m => (a -> m b) -> Expr s a -> m (Expr s b) Source # sequence :: Monad m => Expr s (m a) -> m (Expr s a) Source #
Applicative (Expr s) Source # |
Instance details Defined in Dhall.Syntax Methods pure :: a -> Expr s a Source # (<*>) :: Expr s (a -> b) -> Expr s a -> Expr s b Source # liftA2 :: (a -> b -> c) -> Expr s a -> Expr s b -> Expr s c Source # (*>) :: Expr s a -> Expr s b -> Expr s b Source # (<*) :: Expr s a -> Expr s b -> Expr s a Source #
Functor (Expr s) Source # |
Instance details Defined in Dhall.Syntax Methods fmap :: (a -> b) -> Expr s a -> Expr s b Source # (<$) :: a -> Expr s b -> Expr s a Source #
Monad (Expr s) Source # |
Instance details Defined in Dhall.Syntax Methods (>>=) :: Expr s a -> (a -> Expr s b) -> Expr s b Source # (>>) :: Expr s a -> Expr s b -> Expr s b Source # return :: a -> Expr s a Source #
(Data s, Data a) => Data (Expr s a) Source # |

Instance details

Defined in Dhall.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Expr s a -> c (Expr s a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Expr s a) Source #

toConstr :: Expr s a -> Constr Source #

dataTypeOf :: Expr s a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Expr s a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Expr s a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Expr s a -> Expr s a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr s a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr s a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Expr s a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Expr s a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Expr s a -> m (Expr s a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Expr s a -> m (Expr s a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Expr s a -> m (Expr s a) Source #

IsString (Expr s a) Source # |
Instance details Defined in Dhall.Syntax Methods fromString :: String -> Expr s a Source #
Generic (Expr s a) Source # |
Instance details Defined in Dhall.Syntax Associated Types type Rep (Expr s a) :: Type -> Type Source # Methods from :: Expr s a -> Rep (Expr s a) x Source # to :: Rep (Expr s a) x -> Expr s a Source #
(Show s, Show a) => Show (Expr s a) Source # |
Instance details Defined in Dhall.Syntax Methods showsPrec :: Int -> Expr s a -> ShowS Source # show :: Expr s a -> String Source # showList :: [Expr s a] -> ShowS Source #
(NFData s, NFData a) => NFData (Expr s a) Source # |
Instance details Defined in Dhall.Syntax Methods rnf :: Expr s a -> () Source #

(Eq s, Eq a) => Eq (Expr s a) Source #

This instance encodes what the Dhall standard calls an "exact match" between two expressions.

Note that

    >>> nan = DhallDouble (0/0)
    >>> DoubleLit nan == DoubleLit nan
    True

Instance details Defined in Dhall.Syntax Methods (==) :: Expr s a -> Expr s a -> Bool Source # (/=) :: Expr s a -> Expr s a -> Bool Source #
(Ord s, Ord a) => Ord (Expr s a) Source # | Note that this `Ord` instance inherits `DhallDouble`'s defects.
Instance details Defined in Dhall.Syntax Methods compare :: Expr s a -> Expr s a -> Ordering Source # (<) :: Expr s a -> Expr s a -> Bool Source # (<=) :: Expr s a -> Expr s a -> Bool Source # (>) :: Expr s a -> Expr s a -> Bool Source # (>=) :: Expr s a -> Expr s a -> Bool Source # max :: Expr s a -> Expr s a -> Expr s a Source # min :: Expr s a -> Expr s a -> Expr s a Source #
Pretty a => Pretty (Expr s a) Source # | Generates a syntactically valid Dhall program
Instance details Defined in Dhall.Syntax Methods pretty :: Expr s a -> Doc ann Source # prettyList :: [Expr s a] -> Doc ann Source #
Serialise (Expr Void Void) Source # |
Instance details Defined in Dhall.Binary Methods encode :: Expr Void Void -> Encoding Source # decode :: Decoder s (Expr Void Void) Source # encodeList :: [Expr Void Void] -> Encoding Source # decodeList :: Decoder s [Expr Void Void] Source #
Serialise (Expr Void Import) Source # |
Instance details Defined in Dhall.Binary Methods encode :: Expr Void Import -> Encoding Source # decode :: Decoder s (Expr Void Import) Source # encodeList :: [Expr Void Import] -> Encoding Source # decodeList :: Decoder s [Expr Void Import] Source #
type Rep (Expr s a) Source # |

Instance details

Defined in Dhall.Syntax

type Rep (Expr s a) = D1 ('MetaData "Expr" "Dhall.Syntax" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) ((((((C1 ('MetaCons "Const" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Const)) :+: C1 ('MetaCons "Var" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var))) :+: (C1 ('MetaCons "Lam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CharacterSet)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FunctionBinding s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: C1 ('MetaCons "Pi" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CharacterSet)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))))) :+: ((C1 ('MetaCons "App" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "Let" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Binding s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: (C1 ('MetaCons "Annot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: (C1 ('MetaCons "Bool" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BoolLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))) :+: (((C1 ('MetaCons "BoolAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "BoolOr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: (C1 ('MetaCons "BoolEQ" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: (C1 ('MetaCons "BoolNE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "BoolIf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))))))) :+: ((C1 ('MetaCons "Natural" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NaturalLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural))) :+: (C1 ('MetaCons "NaturalFold" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NaturalBuild" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NaturalIsZero" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "NaturalEven" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NaturalOdd" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NaturalToInteger" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NaturalShow" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "NaturalSubtract" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NaturalPlus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: (C1 ('MetaCons "NaturalTimes" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: (C1 ('MetaCons "Integer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntegerLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))))) :+: (((C1 ('MetaCons "IntegerClamp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntegerNegate" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "IntegerShow" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "IntegerToDouble" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Double" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "DoubleLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DhallDouble)) :+: C1 ('MetaCons "DoubleShow" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Text" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TextLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Chunks s a))) :+: C1 ('MetaCons "TextAppend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))))))))) :+: (((((C1 ('MetaCons "TextReplace" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TextShow" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Date" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DateLiteral" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Day)))) :+: ((C1 ('MetaCons "Time" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TimeLiteral" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TimeOfDay) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word))) :+: (C1 ('MetaCons "TimeZone" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TimeZoneLiteral" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TimeZone)) :+: C1 ('MetaCons "List" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "ListLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Expr s a))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq (Expr s a)))) :+: C1 ('MetaCons "ListAppend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: (C1 ('MetaCons "ListBuild" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ListFold" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ListLength" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ListHead" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ListLast" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ListIndexed" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ListReverse" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Optional" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "Some" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "None" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Record" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text (RecordField s a)))) :+: (C1 ('MetaCons "RecordLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text (RecordField s a)))) :+: C1 ('MetaCons "Union" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text (Maybe (Expr s a)))))))) :+: ((C1 ('MetaCons "Combine" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CharacterSet)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: C1 ('MetaCons "CombineTypes" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CharacterSet)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))))) :+: (C1 ('MetaCons "Prefer" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CharacterSet)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreferAnnotation s a))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: (C1 ('MetaCons "RecordCompletion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "Merge" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Expr s a))))))))) :+: (((C1 ('MetaCons "ToMap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Expr s a)))) :+: C1 ('MetaCons "ShowConstructor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: (C1 ('MetaCons "Field" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FieldSelection s))) :+: (C1 ('MetaCons "Project" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either [Text] (Expr s a)))) :+: C1 ('MetaCons "Assert" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))))) :+: ((C1 ('MetaCons "Equivalent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CharacterSet)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)))) :+: C1 ('MetaCons "With" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty WithComponent)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))))) :+: (C1 ('MetaCons "Note" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 s) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: (C1 ('MetaCons "ImportAlt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Expr s a))) :+: C1 ('MetaCons "Embed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))))))))

# Normalization

alphaNormalize :: Expr s a -> Expr s a Source #

α-normalize an expression by renaming all bound variables to `"_"` and using De Bruijn indices to distinguish them

    >>> mfb = Syntax.makeFunctionBinding
    >>> alphaNormalize (Lam mempty (mfb "a" (Const Type)) (Lam mempty (mfb "b" (Const Type)) (Lam mempty (mfb "x" "a") (Lam mempty (mfb "y" "b") "x"))))
    Lam Nothing (FunctionBinding {functionBindingSrc0 = Nothing, functionBindingVariable = "_", functionBindingSrc1 = Nothing, functionBindingSrc2 = Nothing, functionBindingAnnotation = Const Type}) (Lam Nothing (FunctionBinding {functionBindingSrc0 = Nothing, functionBindingVariable = "_", functionBindingSrc1 = Nothing, functionBindingSrc2 = Nothing, functionBindingAnnotation = Const Type}) (Lam Nothing (FunctionBinding {functionBindingSrc0 = Nothing, functionBindingVariable = "_", functionBindingSrc1 = Nothing, functionBindingSrc2 = Nothing, functionBindingAnnotation = Var (V "_" 1)}) (Lam Nothing (FunctionBinding {functionBindingSrc0 = Nothing, functionBindingVariable = "_", functionBindingSrc1 = Nothing, functionBindingSrc2 = Nothing, functionBindingAnnotation = Var (V "_" 1)}) (Var (V "_" 1)))))

α-normalization does not affect free variables:

    >>> alphaNormalize "x"
    Var (V "x" 0)

normalize :: Eq a => Expr s a -> Expr t a Source #

Reduce an expression to its normal form, performing beta reduction

`normalize` does not type-check the expression. You may want to type-check expressions before normalizing them since normalization can convert an ill-typed expression into a well-typed expression.

`normalize` can also fail with `error` if you normalize an ill-typed expression

normalizeWith :: Eq a => Maybe (ReifiedNormalizer a) -> Expr s a -> Expr t a Source #

Reduce an expression to its normal form, performing beta reduction and applying any custom definitions.

`normalizeWith` is designed to be used with function `typeWith`. The `typeWith` function allows typing of Dhall functions in a custom typing context whereas `normalizeWith` allows evaluating Dhall expressions in a custom context.

To be more precise `normalizeWith` applies the given normalizer when it finds an application term that it cannot reduce by other means.

Note that the context used in normalization will determine the properties of normalization. That is, if the functions in custom context are not total then the Dhall language, evaluated with those functions is not total either.

`normalizeWith` can fail with an `error` if you normalize an ill-typed expression

normalizeWithM :: (Monad m, Eq a) => NormalizerM m a -> Expr s a -> m (Expr t a) Source #

This function generalizes `normalizeWith` by allowing the custom normalizer to use an arbitrary `Monad`

`normalizeWithM` can fail with an `error` if you normalize an ill-typed expression

type Normalizer a = NormalizerM Identity a Source #

An variation on `NormalizerM` for pure normalizers

type NormalizerM m a = forall s. Expr s a -> m (Maybe (Expr s a)) Source #

Use this to wrap you embedded functions (see `normalizeWith`) to make them polymorphic enough to be used.

newtype ReifiedNormalizer a Source #

A reified `Normalizer`, which can be stored in structures without running into impredicative polymorphism.

Constructors

ReifiedNormalizer |

Fields

- getReifiedNormalizer :: Normalizer a

judgmentallyEqual :: Eq a => Expr s a -> Expr t a -> Bool Source #

Returns `True` if two expressions are α-equivalent and β-equivalent and `False` otherwise

`judgmentallyEqual` can fail with an `error` if you compare ill-typed expressions

subst :: Var -> Expr s a -> Expr s a -> Expr s a Source #

Substitute all occurrences of a variable with an expression

    subst x C B  ~  B[x := C]

shift :: Int -> Var -> Expr s a -> Expr s a Source #

`shift` is used by both normalization and type-checking to avoid variable capture by shifting variable indices

For example, suppose that you were to normalize the following expression:

    λ(a : Type) → λ(x : a) → (λ(y : a) → λ(x : a) → y) x

If you were to substitute `y` with `x` without shifting any variable indices, then you would get the following incorrect result:

    λ(a : Type) → λ(x : a) → λ(x : a) → x  -- Incorrect normalized form

In order to substitute `x` in place of `y` we need to `shift` `x` by `1` in order to avoid being misinterpreted as the `x` bound by the innermost lambda. If we perform that `shift` then we get the correct result:

    λ(a : Type) → λ(x : a) → λ(x : a) → x@1

As a more worked example, suppose that you were to normalize the following expression:

        λ(a : Type)
    →   λ(f : a → a → a)
    →   λ(x : a)
    →   λ(x : a)
    →   (λ(x : a) → f x x@1) x@1

The correct normalized result would be:

        λ(a : Type)
    →   λ(f : a → a → a)
    →   λ(x : a)
    →   λ(x : a)
    →   f x@1 x

The above example illustrates how we need to both increase and decrease variable indices as part of substitution:

- We need to increase the index of the outer `x@1` to `x@2` before we substitute it into the body of the innermost lambda expression in order to avoid variable capture. This substitution changes the body of the lambda expression to `(f x@2 x@1)`
- We then remove the innermost lambda and therefore decrease the indices of both `x`s in `(f x@2 x@1)` to `(f x@1 x)` in order to reflect that one less `x` variable is now bound within that scope

Formally, `(shift d (V x n) e)` modifies the expression `e` by adding `d` to the indices of all variables named `x` whose indices are greater than `(n + m)`, where `m` is the number of bound variables of the same name within that scope

In practice, `d` is always `1` or `-1` because we either:

- increment variables by `1` to avoid variable capture during substitution
- decrement variables by `1` when deleting lambdas after substitution

`n` starts off at `0` when substitution begins and increments every time we descend into a lambda or let expression that binds a variable of the same name in order to avoid shifting the bound variables by mistake.

isNormalized :: Eq a => Expr s a -> Bool Source #

Quickly check if an expression is in normal form

Given a well-typed expression `e`, ``isNormalized` e` is equivalent to `e == `normalize` e`.

Given an ill-typed expression, `isNormalized` may fail with an error, or evaluate to either False or True!

isNormalizedWith :: (Eq s, Eq a) => Normalizer a -> Expr s a -> Bool Source #

Check if an expression is in a normal form given a context of evaluation. Unlike `isNormalized`, this will fully normalize and traverse through the expression.

It is much more efficient to use `isNormalized`.

`isNormalizedWith` can fail with an `error` if you check an ill-typed expression

denote :: Expr s a -> Expr t a Source #

Remove all `Note` constructors from an `Expr` (i.e. de-`Note`)

This also remove CharacterSet annotations.

renote :: Expr Void a -> Expr s a Source #

The "opposite" of `denote`, like `first absurd` but faster

shallowDenote :: Expr s a -> Expr s a Source #

Remove any outermost `Note` constructors

This is typically used when you want to get the outermost non-`Note` constructor without removing internal `Note` constructors

freeIn :: Eq a => Var -> Expr s a -> Bool Source #

Detect if the given variable is free within the given expression

    >>> "x" `freeIn` "x"
    True
    >>> "x" `freeIn` "y"
    False
    >>> "x" `freeIn` Lam mempty (Syntax.makeFunctionBinding "x" (Const Type)) "x"
    False

# Pretty-printing

pretty :: Pretty a => a -> Text Source #

Pretty-print a value

# Optics

subExpressions :: Applicative f => (Expr s a -> f (Expr s a)) -> Expr s a -> f (Expr s a) Source #

A traversal over the immediate sub-expressions of an expression.

subExpressionsWith :: Applicative f => (a -> f (Expr s b)) -> (Expr s a -> f (Expr s b)) -> Expr s a -> f (Expr s b) Source #

A traversal over the immediate sub-expressions of an expression which allows mapping embedded values

chunkExprs :: Applicative f => (Expr s a -> f (Expr t b)) -> Chunks s a -> f (Chunks t b) Source #

A traversal over the immediate sub-expressions in `Chunks`.

bindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> Binding s a -> f (Binding s b) Source #

Traverse over the immediate `Expr` children in a `Binding`.

recordFieldExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> RecordField s a -> f (RecordField s b) Source #

Traverse over the immediate `Expr` children in a `RecordField`.

functionBindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> FunctionBinding s a -> f (FunctionBinding s b) Source #

Traverse over the immediate `Expr` children in a `FunctionBinding`.

# Let-blocks

multiLet :: Binding s a -> Expr s a -> MultiLet s a Source #

Generate a `MultiLet` from the contents of a `Let`.

In the resulting ``MultiLet` bs e`, `e` is guaranteed not to be a `Let`, but it might be a `(`Note` … (`Let` …))`.

Given parser output, `multiLet` consolidates `let`s that formed a let-block in the original source.

wrapInLets :: Foldable f => f (Binding s a) -> Expr s a -> Expr s a Source #

Wrap let-`Binding`s around an `Expr`.

`wrapInLets` can be understood as an inverse for `multiLet`:

    let MultiLet bs e1 = multiLet b e0

    wrapInLets bs e1 == Let b e0

data MultiLet s a Source #

This type represents 1 or more nested `Let` bindings that have been coalesced together for ease of manipulation

Constructors

MultiLet (NonEmpty (Binding s a)) (Expr s a) |

# Miscellaneous

internalError :: Text -> forall b. b Source #

Utility function used to throw internal errors that should never happen (in theory) but that are not enforced by the type system

reservedIdentifiers :: HashSet Text Source #

The set of reserved identifiers for the Dhall language | Contains also all keywords from "reservedKeywords"

escapeText :: Text -> Text Source #

Escape a `Text` literal using Dhall's escaping rules

Note that the result does not include surrounding quotes

pathCharacter :: Char -> Bool Source #

Returns `True` if the given `Char` is valid within an unquoted path component

This is exported for reuse within the `Dhall.Parser.Token` module

throws :: (Exception e, MonadIO io) => Either e a -> io a Source #

Convenience utility for converting `Either`-based exceptions to `IO`-based exceptions

textShow :: Text -> Text Source #

Utility that powers the `Text/show` built-in

censorExpression :: Expr Src a -> Expr Src a Source #

Utility used to implement the `--censor` flag, by:

- Replacing all `Src` text with spaces
- Replacing all `Text` literals inside type errors with spaces

censorText :: Text -> Text Source #

Utility used to censor `Text` by replacing all characters with a space