Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Spago.Dhall
Synopsis
- data TemplateComments
- type DhallExpr a = Expr Src a
- data ReadError a where
- ConfigIsNotRecord :: Typeable a => DhallExpr a -> ReadError a
- PackagesIsNotRecord :: Typeable a => DhallExpr a -> ReadError a
- DependenciesIsNotList :: Typeable a => DhallExpr a -> ReadError a
- ExprIsNotTextLit :: Typeable a => DhallExpr a -> ReadError a
- CannotParsePackageSet :: Typeable a => DhallExpr a -> ReadError a
- ImportCannotBeUpdated :: Typeable a => Import -> ReadError a
- RequiredKeyMissing :: Typeable a => Text -> Map Text (DhallExpr a) -> ReadError a
- format :: MonadIO m => Text -> m ()
- prettyWithHeader :: Pretty a => Header -> DhallExpr a -> Text
- processComments :: TemplateComments -> Text -> Text
- stripComments :: Text -> Text
- extractRecordValues :: Map Text (RecordField Src a) -> Map Text (Expr Src a)
- readImports :: Text -> IO [Import]
- readRawExpr :: Text -> IO (Maybe (Header, DhallExpr Import))
- writeRawExpr :: Text -> (Header, DhallExpr Import) -> IO ()
- toTextLit :: Text -> DhallExpr a
- fromTextLit :: Typeable a => DhallExpr a -> Either (ReadError a) Text
- requireKey :: (Typeable b, Pretty b, MonadThrow m) => Map Text (DhallExpr b) -> Text -> (DhallExpr b -> m a) -> m a
- requireTypedKey :: (MonadIO m, MonadThrow m) => Map Text (DhallExpr Void) -> Text -> Decoder a -> m a
- maybeTypedKey :: (MonadIO m, MonadThrow m) => Map Text (DhallExpr Void) -> Text -> Decoder a -> m (Maybe a)
- data Natural
- data Result (f :: Type -> Type)
- class Generic a
- data Const
- data Text
- data Vector a
- data Input
- newtype Header = Header Text
- newtype Directory = Directory {
- components :: [Text]
- data Seq a
- data Decoder a = Decoder {}
- 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
- data Import = Import {}
- data MultiLet s a = MultiLet (NonEmpty (Binding s a)) (Expr s a)
- class FromDhall a where
- autoWith :: InputNormalizer -> Decoder a
- newtype DhallErrors e = DhallErrors {}
- data WithComponent
- data FieldSelection s = FieldSelection {}
- data PreferAnnotation
- newtype DhallDouble = DhallDouble {}
- data Var = V Text !Int
- data Chunks s a = Chunks [(Text, Expr s a)] Text
- 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)
- | Bytes
- | BytesLit ByteString
- | 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
- | DateShow
- | Time
- | TimeLiteral TimeOfDay Word
- | TimeShow
- | TimeZone
- | TimeZoneLiteral TimeZone
- | TimeZoneShow
- | 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 (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
- data RecordField s a = RecordField {
- recordFieldSrc0 :: Maybe s
- recordFieldValue :: Expr s a
- recordFieldSrc1 :: Maybe s
- recordFieldSrc2 :: Maybe s
- data FunctionBinding s a = FunctionBinding {}
- data ImportHashed = ImportHashed {}
- data ImportMode
- data ImportType
- data URL = URL {}
- data Scheme
- data FilePrefix
- data File = File {}
- newtype ReifiedNormalizer a = ReifiedNormalizer {}
- type Normalizer a = NormalizerM Identity a
- type NormalizerM (m :: Type -> Type) a = forall s. Expr s a -> m (Maybe (Expr s a))
- data MultipleCheckFailed = MultipleCheckFailed {}
- newtype CheckFailed = CheckFailed Input
- data OutputMode
- data Output
- data Transitivity
- data Censor
- data SingletonConstructors
- newtype InputNormalizer = InputNormalizer {}
- data InterpretOptions = InterpretOptions {}
- newtype UnionEncoder a = UnionEncoder (Product (Const (Map Text (Expr Src Void)) :: Type -> Type) (Op (Text, Expr Src Void)) a)
- newtype RecordEncoder a = RecordEncoder (Map Text (Encoder a))
- class GenericToDhall (f :: Type -> Type) where
- genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (f a))
- type Inject = ToDhall
- class ToDhall a where
- injectWith :: InputNormalizer -> Encoder a
- data Encoder a = Encoder {}
- data ExpectedTypeError = RecursiveTypeError
- type ExpectedTypeErrors = DhallErrors ExpectedTypeError
- type Expector = Validation ExpectedTypeErrors
- data InvalidDecoder s a = InvalidDecoder {
- invalidDecoderExpected :: Expr s a
- invalidDecoderExpression :: Expr s a
- type MonadicExtractor s a = Either (ExtractErrors s a)
- type Extractor s a = Validation (ExtractErrors s a)
- data ExtractError s a
- type ExtractErrors s a = DhallErrors (ExtractError s a)
- newtype UnionDecoder a = UnionDecoder (Compose (Map Text) Decoder a)
- newtype RecordDecoder a = RecordDecoder (Product (Const (Map Text (Expector (Expr Src Void))) :: Type -> Type) (Compose ((->) (Expr Src Void)) (Extractor Src Void)) a)
- class GenericFromDhallUnion (t :: k) (f :: k1 -> Type) where
- genericUnionAutoWithNormalizer :: forall (a :: k1). Proxy t -> InputNormalizer -> InterpretOptions -> UnionDecoder (f a)
- class GenericFromDhall (t :: k) (f :: k1 -> Type) where
- genericAutoWithNormalizer :: forall (a :: k1). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (f a))
- type Interpret = FromDhall
- class HasEvaluateSettings s where
- evaluateSettings :: Functor f => LensLike' f s EvaluateSettings
- data EvaluateSettings
- data InputSettings
- scientific :: Decoder Scientific
- vector :: Decoder a -> Decoder (Vector a)
- void :: Decoder Void
- map :: Ord k => Decoder k -> Decoder v -> Decoder (Map k v)
- function :: Encoder a -> Decoder b -> Decoder (a -> b)
- unit :: Decoder ()
- insert :: Pretty a => a -> Doc Ann
- union :: UnionDecoder a -> Decoder a
- pair :: Decoder a -> Decoder b -> Decoder (a, b)
- bool :: Decoder Bool
- list :: Decoder a -> Decoder [a]
- (>*<) :: Divisible f => f a -> f b -> f (a, b)
- lazyText :: Decoder Text
- shortText :: Decoder ShortText
- string :: Decoder String
- int8 :: Decoder Int8
- int16 :: Decoder Int16
- int32 :: Decoder Int32
- int64 :: Decoder Int64
- int :: Decoder Int
- word8 :: Decoder Word8
- word16 :: Decoder Word16
- word32 :: Decoder Word32
- word64 :: Decoder Word64
- word :: Decoder Word
- integer :: Decoder Integer
- double :: Decoder Double
- day :: Decoder Day
- localTime :: Decoder LocalTime
- utcTime :: Decoder UTCTime
- timeOfDay :: Decoder TimeOfDay
- zonedTime :: Decoder ZonedTime
- normalize :: Eq a => Expr s a -> Expr t a
- sequence :: Decoder a -> Decoder (Seq a)
- shift :: Int -> Var -> Expr s a -> Expr s a
- (>$<) :: Contravariant f => (a -> b) -> f b -> f a
- maybe :: Decoder a -> Decoder (Maybe a)
- typeError :: Expector (Expr s a) -> Expr s a -> Extractor s a b
- internalError :: Text -> forall b. b
- input :: Decoder a -> Text -> IO a
- makeFieldSelection :: Text -> FieldSelection s
- makeRecordField :: Expr s a -> RecordField s a
- recordFieldExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> RecordField s a -> f (RecordField s b)
- makeFunctionBinding :: Text -> Expr s a -> FunctionBinding s a
- functionBindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> FunctionBinding s a -> f (FunctionBinding s b)
- makeBinding :: Text -> Expr s a -> Binding s a
- bindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> Binding s a -> f (Binding s b)
- snip :: Text -> Text
- chunkExprs :: Applicative f => (Expr s a -> f (Expr t b)) -> Chunks s a -> f (Chunks t b)
- multiLet :: Binding s a -> Expr s a -> MultiLet s a
- wrapInLets :: Foldable f => f (Binding s a) -> Expr s a -> Expr s a
- 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)
- denote :: Expr s a -> Expr t a
- renote :: Expr Void a -> Expr s a
- shallowDenote :: Expr s a -> Expr s a
- reservedIdentifiers :: HashSet Text
- pathCharacter :: Char -> Bool
- textShow :: Text -> Text
- judgmentallyEqual :: Eq a => Expr s a -> Expr t a -> Bool
- subst :: Var -> Expr s a -> Expr s a -> Expr s a
- alphaNormalize :: Expr s a -> Expr s 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)
- isNormalizedWith :: (Eq s, Eq a) => Normalizer a -> Expr s a -> Bool
- isNormalized :: Eq a => Expr s a -> Bool
- freeIn :: Eq a => Var -> Expr s a -> Bool
- escapeText :: Text -> Text
- censorExpression :: Expr Src a -> Expr Src a
- censorText :: Text -> Text
- throws :: (Exception e, MonadIO io) => Either e a -> io a
- snipDoc :: Doc Ann -> Doc a
- _ERROR :: IsString string => string
- handleMultipleChecksFailed :: (Foldable t, Traversable t) => Text -> Text -> (a -> IO (Either CheckFailed ())) -> t a -> IO ()
- getExpression :: Censor -> Input -> IO (Expr Src Import)
- getExpressionAndHeader :: Censor -> Input -> IO (Header, Expr Src Import)
- getExpressionAndHeaderFromStdinText :: Censor -> String -> Text -> IO (Header, Expr Src Import)
- renderExpression :: Pretty a => CharacterSet -> Bool -> Maybe FilePath -> Expr Src a -> IO ()
- defaultInputNormalizer :: InputNormalizer
- defaultInterpretOptions :: InterpretOptions
- inject :: ToDhall a => Encoder a
- genericToDhall :: (Generic a, GenericToDhall (Rep a)) => Encoder a
- genericToDhallWith :: (Generic a, GenericToDhall (Rep a)) => InterpretOptions -> Encoder a
- genericToDhallWithInputNormalizer :: (Generic a, GenericToDhall (Rep a)) => InterpretOptions -> InputNormalizer -> Encoder a
- recordEncoder :: RecordEncoder a -> Encoder a
- encodeField :: ToDhall a => Text -> RecordEncoder a
- encodeFieldWith :: Text -> Encoder a -> RecordEncoder a
- unionEncoder :: UnionEncoder a -> Encoder a
- encodeConstructor :: ToDhall a => Text -> UnionEncoder a
- encodeConstructorWith :: Text -> Encoder a -> UnionEncoder a
- (>|<) :: UnionEncoder a -> UnionEncoder b -> UnionEncoder (Either a b)
- substitutions :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Substitutions Src Void)
- normalizer :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Maybe (ReifiedNormalizer Void))
- startingContext :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Context (Expr Src Void))
- auto :: FromDhall a => Decoder a
- genericAuto :: (Generic a, GenericFromDhall a (Rep a)) => Decoder a
- genericAutoWith :: (Generic a, GenericFromDhall a (Rep a)) => InterpretOptions -> Decoder a
- genericAutoWithInputNormalizer :: (Generic a, GenericFromDhall a (Rep a)) => InterpretOptions -> InputNormalizer -> Decoder a
- natural :: Decoder Natural
- shortBytes :: Decoder ShortByteString
- lazyBytes :: Decoder ByteString
- strictBytes :: Decoder ByteString
- strictText :: Decoder Text
- timeZone :: Decoder TimeZone
- dayOfWeek :: Decoder DayOfWeek
- functionWith :: InputNormalizer -> Encoder a -> Decoder b -> Decoder (a -> b)
- setIgnoringDuplicates :: Ord a => Decoder a -> Decoder (Set a)
- hashSetIgnoringDuplicates :: (Hashable a, Ord a) => Decoder a -> Decoder (HashSet a)
- setFromDistinctList :: (Ord a, Show a) => Decoder a -> Decoder (Set a)
- hashSetFromDistinctList :: (Hashable a, Ord a, Show a) => Decoder a -> Decoder (HashSet a)
- hashMap :: (Eq k, Hashable k) => Decoder k -> Decoder v -> Decoder (HashMap k v)
- pairFromMapEntry :: Decoder k -> Decoder v -> Decoder (k, v)
- record :: RecordDecoder a -> Decoder a
- field :: Text -> Decoder a -> RecordDecoder a
- constructor :: Text -> Decoder a -> UnionDecoder a
- showDhallErrors :: Show e => String -> DhallErrors e -> String
- extractError :: Text -> Extractor s a b
- toMonadic :: Extractor s a b -> MonadicExtractor s a b
- fromMonadic :: MonadicExtractor s a b -> Extractor s a b
- defaultInputSettings :: InputSettings
- rootDirectory :: Functor f => LensLike' f InputSettings FilePath
- sourceName :: Functor f => LensLike' f InputSettings FilePath
- defaultEvaluateSettings :: EvaluateSettings
- newManager :: (Functor f, HasEvaluateSettings s) => LensLike' f s (IO Manager)
- inputWithSettings :: InputSettings -> Decoder a -> Text -> IO a
- inputFile :: Decoder a -> FilePath -> IO a
- inputFileWithSettings :: EvaluateSettings -> Decoder a -> FilePath -> IO a
- inputExpr :: Text -> IO (Expr Src Void)
- inputExprWithSettings :: InputSettings -> Text -> IO (Expr Src Void)
- rawInput :: Alternative f => Decoder a -> Expr s Void -> f a
- detailed :: IO a -> IO a
Documentation
data TemplateComments #
Constructors
WithComments | |
NoComments |
Spago configuration cannot be read
Constructors
ConfigIsNotRecord :: Typeable a => DhallExpr a -> ReadError a | the toplevel value is not a record |
PackagesIsNotRecord :: Typeable a => DhallExpr a -> ReadError a | the "packages" key is not a record |
DependenciesIsNotList :: Typeable a => DhallExpr a -> ReadError a | the "dependencies" key is not a list |
ExprIsNotTextLit :: Typeable a => DhallExpr a -> ReadError a | the expression is not a Text Literal |
CannotParsePackageSet :: Typeable a => DhallExpr a -> ReadError a | the packages.dhall could not be parsed |
ImportCannotBeUpdated :: Typeable a => Import -> ReadError a | the Import is not pointing to the right repo |
RequiredKeyMissing :: Typeable a => Text -> Map Text (DhallExpr a) -> ReadError a | a key is missing from a Dhall map |
Instances
(Pretty a, Typeable a) => Exception (ReadError a) # | |
Defined in Spago.Dhall Methods toException :: ReadError a -> SomeException # fromException :: SomeException -> Maybe (ReadError a) # displayException :: ReadError a -> String # | |
Pretty a => Show (ReadError a) # | |
format :: MonadIO m => Text -> m () #
Format a Dhall file in ASCII We first check if it's already formatted, if not we reformat it.
prettyWithHeader :: Pretty a => Header -> DhallExpr a -> Text #
Prettyprint a Dhall expression adding a comment on top
processComments :: TemplateComments -> Text -> Text #
stripComments :: Text -> Text #
extractRecordValues :: Map Text (RecordField Src a) -> Map Text (Expr Src a) #
readImports :: Text -> IO [Import] #
Return a list of all imports starting from a particular file
fromTextLit :: Typeable a => DhallExpr a -> Either (ReadError a) Text #
Casts a Dhall Text literal to a string, or fails
requireKey :: (Typeable b, Pretty b, MonadThrow m) => Map Text (DhallExpr b) -> Text -> (DhallExpr b -> m a) -> m a #
Require a key from a Dhall.Map, and run an action on it if found. If not found, return the name of the key.
requireTypedKey :: (MonadIO m, MonadThrow m) => Map Text (DhallExpr Void) -> Text -> Decoder a -> m a #
Same as requireKey
, but we give it a Dhall.Decoder to automagically decode from
maybeTypedKey :: (MonadIO m, MonadThrow m) => Map Text (DhallExpr Void) -> Text -> Decoder a -> m (Maybe a) #
Try to find a key from a Dhall.Map, and automagically decode the value with the given Dhall.Type
If not found, return Nothing
, if type is incorrect throw error
Instances
FromJSON Natural | |
Defined in Data.Aeson.Types.FromJSON | |
FromJSONKey Natural | |
Defined in Data.Aeson.Types.FromJSON Methods | |
ToJSON Natural | |
ToJSONKey Natural | |
Defined in Data.Aeson.Types.ToJSON | |
Data Natural | |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Natural -> c Natural # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Natural # toConstr :: Natural -> Constr # dataTypeOf :: Natural -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Natural) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Natural) # gmapT :: (forall b. Data b => b -> b) -> Natural -> Natural # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r # gmapQ :: (forall d. Data d => d -> u) -> Natural -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Natural -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Natural -> m Natural # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural # | |
Enum Natural | |
Num Natural | |
Read Natural | |
Integral Natural | |
Defined in GHC.Real | |
Real Natural | |
Defined in GHC.Real Methods toRational :: Natural -> Rational # | |
Show Natural | |
Subtractive Natural | |
Defined in Basement.Numerical.Subtractive Associated Types type Difference Natural # | |
NFData Natural | |
Defined in Control.DeepSeq | |
FromDhall Natural | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Natural # | |
ToDhall Natural | |
Defined in Dhall.Marshal.Encode Methods injectWith :: InputNormalizer -> Encoder Natural # | |
Eq Natural | |
Ord Natural | |
Hashable Natural | |
Defined in Data.Hashable.Class | |
Pretty Natural | |
Defined in Prettyprinter.Internal | |
UniformRange Natural | |
Defined in System.Random.Internal | |
TestCoercion SNat | |
Defined in GHC.TypeNats Methods testCoercion :: forall (a :: k) (b :: k). SNat a -> SNat b -> Maybe (Coercion a b) | |
TestEquality SNat | |
Defined in GHC.TypeNats Methods testEquality :: forall (a :: k) (b :: k). SNat a -> SNat b -> Maybe (a :~: b) | |
Lift Natural | |
HasPosition i s t a b => HasAny (i :: Nat) s t a b | |
Defined in Data.Generics.Product.Any | |
type Difference Natural | |
Defined in Basement.Numerical.Subtractive | |
type Compare (a :: Natural) (b :: Natural) | |
Defined in Data.Type.Ord |
data Result (f :: Type -> Type) #
This type is exactly the same as Fix
except with a different
FromDhall
instance. This intermediate type
simplifies the implementation of the inner loop for the
FromDhall
instance for Fix
.
Instances
FromDhall (f (Result f)) => FromDhall (Result f) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Result f) # | |
ToDhall (f (Result f)) => ToDhall (Result f) | |
Defined in Dhall.Marshal.Encode Methods injectWith :: InputNormalizer -> Encoder (Result f) # |
Instances
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
Instances
Bounded Const | |
Enum Const | |
Defined in Dhall.Syntax.Const | |
Generic Const | |
type Rep Const | |
Defined in Dhall.Syntax.Const |
Instances
Boxed vectors, supporting efficient slicing.
Instances
Path to input
Constructors
StandardInput | |
InputFile FilePath |
A header corresponds to the leading comment at the top of a Dhall file.
The header includes comment characters but is stripped of leading spaces and trailing newlines
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
|
Instances
Data Directory | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Directory -> c Directory # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Directory # toConstr :: Directory -> Constr # dataTypeOf :: Directory -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Directory) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Directory) # gmapT :: (forall b. Data b => b -> b) -> Directory -> Directory # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Directory -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Directory -> r # gmapQ :: (forall d. Data d => d -> u) -> Directory -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Directory -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Directory -> m Directory # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Directory -> m Directory # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Directory -> m Directory # | |
Semigroup Directory | |
Generic Directory | |
Canonicalize Directory |
|
Defined in Dhall.Import Methods canonicalize :: Directory -> Directory | |
type Rep Directory | |
Instances
FromJSON1 Seq | |
ToJSON1 Seq | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Seq a -> Value # liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Seq a] -> Value # liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Seq a -> Encoding # liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Seq a] -> Encoding # liftOmitField :: (a -> Bool) -> Seq a -> Bool # | |
MonadFix Seq | |
Defined in Data.Sequence.Internal | |
MonadZip Seq | |
Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldMap' :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
Eq1 Seq | |
Ord1 Seq | |
Defined in Data.Sequence.Internal Methods liftCompare :: (a -> b -> Ordering) -> Seq a -> Seq b -> Ordering | |
Read1 Seq | |
Defined in Data.Sequence.Internal Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Seq a) liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Seq a] liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Seq a) liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Seq a] | |
Show1 Seq | |
Defined in Data.Sequence.Internal | |
Traversable Seq | |
Alternative Seq | |
Applicative Seq | |
Functor Seq | |
Monad Seq | |
MonadPlus Seq | |
UnzipWith Seq | |
Defined in Data.Sequence.Internal Methods unzipWith' :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b) | |
Hashable1 Seq | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
Adjustable Seq | |
FoldableWithKey Seq | |
Indexable Seq | |
Keyed Seq | |
Lookup Seq | |
TraversableWithKey Seq | |
Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key Seq -> a -> f b) -> Seq a -> f (Seq b) # mapWithKeyM :: Monad m => (Key Seq -> a -> m b) -> Seq a -> m (Seq b) # | |
Zip Seq | |
ZipWithKey Seq | |
Lift a => Lift (Seq a :: Type) | |
FromJSON a => FromJSON (Seq a) | |
Defined in Data.Aeson.Types.FromJSON | |
ToJSON a => ToJSON (Seq a) | |
Data a => Data (Seq a) | |
Defined in Data.Sequence.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Seq a -> c (Seq a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Seq a) # dataTypeOf :: Seq a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Seq a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Seq a)) # gmapT :: (forall b. Data b => b -> b) -> Seq a -> Seq a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQ :: (forall d. Data d => d -> u) -> Seq a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Seq a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # | |
a ~ Char => IsString (Seq a) | |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
Monoid (Seq a) | |
Semigroup (Seq a) | |
IsList (Seq a) | |
Read a => Read (Seq a) | |
Show a => Show (Seq a) | |
NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
FromDhall a => FromDhall (Seq a) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Seq a) # | |
ToDhall a => ToDhall (Seq a) | |
Defined in Dhall.Marshal.Encode Methods injectWith :: InputNormalizer -> Encoder (Seq a) # | |
Eq a => Eq (Seq a) | |
Ord a => Ord (Seq a) | |
Hashable v => Hashable (Seq v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
Ord a => Stream (Seq a) | Since: megaparsec-9.0.0 |
Defined in Text.Megaparsec.Stream Methods tokenToChunk :: Proxy (Seq a) -> Token (Seq a) -> Tokens (Seq a) # tokensToChunk :: Proxy (Seq a) -> [Token (Seq a)] -> Tokens (Seq a) # chunkToTokens :: Proxy (Seq a) -> Tokens (Seq a) -> [Token (Seq a)] # chunkLength :: Proxy (Seq a) -> Tokens (Seq a) -> Int # chunkEmpty :: Proxy (Seq a) -> Tokens (Seq a) -> Bool # take1_ :: Seq a -> Maybe (Token (Seq a), Seq a) # takeN_ :: Int -> Seq a -> Maybe (Tokens (Seq a), Seq a) # takeWhile_ :: (Token (Seq a) -> Bool) -> Seq a -> (Tokens (Seq a), Seq a) # | |
GrowingAppend (Seq a) | |
Defined in Data.MonoTraversable | |
MonoFoldable (Seq a) | |
Defined in Data.MonoTraversable Methods ofoldMap :: Monoid m => (Element (Seq a) -> m) -> Seq a -> m # ofoldr :: (Element (Seq a) -> b -> b) -> b -> Seq a -> b # ofoldl' :: (a0 -> Element (Seq a) -> a0) -> a0 -> Seq a -> a0 # otoList :: Seq a -> [Element (Seq a)] # oall :: (Element (Seq a) -> Bool) -> Seq a -> Bool # oany :: (Element (Seq a) -> Bool) -> Seq a -> Bool # ocompareLength :: Integral i => Seq a -> i -> Ordering # otraverse_ :: Applicative f => (Element (Seq a) -> f b) -> Seq a -> f () # ofor_ :: Applicative f => Seq a -> (Element (Seq a) -> f b) -> f () # omapM_ :: Applicative m => (Element (Seq a) -> m ()) -> Seq a -> m () # oforM_ :: Applicative m => Seq a -> (Element (Seq a) -> m ()) -> m () # ofoldlM :: Monad m => (a0 -> Element (Seq a) -> m a0) -> a0 -> Seq a -> m a0 # ofoldMap1Ex :: Semigroup m => (Element (Seq a) -> m) -> Seq a -> m # ofoldr1Ex :: (Element (Seq a) -> Element (Seq a) -> Element (Seq a)) -> Seq a -> Element (Seq a) # ofoldl1Ex' :: (Element (Seq a) -> Element (Seq a) -> Element (Seq a)) -> Seq a -> Element (Seq a) # headEx :: Seq a -> Element (Seq a) # lastEx :: Seq a -> Element (Seq a) # unsafeHead :: Seq a -> Element (Seq a) # unsafeLast :: Seq a -> Element (Seq a) # maximumByEx :: (Element (Seq a) -> Element (Seq a) -> Ordering) -> Seq a -> Element (Seq a) # minimumByEx :: (Element (Seq a) -> Element (Seq a) -> Ordering) -> Seq a -> Element (Seq a) # | |
MonoFunctor (Seq a) | |
MonoPointed (Seq a) | |
MonoTraversable (Seq a) | |
IsSequence (Seq a) | |
Defined in Data.Sequences Methods fromList :: [Element (Seq a)] -> Seq a # lengthIndex :: Seq a -> Index (Seq a) # break :: (Element (Seq a) -> Bool) -> Seq a -> (Seq a, Seq a) # span :: (Element (Seq a) -> Bool) -> Seq a -> (Seq a, Seq a) # dropWhile :: (Element (Seq a) -> Bool) -> Seq a -> Seq a # takeWhile :: (Element (Seq a) -> Bool) -> Seq a -> Seq a # splitAt :: Index (Seq a) -> Seq a -> (Seq a, Seq a) # unsafeSplitAt :: Index (Seq a) -> Seq a -> (Seq a, Seq a) # take :: Index (Seq a) -> Seq a -> Seq a # unsafeTake :: Index (Seq a) -> Seq a -> Seq a # drop :: Index (Seq a) -> Seq a -> Seq a # unsafeDrop :: Index (Seq a) -> Seq a -> Seq a # dropEnd :: Index (Seq a) -> Seq a -> Seq a # partition :: (Element (Seq a) -> Bool) -> Seq a -> (Seq a, Seq a) # uncons :: Seq a -> Maybe (Element (Seq a), Seq a) # unsnoc :: Seq a -> Maybe (Seq a, Element (Seq a)) # filter :: (Element (Seq a) -> Bool) -> Seq a -> Seq a # filterM :: Monad m => (Element (Seq a) -> m Bool) -> Seq a -> m (Seq a) # replicate :: Index (Seq a) -> Element (Seq a) -> Seq a # replicateM :: Monad m => Index (Seq a) -> m (Element (Seq a)) -> m (Seq a) # groupBy :: (Element (Seq a) -> Element (Seq a) -> Bool) -> Seq a -> [Seq a] # groupAllOn :: Eq b => (Element (Seq a) -> b) -> Seq a -> [Seq a] # subsequences :: Seq a -> [Seq a] # permutations :: Seq a -> [Seq a] # tailMay :: Seq a -> Maybe (Seq a) # initMay :: Seq a -> Maybe (Seq a) # unsafeTail :: Seq a -> Seq a # unsafeInit :: Seq a -> Seq a # index :: Seq a -> Index (Seq a) -> Maybe (Element (Seq a)) # indexEx :: Seq a -> Index (Seq a) -> Element (Seq a) # unsafeIndex :: Seq a -> Index (Seq a) -> Element (Seq a) # splitWhen :: (Element (Seq a) -> Bool) -> Seq a -> [Seq a] # | |
SemiSequence (Seq a) | |
type Key Seq | |
type Item (Seq a) | |
Defined in Data.Sequence.Internal | |
type Token (Seq a) | |
Defined in Text.Megaparsec.Stream | |
type Tokens (Seq a) | |
Defined in Text.Megaparsec.Stream | |
type Element (Seq a) | |
Defined in Data.MonoTraversable | |
type Index (Seq a) | |
Defined in Data.Sequences |
A (Decoder a)
represents a way to marshal a value of type 'a'
from Dhall
into Haskell.
You can produce Decoder
s either explicitly:
example :: Decoder (Vector Text) example = vector text
... or implicitly using auto
:
example :: Decoder (Vector Text) example = auto
You can consume Decoder
s using the input
function:
input :: Decoder a -> Text -> IO a
Constructors
Decoder | |
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 theA
comment.variable
is"x"
bindingSrc1
corresponds to theB
comment.annotation
isJust
a pair, corresponding to theC
comment andBool
.bindingSrc2
corresponds to theD
comment.value
corresponds toTrue
.
Constructors
Binding | |
Fields
|
Instances
Generic (Binding s a) | |
type Rep (Binding s a) | |
Defined in Dhall.Syntax.Binding type Rep (Binding s a) = D1 ('MetaData "Binding" "Dhall.Syntax.Binding" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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)))))) |
Reference to an external resource
Constructors
Import | |
Fields |
Instances
Data Import | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Import -> c Import # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Import # toConstr :: Import -> Constr # dataTypeOf :: Import -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Import) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Import) # gmapT :: (forall b. Data b => b -> b) -> Import -> Import # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Import -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Import -> r # gmapQ :: (forall d. Data d => d -> u) -> Import -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Import -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Import -> m Import # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Import -> m Import # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Import -> m Import # | |
Semigroup Import | |
Generic Import | |
Canonicalize Import | |
Defined in Dhall.Import Methods canonicalize :: Import -> Import | |
type Rep Import | |
Defined in Dhall.Syntax.Import type Rep Import = D1 ('MetaData "Import" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" 'False) (C1 ('MetaCons "Import" 'PrefixI 'True) (S1 ('MetaSel ('Just "importHashed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImportHashed) :*: S1 ('MetaSel ('Just "importMode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImportMode))) |
This type represents 1 or more nested Let
bindings that have been
coalesced together for ease of manipulation
Any value that implements FromDhall
can be automatically decoded based on
the inferred return type of input
.
>>>
input auto "[1, 2, 3]" :: IO (Vector Natural)
[1,2,3]>>>
input auto "toMap { a = False, b = True }" :: IO (Map Text Bool)
fromList [("a",False),("b",True)]
This class auto-generates a default implementation for types that
implement Generic
. This does not auto-generate an instance for recursive
types.
The default instance can be tweaked using genericAutoWith
/genericAutoWithInputNormalizer
and custom InterpretOptions
, or using
DerivingVia
and Codec
from Dhall.Deriving.
Minimal complete definition
Nothing
Methods
autoWith :: InputNormalizer -> Decoder a #
Instances
FromDhall Void | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Void # | |
FromDhall Int16 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Int16 # | |
FromDhall Int32 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Int32 # | |
FromDhall Int64 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Int64 # | |
FromDhall Int8 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Int8 # | |
FromDhall Word16 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Word16 # | |
FromDhall Word32 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Word32 # | |
FromDhall Word64 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Word64 # | |
FromDhall Word8 | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Word8 # | |
FromDhall ByteString | |
Defined in Dhall.Marshal.Decode Methods | |
FromDhall ByteString | |
Defined in Dhall.Marshal.Decode Methods | |
FromDhall ShortByteString | |
Defined in Dhall.Marshal.Decode Methods | |
FromDhall Scientific | |
Defined in Dhall.Marshal.Decode Methods | |
FromDhall PackageName # | |
Defined in Spago.Types Methods | |
FromDhall Repo # | |
Defined in Spago.Types Methods autoWith :: InputNormalizer -> Decoder Repo # | |
FromDhall SourcePath # | |
Defined in Spago.Types Methods | |
FromDhall Text | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Text # | |
FromDhall Text | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Text # | |
FromDhall ShortText | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder ShortText # | |
FromDhall Day | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Day # | |
FromDhall DayOfWeek | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder DayOfWeek # | |
FromDhall UTCTime | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder UTCTime # | |
FromDhall LocalTime | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder LocalTime # | |
FromDhall TimeOfDay | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder TimeOfDay # | |
FromDhall TimeZone | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder TimeZone # | |
FromDhall ZonedTime | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder ZonedTime # | |
FromDhall Integer | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Integer # | |
FromDhall Natural | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Natural # | |
FromDhall () | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder () # | |
FromDhall Bool | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Bool # | |
FromDhall Double | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Double # | |
FromDhall Int | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Int # | |
FromDhall Word | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder Word # | |
ToDhall x => FromDhall (Equivalence x) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Equivalence x) # | |
ToDhall x => FromDhall (Predicate x) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Predicate x) # | |
FromDhall a => FromDhall (Identity a) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Identity a) # | |
FromDhall a => FromDhall (Seq a) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Seq a) # | |
(FromDhall a, Ord a, Show a) => FromDhall (Set a) | Note that this instance will throw errors in the presence of duplicates in
the list. To ignore duplicates, use |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Set a) # | |
(Functor f, FromDhall (f (Result f))) => FromDhall (Fix f) | You can use this instance to marshal recursive types from Dhall to Haskell. Here is an example use of this instance: {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TemplateHaskell #-} import Data.Fix (Fix(..)) import Data.Text (Text) import Dhall (FromDhall) import GHC.Generics (Generic) import Numeric.Natural (Natural) import qualified Data.Fix as Fix import qualified Data.Functor.Foldable as Foldable import qualified Data.Functor.Foldable.TH as TH import qualified Dhall import qualified NeatInterpolation data Expr = Lit Natural | Add Expr Expr | Mul Expr Expr deriving (Show) TH.makeBaseFunctor ''Expr deriving instance Generic (ExprF a) deriving instance FromDhall a => FromDhall (ExprF a) example :: Text example = [NeatInterpolation.text| \(Expr : Type) -> let ExprF = < LitF : Natural | AddF : { _1 : Expr, _2 : Expr } | MulF : { _1 : Expr, _2 : Expr } > in \(Fix : ExprF -> Expr) -> let Lit = \(x : Natural) -> Fix (ExprF.LitF x) let Add = \(x : Expr) -> \(y : Expr) -> Fix (ExprF.AddF { _1 = x, _2 = y }) let Mul = \(x : Expr) -> \(y : Expr) -> Fix (ExprF.MulF { _1 = x, _2 = y }) in Add (Mul (Lit 3) (Lit 7)) (Add (Lit 1) (Lit 2)) |] convert :: Fix ExprF -> Expr convert = Fix.foldFix Foldable.embed main :: IO () main = do x <- Dhall.input Dhall.auto example :: IO (Fix ExprF) print (convert x :: Expr) |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Fix f) # | |
FromDhall (f (Result f)) => FromDhall (Result f) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Result f) # | |
(FromDhall a, Hashable a, Ord a, Show a) => FromDhall (HashSet a) | Note that this instance will throw errors in the presence of duplicates in
the list. To ignore duplicates, use |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (HashSet a) # | |
FromDhall a => FromDhall (Vector a) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Vector a) # | |
FromDhall a => FromDhall (Maybe a) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Maybe a) # | |
FromDhall [Char] | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder [Char] # | |
FromDhall a => FromDhall [a] | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder [a] # | |
(FromDhall b, ToDhall x) => FromDhall (Op b x) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Op b x) # | |
(Ord k, FromDhall k, FromDhall v) => FromDhall (Map k v) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (Map k v) # | |
(Eq k, Hashable k, FromDhall k, FromDhall v) => FromDhall (HashMap k v) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (HashMap k v) # | |
(FromDhall a, FromDhall b) => FromDhall (a, b) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (a, b) # | |
(ToDhall a, FromDhall b) => FromDhall (a -> b) | |
Defined in Dhall.Marshal.Decode Methods autoWith :: InputNormalizer -> Decoder (a -> b) # |
newtype DhallErrors e #
A newtype suitable for collecting one or more errors.
Constructors
DhallErrors | |
Instances
data WithComponent #
A path component for a with
expression
Constructors
WithLabel Text | |
WithQuestion |
Instances
Generic WithComponent | |
Defined in Dhall.Syntax.Types Associated Types type Rep WithComponent :: Type -> Type # | |
type Rep WithComponent | |
Defined in Dhall.Syntax.Types type Rep WithComponent = D1 ('MetaData "WithComponent" "Dhall.Syntax.Types" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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 FieldSelection s #
Record the field on a selector-expression
For example,
e . {- A -} x {- B -}
… will be instantiated as follows:
fieldSelectionSrc0
corresponds to theA
commentfieldSelectionLabel
corresponds tox
fieldSelectionSrc1
corresponds to theB
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 Dhall.Src.Src' (s =
) to be consistent with similar
data types such as Src
Binding
, for example.
Constructors
FieldSelection | |
Fields
|
Instances
Generic (FieldSelection s) | |
Defined in Dhall.Syntax.Types Associated Types type Rep (FieldSelection s) :: Type -> Type # Methods from :: FieldSelection s -> Rep (FieldSelection s) x # to :: Rep (FieldSelection s) x -> FieldSelection s # | |
type Rep (FieldSelection s) | |
Defined in Dhall.Syntax.Types type Rep (FieldSelection s) = D1 ('MetaData "FieldSelection" "Dhall.Syntax.Types" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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))))) |
data PreferAnnotation #
Used to record the origin of a //
operator (i.e. from source code or a
product of desugaring)
Constructors
PreferFromSource | |
PreferFromCompletion |
Instances
Generic PreferAnnotation | |
Defined in Dhall.Syntax.Types Associated Types type Rep PreferAnnotation :: Type -> Type # Methods from :: PreferAnnotation -> Rep PreferAnnotation x # to :: Rep PreferAnnotation x -> PreferAnnotation # | |
type Rep PreferAnnotation | |
Defined in Dhall.Syntax.Types type Rep PreferAnnotation = D1 ('MetaData "PreferAnnotation" "Dhall.Syntax.Types" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" 'False) (C1 ('MetaCons "PreferFromSource" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PreferFromCompletion" 'PrefixI 'False) (U1 :: Type -> Type)) |
newtype DhallDouble #
This wrapper around Double
exists for its Eq
instance which is
defined via the binary encoding of Dhall Double
s.
Constructors
DhallDouble | |
Fields |
Instances
Generic DhallDouble | |
Defined in Dhall.Syntax.Types Associated Types type Rep DhallDouble :: Type -> Type # | |
type Rep DhallDouble | |
Defined in Dhall.Syntax.Types |
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.
Instances
IsString Var | |
Defined in Dhall.Syntax.Var Methods fromString :: String -> Var # | |
Generic Var | |
type Rep Var | |
Defined in Dhall.Syntax.Var type Rep Var = D1 ('MetaData "Var" "Dhall.Syntax.Var" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" 'False) (C1 ('MetaCons "V" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int))) |
The body of an interpolated Text
literal
Instances
IsString (Chunks s a) | |
Defined in Dhall.Syntax.Chunks Methods fromString :: String -> Chunks s a # | |
Monoid (Chunks s a) | |
Semigroup (Chunks s a) | |
Generic (Chunks s a) | |
type Rep (Chunks s a) | |
Defined in Dhall.Syntax.Chunks type Rep (Chunks s a) = D1 ('MetaData "Chunks" "Dhall.Syntax.Chunks" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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))) |
Syntax tree for expressions
The s
type parameter is used to track the presence or absence of
Src
spans:
- If
s =
then the code may containsSrc
Src
spans (either in aNote
constructor or inline within another constructor, likeLet
) - If
s =
then the code has noVoid
Src
spans
The a
type parameter is used to track the presence or absence of imports
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 See |
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 |
Bytes | Bytes ~ Bytes |
BytesLit ByteString | BytesLit "\x00\xFF" ~ 0x"00FF" |
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 |
DateShow | DateShow ~ Date/show |
Time | Time ~ Time |
TimeLiteral | TimeLiteral (TimeOfDay hh mm ss) _ ~ hh:mm:ss |
TimeShow | |
TimeZone | TimeZone ~ TimeZone |
TimeZoneLiteral TimeZone | TimeZoneLiteral (TimeZone ( 60 * _HH + _MM) _ _) ~ +HH:MM | > TimeZoneLiteral (TimeZone (-60 * _HH + _MM) _ _) ~ -HH:MM |
TimeZoneShow | TimeZoneShow ~ TimeZone/Show |
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
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 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 (Expr s a) (Expr s a) | Prefer _ _ x y ~ x ⫽ y |
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
IsString (Expr s a) | |
Defined in Dhall.Syntax.Expr Methods fromString :: String -> Expr s a # | |
Generic (Expr s a) | |
type Rep (Expr s a) | |
Defined in Dhall.Syntax.Expr type Rep (Expr s a) = D1 ('MetaData "Expr" "Dhall.Syntax.Expr" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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 "Bytes" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "BytesLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)) :+: 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 "DateShow" 'PrefixI 'False) (U1 :: Type -> Type) :+: 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 "TimeShow" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (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 "TimeZoneShow" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((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)) :*: (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))))))))) |
data RecordField s a #
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 theA
comment.recordFieldValue
isT
recordFieldSrc1
corresponds to theB
comment.recordFieldSrc2
corresponds to theC
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 theA
comment.recordFieldValue
corresponds to(Var "x")
recordFieldSrc1
corresponds to theB
comment.recordFieldSrc2
will beNothing
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
andb
field,recordfieldSrc2
isNothing
- For the
a
field: recordFieldSrc0
corresponds to theA
commentrecordFieldSrc1
corresponds to theB
comment- For the
b
field: recordFieldSrc0
corresponds to theC
commentrecordFieldSrc1
corresponds to theD
comment- For the
c
field: recordFieldSrc0
corresponds to theE
commentrecordFieldSrc1
corresponds to theF
commentrecordFieldSrc2
corresponds to theG
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
|
Instances
Generic (RecordField s a) | |
Defined in Dhall.Syntax.RecordField Associated Types type Rep (RecordField s a) :: Type -> Type # Methods from :: RecordField s a -> Rep (RecordField s a) x # to :: Rep (RecordField s a) x -> RecordField s a # | |
type Rep (RecordField s a) | |
Defined in Dhall.Syntax.RecordField type Rep (RecordField s a) = D1 ('MetaData "RecordField" "Dhall.Syntax.RecordField" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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))))) |
data FunctionBinding s a #
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 theA
commentfunctionBindingVariable
isa
functionBindingSrc1
corresponds to theB
commentfunctionBindingSrc2
corresponds to theC
commentfunctionBindingAnnotation
isT
Constructors
FunctionBinding | |
Fields
|
Instances
Generic (FunctionBinding s a) | |
Defined in Dhall.Syntax.FunctionBinding Associated Types type Rep (FunctionBinding s a) :: Type -> Type # Methods from :: FunctionBinding s a -> Rep (FunctionBinding s a) x # to :: Rep (FunctionBinding s a) x -> FunctionBinding s a # | |
type Rep (FunctionBinding s a) | |
Defined in Dhall.Syntax.FunctionBinding type Rep (FunctionBinding s a) = D1 ('MetaData "FunctionBinding" "Dhall.Syntax.FunctionBinding" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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)))))) |
data ImportHashed #
A ImportType
extended with an optional hash for semantic integrity checks
Constructors
ImportHashed | |
Fields |
Instances
Data ImportHashed | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImportHashed -> c ImportHashed # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImportHashed # toConstr :: ImportHashed -> Constr # dataTypeOf :: ImportHashed -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImportHashed) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImportHashed) # gmapT :: (forall b. Data b => b -> b) -> ImportHashed -> ImportHashed # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImportHashed -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImportHashed -> r # gmapQ :: (forall d. Data d => d -> u) -> ImportHashed -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportHashed -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImportHashed -> m ImportHashed # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportHashed -> m ImportHashed # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportHashed -> m ImportHashed # | |
Semigroup ImportHashed | |
Defined in Dhall.Syntax.Import Methods (<>) :: ImportHashed -> ImportHashed -> ImportHashed # sconcat :: NonEmpty ImportHashed -> ImportHashed # stimes :: Integral b => b -> ImportHashed -> ImportHashed # | |
Generic ImportHashed | |
Defined in Dhall.Syntax.Import Associated Types type Rep ImportHashed :: Type -> Type # | |
Canonicalize ImportHashed | |
Defined in Dhall.Import Methods | |
type Rep ImportHashed | |
Defined in Dhall.Syntax.Import type Rep ImportHashed = D1 ('MetaData "ImportHashed" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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 #
How to interpret the import's contents (i.e. as Dhall code or raw text)
Instances
Data ImportMode | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImportMode -> c ImportMode # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImportMode # toConstr :: ImportMode -> Constr # dataTypeOf :: ImportMode -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImportMode) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImportMode) # gmapT :: (forall b. Data b => b -> b) -> ImportMode -> ImportMode # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImportMode -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImportMode -> r # gmapQ :: (forall d. Data d => d -> u) -> ImportMode -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportMode -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImportMode -> m ImportMode # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportMode -> m ImportMode # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportMode -> m ImportMode # | |
Generic ImportMode | |
Defined in Dhall.Syntax.Import Associated Types type Rep ImportMode :: Type -> Type # | |
type Rep ImportMode | |
Defined in Dhall.Syntax.Import type Rep ImportMode = D1 ('MetaData "ImportMode" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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) :+: C1 ('MetaCons "RawBytes" 'PrefixI 'False) (U1 :: Type -> Type))) |
data ImportType #
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
Data ImportType | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImportType -> c ImportType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImportType # toConstr :: ImportType -> Constr # dataTypeOf :: ImportType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImportType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImportType) # gmapT :: (forall b. Data b => b -> b) -> ImportType -> ImportType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImportType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImportType -> r # gmapQ :: (forall d. Data d => d -> u) -> ImportType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImportType -> m ImportType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportType -> m ImportType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportType -> m ImportType # | |
Semigroup ImportType | |
Defined in Dhall.Syntax.Import Methods (<>) :: ImportType -> ImportType -> ImportType # sconcat :: NonEmpty ImportType -> ImportType # stimes :: Integral b => b -> ImportType -> ImportType # | |
Generic ImportType | |
Defined in Dhall.Syntax.Import Associated Types type Rep ImportType :: Type -> Type # | |
Canonicalize ImportType | |
Defined in Dhall.Import Methods canonicalize :: ImportType -> ImportType | |
type Rep ImportType | |
Defined in Dhall.Syntax.Import type Rep ImportType = D1 ('MetaData "ImportType" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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))) |
This type stores all of the components of a remote import
Constructors
URL | |
Instances
Data URL | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URL -> c URL # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URL # dataTypeOf :: URL -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URL) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URL) # gmapT :: (forall b. Data b => b -> b) -> URL -> URL # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URL -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URL -> r # gmapQ :: (forall d. Data d => d -> u) -> URL -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> URL -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> URL -> m URL # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URL -> m URL # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URL -> m URL # | |
Generic URL | |
type Rep URL | |
Defined in Dhall.Syntax.Import type Rep URL = D1 ('MetaData "URL" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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))))))) |
The URI scheme
Instances
Data Scheme | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Scheme -> c Scheme # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Scheme # toConstr :: Scheme -> Constr # dataTypeOf :: Scheme -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Scheme) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Scheme) # gmapT :: (forall b. Data b => b -> b) -> Scheme -> Scheme # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Scheme -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Scheme -> r # gmapQ :: (forall d. Data d => d -> u) -> Scheme -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Scheme -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Scheme -> m Scheme # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Scheme -> m Scheme # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Scheme -> m Scheme # | |
Generic Scheme | |
type Rep Scheme | |
data FilePrefix #
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
Data FilePrefix | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FilePrefix -> c FilePrefix # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FilePrefix # toConstr :: FilePrefix -> Constr # dataTypeOf :: FilePrefix -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FilePrefix) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FilePrefix) # gmapT :: (forall b. Data b => b -> b) -> FilePrefix -> FilePrefix # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FilePrefix -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FilePrefix -> r # gmapQ :: (forall d. Data d => d -> u) -> FilePrefix -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FilePrefix -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FilePrefix -> m FilePrefix # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FilePrefix -> m FilePrefix # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FilePrefix -> m FilePrefix # | |
Generic FilePrefix | |
Defined in Dhall.Syntax.Import Associated Types type Rep FilePrefix :: Type -> Type # | |
type Rep FilePrefix | |
Defined in Dhall.Syntax.Import type Rep FilePrefix = D1 ('MetaData "FilePrefix" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" '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))) |
Instances
Data File | |
Defined in Dhall.Syntax.Import Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> File -> c File # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c File # dataTypeOf :: File -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c File) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c File) # gmapT :: (forall b. Data b => b -> b) -> File -> File # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> File -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> File -> r # gmapQ :: (forall d. Data d => d -> u) -> File -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> File -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> File -> m File # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> File -> m File # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> File -> m File # | |
Semigroup File | |
Generic File | |
Canonicalize File | |
Defined in Dhall.Import Methods canonicalize :: File -> File | |
type Rep File | |
Defined in Dhall.Syntax.Import type Rep File = D1 ('MetaData "File" "Dhall.Syntax.Import" "dhall-1.42.0-KYLP0Bk1OLT52T5U2EOzRV" 'False) (C1 ('MetaCons "File" 'PrefixI 'True) (S1 ('MetaSel ('Just "directory") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Directory) :*: S1 ('MetaSel ('Just "file") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) |
newtype ReifiedNormalizer a #
A reified Normalizer
, which can be stored in structures without
running into impredicative polymorphism.
Constructors
ReifiedNormalizer | |
Fields |
type Normalizer a = NormalizerM Identity a #
An variation on NormalizerM
for pure normalizers
type NormalizerM (m :: Type -> Type) a = forall s. Expr s a -> m (Maybe (Expr s a)) #
Use this to wrap you embedded functions (see normalizeWith
) to make them
polymorphic enough to be used.
data MultipleCheckFailed #
Exception thrown when the --check
flag to a command-line subcommand fails
Instances
Exception MultipleCheckFailed | |
Defined in Dhall.Util Methods toException :: MultipleCheckFailed -> SomeException # fromException :: SomeException -> Maybe MultipleCheckFailed # | |
Show MultipleCheckFailed | |
Defined in Dhall.Util Methods showsPrec :: Int -> MultipleCheckFailed -> ShowS # show :: MultipleCheckFailed -> String # showList :: [MultipleCheckFailed] -> ShowS # |
newtype CheckFailed #
A check failure corresponding to a single input.
This type is intended to be used with MultipleCheckFailed
for error
reporting.
Constructors
CheckFailed Input |
data OutputMode #
data Transitivity #
Specifies whether or not an input's transitive dependencies should also be processed. Transitive dependencies are restricted to relative file imports.
Constructors
NonTransitive | Do not process transitive dependencies |
Transitive | Process transitive dependencies in the same way |
Set to Censor
if you want to censor error text that might include secrets
data SingletonConstructors #
This type specifies how to model a Haskell constructor with 1 field in Dhall
For example, consider the following Haskell datatype definition:
data Example = Foo { x :: Double } | Bar Double
Depending on which option you pick, the corresponding Dhall type could be:
< Foo : Double | Bar : Double > -- Bare
< Foo : { x : Double } | Bar : { _1 : Double } > -- Wrapped
< Foo : { x : Double } | Bar : Double > -- Smart
newtype InputNormalizer #
This is only used by the FromDhall
instance for
functions in order to normalize the function input before marshaling the
input into a Dhall expression.
Constructors
InputNormalizer | |
Fields |
data InterpretOptions #
Use these options to tweak how Dhall derives a generic implementation of
FromDhall
.
Constructors
InterpretOptions | |
Fields
|
newtype UnionEncoder a #
UnionEncoder
allows you to build an Encoder
for a Dhall record.
For example, let's take the following Haskell data type:
>>>
:{
data Status = Queued Natural | Result Text | Errored Text :}
And assume that we have the following Dhall union that we would like to
parse as a Status
:
< Result : Text | Queued : Natural | Errored : Text >.Result "Finish successfully"
Our encoder has type Encoder
Status
, but we can't build that out of any
smaller encoders, as Encoder
s cannot be combined.
However, we can use an UnionEncoder
to build an Encoder
for Status
:
>>>
:{
injectStatus :: Encoder Status injectStatus = adapt >$< unionEncoder ( encodeConstructorWith "Queued" inject >|< encodeConstructorWith "Result" inject >|< encodeConstructorWith "Errored" inject ) where adapt (Queued n) = Left n adapt (Result t) = Right (Left t) adapt (Errored e) = Right (Right e) :}
Or, since we are simply using the ToDhall
instance to inject each branch, we could write
>>>
:{
injectStatus :: Encoder Status injectStatus = adapt >$< unionEncoder ( encodeConstructor "Queued" >|< encodeConstructor "Result" >|< encodeConstructor "Errored" ) where adapt (Queued n) = Left n adapt (Result t) = Right (Left t) adapt (Errored e) = Right (Right e) :}
Constructors
UnionEncoder (Product (Const (Map Text (Expr Src Void)) :: Type -> Type) (Op (Text, Expr Src Void)) a) |
Instances
Contravariant UnionEncoder | |
Defined in Dhall.Marshal.Encode Methods contramap :: (a' -> a) -> UnionEncoder a -> UnionEncoder a' (>$) :: b -> UnionEncoder b -> UnionEncoder a |
newtype RecordEncoder a #
The RecordEncoder
divisible (contravariant) functor allows you to build
an Encoder
for a Dhall record.
For example, let's take the following Haskell data type:
>>>
:{
data Project = Project { projectName :: Text , projectDescription :: Text , projectStars :: Natural } :}
And assume that we have the following Dhall record that we would like to
parse as a Project
:
{ name = "dhall-haskell" , description = "A configuration language guaranteed to terminate" , stars = 289 }
Our encoder has type Encoder
Project
, but we can't build that out of any
smaller encoders, as Encoder
s cannot be combined (they are only Contravariant
s).
However, we can use an RecordEncoder
to build an Encoder
for Project
:
>>>
:{
injectProject :: Encoder Project injectProject = recordEncoder ( adapt >$< encodeFieldWith "name" inject >*< encodeFieldWith "description" inject >*< encodeFieldWith "stars" inject ) where adapt (Project{..}) = (projectName, (projectDescription, projectStars)) :}
Or, since we are simply using the ToDhall
instance to inject each field, we could write
>>>
:{
injectProject :: Encoder Project injectProject = recordEncoder ( adapt >$< encodeField "name" >*< encodeField "description" >*< encodeField "stars" ) where adapt (Project{..}) = (projectName, (projectDescription, projectStars)) :}
Constructors
RecordEncoder (Map Text (Encoder a)) |
Instances
Contravariant RecordEncoder | |
Defined in Dhall.Marshal.Encode Methods contramap :: (a' -> a) -> RecordEncoder a -> RecordEncoder a' (>$) :: b -> RecordEncoder b -> RecordEncoder a | |
Divisible RecordEncoder | |
Defined in Dhall.Marshal.Encode Methods divide :: (a -> (b, c)) -> RecordEncoder b -> RecordEncoder c -> RecordEncoder a # conquer :: RecordEncoder a # |
class GenericToDhall (f :: Type -> Type) where #
This is the underlying class that powers the FromDhall
class's support
for automatically deriving a generic implementation.
Methods
genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (f a)) #
Instances
GenericToDhall (U1 :: Type -> Type) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (U1 a)) # | |
(GenericToDhall (f :*: g), GenericToDhall (h :*: i)) => GenericToDhall ((f :*: g) :*: (h :*: i)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (((f :*: g) :*: (h :*: i)) a)) # | |
(GenericToDhall (f :*: g), Selector s, ToDhall a) => GenericToDhall ((f :*: g) :*: M1 S s (K1 i a :: Type -> Type)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (((f :*: g) :*: M1 S s (K1 i a)) a0)) # | |
(Selector s, ToDhall a, GenericToDhall (f :*: g)) => GenericToDhall (M1 S s (K1 i a :: Type -> Type) :*: (f :*: g)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder ((M1 S s (K1 i a) :*: (f :*: g)) a0)) # | |
(Selector s1, Selector s2, ToDhall a1, ToDhall a2) => GenericToDhall (M1 S s1 (K1 i1 a1 :: Type -> Type) :*: M1 S s2 (K1 i2 a2 :: Type -> Type)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder ((M1 S s1 (K1 i1 a1) :*: M1 S s2 (K1 i2 a2)) a)) # | |
(GenericToDhall (f :+: g), GenericToDhall (h :+: i)) => GenericToDhall ((f :+: g) :+: (h :+: i)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (((f :+: g) :+: (h :+: i)) a)) # | |
(Constructor c, GenericToDhall (f :+: g), GenericToDhall h) => GenericToDhall ((f :+: g) :+: M1 C c h) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (((f :+: g) :+: M1 C c h) a)) # | |
(Constructor c, GenericToDhall f, GenericToDhall (g :+: h)) => GenericToDhall (M1 C c f :+: (g :+: h)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder ((M1 C c f :+: (g :+: h)) a)) # | |
(Constructor c1, Constructor c2, GenericToDhall f1, GenericToDhall f2) => GenericToDhall (M1 C c1 f1 :+: M1 C c2 f2) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder ((M1 C c1 f1 :+: M1 C c2 f2) a)) # | |
GenericToDhall f => GenericToDhall (M1 C c f) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (M1 C c f a)) # | |
GenericToDhall f => GenericToDhall (M1 D d f) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (M1 D d f a)) # | |
(Selector s, ToDhall a) => GenericToDhall (M1 S s (K1 i a :: Type -> Type)) | |
Defined in Dhall.Marshal.Encode Methods genericToDhallWithNormalizer :: InputNormalizer -> InterpretOptions -> State Int (Encoder (M1 S s (K1 i a) a0)) # |
This class is used by FromDhall
instance for functions:
instance (ToDhall a, FromDhall b) => FromDhall (a -> b)
You can convert Dhall functions with "simple" inputs (i.e. instances of this class) into Haskell functions. This works by:
- Marshaling the input to the Haskell function into a Dhall expression (i.e.
x :: Expr Src Void
) - Applying the Dhall function (i.e.
f :: Expr Src Void
) to the Dhall input (i.e.App f x
) - Normalizing the syntax tree (i.e.
normalize (App f x)
) - Marshaling the resulting Dhall expression back into a Haskell value
This class auto-generates a default implementation for types that
implement Generic
. This does not auto-generate an instance for recursive
types.
The default instance can be tweaked using genericToDhallWith
/genericToDhallWithInputNormalizer
and custom InterpretOptions
, or using
DerivingVia
and Codec
from Dhall.Deriving.
Minimal complete definition
Nothing
Methods
injectWith :: InputNormalizer -> Encoder a #
Instances
An (Encoder a)
represents a way to marshal a value of type 'a'
from
Haskell into Dhall.
Constructors
Encoder | |
data ExpectedTypeError #
Error type used when determining the Dhall type of a Haskell expression.
Constructors
RecursiveTypeError |
Instances
Exception ExpectedTypeError | |
Defined in Dhall.Marshal.Decode Methods toException :: ExpectedTypeError -> SomeException # | |
Show ExpectedTypeError | |
Defined in Dhall.Marshal.Decode Methods showsPrec :: Int -> ExpectedTypeError -> ShowS # show :: ExpectedTypeError -> String # showList :: [ExpectedTypeError] -> ShowS # | |
Show ExpectedTypeErrors | |
Defined in Dhall.Marshal.Decode Methods showsPrec :: Int -> ExpectedTypeErrors -> ShowS # show :: ExpectedTypeErrors -> String # showList :: [ExpectedTypeErrors] -> ShowS # | |
Eq ExpectedTypeError | |
Defined in Dhall.Marshal.Decode Methods (==) :: ExpectedTypeError -> ExpectedTypeError -> Bool # (/=) :: ExpectedTypeError -> ExpectedTypeError -> Bool # |
type ExpectedTypeErrors = DhallErrors ExpectedTypeError #
One or more errors returned when determining the Dhall type of a Haskell expression.
type Expector = Validation ExpectedTypeErrors #
Useful synonym for the Validation
type used when marshalling Dhall
expressions.
data InvalidDecoder s a #
Every Decoder
must obey the contract that if an expression's type matches
the expected
type then the extract
function must not fail with a type
error. However, decoding may still fail for other reasons (such as the
decoder for Set
s rejecting a Dhall List
with duplicate
elements).
This error type is used to indicate an internal error in the implementation
of a Decoder
where the expected type matched the Dhall expression, but the
expression supplied to the extraction function did not match the expected
type. If this happens that means that the Decoder
itself needs to be
fixed.
Constructors
InvalidDecoder | |
Fields
|
Instances
(Pretty s, Typeable s, Pretty a, Typeable a) => Exception (InvalidDecoder s a) | |
Defined in Dhall.Marshal.Decode Methods toException :: InvalidDecoder s a -> SomeException # fromException :: SomeException -> Maybe (InvalidDecoder s a) # displayException :: InvalidDecoder s a -> String # | |
(Pretty s, Pretty a, Typeable s, Typeable a) => Show (InvalidDecoder s a) | |
Defined in Dhall.Marshal.Decode Methods showsPrec :: Int -> InvalidDecoder s a -> ShowS # show :: InvalidDecoder s a -> String # showList :: [InvalidDecoder s a] -> ShowS # | |
(Eq s, Eq a) => Eq (InvalidDecoder s a) | |
Defined in Dhall.Marshal.Decode Methods (==) :: InvalidDecoder s a -> InvalidDecoder s a -> Bool # (/=) :: InvalidDecoder s a -> InvalidDecoder s a -> Bool # |
type MonadicExtractor s a = Either (ExtractErrors s a) #
Useful synonym for the equivalent Either
type used when marshalling Dhall
code.
type Extractor s a = Validation (ExtractErrors s a) #
Useful synonym for the Validation
type used when marshalling Dhall
expressions.
data ExtractError s a #
Extraction of a value can fail for two reasons, either a type mismatch (which should not happen,
as expressions are type-checked against the expected type before being passed to extract
), or
a term-level error, described with a freeform text value.
Constructors
TypeMismatch (InvalidDecoder s a) | |
ExpectedTypeError ExpectedTypeError | |
ExtractError Text |
Instances
(Pretty s, Pretty a, Typeable s, Typeable a) => Exception (ExtractError s a) | |
Defined in Dhall.Marshal.Decode Methods toException :: ExtractError s a -> SomeException # fromException :: SomeException -> Maybe (ExtractError s a) # displayException :: ExtractError s a -> String # | |
(Pretty s, Pretty a, Typeable s, Typeable a) => Show (ExtractError s a) | |
Defined in Dhall.Marshal.Decode Methods showsPrec :: Int -> ExtractError s a -> ShowS # show :: ExtractError s a -> String # showList :: [ExtractError s a] -> ShowS # | |
(Pretty s, Pretty a, Typeable s, Typeable a) => Show (ExtractErrors s a) | |
Defined in Dhall.Marshal.Decode Methods showsPrec :: Int -> ExtractErrors s a -> ShowS # show :: ExtractErrors s a -> String # showList :: [ExtractErrors s a] -> ShowS # | |
(Eq s, Eq a) => Eq (ExtractError s a) | |
Defined in Dhall.Marshal.Decode Methods (==) :: ExtractError s a -> ExtractError s a -> Bool # (/=) :: ExtractError s a -> ExtractError s a -> Bool # |
type ExtractErrors s a = DhallErrors (ExtractError s a) #
One or more errors returned from extracting a Dhall expression to a Haskell expression.
newtype UnionDecoder a #
The UnionDecoder
monoid allows you to build a Decoder
from a Dhall union.
For example, let's take the following Haskell data type:
>>>
:{
data Status = Queued Natural | Result Text | Errored Text :}
And assume that we have the following Dhall union that we would like to
parse as a Status
:
< Result : Text | Queued : Natural | Errored : Text >.Result "Finish successfully"
Our decoder has type Decoder
Status
, but we can't build that out of any
smaller decoders, as Decoder
s cannot be combined (they are only Functor
s).
However, we can use a UnionDecoder
to build a Decoder
for Status
:
>>>
:{
status :: Decoder Status status = union ( ( Queued <$> constructor "Queued" natural ) <> ( Result <$> constructor "Result" strictText ) <> ( Errored <$> constructor "Errored" strictText ) ) :}
Constructors
UnionDecoder (Compose (Map Text) Decoder a) |
Instances
Functor UnionDecoder | |
Defined in Dhall.Marshal.Decode Methods fmap :: (a -> b) -> UnionDecoder a -> UnionDecoder b # (<$) :: a -> UnionDecoder b -> UnionDecoder a # | |
Monoid (UnionDecoder a) | |
Defined in Dhall.Marshal.Decode Methods mempty :: UnionDecoder a # mappend :: UnionDecoder a -> UnionDecoder a -> UnionDecoder a # mconcat :: [UnionDecoder a] -> UnionDecoder a # | |
Semigroup (UnionDecoder a) | |
Defined in Dhall.Marshal.Decode Methods (<>) :: UnionDecoder a -> UnionDecoder a -> UnionDecoder a # sconcat :: NonEmpty (UnionDecoder a) -> UnionDecoder a # stimes :: Integral b => b -> UnionDecoder a -> UnionDecoder a # |
newtype RecordDecoder a #
The RecordDecoder
applicative functor allows you to build a Decoder
from a Dhall record.
For example, let's take the following Haskell data type:
>>>
:{
data Project = Project { projectName :: Text , projectDescription :: Text , projectStars :: Natural } :}
And assume that we have the following Dhall record that we would like to
parse as a Project
:
{ name = "dhall-haskell" , description = "A configuration language guaranteed to terminate" , stars = 289 }
Our decoder has type Decoder
Project
, but we can't build that out of any
smaller decoders, as Decoder
s cannot be combined (they are only Functor
s).
However, we can use a RecordDecoder
to build a Decoder
for Project
:
>>>
:{
project :: Decoder Project project = record ( Project <$> field "name" strictText <*> field "description" strictText <*> field "stars" natural ) :}
Constructors
RecordDecoder (Product (Const (Map Text (Expector (Expr Src Void))) :: Type -> Type) (Compose ((->) (Expr Src Void)) (Extractor Src Void)) a) |
Instances
Applicative RecordDecoder | |
Defined in Dhall.Marshal.Decode Methods pure :: a -> RecordDecoder a # (<*>) :: RecordDecoder (a -> b) -> RecordDecoder a -> RecordDecoder b # liftA2 :: (a -> b -> c) -> RecordDecoder a -> RecordDecoder b -> RecordDecoder c # (*>) :: RecordDecoder a -> RecordDecoder b -> RecordDecoder b # (<*) :: RecordDecoder a -> RecordDecoder b -> RecordDecoder a # | |
Functor RecordDecoder | |
Defined in Dhall.Marshal.Decode Methods fmap :: (a -> b) -> RecordDecoder a -> RecordDecoder b # (<$) :: a -> RecordDecoder b -> RecordDecoder a # |
class GenericFromDhallUnion (t :: k) (f :: k1 -> Type) where #
This is the underlying class that powers the FromDhall
class's support
for automatically deriving a generic implementation for a union type.
Methods
genericUnionAutoWithNormalizer :: forall (a :: k1). Proxy t -> InputNormalizer -> InterpretOptions -> UnionDecoder (f a) #
Instances
(GenericFromDhallUnion t f1, GenericFromDhallUnion t f2) => GenericFromDhallUnion (t :: k1) (f1 :+: f2 :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericUnionAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> UnionDecoder ((f1 :+: f2) a) # | |
(Constructor c1, GenericFromDhall t f1) => GenericFromDhallUnion (t :: k1) (M1 C c1 f1 :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericUnionAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> UnionDecoder (M1 C c1 f1 a) # |
class GenericFromDhall (t :: k) (f :: k1 -> Type) where #
This is the underlying class that powers the FromDhall
class's support
for automatically deriving a generic implementation.
Methods
genericAutoWithNormalizer :: forall (a :: k1). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (f a)) #
Instances
GenericFromDhall (t :: k1) (U1 :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (U1 a)) # | |
GenericFromDhall (t :: k1) (V1 :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (V1 a)) # | |
GenericFromDhall (a1 :: Type) (M1 S s1 (K1 i1 a1 :: k -> Type) :*: M1 S s2 (K1 i2 a2 :: k -> Type) :: k -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k1). Proxy a1 -> InputNormalizer -> InterpretOptions -> State Int (Decoder ((M1 S s1 (K1 i1 a1) :*: M1 S s2 (K1 i2 a2)) a)) # | |
GenericFromDhall (a2 :: Type) (M1 S s1 (K1 i1 a1 :: k -> Type) :*: M1 S s2 (K1 i2 a2 :: k -> Type) :: k -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k1). Proxy a2 -> InputNormalizer -> InterpretOptions -> State Int (Decoder ((M1 S s1 (K1 i1 a1) :*: M1 S s2 (K1 i2 a2)) a)) # | |
(GenericFromDhall t (f :*: g), GenericFromDhall t (h :*: i)) => GenericFromDhall (t :: k1) ((f :*: g) :*: (h :*: i) :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (((f :*: g) :*: (h :*: i)) a)) # | |
(GenericFromDhall t (f :*: g), Selector s, FromDhall a) => GenericFromDhall (t :: k1) ((f :*: g) :*: M1 S s (K1 i a :: k2 -> Type) :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a0 :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (((f :*: g) :*: M1 S s (K1 i a)) a0)) # | |
(Selector s, FromDhall a, GenericFromDhall t (f :*: g)) => GenericFromDhall (t :: k1) (M1 S s (K1 i a :: k2 -> Type) :*: (f :*: g) :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a0 :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder ((M1 S s (K1 i a) :*: (f :*: g)) a0)) # | |
(Selector s1, Selector s2, FromDhall a1, FromDhall a2) => GenericFromDhall (t :: k1) (M1 S s1 (K1 i1 a1 :: k2 -> Type) :*: M1 S s2 (K1 i2 a2 :: k2 -> Type) :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder ((M1 S s1 (K1 i1 a1) :*: M1 S s2 (K1 i2 a2)) a)) # | |
GenericFromDhallUnion t (f :+: g) => GenericFromDhall (t :: k1) (f :+: g :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder ((f :+: g) a)) # | |
GenericFromDhall (a :: Type) (M1 S s (K1 i a :: k -> Type) :: k -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a0 :: k1). Proxy a -> InputNormalizer -> InterpretOptions -> State Int (Decoder (M1 S s (K1 i a) a0)) # | |
GenericFromDhall t f => GenericFromDhall (t :: k1) (M1 C c f :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (M1 C c f a)) # | |
GenericFromDhall t f => GenericFromDhall (t :: k1) (M1 D d f :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (M1 D d f a)) # | |
(Selector s, FromDhall a) => GenericFromDhall (t :: k1) (M1 S s (K1 i a :: k2 -> Type) :: k2 -> Type) | |
Defined in Dhall.Marshal.Decode Methods genericAutoWithNormalizer :: forall (a0 :: k10). Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (M1 S s (K1 i a) a0)) # |
class HasEvaluateSettings s where #
Since: dhall-1.16
Methods
evaluateSettings :: Functor f => LensLike' f s EvaluateSettings #
Instances
HasEvaluateSettings EvaluateSettings | |
Defined in Dhall Methods evaluateSettings :: Functor f => LensLike' f EvaluateSettings EvaluateSettings # | |
HasEvaluateSettings InputSettings | |
Defined in Dhall Methods evaluateSettings :: Functor f => LensLike' f InputSettings EvaluateSettings # |
data EvaluateSettings #
Since: dhall-1.16
Instances
HasEvaluateSettings EvaluateSettings | |
Defined in Dhall Methods evaluateSettings :: Functor f => LensLike' f EvaluateSettings EvaluateSettings # |
data InputSettings #
Since: dhall-1.16
Instances
HasEvaluateSettings InputSettings | |
Defined in Dhall Methods evaluateSettings :: Functor f => LensLike' f InputSettings EvaluateSettings # |
scientific :: Decoder Scientific #
Decode a Scientific
.
>>>
input scientific "1e100"
1.0e100
vector :: Decoder a -> Decoder (Vector a) #
Decode a Vector
.
>>>
input (vector natural) "[1, 2, 3]"
[1,2,3]
map :: Ord k => Decoder k -> Decoder v -> Decoder (Map k v) #
Decode a Map
from a toMap
expression or generally a Prelude.Map.Type
.
>>>
input (Dhall.map strictText bool) "toMap { a = True, b = False }"
fromList [("a",True),("b",False)]>>>
input (Dhall.map strictText bool) "[ { mapKey = \"foo\", mapValue = True } ]"
fromList [("foo",True)]
If there are duplicate mapKey
s, later mapValue
s take precedence:
>>>
let expr = "[ { mapKey = 1, mapValue = True }, { mapKey = 1, mapValue = False } ]"
>>>
input (Dhall.map natural bool) expr
fromList [(1,False)]
function :: Encoder a -> Decoder b -> Decoder (a -> b) #
Decode a Dhall function into a Haskell function.
>>>
f <- input (function inject bool) "Natural/even" :: IO (Natural -> Bool)
>>>
f 0
True>>>
f 1
False
Decode ()
from an empty record.
>>>
input unit "{=}" -- GHC doesn't print the result if it is ()
union :: UnionDecoder a -> Decoder a #
Run a UnionDecoder
to build a Decoder
.
pair :: Decoder a -> Decoder b -> Decoder (a, b) #
Given a pair of Decoder
s, decode a tuple-record into their pairing.
>>>
input (pair natural bool) "{ _1 = 42, _2 = False }"
(42,False)
localTime :: Decoder LocalTime #
Decode LocalTime
>>>
input localTime "2020-01-01T12:34:56"
2020-01-01 12:34:56
Decode UTCTime
>>>
input utcTime "2020-01-01T12:34:56+02:00"
2020-01-01 10:34:56 UTC
zonedTime :: Decoder ZonedTime #
Decode ZonedTime
>>>
input zonedTime "2020-01-01T12:34:56+02:00"
2020-01-01 12:34:56 +0200
normalize :: Eq a => Expr s a -> Expr t a #
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
sequence :: Decoder a -> Decoder (Seq a) #
Decode a Seq
.
>>>
input (sequence natural) "[1, 2, 3]"
fromList [1,2,3]
shift :: Int -> Var -> Expr s a -> Expr s a #
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
tox@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 lessx
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.
typeError :: Expector (Expr s a) -> Expr s a -> Extractor s a b #
Generate a type error during extraction by specifying the expected type and the actual type. The expected type is not yet determined.
internalError :: Text -> forall b. b #
Utility function used to throw internal errors that should never happen (in theory) but that are not enforced by the type system
Arguments
:: Decoder a | The decoder for the Dhall value |
-> Text | The Dhall program |
-> IO a | The decoded value in Haskell |
Type-check and evaluate a Dhall program, decoding the result into Haskell
The first argument determines the type of value that you decode:
>>>
input integer "+2"
2>>>
input (vector double) "[1.0, 2.0]"
[1.0,2.0]
Use auto
to automatically select which type to decode based on the
inferred return type:
>>>
input auto "True" :: IO Bool
True
This uses the settings from defaultInputSettings
.
makeFieldSelection :: Text -> FieldSelection s #
Smart constructor for FieldSelection
with no src information
makeRecordField :: Expr s a -> RecordField s a #
Construct a RecordField
with no src information
recordFieldExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> RecordField s a -> f (RecordField s b) #
Traverse over the immediate Expr
children in a RecordField
.
makeFunctionBinding :: Text -> Expr s a -> FunctionBinding s a #
Smart constructor for FunctionBinding
with no src information
functionBindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> FunctionBinding s a -> f (FunctionBinding s b) #
Traverse over the immediate Expr
children in a FunctionBinding
.
makeBinding :: Text -> Expr s a -> Binding s a #
Construct a Binding
with no source information and no type annotation.
bindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> Binding s a -> f (Binding s b) #
chunkExprs :: Applicative f => (Expr s a -> f (Expr t b)) -> Chunks s a -> f (Chunks t b) #
A traversal over the immediate sub-expressions in Chunks
.
wrapInLets :: Foldable f => f (Binding s a) -> Expr s a -> Expr s a #
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
subExpressions :: Applicative f => (Expr s a -> f (Expr s a)) -> Expr s a -> f (Expr s a) #
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) #
A traversal over the immediate sub-expressions of an expression which allows mapping embedded values
shallowDenote :: Expr s a -> Expr s a #
reservedIdentifiers :: HashSet Text #
The set of reserved identifiers for the Dhall language | Contains also all keywords from "reservedKeywords"
pathCharacter :: Char -> Bool #
Returns True
if the given Char
is valid within an unquoted path
component
This is exported for reuse within the Dhall.Parser.Token
module
judgmentallyEqual :: Eq a => Expr s a -> Expr t a -> Bool #
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 #
Substitute all occurrences of a variable with an expression
subst x C B ~ B[x := C]
alphaNormalize :: Expr s a -> Expr s a #
α-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)
normalizeWith :: Eq a => Maybe (ReifiedNormalizer a) -> Expr s a -> Expr t a #
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) #
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
isNormalizedWith :: (Eq s, Eq a) => Normalizer a -> Expr s a -> Bool #
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
isNormalized :: Eq a => Expr s a -> Bool #
Quickly check if an expression is in normal form
Given a well-typed expression e
,
is equivalent to
isNormalized
ee ==
.normalize
e
Given an ill-typed expression, isNormalized
may fail with an error, or
evaluate to either False or True!
freeIn :: Eq a => Var -> Expr s a -> Bool #
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
escapeText :: Text -> Text #
Escape a Text
literal using Dhall's escaping rules
Note that the result does not include surrounding quotes
censorText :: Text -> Text #
Utility used to censor Text
by replacing all characters with a
space
handleMultipleChecksFailed :: (Foldable t, Traversable t) => Text -> Text -> (a -> IO (Either CheckFailed ())) -> t a -> IO () #
Run IO for multiple inputs, then collate all the check failures before throwing if there was any failure
getExpression :: Censor -> Input -> IO (Expr Src Import) #
Convenient utility for retrieving an expression
getExpressionAndHeader :: Censor -> Input -> IO (Header, Expr Src Import) #
Convenient utility for retrieving an expression along with its header
getExpressionAndHeaderFromStdinText :: Censor -> String -> Text -> IO (Header, Expr Src Import) #
Convenient utility for retrieving an expression along with its header from | text already read from STDIN (so it's not re-read)
renderExpression :: Pretty a => CharacterSet -> Bool -> Maybe FilePath -> Expr Src a -> IO () #
Convenient utility to output an expression either to a file or to stdout.
defaultInputNormalizer :: InputNormalizer #
Default normalization-related settings (no custom normalization)
defaultInterpretOptions :: InterpretOptions #
Default interpret options for generics-based instances, which you can tweak or override, like this:
genericAutoWith (defaultInterpretOptions { fieldModifier = Data.Text.Lazy.dropWhile (== '_') })
inject :: ToDhall a => Encoder a #
Use the default input normalizer for injecting a value.
inject = injectWith defaultInputNormalizer
genericToDhall :: (Generic a, GenericToDhall (Rep a)) => Encoder a #
Use the default options for injecting a value, whose structure is determined generically.
This can be used when you want to use ToDhall
on types that you don't
want to define orphan instances for.
genericToDhallWith :: (Generic a, GenericToDhall (Rep a)) => InterpretOptions -> Encoder a #
Use custom options for injecting a value, whose structure is determined generically.
This can be used when you want to use ToDhall
on types that you don't
want to define orphan instances for.
genericToDhallWithInputNormalizer :: (Generic a, GenericToDhall (Rep a)) => InterpretOptions -> InputNormalizer -> Encoder a #
genericToDhallWithInputNormalizer
is like genericToDhallWith
, but
instead of using the defaultInputNormalizer
it expects an custom
InputNormalizer
.
recordEncoder :: RecordEncoder a -> Encoder a #
Convert a RecordEncoder
into the equivalent Encoder
.
encodeField :: ToDhall a => Text -> RecordEncoder a #
Specify how to encode one field of a record using the default ToDhall
instance for that type.
encodeFieldWith :: Text -> Encoder a -> RecordEncoder a #
Specify how to encode one field of a record by supplying an explicit
Encoder
for that field.
unionEncoder :: UnionEncoder a -> Encoder a #
Convert a UnionEncoder
into the equivalent Encoder
.
encodeConstructor :: ToDhall a => Text -> UnionEncoder a #
Specify how to encode an alternative by using the default ToDhall
instance
for that type.
encodeConstructorWith :: Text -> Encoder a -> UnionEncoder a #
Specify how to encode an alternative by providing an explicit Encoder
for that alternative.
(>|<) :: UnionEncoder a -> UnionEncoder b -> UnionEncoder (Either a b) infixr 5 #
Combines two UnionEncoder
values. See UnionEncoder
for usage
notes.
Ideally, this matches chosen
;
however, this allows UnionEncoder
to not need a Divisible
instance
itself (since no instance is possible).
substitutions :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Substitutions Src Void) #
Access the custom substitutions.
Since: dhall-1.30
normalizer :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Maybe (ReifiedNormalizer Void)) #
Access the custom normalizer.
Since: dhall-1.16
startingContext :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Context (Expr Src Void)) #
Access the starting context used for evaluation and type-checking.
Since: dhall-1.16
auto :: FromDhall a => Decoder a #
Use the default input normalizer for interpreting an input.
auto = autoWith defaultInputNormalizer
genericAuto :: (Generic a, GenericFromDhall a (Rep a)) => Decoder a #
genericAuto
is the default implementation for auto
if you derive
FromDhall
. The difference is that you can use genericAuto
without
having to explicitly provide a FromDhall
instance for a type as long as
the type derives Generic
.
genericAutoWith :: (Generic a, GenericFromDhall a (Rep a)) => InterpretOptions -> Decoder a #
genericAutoWith
is a configurable version of genericAuto
.
genericAutoWithInputNormalizer :: (Generic a, GenericFromDhall a (Rep a)) => InterpretOptions -> InputNormalizer -> Decoder a #
genericAutoWithInputNormalizer
is like genericAutoWith
, but instead of
using the defaultInputNormalizer
it expects an custom InputNormalizer
.
shortBytes :: Decoder ShortByteString #
Decode a ShortByteString
>>>
input shortBytes "0x\"00FF\""
"\NUL\255"
lazyBytes :: Decoder ByteString #
Decode a lazy ByteString
.
>>>
input lazyBytes "0x\"00FF\""
"\NUL\255"
strictBytes :: Decoder ByteString #
Decode a strict ByteString
>>>
input strictBytes "0x\"00FF\""
"\NUL\255"
strictText :: Decoder Text #
Decode strict Text
.
>>>
input strictText "\"Test\""
"Test"
dayOfWeek :: Decoder DayOfWeek #
Decode DayOfWeek
>>>
input dayOfWeek "< Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday >.Monday"
Monday
functionWith :: InputNormalizer -> Encoder a -> Decoder b -> Decoder (a -> b) #
Decode a Dhall function into a Haskell function using the specified normalizer.
>>>
f <- input (functionWith defaultInputNormalizer inject bool) "Natural/even" :: IO (Natural -> Bool)
>>>
f 0
True>>>
f 1
False
setFromDistinctList :: (Ord a, Show a) => Decoder a -> Decoder (Set a) #
Decode a Set
from a List
with distinct elements.
>>>
input (setFromDistinctList natural) "[1, 2, 3]"
fromList [1,2,3]
An error is thrown if the list contains duplicates.
>>> input (setFromDistinctList natural) "[1, 1, 3]" *** Exception: Error: Failed extraction The expression type-checked successfully but the transformation to the target type failed with the following error: One duplicate element in the list: 1
>>> input (setFromDistinctList natural) "[1, 1, 3, 3]" *** Exception: Error: Failed extraction The expression type-checked successfully but the transformation to the target type failed with the following error: 2 duplicates were found in the list, including 1
hashSetFromDistinctList :: (Hashable a, Ord a, Show a) => Decoder a -> Decoder (HashSet a) #
Decode a HashSet
from a List
with distinct elements.
>>>
input (hashSetFromDistinctList natural) "[1, 2, 3]"
fromList [1,2,3]
An error is thrown if the list contains duplicates.
>>> input (hashSetFromDistinctList natural) "[1, 1, 3]" *** Exception: Error: Failed extraction The expression type-checked successfully but the transformation to the target type failed with the following error: One duplicate element in the list: 1
>>> input (hashSetFromDistinctList natural) "[1, 1, 3, 3]" *** Exception: Error: Failed extraction The expression type-checked successfully but the transformation to the target type failed with the following error: 2 duplicates were found in the list, including 1
hashMap :: (Eq k, Hashable k) => Decoder k -> Decoder v -> Decoder (HashMap k v) #
Decode a HashMap
from a toMap
expression or generally a Prelude.Map.Type
.
>>>
fmap (List.sort . HashMap.toList) (input (Dhall.hashMap strictText bool) "toMap { a = True, b = False }")
[("a",True),("b",False)]>>>
fmap (List.sort . HashMap.toList) (input (Dhall.hashMap strictText bool) "[ { mapKey = \"foo\", mapValue = True } ]")
[("foo",True)]
If there are duplicate mapKey
s, later mapValue
s take precedence:
>>>
let expr = "[ { mapKey = 1, mapValue = True }, { mapKey = 1, mapValue = False } ]"
>>>
input (Dhall.hashMap natural bool) expr
fromList [(1,False)]
pairFromMapEntry :: Decoder k -> Decoder v -> Decoder (k, v) #
Decode a tuple from a Prelude.Map.Entry
record.
>>>
input (pairFromMapEntry strictText natural) "{ mapKey = \"foo\", mapValue = 3 }"
("foo",3)
record :: RecordDecoder a -> Decoder a #
Run a RecordDecoder
to build a Decoder
.
field :: Text -> Decoder a -> RecordDecoder a #
Parse a single field of a record.
constructor :: Text -> Decoder a -> UnionDecoder a #
Parse a single constructor of a union.
showDhallErrors :: Show e => String -> DhallErrors e -> String #
Render a given prefix and some errors to a string.
extractError :: Text -> Extractor s a b #
Turn a Text
message into an extraction failure.
toMonadic :: Extractor s a b -> MonadicExtractor s a b #
Switches from an Applicative
extraction result, able to accumulate errors,
to a Monad
extraction result, able to chain sequential operations.
fromMonadic :: MonadicExtractor s a b -> Extractor s a b #
Switches from a Monad
extraction result, able to chain sequential errors,
to an Applicative
extraction result, able to accumulate errors.
defaultInputSettings :: InputSettings #
Default input settings: resolves imports relative to .
(the
current working directory), report errors as coming from (input)
,
and default evaluation settings from defaultEvaluateSettings
.
Since: dhall-1.16
rootDirectory :: Functor f => LensLike' f InputSettings FilePath #
Access the directory to resolve imports relative to.
Since: dhall-1.16
sourceName :: Functor f => LensLike' f InputSettings FilePath #
Access the name of the source to report locations from; this is only used in error messages, so it's okay if this is a best guess or something symbolic.
Since: dhall-1.16
defaultEvaluateSettings :: EvaluateSettings #
Default evaluation settings: no extra entries in the initial context, and no special normalizer behaviour.
Since: dhall-1.16
newManager :: (Functor f, HasEvaluateSettings s) => LensLike' f s (IO Manager) #
Access the HTTP manager initializer.
Since: dhall-1.36
Arguments
:: InputSettings | |
-> Decoder a | The decoder for the Dhall value |
-> Text | The Dhall program |
-> IO a | The decoded value in Haskell |
Extend input
with a root directory to resolve imports relative
to, a file to mention in errors as the source, a custom typing
context, and a custom normalization process.
Since: dhall-1.16
Arguments
:: Decoder a | The decoder for the Dhall value |
-> FilePath | The path to the Dhall program. |
-> IO a | The decoded value in Haskell. |
Type-check and evaluate a Dhall program that is read from the file-system.
This uses the settings from defaultEvaluateSettings
.
Since: dhall-1.16
Arguments
:: EvaluateSettings | |
-> Decoder a | The decoder for the Dhall value |
-> FilePath | The path to the Dhall program. |
-> IO a | The decoded value in Haskell. |
Extend inputFile
with a custom typing context and a custom
normalization process.
Since: dhall-1.16
Similar to input
, but without interpreting the Dhall Expr
into a Haskell
type.
Uses the settings from defaultInputSettings
.
Extend inputExpr
with a root directory to resolve imports relative
to, a file to mention in errors as the source, a custom typing
context, and a custom normalization process.
Since: dhall-1.16
Arguments
:: Alternative f | |
=> Decoder a | The decoder for the Dhall value |
-> Expr s Void | a closed form Dhall program, which evaluates to the expected type |
-> f a | The decoded value in Haskell |
Use this function to extract Haskell values directly from Dhall AST.
The intended use case is to allow easy extraction of Dhall values for
making the function normalizeWith
easier to use.
For other use cases, use input
from Dhall module. It will give you
a much better user experience.
Use this to provide more detailed error messages
> input auto "True" :: IO Integer *** Exception: Error: Expression doesn't match annotation True : Integer (input):1:1
> detailed (input auto "True") :: IO Integer *** Exception: Error: Expression doesn't match annotation Explanation: You can annotate an expression with its type or kind using the ❰:❱ symbol, like this: ┌───────┐ │ x : t │ ❰x❱ is an expression and ❰t❱ is the annotated type or kind of ❰x❱ └───────┘ The type checker verifies that the expression's type or kind matches the provided annotation For example, all of the following are valid annotations that the type checker accepts: ┌─────────────┐ │ 1 : Natural │ ❰1❱ is an expression that has type ❰Natural❱, so the type └─────────────┘ checker accepts the annotation ┌───────────────────────┐ │ Natural/even 2 : Bool │ ❰Natural/even 2❱ has type ❰Bool❱, so the type └───────────────────────┘ checker accepts the annotation ┌────────────────────┐ │ List : Type → Type │ ❰List❱ is an expression that has kind ❰Type → Type❱, └────────────────────┘ so the type checker accepts the annotation ┌──────────────────┐ │ List Text : Type │ ❰List Text❱ is an expression that has kind ❰Type❱, so └──────────────────┘ the type checker accepts the annotation However, the following annotations are not valid and the type checker will reject them: ┌──────────┐ │ 1 : Text │ The type checker rejects this because ❰1❱ does not have type └──────────┘ ❰Text❱ ┌─────────────┐ │ List : Type │ ❰List❱ does not have kind ❰Type❱ └─────────────┘ You or the interpreter annotated this expression: ↳ True ... with this type or kind: ↳ Integer ... but the inferred type or kind of the expression is actually: ↳ Bool Some common reasons why you might get this error: ● The Haskell Dhall interpreter implicitly inserts a top-level annotation matching the expected type For example, if you run the following Haskell code: ┌───────────────────────────────┐ │ >>> input auto "1" :: IO Text │ └───────────────────────────────┘ ... then the interpreter will actually type check the following annotated expression: ┌──────────┐ │ 1 : Text │ └──────────┘ ... and then type-checking will fail ──────────────────────────────────────────────────────────────────────────────── True : Integer (input):1:1