-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A configuration language guaranteed to terminate
--   
--   Dhall is an explicitly typed configuration language that is not Turing
--   complete. Despite being Turing incomplete, Dhall is a real programming
--   language with a type-checker and evaluator.
--   
--   Use this library to parse, type-check, evaluate, and pretty-print the
--   Dhall configuration language. This package also includes an executable
--   which type-checks a Dhall file and reduces the file to a fully
--   evaluated normal form.
--   
--   Read <a>Dhall.Tutorial</a> to learn how to use this library
@package dhall
@version 1.42.1


-- | This is a utility module that consolidates all <a>Context</a>-related
--   operations
module Dhall.Context

-- | A <tt>(Context a)</tt> associates <a>Text</a> labels with values of
--   type <tt>a</tt>. Each <a>Text</a> label can correspond to multiple
--   values of type <tt>a</tt>
--   
--   The <a>Context</a> is used for type-checking when <tt>(a = Expr
--   X)</tt>
--   
--   <ul>
--   <li>You create a <a>Context</a> using <a>empty</a> and
--   <a>insert</a></li>
--   <li>You transform a <a>Context</a> using <a>fmap</a></li>
--   <li>You consume a <a>Context</a> using <a>lookup</a> and
--   <a>toList</a></li>
--   </ul>
--   
--   The difference between a <a>Context</a> and a <a>Map</a> is that a
--   <a>Context</a> lets you have multiple ordered occurrences of the same
--   key and you can query for the <tt>n</tt>th occurrence of a given key.
data Context a

-- | An empty context with no key-value pairs
empty :: Context a

-- | Add a key-value pair to the <a>Context</a>
insert :: Text -> a -> Context a -> Context a

-- | "Pattern match" on a <a>Context</a>
--   
--   <pre>
--   match (insert k v ctx) = Just (k, v, ctx)
--   match  empty           = Nothing
--   </pre>
match :: Context a -> Maybe (Text, a, Context a)

-- | Look up a key by name and index
--   
--   <pre>
--   lookup _ _         empty  = Nothing
--   lookup k 0 (insert k v c) = Just v
--   lookup k n (insert k v c) = lookup k (n - 1) c
--   lookup k n (insert j v c) = lookup k  n      c  -- k /= j
--   </pre>
lookup :: Text -> Int -> Context a -> Maybe a

-- | Return all key-value associations as a list
--   
--   <pre>
--   toList           empty  = []
--   toList (insert k v ctx) = (k, v) : toList ctx
--   </pre>
toList :: Context a -> [(Text, a)]
instance GHC.Base.Functor Dhall.Context.Context


-- | This module provides implementations of cryptographic utilities that
--   only work for GHC (as opposed to GHCJS)
module Dhall.Crypto

-- | A SHA256 digest
newtype SHA256Digest
SHA256Digest :: ByteString -> SHA256Digest
[unSHA256Digest] :: SHA256Digest -> ByteString

-- | Attempt to interpret a <a>ByteString</a> as a <a>SHA256Digest</a>,
--   returning <a>Nothing</a> if the conversion fails
sha256DigestFromByteString :: ByteString -> Maybe SHA256Digest

-- | Hash a <a>ByteString</a> and return the hash as a <a>SHA256Digest</a>
sha256Hash :: ByteString -> SHA256Digest

-- | <a>String</a> representation of a <a>SHA256Digest</a>
toString :: SHA256Digest -> String
instance Control.DeepSeq.NFData Dhall.Crypto.SHA256Digest
instance GHC.Classes.Ord Dhall.Crypto.SHA256Digest
instance GHC.Generics.Generic Dhall.Crypto.SHA256Digest
instance GHC.Classes.Eq Dhall.Crypto.SHA256Digest
instance Data.Data.Data Dhall.Crypto.SHA256Digest
instance GHC.Show.Show Dhall.Crypto.SHA256Digest


-- | <a>Map</a> type used to represent records and unions
module Dhall.Map

-- | A <a>Map</a> that remembers the original ordering of keys
--   
--   This is primarily used so that formatting preserves field order
--   
--   This is done primarily to avoid a dependency on
--   <tt>insert-ordered-containers</tt> and also to improve performance
data Map k v

-- | Create an empty <a>Map</a>
empty :: Ord k => Map k v

-- | Create a <a>Map</a> from a single key-value pair
--   
--   <pre>
--   &gt;&gt;&gt; singleton "A" 1
--   fromList [("A",1)]
--   </pre>
singleton :: k -> v -> Map k v

-- | Create a <a>Map</a> from a list of key-value pairs
--   
--   <pre>
--   &gt;&gt;&gt; fromList [("B",1),("A",2)]  -- The map preserves order
--   fromList [("B",1),("A",2)]
--   
--   &gt;&gt;&gt; fromList [("A",1),("A",2)]  -- For duplicates, later values take precedence
--   fromList [("A",2)]
--   </pre>
--   
--   Note that this handling of duplicates means that <a>fromList</a> is
--   <i>not</i> a monoid homomorphism:
--   
--   <pre>
--   &gt;&gt;&gt; fromList [(1, True)] &lt;&gt; fromList [(1, False)]
--   fromList [(1,True)]
--   
--   &gt;&gt;&gt; fromList ([(1, True)] &lt;&gt; [(1, False)])
--   fromList [(1,False)]
--   </pre>
fromList :: Ord k => [(k, v)] -> Map k v

-- | Create a <a>Map</a> from a list of key-value pairs with a combining
--   function.
--   
--   <pre>
--   &gt;&gt;&gt; fromListWithKey (\k v1 v2 -&gt; k ++ v1 ++ v2) [("B","v1"),("A","v2"),("B","v3")]
--   fromList [("B","Bv3v1"),("A","v2")]
--   </pre>
fromListWithKey :: Ord k => (k -> v -> v -> v) -> [(k, v)] -> Map k v

-- | Create a <a>Map</a> from a <tt><a>Data.Map</a>.<a>Map</a></tt>
fromMap :: Map k v -> Map k v

-- | Create a <a>Map</a> from a single key-value pair.
--   
--   Any further operations on this map will not retain the order of the
--   keys.
--   
--   <pre>
--   &gt;&gt;&gt; unorderedSingleton "A" 1
--   fromList [("A",1)]
--   </pre>
unorderedSingleton :: k -> v -> Map k v

-- | Create a <a>Map</a> from a list of key-value pairs
--   
--   Any further operations on this map will not retain the order of the
--   keys.
--   
--   <pre>
--   &gt;&gt;&gt; unorderedFromList []
--   fromList []
--   
--   &gt;&gt;&gt; unorderedFromList [("B",1),("A",2)]  -- The map /doesn't/ preserve order
--   fromList [("A",2),("B",1)]
--   
--   &gt;&gt;&gt; unorderedFromList [("A",1),("A",2)]  -- For duplicates, later values take precedence
--   fromList [("A",2)]
--   </pre>
unorderedFromList :: Ord k => [(k, v)] -> Map k v

-- | Sort the keys of a <a>Map</a>, forgetting the original ordering
--   
--   <pre>
--   sort (sort x) = sort x
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; sort (fromList [("B",1),("A",2)])
--   fromList [("A",2),("B",1)]
--   </pre>
sort :: Map k v -> Map k v

-- | Check if the keys of a <a>Map</a> are already sorted
--   
--   <pre>
--   isSorted (sort m) = True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isSorted (fromList [("B",1),("A",2)])  -- Sortedness is based only on keys
--   False
--   
--   &gt;&gt;&gt; isSorted (fromList [("A",2),("B",1)])
--   True
--   </pre>
isSorted :: Eq k => Map k v -> Bool

-- | Insert a key-value pair into a <a>Map</a>, overriding any previous
--   value stored underneath the same key, if present
--   
--   <pre>
--   insert = insertWith (\v _ -&gt; v)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; insert "C" 1 (fromList [("B",2),("A",3)])  -- Values are inserted on left
--   fromList [("C",1),("B",2),("A",3)]
--   
--   &gt;&gt;&gt; insert "C" 1 (fromList [("C",2),("A",3)])  -- New value takes precedence
--   fromList [("C",1),("A",3)]
--   </pre>
insert :: Ord k => k -> v -> Map k v -> Map k v

-- | Insert a key-value pair into a <a>Map</a>, using the supplied function
--   to combine the new value with any old value underneath the same key,
--   if present
--   
--   <pre>
--   &gt;&gt;&gt; insertWith (+) "C" 1 (fromList [("B",2),("A",3)])  -- No collision
--   fromList [("C",1),("B",2),("A",3)]
--   
--   &gt;&gt;&gt; insertWith (+) "C" 1 (fromList [("C",2),("A",3)])  -- Collision
--   fromList [("C",3),("A",3)]
--   </pre>
insertWith :: Ord k => (v -> v -> v) -> k -> v -> Map k v -> Map k v

-- | Delete a key from a <a>Map</a> if present, otherwise return the
--   original <a>Map</a>
--   
--   <pre>
--   &gt;&gt;&gt; delete "B" (fromList [("C",1),("B",2),("A",3)])
--   fromList [("C",1),("A",3)]
--   
--   &gt;&gt;&gt; delete "D" (fromList [("C",1),("B",2),("A",3)])
--   fromList [("C",1),("B",2),("A",3)]
--   </pre>
delete :: Ord k => k -> Map k v -> Map k v

-- | Keep all values that satisfy the given predicate
--   
--   <pre>
--   &gt;&gt;&gt; filter even (fromList [("C",3),("B",2),("A",1)])
--   fromList [("B",2)]
--   
--   &gt;&gt;&gt; filter odd (fromList [("C",3),("B",2),("A",1)])
--   fromList [("C",3),("A",1)]
--   </pre>
filter :: Ord k => (a -> Bool) -> Map k a -> Map k a

-- | Split the map into values that do and don't satisfy the predicate
--   
--   <pre>
--   &gt;&gt;&gt; partition even (fromList [("C",3),("B",2),("A",1)])
--   (fromList [("B",2)],fromList [("C",3),("A",1)])
--   
--   &gt;&gt;&gt; partition odd (fromList [("C",3),("B",2),("A",1)])
--   (fromList [("C",3),("A",1)],fromList [("B",2)])
--   </pre>
partition :: Ord k => (a -> Bool) -> Map k a -> (Map k a, Map k a)

-- | Restrict a <a>Map</a> to only those keys found in a
--   <tt><a>Data.Set</a>.<a>Set</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; restrictKeys (fromList [("A",1),("B",2)]) (Data.Set.fromList ["A"])
--   fromList [("A",1)]
--   </pre>
restrictKeys :: Ord k => Map k a -> Set k -> Map k a

-- | Remove all keys in a <tt><a>Data.Set</a>.<a>Set</a></tt> from a
--   <a>Map</a>
--   
--   <pre>
--   &gt;&gt;&gt; withoutKeys (fromList [("A",1),("B",2)]) (Data.Set.fromList ["A"])
--   fromList [("B",2)]
--   </pre>
withoutKeys :: Ord k => Map k a -> Set k -> Map k a

-- | Transform all values in a <a>Map</a> using the supplied function,
--   deleting the key if the function returns <a>Nothing</a>
--   
--   <pre>
--   &gt;&gt;&gt; mapMaybe Data.Maybe.listToMaybe (fromList [("C",[1]),("B",[]),("A",[3])])
--   fromList [("C",1),("A",3)]
--   </pre>
mapMaybe :: Ord k => (a -> Maybe b) -> Map k a -> Map k b

-- | Retrieve a key from a <a>Map</a>
--   
--   <pre>
--   lookup k mempty = empty
--   
--   lookup k (x &lt;&gt; y) = lookup k y &lt;|&gt; lookup k x
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lookup "A" (fromList [("B",1),("A",2)])
--   Just 2
--   
--   &gt;&gt;&gt; lookup "C" (fromList [("B",1),("A",2)])
--   Nothing
--   </pre>
lookup :: Ord k => k -> Map k v -> Maybe v

-- | Check if a key belongs to a <a>Map</a>
--   
--   <pre>
--   member k mempty = False
--   
--   member k (x &lt;&gt; y) = member k x || member k y
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; member "A" (fromList [("B",1),("A",2)])
--   True
--   
--   &gt;&gt;&gt; member "C" (fromList [("B",1),("A",2)])
--   False
--   </pre>
member :: Ord k => k -> Map k v -> Bool

-- | Retrieve the first key, value of the <a>Map</a>, if present, and also
--   returning the rest of the <a>Map</a>.
--   
--   <pre>
--   uncons mempty = empty
--   
--   uncons (singleton k v) = (k, v, mempty)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; uncons (fromList [("C",1),("B",2),("A",3)])
--   Just ("C",1,fromList [("B",2),("A",3)])
--   
--   &gt;&gt;&gt; uncons (fromList [])
--   Nothing
--   </pre>
uncons :: Ord k => Map k v -> Maybe (k, v, Map k v)

-- | <pre>
--   &gt;&gt;&gt; size (fromList [("A",1)])
--   1
--   </pre>
size :: Map k v -> Int

-- | Combine two <a>Map</a>s, preferring keys from the first <a>Map</a>
--   
--   <pre>
--   union = unionWith (\v _ -&gt; v)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; union (fromList [("D",1),("C",2)]) (fromList [("B",3),("A",4)])
--   fromList [("D",1),("C",2),("B",3),("A",4)]
--   
--   &gt;&gt;&gt; union (fromList [("D",1),("C",2)]) (fromList [("C",3),("A",4)])
--   fromList [("D",1),("C",2),("A",4)]
--   </pre>
union :: Ord k => Map k v -> Map k v -> Map k v

-- | Combine two <a>Map</a>s using a combining function for colliding keys
--   
--   <pre>
--   &gt;&gt;&gt; unionWith (+) (fromList [("D",1),("C",2)]) (fromList [("B",3),("A",4)])
--   fromList [("D",1),("C",2),("B",3),("A",4)]
--   
--   &gt;&gt;&gt; unionWith (+) (fromList [("D",1),("C",2)]) (fromList [("C",3),("A",4)])
--   fromList [("D",1),("C",5),("A",4)]
--   </pre>
unionWith :: Ord k => (v -> v -> v) -> Map k v -> Map k v -> Map k v

-- | A generalised <a>unionWith</a>.
--   
--   <pre>
--   &gt;&gt;&gt; outerJoin Left Left (\k a b -&gt; Right (k, a, b)) (fromList [("A",1),("B",2)]) (singleton "A" 3)
--   fromList [("A",Right ("A",1,3)),("B",Left 2)]
--   </pre>
--   
--   This function is much inspired by the <a>Data.Semialign.Semialign</a>
--   class.
outerJoin :: Ord k => (a -> c) -> (b -> c) -> (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c

-- | Combine two <a>Map</a> on their shared keys, keeping the value from
--   the first <a>Map</a>
--   
--   <pre>
--   intersection = intersectionWith (\v _ -&gt; v)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; intersection (fromList [("C",1),("B",2)]) (fromList [("B",3),("A",4)])
--   fromList [("B",2)]
--   </pre>
intersection :: Ord k => Map k a -> Map k b -> Map k a

-- | Combine two <a>Map</a>s on their shared keys, using the supplied
--   function to combine values from the first and second <a>Map</a>
--   
--   <pre>
--   &gt;&gt;&gt; intersectionWith (+) (fromList [("C",1),("B",2)]) (fromList [("B",3),("A",4)])
--   fromList [("B",5)]
--   </pre>
intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c

-- | Compute the difference of two <a>Map</a>s by subtracting all keys from
--   the second <a>Map</a> from the first <a>Map</a>
--   
--   <pre>
--   &gt;&gt;&gt; difference (fromList [("C",1),("B",2)]) (fromList [("B",3),("A",4)])
--   fromList [("C",1)]
--   </pre>
difference :: Ord k => Map k a -> Map k b -> Map k a

-- | Transform the values of a <a>Map</a> using their corresponding key
--   
--   <pre>
--   mapWithKey (pure id) = id
--   
--   mapWithKey (liftA2 (.) f g) = mapWithKey f . mapWithKey g
--   </pre>
--   
--   <pre>
--   mapWithKey f mempty = mempty
--   
--   mapWithKey f (x &lt;&gt; y) = mapWithKey f x &lt;&gt; mapWithKey f y
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; mapWithKey (,) (fromList [("B",1),("A",2)])
--   fromList [("B",("B",1)),("A",("A",2))]
--   </pre>
mapWithKey :: (k -> a -> b) -> Map k a -> Map k b

-- | Traverse all of the key-value pairs in a <a>Map</a>, in their original
--   order
--   
--   <pre>
--   &gt;&gt;&gt; traverseWithKey (,) (fromList [("B",1),("A",2)])
--   ("BA",fromList [("B",1),("A",2)])
--   </pre>
traverseWithKey :: Ord k => Applicative f => (k -> a -> f b) -> Map k a -> f (Map k b)

-- | Same as <a>traverseWithKey</a>, except that the order of effects is
--   not necessarily the same as the order of the keys
unorderedTraverseWithKey :: Ord k => Applicative f => (k -> a -> f b) -> Map k a -> f (Map k b)

-- | Traverse all of the key-value pairs in a <a>Map</a>, not preserving
--   their original order, where the result of the computation can be
--   forgotten.
--   
--   Note that this is a strict traversal, fully traversing the map even
--   when the Applicative is lazy in the remaining elements.
unorderedTraverseWithKey_ :: Ord k => Applicative f => (k -> a -> f ()) -> Map k a -> f ()

-- | Fold all of the key-value pairs in a <a>Map</a>, in their original
--   order
--   
--   <pre>
--   &gt;&gt;&gt; foldMapWithKey (,) (fromList [("B",[1]),("A",[2])])
--   ("BA",[1,2])
--   </pre>
foldMapWithKey :: (Monoid m, Ord k) => (k -> a -> m) -> Map k a -> m

-- | Convert a <a>Map</a> to a list of key-value pairs in the original
--   order of keys
--   
--   <pre>
--   &gt;&gt;&gt; toList (fromList [("B",1),("A",2)])
--   [("B",1),("A",2)]
--   </pre>
toList :: Ord k => Map k v -> [(k, v)]

-- | Convert a <a>Map</a> to a list of key-value pairs in ascending order
--   of keys
toAscList :: Map k v -> [(k, v)]

-- | Convert a <tt><a>Dhall.Map</a>.<a>Map</a></tt> to a
--   <tt><a>Data.Map</a>.<a>Map</a></tt>
--   
--   <pre>
--   &gt;&gt;&gt; toMap (fromList [("B",1),("A",2)]) -- Order is lost upon conversion
--   fromList [("A",2),("B",1)]
--   </pre>
toMap :: Map k v -> Map k v

-- | Return the keys from a <a>Map</a> in their original order
--   
--   <pre>
--   &gt;&gt;&gt; keys (fromList [("B",1),("A",2)])
--   ["B","A"]
--   </pre>
keys :: Map k v -> [k]

-- | Return the <tt><a>Data.Set</a>.<a>Set</a></tt> of the keys
--   
--   <pre>
--   &gt;&gt;&gt; keysSet (fromList [("B",1),("A",2)])
--   fromList ["A","B"]
--   </pre>
keysSet :: Map k v -> Set k

-- | Return the values from a <a>Map</a> in their original order.
--   
--   <pre>
--   &gt;&gt;&gt; elems (fromList [("B",1),("A",2)])
--   [1,2]
--   </pre>
elems :: Ord k => Map k v -> [v]
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Dhall.Map.Keys a)
instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (Dhall.Map.Keys a)
instance GHC.Generics.Generic (Dhall.Map.Keys a)
instance Data.Data.Data a => Data.Data.Data (Dhall.Map.Keys a)
instance (Control.DeepSeq.NFData k, Control.DeepSeq.NFData v) => Control.DeepSeq.NFData (Dhall.Map.Map k v)
instance (Language.Haskell.TH.Syntax.Lift k, Language.Haskell.TH.Syntax.Lift v) => Language.Haskell.TH.Syntax.Lift (Dhall.Map.Map k v)
instance GHC.Generics.Generic (Dhall.Map.Map k v)
instance (Data.Data.Data k, Data.Data.Data v, GHC.Classes.Ord k) => Data.Data.Data (Dhall.Map.Map k v)
instance (GHC.Classes.Ord k, GHC.Classes.Eq v) => GHC.Classes.Eq (Dhall.Map.Map k v)
instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Dhall.Map.Map k v)
instance GHC.Base.Functor (Dhall.Map.Map k)
instance GHC.Classes.Ord k => Data.Foldable.Foldable (Dhall.Map.Map k)
instance GHC.Classes.Ord k => Data.Traversable.Traversable (Dhall.Map.Map k)
instance GHC.Classes.Ord k => GHC.Base.Semigroup (Dhall.Map.Map k v)
instance GHC.Classes.Ord k => GHC.Base.Monoid (Dhall.Map.Map k v)
instance (GHC.Show.Show k, GHC.Show.Show v, GHC.Classes.Ord k) => GHC.Show.Show (Dhall.Map.Map k v)
instance GHC.Classes.Ord k => GHC.IsList.IsList (Dhall.Map.Map k v)


-- | This module contains some useful utilities copy-and-pasted from the
--   <tt>lens</tt> library to avoid a dependency which are used internally
--   and also re-exported for convenience
module Dhall.Optics

-- | Identical to <tt><a>Control.Lens.Type</a>.<a>Optic</a></tt>
type Optic p f s t a b = p a (f b) -> p s (f t)

-- | Identical to <tt><a>Control.Lens.Type</a>.<a>Optic'</a></tt>
type Optic' p f s a = Optic p f s s a a

-- | Identical to <tt><a>Control.Lens</a>.<a>rewriteOf</a></tt>
rewriteOf :: ASetter a b a b -> (b -> Maybe a) -> a -> b

-- | Identical to <tt><a>Control.Lens</a>.<a>transformOf</a></tt>
transformOf :: ASetter a b a b -> (b -> b) -> a -> b

-- | Identical to <tt><a>Control.Lens</a>.<a>rewriteMOf</a></tt>
rewriteMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> a -> m b

-- | Identical to <tt><a>Control.Lens</a>.<a>transformMOf</a></tt>
transformMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m b) -> a -> m b

-- | Identical to <tt><a>Control.Lens</a>.<a>mapMOf</a></tt>
mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t

-- | Identical to <tt><a>Control.Lens.Plated</a>.<a>cosmosOf</a></tt>
cosmosOf :: (Applicative f, Contravariant f) => LensLike' f a a -> LensLike' f a a

-- | Identical to <tt><a>Control.Lens.Getter</a>.<a>to</a></tt>
to :: (Profunctor p, Contravariant f) => (s -> a) -> Optic' p f s a

-- | Identical to <tt><a>Control.Lens.Fold</a>.<a>foldOf</a></tt>
foldOf :: Getting a s a -> s -> a


-- | This module only exports ways of constructing a Set, retrieving List,
--   Set, and Seq representations of the same data, as well as a novel
--   "difference" function. Any other Set-like or List-like functionality
--   should be obtained through toSet and toList, respectively.
module Dhall.Set

-- | This is a variation on <tt><a>Data.Set</a>.<a>Set</a></tt> that
--   remembers the original order of elements. This ensures that ordering
--   is not lost when formatting Dhall code
data Set a
Set :: Set a -> Seq a -> Set a

-- | Convert a <a>Set</a> to a list, preserving the original order of the
--   elements
toList :: Set a -> [a]

-- | Convert a <a>Set</a> to a list of ascending elements
toAscList :: Set a -> [a]

-- | Convert to an unordered <tt><a>Data.Set</a>.<a>Set</a></tt>
toSet :: Set a -> Set a

-- | Convert to an ordered <a>Seq</a>
toSeq :: Set a -> Seq a

-- | Convert a list to a <a>Set</a>, remembering the element order
fromList :: Ord a => [a] -> Set a

-- | Convert a <tt><a>Data.Set</a>.<a>Set</a></tt> to a sorted <a>Set</a>
fromSet :: Set a -> Set a

-- | Append an element to the end of a <a>Set</a>
append :: Ord a => a -> Set a -> Set a

-- | The empty <a>Set</a>
empty :: Set a

-- | Returns, in order, all elements of the first Set not present in the
--   second. (It doesn't matter in what order the elements appear in the
--   second Set.)
difference :: Ord a => Set a -> Set a -> [a]

-- | Sort the set elements, forgetting their original ordering.
--   
--   <pre>
--   &gt;&gt;&gt; sort (fromList [2, 1]) == fromList [1, 2]
--   True
--   </pre>
sort :: Ord a => Set a -> Set a

-- | <pre>
--   &gt;&gt;&gt; isSorted (fromList [2, 1])
--   False
--   
--   &gt;&gt;&gt; isSorted (fromList [1, 2])
--   True
--   </pre>
isSorted :: Ord a => Set a -> Bool

-- | <pre>
--   &gt;&gt;&gt; null (fromList [1])
--   False
--   
--   &gt;&gt;&gt; null (fromList [])
--   True
--   </pre>
null :: Set a -> Bool

-- | <pre>
--   &gt;&gt;&gt; size (fromList [1])
--   1
--   </pre>
size :: Set a -> Int
instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (Dhall.Set.Set a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Dhall.Set.Set a)
instance (Data.Data.Data a, GHC.Classes.Ord a) => Data.Data.Data (Dhall.Set.Set a)
instance GHC.Show.Show a => GHC.Show.Show (Dhall.Set.Set a)
instance GHC.Generics.Generic (Dhall.Set.Set a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Dhall.Set.Set a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Dhall.Set.Set a)
instance Data.Foldable.Foldable Dhall.Set.Set


-- | This module provides the <a>Src</a> type used for source spans in
--   error messages
module Dhall.Src

-- | Source code extract
data Src
Src :: !SourcePos -> !SourcePos -> Text -> Src
[srcStart] :: Src -> !SourcePos
[srcEnd] :: Src -> !SourcePos
[srcText] :: Src -> Text
instance Control.DeepSeq.NFData Dhall.Src.Src
instance GHC.Show.Show Dhall.Src.Src
instance GHC.Classes.Ord Dhall.Src.Src
instance GHC.Generics.Generic Dhall.Src.Src
instance GHC.Classes.Eq Dhall.Src.Src
instance Data.Data.Data Dhall.Src.Src
instance Language.Haskell.TH.Syntax.Lift Dhall.Src.Src
instance Prettyprinter.Internal.Pretty Dhall.Src.Src


-- | This module provides types and functions used in the substitution step
--   which is done before type checking and normalization.
module Dhall.Substitution

-- | Substitutions map variables to arbitrary Dhall expressions. Note that
--   we use <a>Dhall.Map.Map</a> as an underlying structure. Hence we
--   respect insertion order.
type Substitutions s a = Map Text (Expr s a)

-- | An empty substitution map.
empty :: Substitutions s a

-- | <tt>substitute expr s</tt> replaces all variables in <tt>expr</tt> (or
--   its subexpression) with their substitute. For example, if the
--   substitution map maps the variable <tt>Foo</tt> to the text "Foo" all
--   occurrences of <tt>Foo</tt> with the text "Foo".
--   
--   The substitutions will be done in the order they are inserted into the
--   substitution map:
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   substitute (Dhall.Core.Var "Foo") (Dhall.Map.fromList [("Foo", Dhall.Core.Var "Bar"), ("Bar", Dhall.Core.Var "Baz")])
--   </pre>
--   
--   results in <tt>Dhall.Core.Var "Baz"</tt> since we first substitute
--   "Foo" with "Bar" and then the resulting "Bar" with the final "Baz".
substitute :: Expr s a -> Substitutions s a -> Expr s a


-- | This module contains logic for converting Dhall expressions to and
--   from CBOR expressions which can in turn be converted to and from a
--   binary representation
module Dhall.Binary

-- | Encode a Dhall expression as a CBOR-encoded <a>ByteString</a>
encodeExpression :: Serialise (Expr Void a) => Expr Void a -> ByteString

-- | Decode a Dhall expression from a CBOR <a>Term</a>
decodeExpression :: Serialise (Expr s a) => ByteString -> Either DecodingFailure (Expr s a)

-- | This indicates that a given CBOR-encoded <a>ByteString</a> did not
--   correspond to a valid Dhall expression
newtype DecodingFailure
CBORIsNotDhall :: ByteString -> DecodingFailure
instance GHC.Classes.Eq Dhall.Binary.DecodingFailure
instance GHC.Exception.Type.Exception Dhall.Binary.DecodingFailure
instance GHC.Show.Show Dhall.Binary.DecodingFailure
instance Codec.Serialise.Class.Serialise (Dhall.Syntax.Expr.Expr GHC.Base.Void GHC.Base.Void)
instance Codec.Serialise.Class.Serialise (Dhall.Syntax.Expr.Expr GHC.Base.Void Dhall.Syntax.Import.Import)


-- | This module contains logic for pretty-printing expressions, including
--   support for syntax highlighting
module Dhall.Pretty

-- | Annotation type used to tag elements in a pretty-printed document for
--   syntax highlighting purposes
data Ann

-- | Used for syntactic keywords
Keyword :: Ann

-- | Syntax punctuation such as commas, parenthesis, and braces
Syntax :: Ann

-- | Record labels
Label :: Ann

-- | Literals such as integers and strings
Literal :: Ann

-- | Builtin types and values
Builtin :: Ann

-- | Operators
Operator :: Ann

-- | Convert annotations to their corresponding color for syntax
--   highlighting purposes
annToAnsiStyle :: Ann -> AnsiStyle

-- | Pretty print an expression
prettyExpr :: Pretty a => Expr s a -> Doc Ann

-- | This type determines whether to render code as <a>ASCII</a> or
--   <a>Unicode</a>
data CharacterSet
ASCII :: CharacterSet
Unicode :: CharacterSet

-- | Detect which character set is used for the syntax of an expression If
--   any parts of the expression uses the Unicode syntax, the whole
--   expression is deemed to be using the Unicode syntax.
detectCharacterSet :: Expr Src a -> CharacterSet

-- | Pretty-print an <a>Expr</a> using the given <a>CharacterSet</a>.
--   
--   <a>prettyCharacterSet</a> largely ignores <a>Note</a>s. <a>Note</a>s
--   do however matter for the layout of let-blocks:
--   
--   <pre>
--   &gt;&gt;&gt; let inner = Let (Binding Nothing "x" Nothing Nothing Nothing (NaturalLit 1)) (Var (V "x" 0)) :: Expr Src ()
--   
--   &gt;&gt;&gt; prettyCharacterSet ASCII (Let (Binding Nothing "y" Nothing Nothing Nothing (NaturalLit 2)) inner)
--   let y = 2 let x = 1 in x
--   
--   &gt;&gt;&gt; prettyCharacterSet ASCII (Let (Binding Nothing "y" Nothing Nothing Nothing (NaturalLit 2)) (Note (Src unusedSourcePos unusedSourcePos "") inner))
--   let y = 2 in let x = 1 in x
--   </pre>
--   
--   This means the structure of parsed let-blocks is preserved.
prettyCharacterSet :: Pretty a => CharacterSet -> Expr Src a -> Doc Ann

-- | Layout using <a>layoutOpts</a>
--   
--   Tries hard to fit the document into 80 columns.
--   
--   This also removes trailing space characters (<tt>' '</tt>)
--   <i>unless</i> they are enclosed in an annotation.
layout :: Doc ann -> SimpleDocStream ann

-- | Default layout options
layoutOpts :: LayoutOptions

-- | Escape an environment variable if not a valid Bash environment
--   variable
escapeEnvironmentVariable :: Text -> Text

-- | Escape a label if it is not valid when unquoted
escapeLabel :: Bool -> Text -> Text

-- | Convert an expression representing a temporal value to <a>Text</a>, if
--   possible
--   
--   This is used by downstream integrations (e.g. `dhall-json` for
--   treating temporal values as strings
temporalToText :: Pretty a => Expr s a -> Maybe Text


-- | This module provides functionality for concisely displaying the
--   difference between two expressions
--   
--   For example, this is used in type errors to explain why the actual
--   type does not match the expected type
module Dhall.Diff

-- | This type is a <a>Doc</a> enriched with a <a>same</a> flag to
--   efficiently track if any difference was detected
data Diff
Diff :: Bool -> Doc Ann -> Diff
[same] :: Diff -> Bool
[doc] :: Diff -> Doc Ann

-- | Render the difference between the normal form of two expressions
diffNormalized :: (Eq a, Pretty a) => Expr s a -> Expr s a -> Diff

-- | Render the difference between two expressions
diff :: (Eq a, Pretty a) => Expr Void a -> Expr Void a -> Diff
instance GHC.Base.Semigroup Dhall.Diff.Diff
instance GHC.Base.Monoid Dhall.Diff.Diff
instance Data.String.IsString Dhall.Diff.Diff


-- | Parse Dhall tokens. Even though we don't have a tokenizer per-se this
module Dhall.Parser.Token

-- | Match an end-of-line character sequence
endOfLine :: Parser Text

-- | Returns <a>True</a> if the given <a>Int</a> is a valid Unicode
--   codepoint
validCodepoint :: Int -> Bool

-- | Parse 0 or more whitespace characters (including comments)
--   
--   This corresponds to the <tt>whsp</tt> rule in the official grammar
whitespace :: Parser ()

-- | Parse a Dhall's single-line comment, starting from `--` and until the
--   last character of the line <i>before</i> the end-of-line character
lineComment :: Parser Text

-- | Same as <a>lineComment</a> except that this doesn't parse the
--   end-of-line character
lineCommentPrefix :: Parser Text

-- | Parsed text doesn't include opening braces
blockComment :: Parser Text

-- | Parse 1 or more whitespace characters (including comments)
--   
--   This corresponds to the <tt>whsp1</tt> rule in the official grammar
nonemptyWhitespace :: Parser ()

-- | Parse a valid Bash environment variable name
--   
--   This corresponds to the <tt>bash-environment-variable</tt> rule in the
--   official grammar
bashEnvironmentVariable :: Parser Text

-- | Parse a valid POSIX environment variable name, which permits a wider
--   range of characters than a Bash environment variable name
--   
--   This corresponds to the <tt>posix-environment-variable</tt> rule in
--   the official grammar
posixEnvironmentVariable :: Parser Text

-- | The <tt>pathComponent</tt> function uses this type to distinguish
--   whether to parse a URL path component or a file path component
data ComponentType
URLComponent :: ComponentType
FileComponent :: ComponentType

-- | A variation on <a>text</a> that doesn't quote the expected in error
--   messages
text :: Text -> Parser Text

-- | A variation on <a>char</a> that doesn't quote the expected token in
--   error messages
char :: Char -> Parser Char

-- | Parse a <a>File</a>
file_ :: ComponentType -> Parser File

-- | Parse a label (e.g. a variable/field/alternative name)
--   
--   Rejects labels that match built-in names (e.g. <tt>Natural/even</tt>)
--   
--   This corresponds to the <tt>nonreserved-label</tt> rule in the
--   official grammar
label :: Parser Text

-- | Same as <a>anyLabel</a> except that <a>Some</a> is allowed
--   
--   This corresponds to the <tt>any-label-or-some</tt> rule in the
--   official grammar
anyLabelOrSome :: Parser Text

-- | Same as <a>label</a> except that built-in names are allowed
--   
--   This corresponds to the <tt>any-label</tt> rule in the official
--   grammar
anyLabel :: Parser Text

-- | Parse a braced sequence of comma-separated labels
--   
--   For example, this is used to parse the record projection syntax
--   
--   This corresponds to the <tt>labels</tt> rule in the official grammar
labels :: Parser [Text]

-- | Parse an HTTP(S) URL without trailing whitespace
--   
--   This corresponds to the <tt>http-raw</tt> rule in the official grammar
httpRaw :: Parser URL

-- | Parse a hex digit (uppercase or lowercase)
--   
--   This corresponds to the <tt>HEXDIG</tt> rule in the official grammar
hexdig :: Char -> Bool

-- | Parse an identifier (i.e. a variable or built-in)
--   
--   Variables can have an optional index to disambiguate shadowed
--   variables
--   
--   This corresponds to the <tt>identifier</tt> rule from the official
--   grammar
identifier :: Parser Var

-- | Parse a hexademical number and convert to the corresponding <a>Int</a>
hexNumber :: Parser Int

-- | Parse a leading <tt>+</tt> or <tt>-</tt> sign
signPrefix :: Num a => Parser (a -> a)

-- | Parse a <a>Double</a> literal
--   
--   This corresponds to the <tt>double-literal</tt> rule from the official
--   grammar
doubleLiteral :: Parser Double

-- | Parse a signed <tt>Infinity</tt>
--   
--   This corresponds to the <tt>minus-infinity-literal</tt> and
--   <tt>plus-infinity-literal</tt> rules from the official grammar
doubleInfinity :: Parser Double

-- | Parse a <a>Natural</a> literal
--   
--   This corresponds to the <tt>natural-literal</tt> rule from the
--   official grammar
naturalLiteral :: Parser Natural

-- | Parse an <a>Integer</a> literal
--   
--   This corresponds to the <tt>integer-literal</tt> rule from the
--   official grammar
integerLiteral :: Parser Integer

-- | Parse a 4-digit year
--   
--   This corresponds to the <tt>date-fullyear</tt> rule from the official
--   grammar
dateFullYear :: Parser Integer

-- | Parse a 2-digit month
--   
--   This corresponds to the <tt>date-month</tt> rule from the official
--   grammar
dateMonth :: Parser Int

-- | Parse a 2-digit day of the month
--   
--   This corresponds to the <tt>date-mday</tt> rule from the official
--   grammar
dateMday :: Parser Int

-- | Parse a 2-digit hour
--   
--   This corresponds to the <tt>time-hour</tt> rule from the official
--   grammar
timeHour :: Parser Int

-- | Parse a 2-digit minute
--   
--   This corresponds to the <tt>time-minute</tt> rule from the official
--   grammar
timeMinute :: Parser Int

-- | Parse a 2-digit second
--   
--   This corresponds to the <tt>time-second</tt> rule from the official
--   grammar
timeSecond :: Parser Pico

-- | Parse the fractional component of a second
--   
--   This corresponds to the <tt>time-secfrac</tt> rule from the official
--   grammar
timeSecFrac :: Parser (Pico, Word)

-- | Parse the <tt>Optional</tt> built-in
--   
--   This corresponds to the <tt>Optional</tt> rule from the official
--   grammar
_Optional :: Parser ()

-- | Parse the <tt>if</tt> keyword
--   
--   This corresponds to the <tt>if</tt> rule from the official grammar
_if :: Parser ()

-- | Parse the <tt>then</tt> keyword
--   
--   This corresponds to the <tt>then</tt> rule from the official grammar
_then :: Parser ()

-- | Parse the <tt>else</tt> keyword
--   
--   This corresponds to the <tt>else</tt> rule from the official grammar
_else :: Parser ()

-- | Parse the <tt>let</tt> keyword
--   
--   This corresponds to the <tt>let</tt> rule from the official grammar
_let :: Parser ()

-- | Parse the <tt>in</tt> keyword
--   
--   This corresponds to the <tt>in</tt> rule from the official grammar
_in :: Parser ()

-- | Parse the <tt>as</tt> keyword
--   
--   This corresponds to the <tt>as</tt> rule from the official grammar
_as :: Parser ()

-- | Parse the <tt>using</tt> keyword
--   
--   This corresponds to the <tt>using</tt> rule from the official grammar
_using :: Parser ()

-- | Parse the <tt>merge</tt> keyword
--   
--   This corresponds to the <tt>merge</tt> rule from the official grammar
_merge :: Parser ()

-- | Parse the <tt>toMap</tt> keyword
--   
--   This corresponds to the <tt>toMap</tt> rule from the official grammar
_toMap :: Parser ()

-- | Parse the <tt>showConstructor</tt> keyword
--   
--   This corresponds to the <tt>showConstructor</tt> rule from the
--   official grammar
_showConstructor :: Parser ()

-- | Parse the <tt>assert</tt> keyword
--   
--   This corresponds to the <tt>assert</tt> rule from the official grammar
_assert :: Parser ()

-- | Parse the <tt>Some</tt> built-in
--   
--   This corresponds to the <tt>Some</tt> rule from the official grammar
_Some :: Parser ()

-- | Parse the <tt>None</tt> built-in
--   
--   This corresponds to the <tt>None</tt> rule from the official grammar
_None :: Parser ()

-- | Parse the <tt>Natural/fold</tt> built-in
--   
--   This corresponds to the <tt>Natural-fold</tt> rule from the official
--   grammar
_NaturalFold :: Parser ()

-- | Parse the <tt>Natural/build</tt> built-in
--   
--   This corresponds to the <tt>Natural-build</tt> rule from the official
--   grammar
_NaturalBuild :: Parser ()

-- | Parse the <tt>Natural/isZero</tt> built-in
--   
--   This corresponds to the <tt>Natural-isZero</tt> rule from the official
--   grammar
_NaturalIsZero :: Parser ()

-- | Parse the <tt>Natural/even</tt> built-in
--   
--   This corresponds to the <tt>Natural-even</tt> rule from the official
--   grammar
_NaturalEven :: Parser ()

-- | Parse the <tt>Natural/odd</tt> built-in
--   
--   This corresponds to the <tt>Natural-odd</tt> rule from the official
--   grammar
_NaturalOdd :: Parser ()

-- | Parse the <tt>Natural/toInteger</tt> built-in
--   
--   This corresponds to the <tt>Natural-toInteger</tt> rule from the
--   official grammar
_NaturalToInteger :: Parser ()

-- | Parse the <tt>Natural/show</tt> built-in
--   
--   This corresponds to the <tt>Natural-show</tt> rule from the official
--   grammar
_NaturalShow :: Parser ()

-- | Parse the <tt>Natural/subtract</tt> built-in
--   
--   This corresponds to the <tt>Natural-subtract</tt> rule from the
--   official grammar
_NaturalSubtract :: Parser ()

-- | Parse the <tt>Integer/clamp</tt> built-in
--   
--   This corresponds to the <tt>Integer-clamp</tt> rule from the official
--   grammar
_IntegerClamp :: Parser ()

-- | Parse the <tt>Integer/negate</tt> built-in
--   
--   This corresponds to the <tt>Integer-negate</tt> rule from the official
--   grammar
_IntegerNegate :: Parser ()

-- | Parse the <tt>Integer/show</tt> built-in
--   
--   This corresponds to the <tt>Integer-show</tt> rule from the official
--   grammar
_IntegerShow :: Parser ()

-- | Parse the <tt>Integer/toDouble</tt> built-in
--   
--   This corresponds to the <tt>Integer-toDouble</tt> rule from the
--   official grammar
_IntegerToDouble :: Parser ()

-- | Parse the <tt>Double/show</tt> built-in
--   
--   This corresponds to the <tt>Double-show</tt> rule from the official
--   grammar
_DoubleShow :: Parser ()

-- | Parse the <tt>List/build</tt> built-in
--   
--   This corresponds to the <tt>List-build</tt> rule from the official
--   grammar
_ListBuild :: Parser ()

-- | Parse the <tt>List/fold</tt> built-in
--   
--   This corresponds to the <tt>List-fold</tt> rule from the official
--   grammar
_ListFold :: Parser ()

-- | Parse the <tt>List/length</tt> built-in
--   
--   This corresponds to the <tt>List-length</tt> rule from the official
--   grammar
_ListLength :: Parser ()

-- | Parse the <tt>List/head</tt> built-in
--   
--   This corresponds to the <tt>List-head</tt> rule from the official
--   grammar
_ListHead :: Parser ()

-- | Parse the <tt>List/last</tt> built-in
--   
--   This corresponds to the <tt>List-last</tt> rule from the official
--   grammar
_ListLast :: Parser ()

-- | Parse the <tt>List/indexed</tt> built-in
--   
--   This corresponds to the <tt>List-indexed</tt> rule from the official
--   grammar
_ListIndexed :: Parser ()

-- | Parse the <tt>List/reverse</tt> built-in
--   
--   This corresponds to the <tt>List-reverse</tt> rule from the official
--   grammar
_ListReverse :: Parser ()

-- | Parse the <tt>Bool</tt> built-in
--   
--   This corresponds to the <tt>Bool</tt> rule from the official grammar
_Bool :: Parser ()

-- | Parse the <tt>Bytes</tt> built-in
--   
--   This corresponds to the <tt>Bytes</tt> rule from the official grammar
_Bytes :: Parser ()

-- | Parse the <tt>Natural</tt> built-in
--   
--   This corresponds to the <tt>Natural</tt> rule from the official
--   grammar
_Natural :: Parser ()

-- | Parse the <tt>Integer</tt> built-in
--   
--   This corresponds to the <tt>Integer</tt> rule from the official
--   grammar
_Integer :: Parser ()

-- | Parse the <tt>Double</tt> built-in
--   
--   This corresponds to the <tt>Double</tt> rule from the official grammar
_Double :: Parser ()

-- | Parse the <tt>Text</tt> built-in
--   
--   This corresponds to the <tt>Text</tt> rule from the official grammar
_Text :: Parser ()

-- | Parse the <tt>Text/replace</tt> built-in
--   
--   This corresponds to the <tt>Text-replace</tt> rule from the official
--   grammar
_TextReplace :: Parser ()

-- | Parse the <tt>Text/show</tt> built-in
--   
--   This corresponds to the <tt>Text-show</tt> rule from the official
--   grammar
_TextShow :: Parser ()

-- | Parse the <tt>Date</tt> bult-in
--   
--   This corresponds to the <tt>Date</tt> rule from the official grammar
_Date :: Parser ()

-- | Parse the <tt>Date/show</tt> built-in
--   
--   This corresponds to the <tt>Date-show</tt> rule from the official
--   grammar
_DateShow :: Parser ()

-- | Parse the <tt>Time</tt> bult-in
--   
--   This corresponds to the <tt>Time</tt> rule from the official grammar
_Time :: Parser ()

-- | Parse the <tt>Time/show</tt> built-in
--   
--   This corresponds to the <tt>Time-show</tt> rule from the official
--   grammar
_TimeShow :: Parser ()

-- | Parse the <tt>TimeZone</tt> bult-in
--   
--   This corresponds to the <tt>TimeZone</tt> rule from the official
--   grammar
_TimeZone :: Parser ()

-- | Parse the <tt>TimeZone/show</tt> built-in
--   
--   This corresponds to the <tt>TimeZone-show</tt> rule from the official
--   grammar
_TimeZoneShow :: Parser ()

-- | Parse the <tt>List</tt> built-in
--   
--   This corresponds to the <tt>List</tt> rule from the official grammar
_List :: Parser ()

-- | Parse the <tt>True</tt> built-in
--   
--   This corresponds to the <tt>True</tt> rule from the official grammar
_True :: Parser ()

-- | Parse the <tt>False</tt> built-in
--   
--   This corresponds to the <tt>False</tt> rule from the official grammar
_False :: Parser ()

-- | Parse a <tt>NaN</tt> literal
--   
--   This corresponds to the <tt>NaN</tt> rule from the official grammar
_NaN :: Parser ()

-- | Parse the <tt>Type</tt> built-in
--   
--   This corresponds to the <tt>Type</tt> rule from the official grammar
_Type :: Parser ()

-- | Parse the <tt>Kind</tt> built-in
--   
--   This corresponds to the <tt>Kind</tt> rule from the official grammar
_Kind :: Parser ()

-- | Parse the <tt>Sort</tt> built-in
--   
--   This corresponds to the <tt>Sort</tt> rule from the official grammar
_Sort :: Parser ()

-- | Parse the <tt>Location</tt> keyword
--   
--   This corresponds to the <tt>Location</tt> rule from the official
--   grammar
_Location :: Parser ()

-- | Parse the <tt>=</tt> symbol
_equal :: Parser ()

-- | Parse the <tt>||</tt> symbol
_or :: Parser ()

-- | Parse the <tt>+</tt> symbol
_plus :: Parser ()

-- | Parse the <tt>++</tt> symbol
_textAppend :: Parser ()

-- | Parse the <tt>#</tt> symbol
_listAppend :: Parser ()

-- | Parse the <tt>&amp;&amp;</tt> symbol
_and :: Parser ()

-- | Parse the <tt>*</tt> symbol
_times :: Parser ()

-- | Parse the <tt>==</tt> symbol
_doubleEqual :: Parser ()

-- | Parse the <tt>!=</tt> symbol
_notEqual :: Parser ()

-- | Parse the <tt>.</tt> symbol
_dot :: Parser ()

-- | Parse the <tt>{</tt> symbol
_openBrace :: Parser ()

-- | Parse the <tt>}</tt> symbol
_closeBrace :: Parser ()

-- | Parse the <tt>[</tt>] symbol
_openBracket :: Parser ()

-- | Parse the <tt>]</tt> symbol
_closeBracket :: Parser ()

-- | Parse the <tt>&lt;</tt> symbol
_openAngle :: Parser ()

-- | Parse the <tt>&gt;</tt> symbol
_closeAngle :: Parser ()

-- | Parse the <tt>|</tt> symbol
_bar :: Parser ()

-- | Parse the <tt>,</tt> symbol
_comma :: Parser ()

-- | Parse the <tt>(</tt> symbol
_openParens :: Parser ()

-- | Parse the <tt>)</tt> symbol
_closeParens :: Parser ()

-- | Parse the <tt>:</tt> symbol
_colon :: Parser ()

-- | Parse the <tt>@</tt> symbol
_at :: Parser ()

-- | Parse the equivalence symbol (<tt>===</tt> or <tt>≡</tt>)
_equivalent :: Parser CharacterSet

-- | Parse the <tt>missing</tt> keyword
_missing :: Parser ()

-- | Parse the <tt>?</tt> symbol
_importAlt :: Parser ()

-- | Parse the record combine operator (<tt>/\</tt> or <tt>∧</tt>)
_combine :: Parser CharacterSet

-- | Parse the record type combine operator (<tt>//\\</tt> or <tt>⩓</tt>)
_combineTypes :: Parser CharacterSet

-- | Parse the record "prefer" operator (<tt>//</tt> or <tt>⫽</tt>)
_prefer :: Parser CharacterSet

-- | Parse a lambda (<tt>\</tt> or <tt>λ</tt>)
_lambda :: Parser CharacterSet

-- | Parse a forall (<tt>forall</tt> or <tt>∀</tt>)
_forall :: Parser CharacterSet

-- | Parse a right arrow (<tt>-&gt;</tt> or <tt>→</tt>)
_arrow :: Parser CharacterSet

-- | Parse a double colon (<tt>::</tt>)
_doubleColon :: Parser ()

-- | Parse the <tt>with</tt> keyword
_with :: Parser ()


-- | Parsing Dhall expressions.
module Dhall.Parser.Expression

-- | Get the current source offset (in tokens)
getOffset :: MonadParsec e s m => m Int

-- | Set the current source offset
setOffset :: MonadParsec e s m => Int -> m ()

-- | Wrap a <a>Parser</a> to still match the same text but return only the
--   <a>Src</a> span
src :: Parser a -> Parser Src

-- | Same as <a>src</a>, except also return the parsed value
srcAnd :: Parser a -> Parser (Src, a)

-- | Wrap a <a>Parser</a> to still match the same text, but to wrap the
--   resulting <a>Expr</a> in a <a>Note</a> constructor containing the
--   <a>Src</a> span
noted :: Parser (Expr Src a) -> Parser (Expr Src a)

-- | Parse a complete expression (with leading and trailing whitespace)
--   
--   This corresponds to the <tt>complete-expression</tt> rule from the
--   official grammar
completeExpression :: Parser a -> Parser (Expr Src a)

-- | Parse an "import expression"
--   
--   This is not the same thing as <tt><a>fmap</a> <a>Embed</a></tt>. This
--   parses any expression of the same or higher precedence as an import
--   expression (such as a selector expression). For example, this parses
--   <tt>(1)</tt>
--   
--   This corresponds to the <tt>import-expression</tt> rule from the
--   official grammar
importExpression :: Parser a -> Parser (Expr Src a)

-- | For efficiency (and simplicity) we only expose two parsers from the
--   result of the <a>parsers</a> function, since these are the only
--   parsers needed outside of this module
data Parsers a
Parsers :: Parser (Expr Src a) -> Parser (Expr Src a) -> Parser (Binding Src a) -> Parsers a
[completeExpression_] :: Parsers a -> Parser (Expr Src a)
[importExpression_] :: Parsers a -> Parser (Expr Src a)
[letBinding] :: Parsers a -> Parser (Binding Src a)

-- | Parse a numeric <a>TimeZone</a>
--   
--   This corresponds to the <tt>time-numoffset</tt> rule from the official
--   grammar
timeNumOffset :: Parser (Expr s a)

-- | Parse a numeric <a>TimeZone</a> or a <tt>Z</tt>
--   
--   This corresponds to the <tt>time-offset</tt> rule from the official
--   grammar
timeOffset :: Parser (Expr s a)

-- | Parse a <a>Time</a>
--   
--   This corresponds to the <tt>partial-time</tt> rule from the official
--   grammar
partialTime :: Parser (Expr s a)

-- | Parse a <a>Date</a>
--   
--   This corresponds to the <tt>full-date</tt> rule from the official
--   grammar
fullDate :: Parser (Expr s a)

-- | Parse a <a>Date</a>, <a>Time</a>, <a>TimeZone</a> or any valid
--   permutation of them as a record
--   
--   This corresponds to the <tt>temporal-literal</tt> rule from the
--   official grammar
temporalLiteral :: Parser (Expr s a)

-- | Parse a "shebang" line (i.e. an initial line beginning with
--   <tt>#!</tt>)
shebang :: Parser ()

-- | Given a parser for imports,
parsers :: forall a. Parser a -> Parsers a

-- | Parse an environment variable import
--   
--   This corresponds to the <tt>env</tt> rule from the official grammar
env :: Parser ImportType

-- | Parse a local import without trailing whitespace
localOnly :: Parser ImportType

-- | Parse a local import
--   
--   This corresponds to the <tt>local</tt> rule from the official grammar
local :: Parser ImportType

-- | Parse an HTTP(S) import
--   
--   This corresponds to the <tt>http</tt> rule from the official grammar
http :: Parser ImportType

-- | Parse a <a>Missing</a> import
--   
--   This corresponds to the <tt>missing</tt> rule from the official
--   grammar
missing :: Parser ImportType

-- | Parse an <a>ImportType</a>
--   
--   This corresponds to the <tt>import-type</tt> rule from the official
--   grammar
importType_ :: Parser ImportType

-- | Parse a <a>SHA256Digest</a>
--   
--   This corresponds to the <tt>hash</tt> rule from the official grammar
importHash_ :: Parser SHA256Digest

-- | Parse an <a>ImportHashed</a>
--   
--   This corresponds to the <tt>import-hashed</tt> rule from the official
--   grammar
importHashed_ :: Parser ImportHashed

-- | Parse an <a>Import</a>
--   
--   This corresponds to the <tt>import</tt> rule from the official grammar
import_ :: Parser Import

-- | <a>ApplicationExprInfo</a> distinguishes certain subtypes of
--   application expressions.
data ApplicationExprInfo

-- | <tt>merge x y</tt>, <tt>Some x</tt> or <tt>toMap x</tt>,
--   unparenthesized.
NakedMergeOrSomeOrToMap :: ApplicationExprInfo

-- | An import expression.
ImportExpr :: ApplicationExprInfo

-- | Any other application expression.
ApplicationExpr :: ApplicationExprInfo


-- | This module contains the core calculus for the Dhall language.
--   
--   Dhall is essentially a fork of the <tt>morte</tt> compiler but with
--   more built-in functionality, better error messages, and Haskell
--   integration
module Dhall.Core

-- | Constants for a pure type system
--   
--   The axioms are:
--   
--   <pre>
--   ⊦ Type : Kind
--   ⊦ Kind : Sort
--   </pre>
--   
--   ... and the valid rule pairs are:
--   
--   <pre>
--   ⊦ 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)
--   </pre>
--   
--   Note that Dhall does not support functions from terms to types and
--   therefore Dhall is not a dependently typed language
data Const
Type :: Const
Kind :: Const
Sort :: Const

-- | Internal representation of a directory that stores the path components
--   in reverse order
--   
--   In other words, the directory <tt>/foo/bar/baz</tt> is encoded as
--   <tt>Directory { components = [ "baz", "bar", "foo" ] }</tt>
newtype Directory
Directory :: [Text] -> Directory
[components] :: Directory -> [Text]

-- | A <a>File</a> is a <a>directory</a> followed by one additional path
--   component representing the <a>file</a> name
data File
File :: Directory -> Text -> File
[directory] :: File -> Directory
[file] :: File -> Text

-- | The beginning of a file path which anchors subsequent path components
data FilePrefix

-- | Absolute path
Absolute :: FilePrefix

-- | Path relative to <tt>.</tt>
Here :: FilePrefix

-- | Path relative to <tt>..</tt>
Parent :: FilePrefix

-- | Path relative to <tt>~</tt>
Home :: FilePrefix

-- | Reference to an external resource
data Import
Import :: ImportHashed -> ImportMode -> Import
[importHashed] :: Import -> ImportHashed
[importMode] :: Import -> ImportMode

-- | A <a>ImportType</a> extended with an optional hash for semantic
--   integrity checks
data ImportHashed
ImportHashed :: Maybe SHA256Digest -> ImportType -> ImportHashed
[hash] :: ImportHashed -> Maybe SHA256Digest
[importType] :: ImportHashed -> ImportType

-- | How to interpret the import's contents (i.e. as Dhall code or raw
--   text)
data ImportMode
Code :: ImportMode
RawText :: ImportMode
Location :: ImportMode
RawBytes :: ImportMode

-- | The type of import (i.e. local vs. remote vs. environment)
data ImportType

-- | Local path
Local :: FilePrefix -> File -> ImportType

-- | URL of remote resource and optional headers stored in an import
Remote :: URL -> ImportType

-- | Environment variable
Env :: Text -> ImportType
Missing :: ImportType

-- | This type stores all of the components of a remote import
data URL
URL :: Scheme -> Text -> File -> Maybe Text -> Maybe (Expr Src Import) -> URL
[scheme] :: URL -> Scheme
[authority] :: URL -> Text
[path] :: URL -> File
[query] :: URL -> Maybe Text
[headers] :: URL -> Maybe (Expr Src Import)

-- | The URI scheme
data Scheme
HTTP :: Scheme
HTTPS :: Scheme

-- | This wrapper around <a>Double</a> exists for its <a>Eq</a> instance
--   which is defined via the binary encoding of Dhall <tt>Double</tt>s.
newtype DhallDouble
DhallDouble :: Double -> DhallDouble
[getDhallDouble] :: DhallDouble -> Double

-- | Label for a bound variable
--   
--   The <a>Text</a> field is the variable's name (i.e. "<tt>x</tt>").
--   
--   The <a>Int</a> 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:
--   
--   <pre>
--                                 ┌──refers to──┐
--                                 │             │
--                                 v             │
--   λ(x : Type) → λ(y : Type) → λ(x : Type) → x@0
--   
--   ┌─────────────────refers to─────────────────┐
--   │                                           │
--   v                                           │
--   λ(x : Type) → λ(y : Type) → λ(x : Type) → x@1
--   </pre>
--   
--   This <a>Int</a> 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 <tt>0</tt>:
--   
--   <pre>
--                                 ┌─refers to─┐
--                                 │           │
--                                 v           │
--   λ(x : Type) → λ(y : Type) → λ(x : Type) → x
--   </pre>
--   
--   Zero indices are omitted when pretty-printing <tt>Var</tt>s and
--   non-zero indices appear as a numeric suffix.
data Var
V :: Text -> !Int -> Var

-- | Record the binding part of a <tt>let</tt> expression.
--   
--   For example,
--   
--   <pre>
--   let {- A -} x {- B -} : {- C -} Bool = {- D -} True in x
--   </pre>
--   
--   … will be instantiated as follows:
--   
--   <ul>
--   <li><tt>bindingSrc0</tt> corresponds to the <tt>A</tt> comment.</li>
--   <li><tt>variable</tt> is <tt>"x"</tt></li>
--   <li><tt>bindingSrc1</tt> corresponds to the <tt>B</tt> comment.</li>
--   <li><tt>annotation</tt> is <a>Just</a> a pair, corresponding to the
--   <tt>C</tt> comment and <tt>Bool</tt>.</li>
--   <li><tt>bindingSrc2</tt> corresponds to the <tt>D</tt> comment.</li>
--   <li><tt>value</tt> corresponds to <tt>True</tt>.</li>
--   </ul>
data Binding s a
Binding :: Maybe s -> Text -> Maybe s -> Maybe (Maybe s, Expr s a) -> Maybe s -> Expr s a -> Binding s a
[bindingSrc0] :: Binding s a -> Maybe s
[variable] :: Binding s a -> Text
[bindingSrc1] :: Binding s a -> Maybe s
[annotation] :: Binding s a -> Maybe (Maybe s, Expr s a)
[bindingSrc2] :: Binding s a -> Maybe s
[value] :: Binding s a -> Expr s a

-- | Construct a <a>Binding</a> with no source information and no type
--   annotation.
makeBinding :: Text -> Expr s a -> Binding s a

-- | The body of an interpolated <tt>Text</tt> literal
data Chunks s a
Chunks :: [(Text, Expr s a)] -> Text -> Chunks s a

-- | Used to record the origin of a <tt>//</tt> operator (i.e. from source
--   code or a product of desugaring)
data PreferAnnotation
PreferFromSource :: PreferAnnotation
PreferFromCompletion :: PreferAnnotation

-- | 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,
--   
--   <pre>
--   { {- A -} x {- B -} : {- C -} T }
--   </pre>
--   
--   ... or
--   
--   <pre>
--   { {- A -} x {- B -} = {- C -} T }
--   </pre>
--   
--   will be instantiated as follows:
--   
--   <ul>
--   <li><tt>recordFieldSrc0</tt> corresponds to the <tt>A</tt>
--   comment.</li>
--   <li><tt>recordFieldValue</tt> is <tt><a>T</a></tt></li>
--   <li><tt>recordFieldSrc1</tt> corresponds to the <tt>B</tt>
--   comment.</li>
--   <li><tt>recordFieldSrc2</tt> corresponds to the <tt>C</tt>
--   comment.</li>
--   </ul>
--   
--   Although the <tt>A</tt> comment isn't annotating the <tt><a>T</a></tt>
--   Record Field, this is the best place to keep these comments.
--   
--   Note that <tt>recordFieldSrc2</tt> is always <a>Nothing</a> when the
--   <a>RecordField</a> is for a punned entry, because there is no
--   <tt>=</tt> sign. For example,
--   
--   <pre>
--   { {- A -} x {- B -} }
--   </pre>
--   
--   will be instantiated as follows:
--   
--   <ul>
--   <li><tt>recordFieldSrc0</tt> corresponds to the <tt>A</tt>
--   comment.</li>
--   <li><tt>recordFieldValue</tt> corresponds to <tt>(Var "x")</tt></li>
--   <li><tt>recordFieldSrc1</tt> corresponds to the <tt>B</tt>
--   comment.</li>
--   <li><tt>recordFieldSrc2</tt> will be <a>Nothing</a></li>
--   </ul>
--   
--   The labels involved in a record using dot-syntax like in this example:
--   
--   <pre>
--   { {- A -} a {- B -} . {- C -} b {- D -} . {- E -} c {- F -} = {- G -} e }
--   </pre>
--   
--   will be instantiated as follows:
--   
--   <ul>
--   <li>For both the <tt>a</tt> and <tt>b</tt> field,
--   <tt>recordfieldSrc2</tt> is <a>Nothing</a></li>
--   <li>For the <tt>a</tt> field:</li>
--   <li><tt>recordFieldSrc0</tt> corresponds to the <tt>A</tt>
--   comment</li>
--   <li><tt>recordFieldSrc1</tt> corresponds to the <tt>B</tt>
--   comment</li>
--   <li>For the <tt>b</tt> field:</li>
--   <li><tt>recordFieldSrc0</tt> corresponds to the <tt>C</tt>
--   comment</li>
--   <li><tt>recordFieldSrc1</tt> corresponds to the <tt>D</tt>
--   comment</li>
--   <li>For the <tt>c</tt> field:</li>
--   <li><tt>recordFieldSrc0</tt> corresponds to the <tt>E</tt>
--   comment</li>
--   <li><tt>recordFieldSrc1</tt> corresponds to the <tt>F</tt>
--   comment</li>
--   <li><tt>recordFieldSrc2</tt> corresponds to the <tt>G</tt>
--   comment</li>
--   </ul>
--   
--   That is, for every label except the last one the semantics of
--   <tt>recordFieldSrc0</tt> and <tt>recordFieldSrc1</tt> are the same
--   from a regular record label but <tt>recordFieldSrc2</tt> is always
--   <a>Nothing</a>. For the last keyword, all srcs are <a>Just</a>
data RecordField s a
RecordField :: Maybe s -> Expr s a -> Maybe s -> Maybe s -> RecordField s a
[recordFieldSrc0] :: RecordField s a -> Maybe s
[recordFieldValue] :: RecordField s a -> Expr s a
[recordFieldSrc1] :: RecordField s a -> Maybe s
[recordFieldSrc2] :: RecordField s a -> Maybe s

-- | Construct a <a>RecordField</a> with no src information
makeRecordField :: Expr s a -> RecordField s a

-- | Record the label of a function or a function-type expression
--   
--   For example,
--   
--   <pre>
--   λ({- A -} a {- B -} : {- C -} T) -&gt; e
--   </pre>
--   
--   … will be instantiated as follows:
--   
--   <ul>
--   <li><tt>functionBindingSrc0</tt> corresponds to the <tt>A</tt>
--   comment</li>
--   <li><tt>functionBindingVariable</tt> is <tt>a</tt></li>
--   <li><tt>functionBindingSrc1</tt> corresponds to the <tt>B</tt>
--   comment</li>
--   <li><tt>functionBindingSrc2</tt> corresponds to the <tt>C</tt>
--   comment</li>
--   <li><tt>functionBindingAnnotation</tt> is <tt>T</tt></li>
--   </ul>
data FunctionBinding s a
FunctionBinding :: Maybe s -> Text -> Maybe s -> Maybe s -> Expr s a -> FunctionBinding s a
[functionBindingSrc0] :: FunctionBinding s a -> Maybe s
[functionBindingVariable] :: FunctionBinding s a -> Text
[functionBindingSrc1] :: FunctionBinding s a -> Maybe s
[functionBindingSrc2] :: FunctionBinding s a -> Maybe s
[functionBindingAnnotation] :: FunctionBinding s a -> Expr s a

-- | Smart constructor for <a>FunctionBinding</a> with no src information
makeFunctionBinding :: Text -> Expr s a -> FunctionBinding s a

-- | Record the field on a selector-expression
--   
--   For example,
--   
--   <pre>
--   e . {- A -} x {- B -}
--   </pre>
--   
--   … will be instantiated as follows:
--   
--   <ul>
--   <li><tt>fieldSelectionSrc0</tt> corresponds to the <tt>A</tt>
--   comment</li>
--   <li><tt>fieldSelectionLabel</tt> corresponds to <tt>x</tt></li>
--   <li><tt>fieldSelectionSrc1</tt> corresponds to the <tt>B</tt>
--   comment</li>
--   </ul>
--   
--   Given our limitation that not all expressions recover their
--   whitespaces, the purpose of <tt>fieldSelectionSrc1</tt> is to save the
--   <a>SourcePos</a> where the <tt>fieldSelectionLabel</tt> ends, but we
--   <i>still</i> use a 'Maybe Dhall.Src.Src' (<tt>s = <a>Src</a></tt>) to
--   be consistent with similar data types such as <a>Binding</a>, for
--   example.
data FieldSelection s
FieldSelection :: Maybe s -> !Text -> Maybe s -> FieldSelection s
[fieldSelectionSrc0] :: FieldSelection s -> Maybe s
[fieldSelectionLabel] :: FieldSelection s -> !Text
[fieldSelectionSrc1] :: FieldSelection s -> Maybe s

-- | Smart constructor for <a>FieldSelection</a> with no src information
makeFieldSelection :: Text -> FieldSelection s

-- | A path component for a <tt>with</tt> expression
data WithComponent
WithLabel :: Text -> WithComponent
WithQuestion :: WithComponent

-- | Syntax tree for expressions
--   
--   The <tt>s</tt> type parameter is used to track the presence or absence
--   of <a>Src</a> spans:
--   
--   <ul>
--   <li>If <tt>s = <a>Src</a></tt> then the code may contains <a>Src</a>
--   spans (either in a <a>Note</a> constructor or inline within another
--   constructor, like <a>Let</a>)</li>
--   <li>If <tt>s = <a>Void</a></tt> then the code has no <a>Src</a>
--   spans</li>
--   </ul>
--   
--   The <tt>a</tt> type parameter is used to track the presence or absence
--   of imports
--   
--   <ul>
--   <li>If <tt>a = <a>Import</a></tt> then the code may contain unresolved
--   <a>Import</a>s</li>
--   <li>If <tt>a = <a>Void</a></tt> then the code has no
--   <a>Import</a>s</li>
--   </ul>
data Expr s a

-- | <pre>
--   Const c                                  ~  c
--   </pre>
Const :: Const -> Expr s a

-- | <pre>
--   Var (V x 0)                              ~  x
--   Var (V x n)                              ~  x@n
--   </pre>
Var :: Var -> Expr s a

-- | <pre>
--   Lam _ (FunctionBinding _ "x" _ _ A) b    ~  λ(x : A) -&gt; b
--   </pre>
Lam :: Maybe CharacterSet -> FunctionBinding s a -> Expr s a -> Expr s a

-- | <pre>
--   Pi _ "_" A B                               ~        A  -&gt; B
--   Pi _ x   A B                               ~  ∀(x : A) -&gt; B
--   </pre>
Pi :: Maybe CharacterSet -> Text -> Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   App f a                                  ~  f a
--   </pre>
App :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Let (Binding _ x _  Nothing  _ r) e      ~  let x     = r in e
--   Let (Binding _ x _ (Just t ) _ r) e      ~  let x : t = r in e
--   </pre>
--   
--   The difference between
--   
--   <pre>
--   let x = a    let y = b in e
--   </pre>
--   
--   and
--   
--   <pre>
--   let x = a in let y = b in e
--   </pre>
--   
--   is only an additional <a>Note</a> around <tt><a>Let</a> "y" …</tt> in
--   the second example.
--   
--   See <a>MultiLet</a> for a representation of let-blocks that mirrors
--   the source code more closely.
Let :: Binding s a -> Expr s a -> Expr s a

-- | <pre>
--   Annot x t                                ~  x : t
--   </pre>
Annot :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Bool                                     ~  Bool
--   </pre>
Bool :: Expr s a

-- | <pre>
--   BoolLit b                                ~  b
--   </pre>
BoolLit :: Bool -> Expr s a

-- | <pre>
--   BoolAnd x y                              ~  x &amp;&amp; y
--   </pre>
BoolAnd :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   BoolOr  x y                              ~  x || y
--   </pre>
BoolOr :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   BoolEQ  x y                              ~  x == y
--   </pre>
BoolEQ :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   BoolNE  x y                              ~  x != y
--   </pre>
BoolNE :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   BoolIf x y z                             ~  if x then y else z
--   </pre>
BoolIf :: Expr s a -> Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Bytes                                    ~ Bytes
--   </pre>
Bytes :: Expr s a

-- | <pre>
--   BytesLit "\x00\xFF"                      ~ 0x"00FF"
--   </pre>
BytesLit :: ByteString -> Expr s a

-- | <pre>
--   Natural                                  ~  Natural
--   </pre>
Natural :: Expr s a

-- | <pre>
--   NaturalLit n                             ~  n
--   </pre>
NaturalLit :: Natural -> Expr s a

-- | <pre>
--   NaturalFold                              ~  Natural/fold
--   </pre>
NaturalFold :: Expr s a

-- | <pre>
--   NaturalBuild                             ~  Natural/build
--   </pre>
NaturalBuild :: Expr s a

-- | <pre>
--   NaturalIsZero                            ~  Natural/isZero
--   </pre>
NaturalIsZero :: Expr s a

-- | <pre>
--   NaturalEven                              ~  Natural/even
--   </pre>
NaturalEven :: Expr s a

-- | <pre>
--   NaturalOdd                               ~  Natural/odd
--   </pre>
NaturalOdd :: Expr s a

-- | <pre>
--   NaturalToInteger                         ~  Natural/toInteger
--   </pre>
NaturalToInteger :: Expr s a

-- | <pre>
--   NaturalShow                              ~  Natural/show
--   </pre>
NaturalShow :: Expr s a

-- | <pre>
--   NaturalSubtract                          ~  Natural/subtract
--   </pre>
NaturalSubtract :: Expr s a

-- | <pre>
--   NaturalPlus x y                          ~  x + y
--   </pre>
NaturalPlus :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   NaturalTimes x y                         ~  x * y
--   </pre>
NaturalTimes :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Integer                                  ~  Integer
--   </pre>
Integer :: Expr s a

-- | <pre>
--   IntegerLit n                             ~  ±n
--   </pre>
IntegerLit :: Integer -> Expr s a

-- | <pre>
--   IntegerClamp                             ~  Integer/clamp
--   </pre>
IntegerClamp :: Expr s a

-- | <pre>
--   IntegerNegate                            ~  Integer/negate
--   </pre>
IntegerNegate :: Expr s a

-- | <pre>
--   IntegerShow                              ~  Integer/show
--   </pre>
IntegerShow :: Expr s a

-- | <pre>
--   IntegerToDouble                          ~  Integer/toDouble
--   </pre>
IntegerToDouble :: Expr s a

-- | <pre>
--   Double                                   ~  Double
--   </pre>
Double :: Expr s a

-- | <pre>
--   DoubleLit n                              ~  n
--   </pre>
DoubleLit :: DhallDouble -> Expr s a

-- | <pre>
--   DoubleShow                               ~  Double/show
--   </pre>
DoubleShow :: Expr s a

-- | <pre>
--   Text                                     ~  Text
--   </pre>
Text :: Expr s a

-- | <pre>
--   TextLit (Chunks [(t1, e1), (t2, e2)] t3) ~  "t1${e1}t2${e2}t3"
--   </pre>
TextLit :: Chunks s a -> Expr s a

-- | <pre>
--   TextAppend x y                           ~  x ++ y
--   </pre>
TextAppend :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   TextReplace                              ~ Text/replace
--   </pre>
TextReplace :: Expr s a

-- | <pre>
--   TextShow                                 ~  Text/show
--   </pre>
TextShow :: Expr s a

-- | <pre>
--   Date                                     ~  Date
--   </pre>
Date :: Expr s a

-- | <pre>
--   DateLiteral (fromGregorian _YYYY _MM _DD) ~ YYYY-MM-DD
--   </pre>
DateLiteral :: Day -> Expr s a

-- | <pre>
--   DateShow                                 ~  Date/show
--   </pre>
DateShow :: Expr s a

-- | <pre>
--   Time                                     ~  Time
--   </pre>
Time :: Expr s a

-- | <pre>
--   TimeLiteral (TimeOfDay hh mm ss) _       ~  hh:mm:ss
--   </pre>
TimeLiteral :: TimeOfDay -> Word -> Expr s a
TimeShow :: Expr s a

-- | <pre>
--   TimeZone                                 ~  TimeZone
--   </pre>
TimeZone :: Expr s a

-- | <pre>
--   TimeZoneLiteral (TimeZone ( 60 * _HH + _MM) _ _) ~ +HH:MM
--   </pre>
--   
--   | &gt; TimeZoneLiteral (TimeZone (-60 * _HH + _MM) _ _) ~ -HH:MM
TimeZoneLiteral :: TimeZone -> Expr s a

-- | <pre>
--   TimeZoneShow                             ~  TimeZone/Show
--   </pre>
TimeZoneShow :: Expr s a

-- | <pre>
--   List                                     ~  List
--   </pre>
List :: Expr s a

-- | <pre>
--   ListLit (Just t ) []                     ~  [] : t
--   ListLit  Nothing  [x, y, z]              ~  [x, y, z]
--   </pre>
--   
--   Invariant: A non-empty list literal is always represented as
--   <tt>ListLit Nothing xs</tt>.
--   
--   When an annotated, non-empty list literal is parsed, it is represented
--   as
--   
--   <pre>
--   Annot (ListLit Nothing [x, y, z]) t      ~ [x, y, z] : t
--   </pre>
ListLit :: Maybe (Expr s a) -> Seq (Expr s a) -> Expr s a

-- | <pre>
--   ListAppend x y                           ~  x # y
--   </pre>
ListAppend :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   ListBuild                                ~  List/build
--   </pre>
ListBuild :: Expr s a

-- | <pre>
--   ListFold                                 ~  List/fold
--   </pre>
ListFold :: Expr s a

-- | <pre>
--   ListLength                               ~  List/length
--   </pre>
ListLength :: Expr s a

-- | <pre>
--   ListHead                                 ~  List/head
--   </pre>
ListHead :: Expr s a

-- | <pre>
--   ListLast                                 ~  List/last
--   </pre>
ListLast :: Expr s a

-- | <pre>
--   ListIndexed                              ~  List/indexed
--   </pre>
ListIndexed :: Expr s a

-- | <pre>
--   ListReverse                              ~  List/reverse
--   </pre>
ListReverse :: Expr s a

-- | <pre>
--   Optional                                 ~  Optional
--   </pre>
Optional :: Expr s a

-- | <pre>
--   Some e                                   ~  Some e
--   </pre>
Some :: Expr s a -> Expr s a

-- | <pre>
--   None                                     ~  None
--   </pre>
None :: Expr s a

-- | <pre>
--   Record [ (k1, RecordField _ t1)          ~  { k1 : t1, k2 : t1 }
--          , (k2, RecordField _ t2)
--          ]
--   </pre>
Record :: Map Text (RecordField s a) -> Expr s a

-- | <pre>
--   RecordLit [ (k1, RecordField _ v1)       ~  { k1 = v1, k2 = v2 }
--             , (k2, RecordField _ v2)
--             ]
--   </pre>
RecordLit :: Map Text (RecordField s a) -> Expr s a

-- | <pre>
--   Union        [(k1, Just t1), (k2, Nothing)] ~  &lt; k1 : t1 | k2 &gt;
--   </pre>
Union :: Map Text (Maybe (Expr s a)) -> Expr s a

-- | <pre>
--   Combine _ Nothing x y                    ~  x ∧ y
--   </pre>
--   
--   The first field is a <a>Just</a> when the <a>Combine</a> operator is
--   introduced as a result of desugaring duplicate record fields:
--   
--   <pre>
--   RecordLit [ ( k                          ~ { k = x, k = y }
--             , RecordField
--                _
--                (Combine (Just k) x y)
--              )]
--   </pre>
Combine :: Maybe CharacterSet -> Maybe Text -> Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   CombineTypes _ x y                       ~  x ⩓ y
--   </pre>
CombineTypes :: Maybe CharacterSet -> Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Prefer _ _ x y                           ~  x ⫽ y
--   </pre>
Prefer :: Maybe CharacterSet -> PreferAnnotation -> Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   RecordCompletion x y                     ~  x::y
--   </pre>
RecordCompletion :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Merge x y (Just t )                      ~  merge x y : t
--   Merge x y  Nothing                       ~  merge x y
--   </pre>
Merge :: Expr s a -> Expr s a -> Maybe (Expr s a) -> Expr s a

-- | <pre>
--   ToMap x (Just t)                         ~  toMap x : t
--   ToMap x  Nothing                         ~  toMap x
--   </pre>
ToMap :: Expr s a -> Maybe (Expr s a) -> Expr s a

-- | <pre>
--   ShowConstructor x                        ~  showConstructor x
--   </pre>
ShowConstructor :: Expr s a -> Expr s a

-- | <pre>
--   Field e (FieldSelection _ x _)              ~  e.x
--   </pre>
Field :: Expr s a -> FieldSelection s -> Expr s a

-- | <pre>
--   Project e (Left xs)                      ~  e.{ xs }
--   Project e (Right t)                      ~  e.(t)
--   </pre>
Project :: Expr s a -> Either [Text] (Expr s a) -> Expr s a

-- | <pre>
--   Assert e                                 ~  assert : e
--   </pre>
Assert :: Expr s a -> Expr s a

-- | <pre>
--   Equivalent _ x y                           ~  x ≡ y
--   </pre>
Equivalent :: Maybe CharacterSet -> Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   With x y e                               ~  x with y = e
--   </pre>
With :: Expr s a -> NonEmpty WithComponent -> Expr s a -> Expr s a

-- | <pre>
--   Note s x                                 ~  e
--   </pre>
Note :: s -> Expr s a -> Expr s a

-- | <pre>
--   ImportAlt                                ~  e1 ? e2
--   </pre>
ImportAlt :: Expr s a -> Expr s a -> Expr s a

-- | <pre>
--   Embed import                             ~  import
--   </pre>
Embed :: a -> Expr s a

-- | α-normalize an expression by renaming all bound variables to
--   <tt>"_"</tt> and using De Bruijn indices to distinguish them
--   
--   <pre>
--   &gt;&gt;&gt; mfb = Syntax.makeFunctionBinding
--   
--   &gt;&gt;&gt; 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)))))
--   </pre>
--   
--   α-normalization does not affect free variables:
--   
--   <pre>
--   &gt;&gt;&gt; alphaNormalize "x"
--   Var (V "x" 0)
--   </pre>
alphaNormalize :: Expr s a -> Expr s a

-- | Reduce an expression to its normal form, performing beta reduction
--   
--   <a>normalize</a> 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.
--   
--   <a>normalize</a> can also fail with <a>error</a> if you normalize an
--   ill-typed expression
normalize :: Eq a => Expr s a -> Expr t a

-- | Reduce an expression to its normal form, performing beta reduction and
--   applying any custom definitions.
--   
--   <a>normalizeWith</a> is designed to be used with function
--   <a>typeWith</a>. The <a>typeWith</a> function allows typing of Dhall
--   functions in a custom typing context whereas <a>normalizeWith</a>
--   allows evaluating Dhall expressions in a custom context.
--   
--   To be more precise <a>normalizeWith</a> 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.
--   
--   <a>normalizeWith</a> can fail with an <a>error</a> if you normalize an
--   ill-typed expression
normalizeWith :: Eq a => Maybe (ReifiedNormalizer a) -> Expr s a -> Expr t a

-- | This function generalizes <a>normalizeWith</a> by allowing the custom
--   normalizer to use an arbitrary <a>Monad</a>
--   
--   <a>normalizeWithM</a> can fail with an <a>error</a> if you normalize
--   an ill-typed expression
normalizeWithM :: (Monad m, Eq a) => NormalizerM m a -> Expr s a -> m (Expr t a)

-- | An variation on <a>NormalizerM</a> for pure normalizers
type Normalizer a = NormalizerM Identity a

-- | Use this to wrap you embedded functions (see <a>normalizeWith</a>) to
--   make them polymorphic enough to be used.
type NormalizerM m a = forall s. Expr s a -> m (Maybe (Expr s a))

-- | A reified <a>Normalizer</a>, which can be stored in structures without
--   running into impredicative polymorphism.
newtype ReifiedNormalizer a
ReifiedNormalizer :: Normalizer a -> ReifiedNormalizer a
[getReifiedNormalizer] :: ReifiedNormalizer a -> Normalizer a

-- | Returns <a>True</a> if two expressions are α-equivalent and
--   β-equivalent and <a>False</a> otherwise
--   
--   <a>judgmentallyEqual</a> can fail with an <a>error</a> if you compare
--   ill-typed expressions
judgmentallyEqual :: Eq a => Expr s a -> Expr t a -> Bool

-- | Substitute all occurrences of a variable with an expression
--   
--   <pre>
--   subst x C B  ~  B[x := C]
--   </pre>
subst :: Var -> Expr s a -> Expr s a -> Expr s a

-- | <a>shift</a> 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:
--   
--   <pre>
--   λ(a : Type) → λ(x : a) → (λ(y : a) → λ(x : a) → y) x
--   </pre>
--   
--   If you were to substitute <tt>y</tt> with <tt>x</tt> without shifting
--   any variable indices, then you would get the following incorrect
--   result:
--   
--   <pre>
--   λ(a : Type) → λ(x : a) → λ(x : a) → x  -- Incorrect normalized form
--   </pre>
--   
--   In order to substitute <tt>x</tt> in place of <tt>y</tt> we need to
--   <a>shift</a> <tt>x</tt> by <tt>1</tt> in order to avoid being
--   misinterpreted as the <tt>x</tt> bound by the innermost lambda. If we
--   perform that <a>shift</a> then we get the correct result:
--   
--   <pre>
--   λ(a : Type) → λ(x : a) → λ(x : a) → x@1
--   </pre>
--   
--   As a more worked example, suppose that you were to normalize the
--   following expression:
--   
--   <pre>
--       λ(a : Type)
--   →   λ(f : a → a → a)
--   →   λ(x : a)
--   →   λ(x : a)
--   →   (λ(x : a) → f x x@1) x@1
--   </pre>
--   
--   The correct normalized result would be:
--   
--   <pre>
--       λ(a : Type)
--   →   λ(f : a → a → a)
--   →   λ(x : a)
--   →   λ(x : a)
--   →   f x@1 x
--   </pre>
--   
--   The above example illustrates how we need to both increase and
--   decrease variable indices as part of substitution:
--   
--   <ul>
--   <li>We need to increase the index of the outer <tt>x@1</tt> to
--   <tt>x@2</tt> 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 <tt>(f x@2
--   x@1)</tt></li>
--   <li>We then remove the innermost lambda and therefore decrease the
--   indices of both <tt>x</tt>s in <tt>(f x@2 x@1)</tt> to <tt>(f x@1
--   x)</tt> in order to reflect that one less <tt>x</tt> variable is now
--   bound within that scope</li>
--   </ul>
--   
--   Formally, <tt>(shift d (V x n) e)</tt> modifies the expression
--   <tt>e</tt> by adding <tt>d</tt> to the indices of all variables named
--   <tt>x</tt> whose indices are greater than <tt>(n + m)</tt>, where
--   <tt>m</tt> is the number of bound variables of the same name within
--   that scope
--   
--   In practice, <tt>d</tt> is always <tt>1</tt> or <tt>-1</tt> because we
--   either:
--   
--   <ul>
--   <li>increment variables by <tt>1</tt> to avoid variable capture during
--   substitution</li>
--   <li>decrement variables by <tt>1</tt> when deleting lambdas after
--   substitution</li>
--   </ul>
--   
--   <tt>n</tt> starts off at <tt>0</tt> 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.
shift :: Int -> Var -> Expr s a -> Expr s a

-- | Quickly check if an expression is in normal form
--   
--   Given a well-typed expression <tt>e</tt>, <tt><a>isNormalized</a>
--   e</tt> is equivalent to <tt>e == <a>normalize</a> e</tt>.
--   
--   Given an ill-typed expression, <a>isNormalized</a> may fail with an
--   error, or evaluate to either False or True!
isNormalized :: Eq a => Expr s a -> Bool

-- | Check if an expression is in a normal form given a context of
--   evaluation. Unlike <a>isNormalized</a>, this will fully normalize and
--   traverse through the expression.
--   
--   It is much more efficient to use <a>isNormalized</a>.
--   
--   <a>isNormalizedWith</a> can fail with an <a>error</a> if you check an
--   ill-typed expression
isNormalizedWith :: (Eq s, Eq a) => Normalizer a -> Expr s a -> Bool

-- | Remove all <a>Note</a> constructors from an <a>Expr</a> (i.e.
--   de-<a>Note</a>)
--   
--   This also remove CharacterSet annotations.
denote :: Expr s a -> Expr t a

-- | The "opposite" of <a>denote</a>, like <tt>first absurd</tt> but faster
renote :: Expr Void a -> Expr s a

-- | Remove any outermost <a>Note</a> constructors
--   
--   This is typically used when you want to get the outermost
--   non-<a>Note</a> constructor without removing internal <a>Note</a>
--   constructors
shallowDenote :: Expr s a -> Expr s a

-- | Detect if the given variable is free within the given expression
--   
--   <pre>
--   &gt;&gt;&gt; "x" `freeIn` "x"
--   True
--   
--   &gt;&gt;&gt; "x" `freeIn` "y"
--   False
--   
--   &gt;&gt;&gt; "x" `freeIn` Lam mempty (Syntax.makeFunctionBinding "x" (Const Type)) "x"
--   False
--   </pre>
freeIn :: Eq a => Var -> Expr s a -> Bool

-- | Pretty-print a value
pretty :: Pretty a => a -> Text

-- | A traversal over the immediate sub-expressions of an expression.
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 which
--   allows mapping embedded values
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 in <a>Chunks</a>.
chunkExprs :: Applicative f => (Expr s a -> f (Expr t b)) -> Chunks s a -> f (Chunks t b)

-- | Traverse over the immediate <a>Expr</a> children in a <a>Binding</a>.
bindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> Binding s a -> f (Binding s b)

-- | Traverse over the immediate <a>Expr</a> children in a
--   <a>RecordField</a>.
recordFieldExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> RecordField s a -> f (RecordField s b)

-- | Traverse over the immediate <a>Expr</a> children in a
--   <a>FunctionBinding</a>.
functionBindingExprs :: Applicative f => (Expr s a -> f (Expr s b)) -> FunctionBinding s a -> f (FunctionBinding s b)

-- | Generate a <a>MultiLet</a> from the contents of a <a>Let</a>.
--   
--   In the resulting <tt><a>MultiLet</a> bs e</tt>, <tt>e</tt> is
--   guaranteed not to be a <a>Let</a>, but it might be a <tt>(<a>Note</a>
--   … (<a>Let</a> …))</tt>.
--   
--   Given parser output, <a>multiLet</a> consolidates <tt>let</tt>s that
--   formed a let-block in the original source.
multiLet :: Binding s a -> Expr s a -> MultiLet s a

-- | Wrap let-<a>Binding</a>s around an <a>Expr</a>.
--   
--   <a>wrapInLets</a> can be understood as an inverse for <a>multiLet</a>:
--   
--   <pre>
--   let MultiLet bs e1 = multiLet b e0
--   
--   wrapInLets bs e1 == Let b e0
--   </pre>
wrapInLets :: Foldable f => f (Binding s a) -> Expr s a -> Expr s a

-- | This type represents 1 or more nested <a>Let</a> bindings that have
--   been coalesced together for ease of manipulation
data MultiLet s a
MultiLet :: NonEmpty (Binding s a) -> Expr s a -> MultiLet s a

-- | Utility function used to throw internal errors that should never
--   happen (in theory) but that are not enforced by the type system
internalError :: Text -> forall b. b

-- | The set of reserved identifiers for the Dhall language | Contains also
--   all keywords from "reservedKeywords"
reservedIdentifiers :: HashSet Text

-- | Escape a <a>Text</a> literal using Dhall's escaping rules
--   
--   Note that the result does not include surrounding quotes
escapeText :: Text -> Text

-- | Returns <a>True</a> if the given <a>Char</a> is valid within an
--   unquoted path component
--   
--   This is exported for reuse within the
--   <tt><a>Dhall.Parser.Token</a></tt> module
pathCharacter :: Char -> Bool

-- | Convenience utility for converting <a>Either</a>-based exceptions to
--   <a>IO</a>-based exceptions
throws :: (Exception e, MonadIO io) => Either e a -> io a

-- | Utility that powers the <tt>Text/show</tt> built-in
textShow :: Text -> Text

-- | Utility used to implement the <tt>--censor</tt> flag, by:
--   
--   <ul>
--   <li>Replacing all <a>Src</a> text with spaces</li>
--   <li>Replacing all <a>Text</a> literals inside type errors with
--   spaces</li>
--   </ul>
censorExpression :: Expr Src a -> Expr Src a

-- | Utility used to censor <a>Text</a> by replacing all characters with a
--   space
censorText :: Text -> Text


-- | This module contains Dhall's parsing logic
module Dhall.Parser

-- | Parse an expression from <a>Text</a> containing a Dhall program
exprFromText :: String -> Text -> Either ParseError (Expr Src Import)

-- | Like <a>exprFromText</a> but also returns the leading comments and
--   whitespace (i.e. header) up to the last newline before the code begins
--   
--   In other words, if you have a Dhall file of the form:
--   
--   <pre>
--   -- Comment 1
--   {- Comment -} 2
--   </pre>
--   
--   Then this will preserve <tt>Comment 1</tt>, but not <tt>Comment 2</tt>
--   
--   This is used by <tt>dhall-format</tt> to preserve leading comments and
--   whitespace
exprAndHeaderFromText :: String -> Text -> Either ParseError (Header, Expr Src Import)

-- | Replace the source code with spaces when rendering error messages
--   
--   This utility is used to implement the <tt>--censor</tt> flag
censor :: ParseError -> ParseError

-- | Create a header with stripped leading spaces and trailing newlines
createHeader :: Text -> Header

-- | Parser for a top-level Dhall expression
expr :: Parser (Expr Src Import)

-- | Parser for a top-level Dhall expression. The expression is
--   parameterized over any parseable type, allowing the language to be
--   extended as needed.

-- | <i>Deprecated: Support for parsing custom imports will be dropped in a
--   future release</i>
exprA :: Parser a -> Parser (Expr Src a)

-- | 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
newtype Header
Header :: Text -> Header

-- | Source code extract
data Src
Src :: !SourcePos -> !SourcePos -> Text -> Src
[srcStart] :: Src -> !SourcePos
[srcEnd] :: Src -> !SourcePos
[srcText] :: Src -> Text

-- | An exception annotated with a <a>Src</a> span
data SourcedException e
SourcedException :: Src -> e -> SourcedException e

-- | A parsing error
data ParseError
ParseError :: ParseErrorBundle Text Void -> Text -> ParseError
[unwrap] :: ParseError -> ParseErrorBundle Text Void
[input] :: ParseError -> Text

-- | A <a>Parser</a> that is almost identical to
--   <tt><a>Text.Megaparsec</a>.<a>Parsec</a></tt> except treating
--   Haskell-style comments as whitespace
newtype Parser a
Parser :: Parsec Void Text a -> Parser a
[unParser] :: Parser a -> Parsec Void Text a
instance GHC.Show.Show Dhall.Parser.Header
instance GHC.Show.Show Dhall.Parser.ParseError
instance GHC.Exception.Type.Exception Dhall.Parser.ParseError


-- | Shared utility functions
module Dhall.Util

-- | Utility function to cut out the interior of a large text block
snip :: Text -> Text

-- | Like <a>snip</a>, but for <a>Doc</a>s
--   
--   Note that this has to be opinionated and render ANSI color codes, but
--   that should be fine because we don't use this in a non-interactive
--   context
snipDoc :: Doc Ann -> Doc a

-- | Function to insert an aligned pretty expression
insert :: Pretty a => a -> Doc Ann

-- | Prefix used for error messages
_ERROR :: IsString string => string

-- | Set to <a>Censor</a> if you want to censor error text that might
--   include secrets
data Censor
NoCensor :: Censor
Censor :: Censor

-- | Path to input
data Input
StandardInput :: Input
InputFile :: FilePath -> Input

-- | Specifies whether or not an input's transitive dependencies should
--   also be processed. Transitive dependencies are restricted to relative
--   file imports.
data Transitivity

-- | Do not process transitive dependencies
NonTransitive :: Transitivity

-- | Process transitive dependencies in the same way
Transitive :: Transitivity

-- | Some command-line subcommands can either <a>Write</a> their input or
--   <a>Check</a> that the input has already been modified. This type is
--   shared between them to record that choice.
data OutputMode
Write :: OutputMode
Check :: OutputMode

-- | Path to output
data Output
StandardOutput :: Output
OutputFile :: FilePath -> Output

-- | Convenient utility for retrieving an expression
getExpression :: Censor -> Input -> IO (Expr Src Import)

-- | Convenient utility for retrieving an expression along with its header
getExpressionAndHeader :: Censor -> Input -> 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)
getExpressionAndHeaderFromStdinText :: Censor -> String -> Text -> IO (Header, Expr Src Import)

-- | 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
newtype Header
Header :: Text -> Header

-- | A check failure corresponding to a single input. This type is intended
--   to be used with <a>MultipleCheckFailed</a> for error reporting.
newtype CheckFailed
CheckFailed :: Input -> CheckFailed
[input] :: CheckFailed -> Input

-- | Exception thrown when the <tt>--check</tt> flag to a command-line
--   subcommand fails
data MultipleCheckFailed
MultipleCheckFailed :: Text -> Text -> NonEmpty Input -> MultipleCheckFailed
[command] :: MultipleCheckFailed -> Text
[modified] :: MultipleCheckFailed -> Text
[inputs] :: MultipleCheckFailed -> NonEmpty Input

-- | Run IO for multiple inputs, then collate all the check failures before
--   throwing if there was any failure
handleMultipleChecksFailed :: (Foldable t, Traversable t) => Text -> Text -> (a -> IO (Either CheckFailed ())) -> t a -> IO ()

-- | Convenient utility to output an expression either to a file or to
--   stdout.
renderExpression :: Pretty a => CharacterSet -> Bool -> Maybe FilePath -> Expr Src a -> IO ()
instance GHC.Classes.Eq Dhall.Util.Input
instance GHC.Exception.Type.Exception Dhall.Util.MultipleCheckFailed
instance GHC.Show.Show Dhall.Util.MultipleCheckFailed


-- | This module contains the logic for type checking Dhall code
module Dhall.TypeCheck

-- | Type-check an expression and return the expression's type if
--   type-checking succeeds or an error if type-checking fails
--   
--   <a>typeWith</a> does not necessarily normalize the type since full
--   normalization is not necessary for just type-checking. If you actually
--   care about the returned type then you may want to <a>normalize</a> it
--   afterwards.
--   
--   The supplied <a>Context</a> records the types of the names in scope.
--   If these are ill-typed, the return value may be ill-typed.
typeWith :: Context (Expr s X) -> Expr s X -> Either (TypeError s X) (Expr s X)

-- | <a>typeOf</a> is the same as <a>typeWith</a> with an empty context,
--   meaning that the expression must be closed (i.e. no free variables),
--   otherwise type-checking will fail.
typeOf :: Expr s X -> Either (TypeError s X) (Expr s X)

-- | Generalization of <a>typeWith</a> that allows type-checking the
--   <a>Embed</a> constructor with custom logic
typeWithA :: (Eq a, Pretty a) => Typer a -> Context (Expr s a) -> Expr s a -> Either (TypeError s a) (Expr s a)

-- | This function verifies that a custom context is well-formed so that
--   type-checking will not loop
--   
--   Note that <a>typeWith</a> already calls <a>checkContext</a> for you on
--   the <a>Context</a> that you supply
checkContext :: Context (Expr s X) -> Either (TypeError s X) ()

-- | <tt>Traversal</tt> that traverses every <a>Expr</a> in a
--   <a>TypeMessage</a>
messageExpressions :: Applicative f => (Expr s a -> f (Expr t b)) -> TypeMessage s a -> f (TypeMessage t b)

-- | Function that converts the value inside an <a>Embed</a> constructor
--   into a new expression
type Typer a = forall s. a -> Expr s a

-- | A type synonym for <a>Void</a>
--   
--   This is provided for backwards compatibility, since Dhall used to use
--   its own <a>X</a> type instead of
--   <tt><a>Data.Void</a>.<a>Void</a></tt>. You should use <a>Void</a>
--   instead of <a>X</a> now

-- | <i>Deprecated: Use Data.Void.Void instead</i>
type X = Void
absurd :: Void -> a

-- | A structured type error that includes context
data TypeError s a
TypeError :: Context (Expr s a) -> Expr s a -> TypeMessage s a -> TypeError s a
[context] :: TypeError s a -> Context (Expr s a)
[current] :: TypeError s a -> Expr s a
[typeMessage] :: TypeError s a -> TypeMessage s a

-- | Newtype used to wrap error messages so that they render with a more
--   detailed explanation of what went wrong
newtype DetailedTypeError s a
DetailedTypeError :: TypeError s a -> DetailedTypeError s a

-- | Wrap a type error in this exception type to censor source code and
--   <a>Text</a> literals from the error message
data Censored
CensoredDetailed :: DetailedTypeError Src X -> Censored
Censored :: TypeError Src X -> Censored

-- | The specific type error
data TypeMessage s a
UnboundVariable :: Text -> TypeMessage s a
InvalidInputType :: Expr s a -> TypeMessage s a
InvalidOutputType :: Expr s a -> TypeMessage s a
NotAFunction :: Expr s a -> Expr s a -> TypeMessage s a
TypeMismatch :: Expr s a -> Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
AnnotMismatch :: Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
Untyped :: TypeMessage s a
MissingListType :: TypeMessage s a
MismatchedListElements :: Int -> Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
InvalidListElement :: Int -> Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
InvalidListType :: Expr s a -> TypeMessage s a
ListLitInvariant :: TypeMessage s a
InvalidSome :: Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
InvalidPredicate :: Expr s a -> Expr s a -> TypeMessage s a
IfBranchMismatch :: Expr s a -> Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
InvalidFieldType :: Text -> Expr s a -> TypeMessage s a
InvalidAlternativeType :: Text -> Expr s a -> TypeMessage s a
ListAppendMismatch :: Expr s a -> Expr s a -> TypeMessage s a
MustUpdateARecord :: Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
MustCombineARecord :: Char -> Expr s a -> Expr s a -> TypeMessage s a
InvalidDuplicateField :: Text -> Expr s a -> Expr s a -> TypeMessage s a
InvalidRecordCompletion :: Text -> Expr s a -> TypeMessage s a
CompletionSchemaMustBeARecord :: Expr s a -> Expr s a -> TypeMessage s a
CombineTypesRequiresRecordType :: Expr s a -> Expr s a -> TypeMessage s a
RecordTypeMismatch :: Const -> Const -> Expr s a -> Expr s a -> TypeMessage s a
DuplicateFieldCannotBeMerged :: NonEmpty Text -> TypeMessage s a
FieldCollision :: NonEmpty Text -> TypeMessage s a
FieldTypeCollision :: NonEmpty Text -> TypeMessage s a
MustMergeARecord :: Expr s a -> Expr s a -> TypeMessage s a
MustMergeUnionOrOptional :: Expr s a -> Expr s a -> TypeMessage s a
MustMapARecord :: Expr s a -> Expr s a -> TypeMessage s a
InvalidToMapRecordKind :: Expr s a -> Expr s a -> TypeMessage s a
HeterogenousRecordToMap :: Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
InvalidToMapType :: Expr s a -> TypeMessage s a
MapTypeMismatch :: Expr s a -> Expr s a -> TypeMessage s a
MissingToMapType :: TypeMessage s a
UnusedHandler :: Set Text -> TypeMessage s a
MissingHandler :: Text -> Set Text -> TypeMessage s a
HandlerInputTypeMismatch :: Text -> Expr s a -> Expr s a -> TypeMessage s a
DisallowedHandlerType :: Text -> Expr s a -> Expr s a -> Text -> TypeMessage s a
HandlerOutputTypeMismatch :: Text -> Expr s a -> Text -> Expr s a -> TypeMessage s a
InvalidHandlerOutputType :: Text -> Expr s a -> Expr s a -> TypeMessage s a
MissingMergeType :: TypeMessage s a
HandlerNotAFunction :: Text -> Expr s a -> TypeMessage s a
CantAccess :: Text -> Expr s a -> Expr s a -> TypeMessage s a
CantProject :: Text -> Expr s a -> Expr s a -> TypeMessage s a
CantProjectByExpression :: Expr s a -> TypeMessage s a
DuplicateProjectionLabel :: Text -> TypeMessage s a
MissingField :: Text -> Expr s a -> TypeMessage s a
MissingConstructor :: Text -> Expr s a -> TypeMessage s a
ProjectionTypeMismatch :: Text -> Expr s a -> Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
AssertionFailed :: Expr s a -> Expr s a -> TypeMessage s a
NotAnEquivalence :: Expr s a -> TypeMessage s a
IncomparableExpression :: Expr s a -> TypeMessage s a
EquivalenceTypeMismatch :: Expr s a -> Expr s a -> Expr s a -> Expr s a -> TypeMessage s a
NotWithARecord :: Expr s a -> Expr s a -> TypeMessage s a
CantAnd :: Expr s a -> Expr s a -> TypeMessage s a
CantOr :: Expr s a -> Expr s a -> TypeMessage s a
CantEQ :: Expr s a -> Expr s a -> TypeMessage s a
CantNE :: Expr s a -> Expr s a -> TypeMessage s a
CantInterpolate :: Expr s a -> Expr s a -> TypeMessage s a
CantTextAppend :: Expr s a -> Expr s a -> TypeMessage s a
CantListAppend :: Expr s a -> Expr s a -> TypeMessage s a
CantAdd :: Expr s a -> Expr s a -> TypeMessage s a
CantMultiply :: Expr s a -> Expr s a -> TypeMessage s a
OptionalWithTypeMismatch :: TypeMessage s a
NotALabelPath :: TypeMessage s a
NotAQuestionPath :: Text -> TypeMessage s a
ShowConstructorNotOnUnion :: TypeMessage s a

-- | Convert a <a>TypeMessage</a> to short- and long-form
--   <a>ErrorMessages</a>
prettyTypeMessage :: (Eq a, Pretty a) => TypeMessage s a -> ErrorMessages

-- | Output of <a>prettyTypeMessage</a>, containing short- and long-form
--   error messages
data ErrorMessages
ErrorMessages :: Doc Ann -> [Doc Ann] -> Doc Ann -> ErrorMessages

-- | Default succinct 1-line explanation of what went wrong
[short] :: ErrorMessages -> Doc Ann

-- | Possibly-empty hints based on specific types involved in the error
[hints] :: ErrorMessages -> [Doc Ann]

-- | Longer and more detailed explanation of the error
[long] :: ErrorMessages -> Doc Ann
instance (GHC.Show.Show s, GHC.Show.Show a) => GHC.Show.Show (Dhall.TypeCheck.TypeMessage s a)
instance GHC.Show.Show Dhall.TypeCheck.Censored
instance GHC.Exception.Type.Exception Dhall.TypeCheck.Censored
instance Prettyprinter.Internal.Pretty Dhall.TypeCheck.Censored
instance (GHC.Classes.Eq a, Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a) => GHC.Show.Show (Dhall.TypeCheck.DetailedTypeError s a)
instance (GHC.Classes.Eq a, Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => GHC.Exception.Type.Exception (Dhall.TypeCheck.DetailedTypeError s a)
instance (GHC.Classes.Eq a, Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a) => Prettyprinter.Internal.Pretty (Dhall.TypeCheck.DetailedTypeError s a)
instance (GHC.Classes.Eq a, Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a) => GHC.Show.Show (Dhall.TypeCheck.TypeError s a)
instance (GHC.Classes.Eq a, Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => GHC.Exception.Type.Exception (Dhall.TypeCheck.TypeError s a)
instance (GHC.Classes.Eq a, Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a) => Prettyprinter.Internal.Pretty (Dhall.TypeCheck.TypeError s a)


-- | This module contains the implementation of the <tt>dhall tags</tt>
--   command
module Dhall.Tags

-- | Generate etags for Dhall expressions
generate :: Input -> Maybe [Text] -> Bool -> IO Text
instance GHC.Show.Show Dhall.Tags.LineColumn
instance GHC.Classes.Ord Dhall.Tags.LineColumn
instance GHC.Classes.Eq Dhall.Tags.LineColumn
instance GHC.Show.Show Dhall.Tags.LineOffset
instance GHC.Classes.Ord Dhall.Tags.LineOffset
instance GHC.Classes.Eq Dhall.Tags.LineOffset
instance GHC.Show.Show Dhall.Tags.Tag
instance GHC.Base.Semigroup Dhall.Tags.Tags
instance GHC.Base.Monoid Dhall.Tags.Tags


-- | Create a package.dhall from files and directory contents.
module Dhall.Package

-- | Create a package.dhall from files and directory contents. For a
--   description of how the package file is constructed see
--   <a>getPackagePathAndContent</a>.
writePackage :: CharacterSet -> Maybe String -> NonEmpty FilePath -> IO ()

-- | Get the path and the Dhall expression for a package file.
--   
--   The location of the resulting package file is determined by the first
--   path of the second argument:
--   
--   <ul>
--   <li>If it is a directory, it is also the output directory and the
--   package file will be placed there.</li>
--   <li>If it is a file, then the directory that file resides in is the
--   output directory and the package file will be placed there.</li>
--   </ul>
--   
--   All inputs provided as the second argument must be either in the
--   output directory or below it. They are processed depending on whether
--   the path points to a directory or a file:
--   
--   <ul>
--   <li>If the path points to a directory, all files with a
--   <tt>.dhall</tt> extensions in that directory are included in the
--   package.</li>
--   <li>If the path points to a regular file, it is included in the
--   package unless it is the path of the package file itself.</li>
--   </ul>
getPackagePathAndContent :: Maybe String -> NonEmpty FilePath -> IO (FilePath, Expr s Import)

-- | Exception thrown when creating a package file.
data PackageError
AmbiguousOutputDirectory :: FilePath -> FilePath -> PackageError
IncompatiblePaths :: [Import] -> PackageError
InvalidPath :: FilePath -> PackageError
instance GHC.Exception.Type.Exception Dhall.Package.PackageError
instance GHC.Show.Show Dhall.Package.PackageError


-- | Please read the <a>Dhall.Tutorial</a> module, which contains a
--   tutorial explaining how to use the language, the compiler, and this
--   library
module Dhall.Marshal.Encode

-- | An <tt>(Encoder a)</tt> represents a way to marshal a value of type
--   <tt>'a'</tt> from Haskell into Dhall.
data Encoder a
Encoder :: (a -> Expr Src Void) -> Expr Src Void -> Encoder a

-- | Embeds a Haskell value as a Dhall expression
[embed] :: Encoder a -> a -> Expr Src Void

-- | Dhall type of the Haskell value
[declared] :: Encoder a -> Expr Src Void

-- | This class is used by <a>FromDhall</a> instance for functions:
--   
--   <pre>
--   instance (ToDhall a, FromDhall b) =&gt; FromDhall (a -&gt; b)
--   </pre>
--   
--   You can convert Dhall functions with "simple" inputs (i.e. instances
--   of this class) into Haskell functions. This works by:
--   
--   <ul>
--   <li>Marshaling the input to the Haskell function into a Dhall
--   expression (i.e. <tt>x :: Expr Src Void</tt>)</li>
--   <li>Applying the Dhall function (i.e. <tt>f :: Expr Src Void</tt>) to
--   the Dhall input (i.e. <tt>App f x</tt>)</li>
--   <li>Normalizing the syntax tree (i.e. <tt>normalize (App f
--   x)</tt>)</li>
--   <li>Marshaling the resulting Dhall expression back into a Haskell
--   value</li>
--   </ul>
--   
--   This class auto-generates a default implementation for types that
--   implement <a>Generic</a>. This does not auto-generate an instance for
--   recursive types.
--   
--   The default instance can be tweaked using
--   <a>genericToDhallWith</a>/<a>genericToDhallWithInputNormalizer</a> and
--   custom <a>InterpretOptions</a>, or using <a>DerivingVia</a> and
--   <a>Codec</a> from <a>Dhall.Deriving</a>.
class ToDhall a
injectWith :: ToDhall a => InputNormalizer -> Encoder a
injectWith :: (ToDhall a, Generic a, GenericToDhall (Rep a)) => InputNormalizer -> Encoder a

-- | A compatibility alias for <a>ToDhall</a>

-- | <i>Deprecated: Use ToDhall instead</i>
type Inject = ToDhall

-- | Use the default input normalizer for injecting a value.
--   
--   <pre>
--   inject = injectWith defaultInputNormalizer
--   </pre>
inject :: ToDhall a => Encoder a

-- | The <a>RecordEncoder</a> divisible (contravariant) functor allows you
--   to build an <a>Encoder</a> for a Dhall record.
--   
--   For example, let's take the following Haskell data type:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   data Project = Project
--     { projectName :: Text
--     , projectDescription :: Text
--     , projectStars :: Natural
--     }
--   :}
--   </pre>
--   
--   And assume that we have the following Dhall record that we would like
--   to parse as a <tt>Project</tt>:
--   
--   <pre>
--   { name =
--       "dhall-haskell"
--   , description =
--       "A configuration language guaranteed to terminate"
--   , stars =
--       289
--   }
--   </pre>
--   
--   Our encoder has type <a>Encoder</a> <tt>Project</tt>, but we can't
--   build that out of any smaller encoders, as <a>Encoder</a>s cannot be
--   combined (they are only <a>Contravariant</a>s). However, we can use an
--   <a>RecordEncoder</a> to build an <a>Encoder</a> for <tt>Project</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   injectProject :: Encoder Project
--   injectProject =
--     recordEncoder
--       ( adapt &gt;$&lt; encodeFieldWith "name" inject
--               &gt;*&lt; encodeFieldWith "description" inject
--               &gt;*&lt; encodeFieldWith "stars" inject
--       )
--     where
--       adapt (Project{..}) = (projectName, (projectDescription, projectStars))
--   :}
--   </pre>
--   
--   Or, since we are simply using the <a>ToDhall</a> instance to inject
--   each field, we could write
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   injectProject :: Encoder Project
--   injectProject =
--     recordEncoder
--       ( adapt &gt;$&lt; encodeField "name"
--               &gt;*&lt; encodeField "description"
--               &gt;*&lt; encodeField "stars"
--       )
--     where
--       adapt (Project{..}) = (projectName, (projectDescription, projectStars))
--   :}
--   </pre>
newtype RecordEncoder a
RecordEncoder :: Map Text (Encoder a) -> RecordEncoder a

-- | Convert a <a>RecordEncoder</a> into the equivalent <a>Encoder</a>.
recordEncoder :: RecordEncoder a -> Encoder a

-- | Specify how to encode one field of a record using the default
--   <a>ToDhall</a> instance for that type.
encodeField :: ToDhall a => Text -> RecordEncoder a

-- | Specify how to encode one field of a record by supplying an explicit
--   <a>Encoder</a> for that field.
encodeFieldWith :: Text -> Encoder a -> RecordEncoder a

-- | <a>UnionEncoder</a> allows you to build an <a>Encoder</a> for a Dhall
--   record.
--   
--   For example, let's take the following Haskell data type:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   data Status = Queued Natural
--               | Result Text
--               | Errored Text
--   :}
--   </pre>
--   
--   And assume that we have the following Dhall union that we would like
--   to parse as a <tt>Status</tt>:
--   
--   <pre>
--   &lt; Result : Text
--   | Queued : Natural
--   | Errored : Text
--   &gt;.Result "Finish successfully"
--   </pre>
--   
--   Our encoder has type <a>Encoder</a> <tt>Status</tt>, but we can't
--   build that out of any smaller encoders, as <a>Encoder</a>s cannot be
--   combined. However, we can use an <a>UnionEncoder</a> to build an
--   <a>Encoder</a> for <tt>Status</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   injectStatus :: Encoder Status
--   injectStatus = adapt &gt;$&lt; unionEncoder
--     (   encodeConstructorWith "Queued"  inject
--     &gt;|&lt; encodeConstructorWith "Result"  inject
--     &gt;|&lt; encodeConstructorWith "Errored" inject
--     )
--     where
--       adapt (Queued  n) = Left n
--       adapt (Result  t) = Right (Left t)
--       adapt (Errored e) = Right (Right e)
--   :}
--   </pre>
--   
--   Or, since we are simply using the <a>ToDhall</a> instance to inject
--   each branch, we could write
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   injectStatus :: Encoder Status
--   injectStatus = adapt &gt;$&lt; unionEncoder
--     (   encodeConstructor "Queued"
--     &gt;|&lt; encodeConstructor "Result"
--     &gt;|&lt; encodeConstructor "Errored"
--     )
--     where
--       adapt (Queued  n) = Left n
--       adapt (Result  t) = Right (Left t)
--       adapt (Errored e) = Right (Right e)
--   :}
--   </pre>
newtype UnionEncoder a
UnionEncoder :: Product (Const (Map Text (Expr Src Void))) (Op (Text, Expr Src Void)) a -> UnionEncoder a

-- | Convert a <a>UnionEncoder</a> into the equivalent <a>Encoder</a>.
unionEncoder :: UnionEncoder a -> Encoder a

-- | Specify how to encode an alternative by using the default
--   <a>ToDhall</a> instance for that type.
encodeConstructor :: ToDhall a => Text -> UnionEncoder a

-- | Specify how to encode an alternative by providing an explicit
--   <a>Encoder</a> for that alternative.
encodeConstructorWith :: Text -> Encoder a -> UnionEncoder a

-- | Combines two <a>UnionEncoder</a> values. See <a>UnionEncoder</a> for
--   usage notes.
--   
--   Ideally, this matches <a>chosen</a>; however, this allows
--   <a>UnionEncoder</a> to not need a <a>Divisible</a> instance itself
--   (since no instance is possible).
(>|<) :: UnionEncoder a -> UnionEncoder b -> UnionEncoder (Either a b)
infixr 5 >|<

-- | This is the underlying class that powers the <a>FromDhall</a> class's
--   support for automatically deriving a generic implementation.
class GenericToDhall f
genericToDhallWithNormalizer :: GenericToDhall f => InputNormalizer -> InterpretOptions -> State Int (Encoder (f a))

-- | Use the default options for injecting a value, whose structure is
--   determined generically.
--   
--   This can be used when you want to use <a>ToDhall</a> on types that you
--   don't want to define orphan instances for.
genericToDhall :: (Generic a, GenericToDhall (Rep a)) => Encoder a

-- | Use custom options for injecting a value, whose structure is
--   determined generically.
--   
--   This can be used when you want to use <a>ToDhall</a> on types that you
--   don't want to define orphan instances for.
genericToDhallWith :: (Generic a, GenericToDhall (Rep a)) => InterpretOptions -> Encoder a

-- | <a>genericToDhallWithInputNormalizer</a> is like
--   <a>genericToDhallWith</a>, but instead of using the
--   <a>defaultInputNormalizer</a> it expects an custom
--   <a>InputNormalizer</a>.
genericToDhallWithInputNormalizer :: (Generic a, GenericToDhall (Rep a)) => InterpretOptions -> InputNormalizer -> Encoder a

-- | Use these options to tweak how Dhall derives a generic implementation
--   of <a>FromDhall</a>.
data InterpretOptions
InterpretOptions :: (Text -> Text) -> (Text -> Text) -> SingletonConstructors -> InterpretOptions

-- | Function used to transform Haskell field names into their
--   corresponding Dhall field names
[fieldModifier] :: InterpretOptions -> Text -> Text

-- | Function used to transform Haskell constructor names into their
--   corresponding Dhall alternative names
[constructorModifier] :: InterpretOptions -> Text -> Text

-- | Specify how to handle constructors with only one field. The default is
--   <a>Smart</a>
[singletonConstructors] :: InterpretOptions -> SingletonConstructors

-- | This type specifies how to model a Haskell constructor with 1 field in
--   Dhall
--   
--   For example, consider the following Haskell datatype definition:
--   
--   <pre>
--   data Example = Foo { x :: Double } | Bar Double
--   </pre>
--   
--   Depending on which option you pick, the corresponding Dhall type could
--   be:
--   
--   <pre>
--   &lt; Foo : Double | Bar : Double &gt;                   -- Bare
--   </pre>
--   
--   <pre>
--   &lt; Foo : { x : Double } | Bar : { _1 : Double } &gt;  -- Wrapped
--   </pre>
--   
--   <pre>
--   &lt; Foo : { x : Double } | Bar : Double &gt;           -- Smart
--   </pre>
data SingletonConstructors

-- | Never wrap the field in a record
Bare :: SingletonConstructors

-- | Always wrap the field in a record
Wrapped :: SingletonConstructors

-- | Only fields in a record if they are named
Smart :: SingletonConstructors

-- | Default interpret options for generics-based instances, which you can
--   tweak or override, like this:
--   
--   <pre>
--   genericAutoWith
--       (defaultInterpretOptions { fieldModifier = Data.Text.Lazy.dropWhile (== '_') })
--   </pre>
defaultInterpretOptions :: InterpretOptions

-- | This is only used by the <a>FromDhall</a> instance for functions in
--   order to normalize the function input before marshaling the input into
--   a Dhall expression.
newtype InputNormalizer
InputNormalizer :: ReifiedNormalizer Void -> InputNormalizer
[getInputNormalizer] :: InputNormalizer -> ReifiedNormalizer Void

-- | Default normalization-related settings (no custom normalization)
defaultInputNormalizer :: InputNormalizer

-- | This type is exactly the same as <a>Fix</a> except with a different
--   <a>FromDhall</a> instance. This intermediate type simplifies the
--   implementation of the inner loop for the <a>FromDhall</a> instance for
--   <a>Fix</a>.
data Result f
(>$<) :: Contravariant f => (a -> b) -> f b -> f a

-- | Infix <a>divided</a>
(>*<) :: Divisible f => f a -> f b -> f (a, b)
infixr 5 >*<
data () => Natural
data () => Seq a
data () => Text
data () => Vector a
class () => Generic a
instance Data.Functor.Contravariant.Contravariant Dhall.Marshal.Encode.UnionEncoder
instance Data.Functor.Contravariant.Contravariant Dhall.Marshal.Encode.RecordEncoder
instance Data.Functor.Contravariant.Divisible.Divisible Dhall.Marshal.Encode.RecordEncoder
instance Dhall.Marshal.Encode.ToDhall GHC.Base.Void
instance Dhall.Marshal.Encode.ToDhall GHC.Types.Bool
instance Dhall.Marshal.Encode.ToDhall Data.ByteString.Short.Internal.ShortByteString
instance Dhall.Marshal.Encode.ToDhall Data.ByteString.Lazy.Internal.ByteString
instance Dhall.Marshal.Encode.ToDhall Data.ByteString.Internal.Type.ByteString
instance Dhall.Marshal.Encode.ToDhall Data.Text.Short.Internal.ShortText
instance Dhall.Marshal.Encode.ToDhall Data.Text.Internal.Lazy.Text
instance Dhall.Marshal.Encode.ToDhall Data.Text.Internal.Text
instance Dhall.Marshal.Encode.ToDhall GHC.Base.String
instance Dhall.Marshal.Encode.ToDhall GHC.Num.Natural.Natural
instance Dhall.Marshal.Encode.ToDhall GHC.Num.Integer.Integer
instance Dhall.Marshal.Encode.ToDhall GHC.Types.Int
instance Dhall.Marshal.Encode.ToDhall GHC.Int.Int8
instance Dhall.Marshal.Encode.ToDhall GHC.Int.Int16
instance Dhall.Marshal.Encode.ToDhall GHC.Int.Int32
instance Dhall.Marshal.Encode.ToDhall GHC.Int.Int64
instance Dhall.Marshal.Encode.ToDhall GHC.Types.Word
instance Dhall.Marshal.Encode.ToDhall GHC.Word.Word8
instance Dhall.Marshal.Encode.ToDhall GHC.Word.Word16
instance Dhall.Marshal.Encode.ToDhall GHC.Word.Word32
instance Dhall.Marshal.Encode.ToDhall GHC.Word.Word64
instance Dhall.Marshal.Encode.ToDhall GHC.Types.Double
instance Dhall.Marshal.Encode.ToDhall Data.Scientific.Scientific
instance Dhall.Marshal.Encode.ToDhall ()
instance Dhall.Marshal.Encode.ToDhall a => Dhall.Marshal.Encode.ToDhall (GHC.Maybe.Maybe a)
instance Dhall.Marshal.Encode.ToDhall a => Dhall.Marshal.Encode.ToDhall (Data.Sequence.Internal.Seq a)
instance Dhall.Marshal.Encode.ToDhall a => Dhall.Marshal.Encode.ToDhall [a]
instance Dhall.Marshal.Encode.ToDhall a => Dhall.Marshal.Encode.ToDhall (Data.Vector.Vector a)
instance Dhall.Marshal.Encode.ToDhall Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance Dhall.Marshal.Encode.ToDhall Data.Time.Calendar.Days.Day
instance Dhall.Marshal.Encode.ToDhall Data.Time.LocalTime.Internal.TimeZone.TimeZone
instance Dhall.Marshal.Encode.ToDhall Data.Time.LocalTime.Internal.LocalTime.LocalTime
instance Dhall.Marshal.Encode.ToDhall Data.Time.LocalTime.Internal.ZonedTime.ZonedTime
instance Dhall.Marshal.Encode.ToDhall Data.Time.Clock.Internal.UTCTime.UTCTime
instance Dhall.Marshal.Encode.ToDhall Data.Time.Calendar.Week.DayOfWeek
instance Dhall.Marshal.Encode.ToDhall a => Dhall.Marshal.Encode.ToDhall (Data.Set.Internal.Set a)
instance Dhall.Marshal.Encode.ToDhall a => Dhall.Marshal.Encode.ToDhall (Data.HashSet.Internal.HashSet a)
instance (Dhall.Marshal.Encode.ToDhall a, Dhall.Marshal.Encode.ToDhall b) => Dhall.Marshal.Encode.ToDhall (a, b)
instance (Dhall.Marshal.Encode.ToDhall k, Dhall.Marshal.Encode.ToDhall v) => Dhall.Marshal.Encode.ToDhall (Data.Map.Internal.Map k v)
instance (Dhall.Marshal.Encode.ToDhall k, Dhall.Marshal.Encode.ToDhall v) => Dhall.Marshal.Encode.ToDhall (Data.HashMap.Internal.HashMap k v)
instance Dhall.Marshal.Encode.ToDhall (f (Dhall.Marshal.Internal.Result f)) => Dhall.Marshal.Encode.ToDhall (Dhall.Marshal.Internal.Result f)
instance (GHC.Base.Functor f, Dhall.Marshal.Encode.ToDhall (f (Dhall.Marshal.Internal.Result f))) => Dhall.Marshal.Encode.ToDhall (Data.Fix.Fix f)
instance (GHC.Generics.Selector s, Dhall.Marshal.Encode.ToDhall a) => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a))
instance (Dhall.Marshal.Encode.GenericToDhall (f GHC.Generics.:*: g), GHC.Generics.Selector s, Dhall.Marshal.Encode.ToDhall a) => Dhall.Marshal.Encode.GenericToDhall ((f GHC.Generics.:*: g) GHC.Generics.:*: GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a))
instance (GHC.Generics.Selector s, Dhall.Marshal.Encode.ToDhall a, Dhall.Marshal.Encode.GenericToDhall (f GHC.Generics.:*: g)) => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a) GHC.Generics.:*: (f GHC.Generics.:*: g))
instance (GHC.Generics.Selector s1, GHC.Generics.Selector s2, Dhall.Marshal.Encode.ToDhall a1, Dhall.Marshal.Encode.ToDhall a2) => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.S s1 (GHC.Generics.K1 i1 a1) GHC.Generics.:*: GHC.Generics.M1 GHC.Generics.S s2 (GHC.Generics.K1 i2 a2))
instance Dhall.Marshal.Encode.GenericToDhall f => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.D d f)
instance Dhall.Marshal.Encode.GenericToDhall f => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.C c f)
instance (GHC.Generics.Constructor c1, GHC.Generics.Constructor c2, Dhall.Marshal.Encode.GenericToDhall f1, Dhall.Marshal.Encode.GenericToDhall f2) => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.C c1 f1 GHC.Generics.:+: GHC.Generics.M1 GHC.Generics.C c2 f2)
instance (GHC.Generics.Constructor c, Dhall.Marshal.Encode.GenericToDhall (f GHC.Generics.:+: g), Dhall.Marshal.Encode.GenericToDhall h) => Dhall.Marshal.Encode.GenericToDhall ((f GHC.Generics.:+: g) GHC.Generics.:+: GHC.Generics.M1 GHC.Generics.C c h)
instance (GHC.Generics.Constructor c, Dhall.Marshal.Encode.GenericToDhall f, Dhall.Marshal.Encode.GenericToDhall (g GHC.Generics.:+: h)) => Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.M1 GHC.Generics.C c f GHC.Generics.:+: (g GHC.Generics.:+: h))
instance (Dhall.Marshal.Encode.GenericToDhall (f GHC.Generics.:+: g), Dhall.Marshal.Encode.GenericToDhall (h GHC.Generics.:+: i)) => Dhall.Marshal.Encode.GenericToDhall ((f GHC.Generics.:+: g) GHC.Generics.:+: (h GHC.Generics.:+: i))
instance (Dhall.Marshal.Encode.GenericToDhall (f GHC.Generics.:*: g), Dhall.Marshal.Encode.GenericToDhall (h GHC.Generics.:*: i)) => Dhall.Marshal.Encode.GenericToDhall ((f GHC.Generics.:*: g) GHC.Generics.:*: (h GHC.Generics.:*: i))
instance Dhall.Marshal.Encode.GenericToDhall GHC.Generics.U1
instance Data.Functor.Contravariant.Contravariant Dhall.Marshal.Encode.Encoder


-- | Please read the <a>Dhall.Tutorial</a> module, which contains a
--   tutorial explaining how to use the language, the compiler, and this
--   library
module Dhall.Marshal.Decode

-- | A <tt>(Decoder a)</tt> represents a way to marshal a value of type
--   <tt>'a'</tt> from Dhall into Haskell.
--   
--   You can produce <a>Decoder</a>s either explicitly:
--   
--   <pre>
--   example :: Decoder (Vector Text)
--   example = vector text
--   </pre>
--   
--   ... or implicitly using <a>auto</a>:
--   
--   <pre>
--   example :: Decoder (Vector Text)
--   example = auto
--   </pre>
--   
--   You can consume <a>Decoder</a>s using the <a>input</a> function:
--   
--   <pre>
--   input :: Decoder a -&gt; Text -&gt; IO a
--   </pre>
data Decoder a
Decoder :: (Expr Src Void -> Extractor Src Void a) -> Expector (Expr Src Void) -> Decoder a

-- | Extracts Haskell value from the Dhall expression
[extract] :: Decoder a -> Expr Src Void -> Extractor Src Void a

-- | Dhall type of the Haskell value
[expected] :: Decoder a -> Expector (Expr Src Void)

-- | Any value that implements <a>FromDhall</a> can be automatically
--   decoded based on the inferred return type of <a>input</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input auto "[1, 2, 3]" :: IO (Vector Natural)
--   [1,2,3]
--   
--   &gt;&gt;&gt; input auto "toMap { a = False, b = True }" :: IO (Map Text Bool)
--   fromList [("a",False),("b",True)]
--   </pre>
--   
--   This class auto-generates a default implementation for types that
--   implement <a>Generic</a>. This does not auto-generate an instance for
--   recursive types.
--   
--   The default instance can be tweaked using
--   <a>genericAutoWith</a>/<a>genericAutoWithInputNormalizer</a> and
--   custom <a>InterpretOptions</a>, or using <a>DerivingVia</a> and
--   <a>Codec</a> from <a>Dhall.Deriving</a>.
class FromDhall a
autoWith :: FromDhall a => InputNormalizer -> Decoder a
autoWith :: (FromDhall a, Generic a, GenericFromDhall a (Rep a)) => InputNormalizer -> Decoder a

-- | A compatibility alias for <a>FromDhall</a>.

-- | <i>Deprecated: Use FromDhall instead</i>
type Interpret = FromDhall

-- | Use the default input normalizer for interpreting an input.
--   
--   <pre>
--   auto = autoWith defaultInputNormalizer
--   </pre>
auto :: FromDhall a => Decoder a

-- | Decode a <a>Bool</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input bool "True"
--   True
--   </pre>
bool :: Decoder Bool

-- | Decode <tt>()</tt> from an empty record.
--   
--   <pre>
--   &gt;&gt;&gt; input unit "{=}"  -- GHC doesn't print the result if it is ()
--   </pre>
unit :: Decoder ()

-- | Decode <a>Void</a> from an empty union.
--   
--   Since <tt>&lt;&gt;</tt> is uninhabited, <tt><a>input</a>
--   <a>void</a></tt> will always fail.
void :: Decoder Void

-- | Decode a <a>Natural</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input natural "42"
--   42
--   </pre>
natural :: Decoder Natural

-- | Decode a <a>Word</a> from a Dhall <tt>Natural</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input word "42"
--   42
--   </pre>
word :: Decoder Word

-- | Decode a <a>Word8</a> from a Dhall <tt>Natural</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input word8 "42"
--   42
--   </pre>
word8 :: Decoder Word8

-- | Decode a <a>Word16</a> from a Dhall <tt>Natural</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input word16 "42"
--   42
--   </pre>
word16 :: Decoder Word16

-- | Decode a <a>Word32</a> from a Dhall <tt>Natural</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input word32 "42"
--   42
--   </pre>
word32 :: Decoder Word32

-- | Decode a <a>Word64</a> from a Dhall <tt>Natural</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input word64 "42"
--   42
--   </pre>
word64 :: Decoder Word64

-- | Decode an <a>Integer</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input integer "+42"
--   42
--   </pre>
integer :: Decoder Integer

-- | Decode an <a>Int</a> from a Dhall <tt>Integer</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input int "-42"
--   -42
--   </pre>
int :: Decoder Int

-- | Decode an <a>Int8</a> from a Dhall <tt>Integer</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input int8 "-42"
--   -42
--   </pre>
int8 :: Decoder Int8

-- | Decode an <a>Int16</a> from a Dhall <tt>Integer</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input int16 "-42"
--   -42
--   </pre>
int16 :: Decoder Int16

-- | Decode an <a>Int32</a> from a Dhall <tt>Integer</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input int32 "-42"
--   -42
--   </pre>
int32 :: Decoder Int32

-- | Decode an <a>Int64</a> from a Dhall <tt>Integer</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input int64 "-42"
--   -42
--   </pre>
int64 :: Decoder Int64

-- | Decode a <a>Scientific</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input scientific "1e100"
--   1.0e100
--   </pre>
scientific :: Decoder Scientific

-- | Decode a <a>Double</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input double "42.0"
--   42.0
--   </pre>
double :: Decoder Double

-- | Decode a lazy <a>ByteString</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input lazyBytes "0x\"00FF\""
--   "\NUL\255"
--   </pre>
lazyBytes :: Decoder ByteString

-- | Decode a strict <a>ByteString</a>
--   
--   <pre>
--   &gt;&gt;&gt; input strictBytes "0x\"00FF\""
--   "\NUL\255"
--   </pre>
strictBytes :: Decoder ByteString

-- | Decode a <a>ShortByteString</a>
--   
--   <pre>
--   &gt;&gt;&gt; input shortBytes "0x\"00FF\""
--   "\NUL\255"
--   </pre>
shortBytes :: Decoder ShortByteString

-- | Decode a <a>String</a>
--   
--   <pre>
--   &gt;&gt;&gt; input string "\"ABC\""
--   "ABC"
--   </pre>
string :: Decoder String

-- | Decode lazy <a>Text</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input lazyText "\"Test\""
--   "Test"
--   </pre>
lazyText :: Decoder Text

-- | Decode strict <a>Text</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input strictText "\"Test\""
--   "Test"
--   </pre>
strictText :: Decoder Text

-- | Decode <a>ShortText</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input shortText "\"Test\""
--   "Test"
--   </pre>
shortText :: Decoder ShortText

-- | Decode <a>TimeOfDay</a>
--   
--   <pre>
--   &gt;&gt;&gt; input timeOfDay "00:00:00"
--   00:00:00
--   </pre>
timeOfDay :: Decoder TimeOfDay

-- | Decode <a>Day</a>
--   
--   <pre>
--   &gt;&gt;&gt; input day "2000-01-01"
--   2000-01-01
--   </pre>
day :: Decoder Day

-- | Decode <a>TimeZone</a>
--   
--   <pre>
--   &gt;&gt;&gt; input timeZone "+00:00"
--   +0000
--   </pre>
timeZone :: Decoder TimeZone

-- | Decode <a>LocalTime</a>
--   
--   <pre>
--   &gt;&gt;&gt; input localTime "2020-01-01T12:34:56"
--   2020-01-01 12:34:56
--   </pre>
localTime :: Decoder LocalTime

-- | Decode <a>ZonedTime</a>
--   
--   <pre>
--   &gt;&gt;&gt; input zonedTime "2020-01-01T12:34:56+02:00"
--   2020-01-01 12:34:56 +0200
--   </pre>
zonedTime :: Decoder ZonedTime

-- | Decode <a>UTCTime</a>
--   
--   <pre>
--   &gt;&gt;&gt; input utcTime "2020-01-01T12:34:56+02:00"
--   2020-01-01 10:34:56 UTC
--   </pre>
utcTime :: Decoder UTCTime

-- | Decode <a>DayOfWeek</a>
--   
--   <pre>
--   &gt;&gt;&gt; input dayOfWeek "&lt; Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday &gt;.Monday"
--   Monday
--   </pre>
dayOfWeek :: Decoder DayOfWeek

-- | Decode a <a>Maybe</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input (maybe natural) "Some 1"
--   Just 1
--   </pre>
maybe :: Decoder a -> Decoder (Maybe a)

-- | Given a pair of <a>Decoder</a>s, decode a tuple-record into their
--   pairing.
--   
--   <pre>
--   &gt;&gt;&gt; input (pair natural bool) "{ _1 = 42, _2 = False }"
--   (42,False)
--   </pre>
pair :: Decoder a -> Decoder b -> Decoder (a, b)

-- | Decode a <a>Seq</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input (sequence natural) "[1, 2, 3]"
--   fromList [1,2,3]
--   </pre>
sequence :: Decoder a -> Decoder (Seq a)

-- | Decode a list.
--   
--   <pre>
--   &gt;&gt;&gt; input (list natural) "[1, 2, 3]"
--   [1,2,3]
--   </pre>
list :: Decoder a -> Decoder [a]

-- | Decode a <a>Vector</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input (vector natural) "[1, 2, 3]"
--   [1,2,3]
--   </pre>
vector :: Decoder a -> Decoder (Vector a)

-- | Decode a <a>Set</a> from a <a>List</a> with distinct elements.
--   
--   <pre>
--   &gt;&gt;&gt; input (setFromDistinctList natural) "[1, 2, 3]"
--   fromList [1,2,3]
--   </pre>
--   
--   An error is thrown if the list contains duplicates.
--   
--   <pre>
--   &gt;&gt;&gt; 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
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 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
--   </pre>
setFromDistinctList :: (Ord a, Show a) => Decoder a -> Decoder (Set a)

-- | Decode a <a>Set</a> from a <a>List</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input (setIgnoringDuplicates natural) "[1, 2, 3]"
--   fromList [1,2,3]
--   </pre>
--   
--   Duplicate elements are ignored.
--   
--   <pre>
--   &gt;&gt;&gt; input (setIgnoringDuplicates natural) "[1, 1, 3]"
--   fromList [1,3]
--   </pre>
setIgnoringDuplicates :: Ord a => Decoder a -> Decoder (Set a)

-- | Decode a <a>HashSet</a> from a <a>List</a> with distinct elements.
--   
--   <pre>
--   &gt;&gt;&gt; input (hashSetFromDistinctList natural) "[1, 2, 3]"
--   fromList [1,2,3]
--   </pre>
--   
--   An error is thrown if the list contains duplicates.
--   
--   <pre>
--   &gt;&gt;&gt; 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
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 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
--   </pre>
hashSetFromDistinctList :: (Hashable a, Ord a, Show a) => Decoder a -> Decoder (HashSet a)

-- | Decode a <a>HashSet</a> from a <a>List</a>.
--   
--   <pre>
--   &gt;&gt;&gt; input (hashSetIgnoringDuplicates natural) "[1, 2, 3]"
--   fromList [1,2,3]
--   </pre>
--   
--   Duplicate elements are ignored.
--   
--   <pre>
--   &gt;&gt;&gt; input (hashSetIgnoringDuplicates natural) "[1, 1, 3]"
--   fromList [1,3]
--   </pre>
hashSetIgnoringDuplicates :: (Hashable a, Ord a) => Decoder a -> Decoder (HashSet a)

-- | Decode a <a>Map</a> from a <tt>toMap</tt> expression or generally a
--   <tt>Prelude.Map.Type</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; input (Dhall.map strictText bool) "toMap { a = True, b = False }"
--   fromList [("a",True),("b",False)]
--   
--   &gt;&gt;&gt; input (Dhall.map strictText bool) "[ { mapKey = \"foo\", mapValue = True } ]"
--   fromList [("foo",True)]
--   </pre>
--   
--   If there are duplicate <tt>mapKey</tt>s, later <tt>mapValue</tt>s take
--   precedence:
--   
--   <pre>
--   &gt;&gt;&gt; let expr = "[ { mapKey = 1, mapValue = True }, { mapKey = 1, mapValue = False } ]"
--   
--   &gt;&gt;&gt; input (Dhall.map natural bool) expr
--   fromList [(1,False)]
--   </pre>
map :: Ord k => Decoder k -> Decoder v -> Decoder (Map k v)

-- | Decode a <a>HashMap</a> from a <tt>toMap</tt> expression or generally
--   a <tt>Prelude.Map.Type</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; fmap (List.sort . HashMap.toList) (input (Dhall.hashMap strictText bool) "toMap { a = True, b = False }")
--   [("a",True),("b",False)]
--   
--   &gt;&gt;&gt; fmap (List.sort . HashMap.toList) (input (Dhall.hashMap strictText bool) "[ { mapKey = \"foo\", mapValue = True } ]")
--   [("foo",True)]
--   </pre>
--   
--   If there are duplicate <tt>mapKey</tt>s, later <tt>mapValue</tt>s take
--   precedence:
--   
--   <pre>
--   &gt;&gt;&gt; let expr = "[ { mapKey = 1, mapValue = True }, { mapKey = 1, mapValue = False } ]"
--   
--   &gt;&gt;&gt; input (Dhall.hashMap natural bool) expr
--   fromList [(1,False)]
--   </pre>
hashMap :: (Eq k, Hashable k) => Decoder k -> Decoder v -> Decoder (HashMap k v)

-- | Decode a tuple from a <tt>Prelude.Map.Entry</tt> record.
--   
--   <pre>
--   &gt;&gt;&gt; input (pairFromMapEntry strictText natural) "{ mapKey = \"foo\", mapValue = 3 }"
--   ("foo",3)
--   </pre>
pairFromMapEntry :: Decoder k -> Decoder v -> Decoder (k, v)

-- | Decode a Dhall function into a Haskell function.
--   
--   <pre>
--   &gt;&gt;&gt; f &lt;- input (function inject bool) "Natural/even" :: IO (Natural -&gt; Bool)
--   
--   &gt;&gt;&gt; f 0
--   True
--   
--   &gt;&gt;&gt; f 1
--   False
--   </pre>
function :: Encoder a -> Decoder b -> Decoder (a -> b)

-- | Decode a Dhall function into a Haskell function using the specified
--   normalizer.
--   
--   <pre>
--   &gt;&gt;&gt; f &lt;- input (functionWith defaultInputNormalizer inject bool) "Natural/even" :: IO (Natural -&gt; Bool)
--   
--   &gt;&gt;&gt; f 0
--   True
--   
--   &gt;&gt;&gt; f 1
--   False
--   </pre>
functionWith :: InputNormalizer -> Encoder a -> Decoder b -> Decoder (a -> b)

-- | The <a>RecordDecoder</a> applicative functor allows you to build a
--   <a>Decoder</a> from a Dhall record.
--   
--   For example, let's take the following Haskell data type:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   data Project = Project
--     { projectName :: Text
--     , projectDescription :: Text
--     , projectStars :: Natural
--     }
--   :}
--   </pre>
--   
--   And assume that we have the following Dhall record that we would like
--   to parse as a <tt>Project</tt>:
--   
--   <pre>
--   { name =
--       "dhall-haskell"
--   , description =
--       "A configuration language guaranteed to terminate"
--   , stars =
--       289
--   }
--   </pre>
--   
--   Our decoder has type <a>Decoder</a> <tt>Project</tt>, but we can't
--   build that out of any smaller decoders, as <a>Decoder</a>s cannot be
--   combined (they are only <a>Functor</a>s). However, we can use a
--   <a>RecordDecoder</a> to build a <a>Decoder</a> for <tt>Project</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   project :: Decoder Project
--   project =
--     record
--       ( Project &lt;$&gt; field "name" strictText
--                 &lt;*&gt; field "description" strictText
--                 &lt;*&gt; field "stars" natural
--       )
--   :}
--   </pre>
newtype RecordDecoder a
RecordDecoder :: Product (Const (Map Text (Expector (Expr Src Void)))) (Compose ((->) (Expr Src Void)) (Extractor Src Void)) a -> RecordDecoder a

-- | Run a <a>RecordDecoder</a> to build a <a>Decoder</a>.
record :: RecordDecoder a -> Decoder a

-- | Parse a single field of a record.
field :: Text -> Decoder a -> RecordDecoder a

-- | The <a>UnionDecoder</a> monoid allows you to build a <a>Decoder</a>
--   from a Dhall union.
--   
--   For example, let's take the following Haskell data type:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   data Status = Queued Natural
--               | Result Text
--               | Errored Text
--   :}
--   </pre>
--   
--   And assume that we have the following Dhall union that we would like
--   to parse as a <tt>Status</tt>:
--   
--   <pre>
--   &lt; Result : Text
--   | Queued : Natural
--   | Errored : Text
--   &gt;.Result "Finish successfully"
--   </pre>
--   
--   Our decoder has type <a>Decoder</a> <tt>Status</tt>, but we can't
--   build that out of any smaller decoders, as <a>Decoder</a>s cannot be
--   combined (they are only <a>Functor</a>s). However, we can use a
--   <a>UnionDecoder</a> to build a <a>Decoder</a> for <tt>Status</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--   status :: Decoder Status
--   status = union
--     (  ( Queued  &lt;$&gt; constructor "Queued"  natural )
--     &lt;&gt; ( Result  &lt;$&gt; constructor "Result"  strictText )
--     &lt;&gt; ( Errored &lt;$&gt; constructor "Errored" strictText )
--     )
--   :}
--   </pre>
newtype UnionDecoder a
UnionDecoder :: Compose (Map Text) Decoder a -> UnionDecoder a

-- | Run a <a>UnionDecoder</a> to build a <a>Decoder</a>.
union :: UnionDecoder a -> Decoder a

-- | Parse a single constructor of a union.
constructor :: Text -> Decoder a -> UnionDecoder a

-- | This is the underlying class that powers the <a>FromDhall</a> class's
--   support for automatically deriving a generic implementation.
class GenericFromDhall t f
genericAutoWithNormalizer :: GenericFromDhall t f => Proxy t -> InputNormalizer -> InterpretOptions -> State Int (Decoder (f a))

-- | This is the underlying class that powers the <a>FromDhall</a> class's
--   support for automatically deriving a generic implementation for a
--   union type.
class GenericFromDhallUnion t f
genericUnionAutoWithNormalizer :: GenericFromDhallUnion t f => Proxy t -> InputNormalizer -> InterpretOptions -> UnionDecoder (f a)

-- | <a>genericAuto</a> is the default implementation for <a>auto</a> if
--   you derive <a>FromDhall</a>. The difference is that you can use
--   <a>genericAuto</a> without having to explicitly provide a
--   <a>FromDhall</a> instance for a type as long as the type derives
--   <a>Generic</a>.
genericAuto :: (Generic a, GenericFromDhall a (Rep a)) => Decoder a

-- | <a>genericAutoWith</a> is a configurable version of
--   <a>genericAuto</a>.
genericAutoWith :: (Generic a, GenericFromDhall a (Rep a)) => InterpretOptions -> Decoder a

-- | <a>genericAutoWithInputNormalizer</a> is like <a>genericAutoWith</a>,
--   but instead of using the <a>defaultInputNormalizer</a> it expects an
--   custom <a>InputNormalizer</a>.
genericAutoWithInputNormalizer :: (Generic a, GenericFromDhall a (Rep a)) => InterpretOptions -> InputNormalizer -> Decoder a

-- | A newtype suitable for collecting one or more errors.
newtype DhallErrors e
DhallErrors :: NonEmpty e -> DhallErrors e
[getErrors] :: DhallErrors e -> NonEmpty e

-- | Render a given prefix and some errors to a string.
showDhallErrors :: Show e => String -> DhallErrors e -> String

-- | Every <a>Decoder</a> must obey the contract that if an expression's
--   type matches the <a>expected</a> type then the <a>extract</a> function
--   must not fail with a type error. However, decoding may still fail for
--   other reasons (such as the decoder for <a>Set</a>s rejecting a Dhall
--   <tt>List</tt> with duplicate elements).
--   
--   This error type is used to indicate an internal error in the
--   implementation of a <a>Decoder</a> 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 <a>Decoder</a> itself needs to be fixed.
data InvalidDecoder s a
InvalidDecoder :: Expr s a -> Expr s a -> InvalidDecoder s a
[invalidDecoderExpected] :: InvalidDecoder s a -> Expr s a
[invalidDecoderExpression] :: InvalidDecoder s a -> Expr s a

-- | One or more errors returned from extracting a Dhall expression to a
--   Haskell expression.
type ExtractErrors s a = DhallErrors (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 <tt>extract</tt>), or a
--   term-level error, described with a freeform text value.
data ExtractError s a
TypeMismatch :: InvalidDecoder s a -> ExtractError s a
ExpectedTypeError :: ExpectedTypeError -> ExtractError s a
ExtractError :: Text -> ExtractError s a

-- | Useful synonym for the <a>Validation</a> type used when marshalling
--   Dhall expressions.
type Extractor s a = Validation (ExtractErrors s a)

-- | Generate a type error during extraction by specifying the expected
--   type and the actual type. The expected type is not yet determined.
typeError :: Expector (Expr s a) -> Expr s a -> Extractor s a b

-- | Turn a <a>Text</a> message into an extraction failure.
extractError :: Text -> Extractor s a b

-- | Useful synonym for the equivalent <a>Either</a> type used when
--   marshalling Dhall code.
type MonadicExtractor s a = Either (ExtractErrors s a)

-- | Switches from an <tt>Applicative</tt> extraction result, able to
--   accumulate errors, to a <tt>Monad</tt> extraction result, able to
--   chain sequential operations.
toMonadic :: Extractor s a b -> MonadicExtractor s a b

-- | Switches from a <tt>Monad</tt> extraction result, able to chain
--   sequential errors, to an <tt>Applicative</tt> extraction result, able
--   to accumulate errors.
fromMonadic :: MonadicExtractor s a b -> Extractor s a b

-- | One or more errors returned when determining the Dhall type of a
--   Haskell expression.
type ExpectedTypeErrors = DhallErrors ExpectedTypeError

-- | Error type used when determining the Dhall type of a Haskell
--   expression.
data ExpectedTypeError
RecursiveTypeError :: ExpectedTypeError

-- | Useful synonym for the <a>Validation</a> type used when marshalling
--   Dhall expressions.
type Expector = Validation ExpectedTypeErrors

-- | This is only used by the <a>FromDhall</a> instance for functions in
--   order to normalize the function input before marshaling the input into
--   a Dhall expression.
newtype InputNormalizer
InputNormalizer :: ReifiedNormalizer Void -> InputNormalizer
[getInputNormalizer] :: InputNormalizer -> ReifiedNormalizer Void

-- | Default normalization-related settings (no custom normalization)
defaultInputNormalizer :: InputNormalizer

-- | Use these options to tweak how Dhall derives a generic implementation
--   of <a>FromDhall</a>.
data InterpretOptions
InterpretOptions :: (Text -> Text) -> (Text -> Text) -> SingletonConstructors -> InterpretOptions

-- | Function used to transform Haskell field names into their
--   corresponding Dhall field names
[fieldModifier] :: InterpretOptions -> Text -> Text

-- | Function used to transform Haskell constructor names into their
--   corresponding Dhall alternative names
[constructorModifier] :: InterpretOptions -> Text -> Text

-- | Specify how to handle constructors with only one field. The default is
--   <a>Smart</a>
[singletonConstructors] :: InterpretOptions -> SingletonConstructors

-- | This type specifies how to model a Haskell constructor with 1 field in
--   Dhall
--   
--   For example, consider the following Haskell datatype definition:
--   
--   <pre>
--   data Example = Foo { x :: Double } | Bar Double
--   </pre>
--   
--   Depending on which option you pick, the corresponding Dhall type could
--   be:
--   
--   <pre>
--   &lt; Foo : Double | Bar : Double &gt;                   -- Bare
--   </pre>
--   
--   <pre>
--   &lt; Foo : { x : Double } | Bar : { _1 : Double } &gt;  -- Wrapped
--   </pre>
--   
--   <pre>
--   &lt; Foo : { x : Double } | Bar : Double &gt;           -- Smart
--   </pre>
data SingletonConstructors

-- | Never wrap the field in a record
Bare :: SingletonConstructors

-- | Always wrap the field in a record
Wrapped :: SingletonConstructors

-- | Only fields in a record if they are named
Smart :: SingletonConstructors

-- | Default interpret options for generics-based instances, which you can
--   tweak or override, like this:
--   
--   <pre>
--   genericAutoWith
--       (defaultInterpretOptions { fieldModifier = Data.Text.Lazy.dropWhile (== '_') })
--   </pre>
defaultInterpretOptions :: InterpretOptions

-- | This type is exactly the same as <a>Fix</a> except with a different
--   <a>FromDhall</a> instance. This intermediate type simplifies the
--   implementation of the inner loop for the <a>FromDhall</a> instance for
--   <a>Fix</a>.
data Result f
data () => Natural
data () => Seq a
data () => Text
data () => Vector a
class () => Generic a
instance GHC.Base.Semigroup (Dhall.Marshal.Decode.DhallErrors e)
instance GHC.Base.Functor Dhall.Marshal.Decode.DhallErrors
instance GHC.Classes.Eq e => GHC.Classes.Eq (Dhall.Marshal.Decode.DhallErrors e)
instance (GHC.Classes.Eq s, GHC.Classes.Eq a) => GHC.Classes.Eq (Dhall.Marshal.Decode.InvalidDecoder s a)
instance GHC.Show.Show Dhall.Marshal.Decode.ExpectedTypeError
instance GHC.Classes.Eq Dhall.Marshal.Decode.ExpectedTypeError
instance (GHC.Classes.Eq s, GHC.Classes.Eq a) => GHC.Classes.Eq (Dhall.Marshal.Decode.ExtractError s a)
instance GHC.Base.Applicative Dhall.Marshal.Decode.RecordDecoder
instance GHC.Base.Functor Dhall.Marshal.Decode.RecordDecoder
instance GHC.Base.Functor Dhall.Marshal.Decode.Decoder
instance GHC.Base.Functor Dhall.Marshal.Decode.UnionDecoder
instance Dhall.Marshal.Encode.ToDhall x => Dhall.Marshal.Decode.FromDhall (Data.Functor.Contravariant.Predicate x)
instance Dhall.Marshal.Encode.ToDhall x => Dhall.Marshal.Decode.FromDhall (Data.Functor.Contravariant.Equivalence x)
instance (Dhall.Marshal.Decode.FromDhall b, Dhall.Marshal.Encode.ToDhall x) => Dhall.Marshal.Decode.FromDhall (Data.Functor.Contravariant.Op b x)
instance Dhall.Marshal.Decode.FromDhall GHC.Base.Void
instance Dhall.Marshal.Decode.FromDhall ()
instance Dhall.Marshal.Decode.FromDhall GHC.Types.Bool
instance Dhall.Marshal.Decode.FromDhall GHC.Num.Natural.Natural
instance Dhall.Marshal.Decode.FromDhall GHC.Types.Word
instance Dhall.Marshal.Decode.FromDhall GHC.Word.Word8
instance Dhall.Marshal.Decode.FromDhall GHC.Word.Word16
instance Dhall.Marshal.Decode.FromDhall GHC.Word.Word32
instance Dhall.Marshal.Decode.FromDhall GHC.Word.Word64
instance Dhall.Marshal.Decode.FromDhall GHC.Num.Integer.Integer
instance Dhall.Marshal.Decode.FromDhall GHC.Types.Int
instance Dhall.Marshal.Decode.FromDhall GHC.Int.Int8
instance Dhall.Marshal.Decode.FromDhall GHC.Int.Int16
instance Dhall.Marshal.Decode.FromDhall GHC.Int.Int32
instance Dhall.Marshal.Decode.FromDhall GHC.Int.Int64
instance Dhall.Marshal.Decode.FromDhall Data.Scientific.Scientific
instance Dhall.Marshal.Decode.FromDhall GHC.Types.Double
instance Dhall.Marshal.Decode.FromDhall Data.ByteString.Short.Internal.ShortByteString
instance Dhall.Marshal.Decode.FromDhall Data.ByteString.Lazy.Internal.ByteString
instance Dhall.Marshal.Decode.FromDhall Data.ByteString.Internal.Type.ByteString
instance Dhall.Marshal.Decode.FromDhall [GHC.Types.Char]
instance Dhall.Marshal.Decode.FromDhall Data.Text.Short.Internal.ShortText
instance Dhall.Marshal.Decode.FromDhall Data.Text.Internal.Lazy.Text
instance Dhall.Marshal.Decode.FromDhall Data.Text.Internal.Text
instance Dhall.Marshal.Decode.FromDhall a => Dhall.Marshal.Decode.FromDhall (Data.Functor.Identity.Identity a)
instance Dhall.Marshal.Decode.FromDhall a => Dhall.Marshal.Decode.FromDhall (GHC.Maybe.Maybe a)
instance Dhall.Marshal.Decode.FromDhall a => Dhall.Marshal.Decode.FromDhall (Data.Sequence.Internal.Seq a)
instance Dhall.Marshal.Decode.FromDhall a => Dhall.Marshal.Decode.FromDhall [a]
instance Dhall.Marshal.Decode.FromDhall a => Dhall.Marshal.Decode.FromDhall (Data.Vector.Vector a)
instance Dhall.Marshal.Decode.FromDhall Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance Dhall.Marshal.Decode.FromDhall Data.Time.Calendar.Days.Day
instance Dhall.Marshal.Decode.FromDhall Data.Time.LocalTime.Internal.TimeZone.TimeZone
instance Dhall.Marshal.Decode.FromDhall Data.Time.LocalTime.Internal.LocalTime.LocalTime
instance Dhall.Marshal.Decode.FromDhall Data.Time.LocalTime.Internal.ZonedTime.ZonedTime
instance Dhall.Marshal.Decode.FromDhall Data.Time.Clock.Internal.UTCTime.UTCTime
instance Dhall.Marshal.Decode.FromDhall Data.Time.Calendar.Week.DayOfWeek
instance (Dhall.Marshal.Decode.FromDhall a, GHC.Classes.Ord a, GHC.Show.Show a) => Dhall.Marshal.Decode.FromDhall (Data.Set.Internal.Set a)
instance (Dhall.Marshal.Decode.FromDhall a, Data.Hashable.Class.Hashable a, GHC.Classes.Ord a, GHC.Show.Show a) => Dhall.Marshal.Decode.FromDhall (Data.HashSet.Internal.HashSet a)
instance (GHC.Classes.Ord k, Dhall.Marshal.Decode.FromDhall k, Dhall.Marshal.Decode.FromDhall v) => Dhall.Marshal.Decode.FromDhall (Data.Map.Internal.Map k v)
instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k, Dhall.Marshal.Decode.FromDhall k, Dhall.Marshal.Decode.FromDhall v) => Dhall.Marshal.Decode.FromDhall (Data.HashMap.Internal.HashMap k v)
instance (Dhall.Marshal.Encode.ToDhall a, Dhall.Marshal.Decode.FromDhall b) => Dhall.Marshal.Decode.FromDhall (a -> b)
instance (Dhall.Marshal.Decode.FromDhall a, Dhall.Marshal.Decode.FromDhall b) => Dhall.Marshal.Decode.FromDhall (a, b)
instance Dhall.Marshal.Decode.FromDhall (f (Dhall.Marshal.Internal.Result f)) => Dhall.Marshal.Decode.FromDhall (Dhall.Marshal.Internal.Result f)
instance (GHC.Base.Functor f, Dhall.Marshal.Decode.FromDhall (f (Dhall.Marshal.Internal.Result f))) => Dhall.Marshal.Decode.FromDhall (Data.Fix.Fix f)
instance forall k1 k2 (t :: k1) (f :: k2 -> *) (g :: k2 -> *) (s :: GHC.Generics.Meta) a i. (Dhall.Marshal.Decode.GenericFromDhall t (f GHC.Generics.:*: g), GHC.Generics.Selector s, Dhall.Marshal.Decode.FromDhall a) => Dhall.Marshal.Decode.GenericFromDhall t ((f GHC.Generics.:*: g) GHC.Generics.:*: GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a))
instance forall k1 k2 (s :: GHC.Generics.Meta) a (t :: k1) (f :: k2 -> *) (g :: k2 -> *) i. (GHC.Generics.Selector s, Dhall.Marshal.Decode.FromDhall a, Dhall.Marshal.Decode.GenericFromDhall t (f GHC.Generics.:*: g)) => Dhall.Marshal.Decode.GenericFromDhall t (GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a) GHC.Generics.:*: (f GHC.Generics.:*: g))
instance forall k1 k2 (s1 :: GHC.Generics.Meta) (s2 :: GHC.Generics.Meta) a1 a2 (t :: k1) i1 i2. (GHC.Generics.Selector s1, GHC.Generics.Selector s2, Dhall.Marshal.Decode.FromDhall a1, Dhall.Marshal.Decode.FromDhall a2) => Dhall.Marshal.Decode.GenericFromDhall t (GHC.Generics.M1 GHC.Generics.S s1 (GHC.Generics.K1 i1 a1) GHC.Generics.:*: GHC.Generics.M1 GHC.Generics.S s2 (GHC.Generics.K1 i2 a2))
instance forall k1 k2 (s :: GHC.Generics.Meta) a (t :: k1) i. (GHC.Generics.Selector s, Dhall.Marshal.Decode.FromDhall a) => Dhall.Marshal.Decode.GenericFromDhall t (GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a))
instance forall k1 k2 (t :: k1) (f :: k2 -> *) (d :: GHC.Generics.Meta). Dhall.Marshal.Decode.GenericFromDhall t f => Dhall.Marshal.Decode.GenericFromDhall t (GHC.Generics.M1 GHC.Generics.D d f)
instance forall k1 k2 (t :: k1). Dhall.Marshal.Decode.GenericFromDhall t GHC.Generics.V1
instance forall k1 k2 (t :: k1) (f :: k2 -> *) (g :: k2 -> *). Dhall.Marshal.Decode.GenericFromDhallUnion t (f GHC.Generics.:+: g) => Dhall.Marshal.Decode.GenericFromDhall t (f GHC.Generics.:+: g)
instance forall k1 k2 (t :: k1) (f :: k2 -> *) (c :: GHC.Generics.Meta). Dhall.Marshal.Decode.GenericFromDhall t f => Dhall.Marshal.Decode.GenericFromDhall t (GHC.Generics.M1 GHC.Generics.C c f)
instance forall k1 k2 (t :: k1). Dhall.Marshal.Decode.GenericFromDhall t GHC.Generics.U1
instance forall k1 k2 (t :: k1) (f :: k2 -> *) (g :: k2 -> *) (h :: k2 -> *) (i :: k2 -> *). (Dhall.Marshal.Decode.GenericFromDhall t (f GHC.Generics.:*: g), Dhall.Marshal.Decode.GenericFromDhall t (h GHC.Generics.:*: i)) => Dhall.Marshal.Decode.GenericFromDhall t ((f GHC.Generics.:*: g) GHC.Generics.:*: (h GHC.Generics.:*: i))
instance Dhall.Marshal.Decode.GenericFromDhall a1 (GHC.Generics.M1 GHC.Generics.S s1 (GHC.Generics.K1 i1 a1) GHC.Generics.:*: GHC.Generics.M1 GHC.Generics.S s2 (GHC.Generics.K1 i2 a2))
instance Dhall.Marshal.Decode.GenericFromDhall a2 (GHC.Generics.M1 GHC.Generics.S s1 (GHC.Generics.K1 i1 a1) GHC.Generics.:*: GHC.Generics.M1 GHC.Generics.S s2 (GHC.Generics.K1 i2 a2))
instance Dhall.Marshal.Decode.GenericFromDhall a (GHC.Generics.M1 GHC.Generics.S s (GHC.Generics.K1 i a))
instance forall k1 k2 (c1 :: GHC.Generics.Meta) (t :: k1) (f1 :: k2 -> *). (GHC.Generics.Constructor c1, Dhall.Marshal.Decode.GenericFromDhall t f1) => Dhall.Marshal.Decode.GenericFromDhallUnion t (GHC.Generics.M1 GHC.Generics.C c1 f1)
instance forall k1 k2 (t :: k1) (f1 :: k2 -> *) (f2 :: k2 -> *). (Dhall.Marshal.Decode.GenericFromDhallUnion t f1, Dhall.Marshal.Decode.GenericFromDhallUnion t f2) => Dhall.Marshal.Decode.GenericFromDhallUnion t (f1 GHC.Generics.:+: f2)
instance GHC.Base.Semigroup (Dhall.Marshal.Decode.UnionDecoder a)
instance GHC.Base.Monoid (Dhall.Marshal.Decode.UnionDecoder a)
instance (Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => GHC.Show.Show (Dhall.Marshal.Decode.ExtractErrors s a)
instance (Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => GHC.Show.Show (Dhall.Marshal.Decode.ExtractError s a)
instance (Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => GHC.Exception.Type.Exception (Dhall.Marshal.Decode.ExtractError s a)
instance GHC.Show.Show Dhall.Marshal.Decode.ExpectedTypeErrors
instance GHC.Exception.Type.Exception Dhall.Marshal.Decode.ExpectedTypeError
instance (Prettyprinter.Internal.Pretty s, Data.Typeable.Internal.Typeable s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable a) => GHC.Exception.Type.Exception (Dhall.Marshal.Decode.InvalidDecoder s a)
instance (Prettyprinter.Internal.Pretty s, Prettyprinter.Internal.Pretty a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => GHC.Show.Show (Dhall.Marshal.Decode.InvalidDecoder s a)
instance (GHC.Show.Show (Dhall.Marshal.Decode.DhallErrors e), Data.Typeable.Internal.Typeable e) => GHC.Exception.Type.Exception (Dhall.Marshal.Decode.DhallErrors e)


-- | This module contains the implementation of the <tt>dhall lint</tt>
--   command
module Dhall.Lint

-- | Automatically improve a Dhall expression
--   
--   Currently this:
--   
--   <ul>
--   <li>removes unused <tt>let</tt> bindings with
--   <a>removeUnusedBindings</a>.</li>
--   <li>fixes <tt>let a = x ≡ y</tt> to be <tt>let a = assert : x ≡
--   y</tt></li>
--   <li>consolidates nested <tt>let</tt> bindings to use a
--   multiple-<tt>let</tt> binding with <a>removeLetInLet</a></li>
--   <li>fixes paths of the form <tt>./../foo</tt> to <tt>../foo</tt></li>
--   </ul>
lint :: Eq s => Expr s Import -> Expr s Import

-- | Remove unused <a>Let</a> bindings.
removeUnusedBindings :: Eq a => Expr s a -> Maybe (Expr s a)

-- | Fix <a>Let</a> bindings that the user probably meant to be
--   <tt>assert</tt>s
fixAssert :: Expr s a -> Maybe (Expr s a)

-- | This transforms <tt>./../foo</tt> into <tt>../foo</tt>
fixParentPath :: Expr s Import -> Maybe (Expr s Import)

-- | This transforms <tt><a>https://prelude.dhall-lang.org/…/foo</a></tt>
--   to <tt><a>https://prelude.dhall-lang.org/…/foo.dhall</a></tt>
addPreludeExtensions :: Expr s Import -> Maybe (Expr s Import)

-- | The difference between
--   
--   <pre>
--   let x = 1 let y = 2 in x + y
--   </pre>
--   
--   and
--   
--   <pre>
--   let x = 1 in let y = 2 in x + y
--   </pre>
--   
--   is that in the second expression, the inner <a>Let</a> is wrapped by a
--   <a>Note</a>.
--   
--   We remove such a <a>Note</a> in order to consolidate nested let-blocks
--   into a single one.
removeLetInLet :: Expr s a -> Maybe (Expr s a)

-- | This replaces a record of key-value pairs with the equivalent use of
--   <tt>toMap</tt>
--   
--   This is currently not used by <tt>dhall lint</tt> because this would
--   sort <tt>Map</tt> keys, which is not necessarily a behavior-preserving
--   change, but is still made available as a convenient rewrite rule. For
--   example, <tt>{json,yaml}-to-dhall</tt> use this rewrite to simplify
--   their output.
useToMap :: Expr s a -> Maybe (Expr s a)


-- | Dhall lets you import external expressions located either in local
--   files or hosted on network endpoints.
--   
--   To import a local file as an expression, just insert the path to the
--   file, prepending a <tt>./</tt> if the path is relative to the current
--   directory. For example, if you create a file named <tt>id</tt> with
--   the following contents:
--   
--   <pre>
--   $ cat id
--   λ(a : Type) → λ(x : a) → x
--   </pre>
--   
--   Then you can use the file directly within a <tt>dhall</tt> program
--   just by referencing the file's path:
--   
--   <pre>
--   $ dhall
--   ./id Bool True
--   &lt;Ctrl-D&gt;
--   Bool
--   
--   True
--   </pre>
--   
--   Imported expressions may contain imports of their own, too, which will
--   continue to be resolved. However, Dhall will prevent cyclic imports.
--   For example, if you had these two files:
--   
--   <pre>
--   $ cat foo
--   ./bar
--   </pre>
--   
--   <pre>
--   $ cat bar
--   ./foo
--   </pre>
--   
--   ... Dhall would throw the following exception if you tried to import
--   <tt>foo</tt>:
--   
--   <pre>
--   $ dhall
--   ./foo
--   ^D
--   ↳ ./foo
--     ↳ ./bar
--   
--   Cyclic import: ./foo
--   </pre>
--   
--   You can also import expressions hosted on network endpoints. Just use
--   the URL
--   
--   <pre>
--   http://host[:port]/path
--   </pre>
--   
--   The compiler expects the downloaded expressions to be in the same
--   format as local files, specifically UTF8-encoded source code text.
--   
--   For example, if our <tt>id</tt> expression were hosted at
--   <tt><a>http://example.com/id</a></tt>, then we would embed the
--   expression within our code using:
--   
--   <pre>
--   http://example.com/id
--   </pre>
--   
--   You can also import expressions stored within environment variables
--   using <tt>env:NAME</tt>, where <tt>NAME</tt> is the name of the
--   environment variable. For example:
--   
--   <pre>
--   $ export FOO=1
--   $ export BAR='"Hi"'
--   $ export BAZ='λ(x : Bool) → x == False'
--   $ dhall &lt;&lt;&lt; "{ foo = env:FOO , bar = env:BAR , baz = env:BAZ }"
--   { bar : Text, baz : ∀(x : Bool) → Bool, foo : Integer }
--   
--   { bar = "Hi", baz = λ(x : Bool) → x == False, foo = 1 }
--   </pre>
--   
--   If you wish to import the raw contents of an impoert as <tt>Text</tt>
--   then add <tt>as Text</tt> to the end of the import:
--   
--   <pre>
--   $ dhall &lt;&lt;&lt; "http://example.com as Text"
--   Text
--   
--   "&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;Example Domain&lt;/title&gt;\n\n    &lt;meta
--    charset=\"utf-8\" /&gt;\n    &lt;meta http-equiv=\"Content-type\" content=\"text/html
--   ; charset=utf-8\" /&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width,
--   initial-scale=1\" /&gt;\n    &lt;style type=\"text/css\"&gt;\n    body {\n        backgro
--   und-color: #f0f0f2;\n        margin: 0;\n        padding: 0;\n        font-famil
--   y: \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n        \n
--      }\n    div {\n        width: 600px;\n        margin: 5em auto;\n        paddi
--   ng: 50px;\n        background-color: #fff;\n        border-radius: 1em;\n    }\n
--       a:link, a:visited {\n        color: #38488f;\n        text-decoration: none;
--   \n    }\n    @media (max-width: 700px) {\n        body {\n            background
--   -color: #fff;\n        }\n        div {\n            width: auto;\n            m
--   argin: 0 auto;\n            border-radius: 0;\n            padding: 1em;\n
--     }\n    }\n    &lt;/style&gt;    \n&lt;/head&gt;\n\n&lt;body&gt;\n&lt;div&gt;\n    &lt;h1&gt;Example Domain&lt;/
--   h1&gt;\n    &lt;p&gt;This domain is established to be used for illustrative examples in d
--   ocuments. You may use this\n    domain in examples without prior coordination or
--    asking for permission.&lt;/p&gt;\n    &lt;p&gt;&lt;a href=\"http://www.iana.org/domains/exampl
--   e\"&gt;More information...&lt;/a&gt;&lt;/p&gt;\n&lt;/div&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n"
--   </pre>
module Dhall.Import

-- | Resolve all imports within an expression
load :: Expr Src Import -> IO (Expr Src Void)

-- | See <a>load</a>.
loadWithManager :: IO Manager -> Expr Src Import -> IO (Expr Src Void)

-- | Resolve all imports within an expression, importing relative to the
--   given directory.
loadRelativeTo :: FilePath -> SemanticCacheMode -> Expr Src Import -> IO (Expr Src Void)

-- | See <a>loadRelativeTo</a>.
loadWithStatus :: Status -> SemanticCacheMode -> Expr Src Import -> IO (Expr Src Void)

-- | Generalized version of <a>load</a>
--   
--   You can configure the desired behavior through the initial
--   <a>Status</a> that you supply
loadWith :: Expr Src Import -> StateT Status IO (Expr Src Void)

-- | Construct the file path corresponding to a local import. If the import
--   is _relative_ then the resulting path is also relative.
localToPath :: MonadIO io => FilePrefix -> File -> io FilePath

-- | Hash a fully resolved expression
hashExpression :: Expr Void Void -> SHA256Digest

-- | Convenience utility to hash a fully resolved expression and return the
--   base-16 encoded hash with the <tt>sha256:</tt> prefix
--   
--   In other words, the output of this function can be pasted into Dhall
--   source code to add an integrity check to an import
hashExpressionToCode :: Expr Void Void -> Text

-- | Ensure that the given expression is present in the semantic cache. The
--   given expression should be alpha-beta-normal.
writeExpressionToSemanticCache :: Expr Void Void -> IO ()

-- | Assert than an expression is import-free
assertNoImports :: MonadIO io => Expr Src Import -> io (Expr Src Void)

-- | Shared state for HTTP requests
type Manager = Manager

-- | The default HTTP <a>Manager</a>
defaultNewManager :: IO Manager

-- | Used internally to track whether or not we've already warned the user
--   about caching issues
data CacheWarning
CacheNotWarned :: CacheWarning
CacheWarned :: CacheWarning

-- | State threaded throughout the import process
data Status
Status :: NonEmpty Chained -> [Depends] -> Map Chained ImportSemantics -> IO Manager -> Maybe Manager -> StateT Status IO OriginHeaders -> (URL -> StateT Status IO Text) -> (URL -> StateT Status IO ByteString) -> Substitutions Src Void -> Maybe (ReifiedNormalizer Void) -> Context (Expr Src Void) -> SemanticCacheMode -> CacheWarning -> Status

-- | Stack of <a>Import</a>s that we've imported along the way to get to
--   the current point
[_stack] :: Status -> NonEmpty Chained

-- | Graph of all the imports visited so far, represented by a list of
--   import dependencies.
[_graph] :: Status -> [Depends]

-- | Cache of imported expressions with their node id in order to avoid
--   importing the same expression twice with different values
[_cache] :: Status -> Map Chained ImportSemantics
[_newManager] :: Status -> IO Manager

-- | Used to cache the <a>Manager</a> when making multiple requests
[_manager] :: Status -> Maybe Manager

-- | Load the origin headers from environment or configuration file. After
--   loading once, further evaluations return the cached version.
[_loadOriginHeaders] :: Status -> StateT Status IO OriginHeaders

-- | The remote resolver, fetches the content at the given URL.
[_remote] :: Status -> URL -> StateT Status IO Text

-- | Like <a>_remote</a>, except for <a>Bytes</a>
[_remoteBytes] :: Status -> URL -> StateT Status IO ByteString
[_substitutions] :: Status -> Substitutions Src Void
[_normalizer] :: Status -> Maybe (ReifiedNormalizer Void)
[_startingContext] :: Status -> Context (Expr Src Void)
[_semanticCacheMode] :: Status -> SemanticCacheMode

-- | Records whether or not we already warned the user about issues with
--   cache directory
[_cacheWarning] :: Status -> CacheWarning

-- | This enables or disables the semantic cache for imports protected by
--   integrity checks
data SemanticCacheMode
IgnoreSemanticCache :: SemanticCacheMode
UseSemanticCache :: SemanticCacheMode

-- | A fully "chained" import, i.e. if it contains a relative path that
--   path is relative to the current directory. If it is a remote import
--   with headers those are well-typed (either of type `List { header :
--   Text, value Text}` or `List { mapKey : Text, mapValue Text})` and in
--   normal form. These invariants are preserved by the API exposed by
--   <tt>Dhall.Import</tt>.
data Chained

-- | The underlying import
chainedImport :: Chained -> Import

-- | Given a <a>Local</a> import construct the corresponding unhashed
--   <a>Chained</a> import (interpreting relative path as relative to the
--   current directory).
chainedFromLocalHere :: FilePrefix -> File -> ImportMode -> Chained

-- | Adjust the import mode of a chained import
chainedChangeMode :: ImportMode -> Chained -> Chained

-- | Default starting <a>Status</a>, importing relative to the given
--   directory.
emptyStatus :: FilePath -> Status

-- | See <a>emptyStatus</a>
emptyStatusWithManager :: IO Manager -> FilePath -> Status

-- | Load headers only from the environment (used in tests)
envOriginHeaders :: Expr Src Import

-- | See <a>emptyStatus</a>.
makeEmptyStatus :: IO Manager -> IO (Expr Src Import) -> FilePath -> Status

-- | Default <a>Status</a> appropriate for a server interpreting Dhall code
--   
--   Using this <a>Status</a> ensures that interpreted Dhall code cannot
--   access server-local resources (like files or environment variables)
remoteStatus :: URL -> Status

-- | See <a>remoteStatus</a>
remoteStatusWithManager :: IO Manager -> URL -> Status

-- | Fetch the text contents of a URL
fetchRemote :: URL -> StateT Status IO Text

-- | Lens from a <a>Status</a> to its <a>_stack</a> field
stack :: Functor f => LensLike' f Status (NonEmpty Chained)

-- | Lens from a <a>Status</a> to its <a>_cache</a> field
cache :: Functor f => LensLike' f Status (Map Chained ImportSemantics)

-- | <a>parent</a> imports (i.e. depends on) <a>child</a>
data Depends
Depends :: Chained -> Chained -> Depends
[parent] :: Depends -> Chained
[child] :: Depends -> Chained

-- | Lens from a <a>Status</a> to its <a>_graph</a> field
graph :: Functor f => LensLike' f Status [Depends]

-- | Lens from a <a>Status</a> to its <a>_remote</a> field
remote :: Functor f => LensLike' f Status (URL -> StateT Status IO Text)

-- | Given a well-typed (of type `List { header : Text, value Text }` or
--   `List { mapKey : Text, mapValue Text }`) headers expressions in normal
--   form construct the corresponding binary http headers; otherwise return
--   the empty list.
toHeaders :: Expr s a -> [HTTPHeader]

-- | Lens from a <a>Status</a> to its <a>_substitutions</a> field
substitutions :: Functor f => LensLike' f Status (Substitutions Src Void)

-- | Lens from a <a>Status</a> to its <a>_normalizer</a> field
normalizer :: Functor f => LensLike' f Status (Maybe (ReifiedNormalizer Void))

-- | Lens from a <a>Status</a> to its <a>_startingContext</a> field
startingContext :: Functor f => LensLike' f Status (Context (Expr Src Void))

-- | Chain imports, also typecheck and normalize headers if applicable.
chainImport :: Chained -> Import -> StateT Status IO Chained

-- | This function is used by the <tt>--transitive</tt> option of the
--   <tt>dhall {freeze,format,lint}</tt> subcommands to determine which
--   dependencies to descend into
--   
--   <pre>
--   &gt;&gt;&gt; dependencyToFile (emptyStatus ".") Import{ importHashed = ImportHashed{ hash = Nothing, importType = Local Here (File (Directory []) "foo") }, importMode = Code }
--   Just "./foo"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; dependencyToFile (emptyStatus "./foo") Import{ importHashed = ImportHashed{ hash = Nothing, importType = Local Here (File (Directory []) "bar") }, importMode = Code }
--   Just "./foo/bar"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; dependencyToFile (emptyStatus "./foo") Import{ importHashed = ImportHashed{ hash = Nothing, importType = Remote (URL HTTPS "example.com" (File (Directory []) "") Nothing Nothing) }, importMode = Code }
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; dependencyToFile (emptyStatus ".") Import{ importHashed = ImportHashed{ hash = Nothing, importType = Env "foo" }, importMode = Code }
--   Nothing
--   </pre>
dependencyToFile :: Status -> Import -> IO (Maybe FilePath)

-- | An import that has been fully interpeted
data ImportSemantics

-- | HTTP headers
type HTTPHeader = (CI ByteString, ByteString)

-- | An import failed because of a cycle in the import graph
newtype Cycle
Cycle :: Import -> Cycle

-- | The offending cyclic import
[cyclicImport] :: Cycle -> Import

-- | Dhall tries to ensure that all expressions hosted on network endpoints
--   are weakly referentially transparent, meaning roughly that any two
--   clients will compile the exact same result given the same URL.
--   
--   To be precise, a strong interpretaton of referential transparency
--   means that if you compiled a URL you could replace the expression
--   hosted at that URL with the compiled result. Let's call this "static
--   linking". Dhall (very intentionally) does not satisfy this stronger
--   interpretation of referential transparency since "statically linking"
--   an expression (i.e. permanently resolving all imports) means that the
--   expression will no longer update if its dependencies change.
--   
--   In general, either interpretation of referential transparency is not
--   enforceable in a networked context since one can easily violate
--   referential transparency with a custom DNS, but Dhall can still try to
--   guard against common unintentional violations. To do this, Dhall
--   enforces that a non-local import may not reference a local import.
--   
--   Local imports are defined as:
--   
--   <ul>
--   <li>A file</li>
--   <li>A URL with a host of <tt>localhost</tt> or <tt>127.0.0.1</tt></li>
--   </ul>
--   
--   All other imports are defined to be non-local
newtype ReferentiallyOpaque
ReferentiallyOpaque :: Import -> ReferentiallyOpaque

-- | The offending opaque import
[opaqueImport] :: ReferentiallyOpaque -> Import

-- | Extend another exception with the current import stack
data Imported e
Imported :: NonEmpty Chained -> e -> Imported e

-- | Imports resolved so far, in reverse order
[importStack] :: Imported e -> NonEmpty Chained

-- | The nested exception
[nested] :: Imported e -> e

-- | A call to <a>assertNoImports</a> failed because there was at least one
--   import
data ImportResolutionDisabled
ImportResolutionDisabled :: ImportResolutionDisabled

-- | Wrapper around <a>HttpException</a>s with a prettier <a>Show</a>
--   instance
--   
--   In order to keep the library API constant even when the
--   <tt>with-http</tt> Cabal flag is disabled the pretty error message is
--   pre-rendered and the real <a>HttpException</a> is stored in a
--   <a>Dynamic</a>
data PrettyHttpException
PrettyHttpException :: String -> Dynamic -> PrettyHttpException

-- | Exception thrown when an imported file is missing
newtype MissingFile
MissingFile :: FilePath -> MissingFile

-- | Exception thrown when an environment variable is missing
newtype MissingEnvironmentVariable
MissingEnvironmentVariable :: Text -> MissingEnvironmentVariable
[name] :: MissingEnvironmentVariable -> Text

-- | List of Exceptions we encounter while resolving Import Alternatives
newtype MissingImports
MissingImports :: [SomeException] -> MissingImports

-- | Exception thrown when an integrity check fails
data HashMismatch
HashMismatch :: SHA256Digest -> SHA256Digest -> HashMismatch
[expectedHash] :: HashMismatch -> SHA256Digest
[actualHash] :: HashMismatch -> SHA256Digest
instance GHC.Exception.Type.Exception Dhall.Import.ImportResolutionDisabled
instance GHC.Show.Show Dhall.Import.ImportResolutionDisabled
instance GHC.Exception.Type.Exception Dhall.Import.HashMismatch
instance GHC.Show.Show Dhall.Import.HashMismatch
instance Dhall.Import.Canonicalize Dhall.Syntax.Import.Directory
instance Dhall.Import.Canonicalize Dhall.Syntax.Import.File
instance Dhall.Import.Canonicalize Dhall.Syntax.Import.ImportType
instance Dhall.Import.Canonicalize Dhall.Syntax.Import.ImportHashed
instance Dhall.Import.Canonicalize Dhall.Syntax.Import.Import
instance GHC.Exception.Type.Exception Dhall.Import.CannotImportHTTPURL
instance GHC.Show.Show Dhall.Import.CannotImportHTTPURL
instance GHC.Exception.Type.Exception Dhall.Import.MissingImports
instance GHC.Show.Show Dhall.Import.MissingImports
instance GHC.Exception.Type.Exception Dhall.Import.MissingEnvironmentVariable
instance GHC.Show.Show Dhall.Import.MissingEnvironmentVariable
instance GHC.Exception.Type.Exception Dhall.Import.MissingFile
instance GHC.Show.Show Dhall.Import.MissingFile
instance GHC.Exception.Type.Exception e => GHC.Exception.Type.Exception (Dhall.Import.Imported e)
instance GHC.Show.Show e => GHC.Show.Show (Dhall.Import.Imported e)
instance GHC.Exception.Type.Exception Dhall.Import.ReferentiallyOpaque
instance GHC.Show.Show Dhall.Import.ReferentiallyOpaque
instance GHC.Exception.Type.Exception Dhall.Import.Cycle
instance GHC.Show.Show Dhall.Import.Cycle


-- | This module contains the implementation of the <tt>dhall
--   rewrite-with-schemas</tt> subcommand
module Dhall.Schemas

-- | Implementation of the <tt>dhall rewrite-with-schemas</tt> subcommand
schemasCommand :: Schemas -> IO ()

-- | Arguments to the <tt>rewrite-with-schemas</tt> subcommand
data Schemas
Schemas :: Maybe CharacterSet -> Censor -> Input -> OutputMode -> Text -> Schemas
[chosenCharacterSet] :: Schemas -> Maybe CharacterSet
[censor] :: Schemas -> Censor
[input] :: Schemas -> Input
[outputMode] :: Schemas -> OutputMode
[schemas] :: Schemas -> Text

-- | Simplify a Dhall expression using a record of schemas
rewriteWithSchemas :: Expr Src Import -> Expr Src Import -> IO (Expr Src Import)

-- | Errors that can be thrown by <a>rewriteWithSchemas</a>
data SchemasError
NotASchemaRecord :: SchemasError
instance GHC.Exception.Type.Exception Dhall.Schemas.SchemasError
instance GHC.Show.Show Dhall.Schemas.SchemasError


-- | This module contains the implementation of the <tt>dhall format</tt>
--   subcommand
module Dhall.Format

-- | Arguments to the <a>format</a> subcommand
data Format
Format :: Maybe CharacterSet -> Censor -> Transitivity -> NonEmpty Input -> OutputMode -> Format
[chosenCharacterSet] :: Format -> Maybe CharacterSet
[censor] :: Format -> Censor
[transitivity] :: Format -> Transitivity
[inputs] :: Format -> NonEmpty Input
[outputMode] :: Format -> OutputMode

-- | Implementation of the <tt>dhall format</tt> subcommand
format :: Format -> IO ()


-- | Implementation of the <tt>dhall to-directory-tree</tt> subcommand
module Dhall.DirectoryTree

-- | Attempt to transform a Dhall record into a directory tree where:
--   
--   <ul>
--   <li>Records are translated into directories</li>
--   <li><tt>Map</tt>s are also translated into directories</li>
--   <li><tt>Text</tt> values or fields are translated into files</li>
--   <li><tt>Optional</tt> values are omitted if <tt>None</tt></li>
--   <li>There is a more advanced way to construct directory trees using a
--   fixpoint encoding. See the documentation below on that.</li>
--   </ul>
--   
--   For example, the following Dhall record:
--   
--   <pre>
--   { dir = { `hello.txt` = "Hello\n" }
--   , `goodbye.txt`= Some "Goodbye\n"
--   , `missing.txt` = None Text
--   }
--   </pre>
--   
--   ... should translate to this directory tree:
--   
--   <pre>
--   $ tree result
--   result
--   ├── dir
--   │   └── hello.txt
--   └── goodbye.txt
--   
--   $ cat result/dir/hello.txt
--   Hello
--   
--   $ cat result/goodbye.txt
--   Goodbye
--   </pre>
--   
--   Use this in conjunction with the Prelude's support for rendering
--   JSON/YAML in "pure Dhall" so that you can generate files containing
--   JSON. For example:
--   
--   <pre>
--   let JSON =
--         https://prelude.dhall-lang.org/v12.0.0/JSON/package.dhall sha256:843783d29e60b558c2de431ce1206ce34bdfde375fcf06de8ec5bf77092fdef7
--   
--   in  { `example.json` =
--           JSON.render (JSON.array [ JSON.number 1.0, JSON.bool True ])
--       , `example.yaml` =
--           JSON.renderYAML
--             (JSON.object (toMap { foo = JSON.string "Hello", bar = JSON.null }))
--       }
--   </pre>
--   
--   ... which would generate:
--   
--   <pre>
--   $ cat result/example.json
--   [ 1.0, true ]
--   
--   $ cat result/example.yaml
--   ! "bar": null
--   ! "foo": "Hello"
--   </pre>
--   
--   <i>Advanced construction of directory trees</i>
--   
--   In addition to the ways described above using "simple" Dhall values to
--   construct the directory tree there is one based on a fixpoint
--   encoding. It works by passing a value of the following type to the
--   interpreter:
--   
--   <pre>
--   let User = &lt; UserId : Natural | UserName : Text &gt;
--   
--   let Group = &lt; GroupId : Natural | GroupName : Text &gt;
--   
--   let Access =
--         { execute : Optional Bool
--         , read : Optional Bool
--         , write : Optional Bool
--         }
--   
--   let Mode =
--         { user : Optional Access
--         , group : Optional Access
--         , other : Optional Access
--         }
--   
--   let Entry =
--         \(content : Type) -&gt;
--           { name : Text
--           , content : content
--           , user : Optional User
--           , group : Optional Group
--           , mode : Optional Mode
--           }
--   
--   in  forall (tree : Type) -&gt;
--       forall  ( make
--               : { directory : Entry (List tree) -&gt; tree
--                 , file : Entry Text -&gt; tree
--                 }
--               ) -&gt;
--         List tree
--   </pre>
--   
--   The fact that the metadata for filesystem entries is modeled after the
--   POSIX permission model comes with the unfortunate downside that it
--   might not apply to other systems: There, changes to the metadata
--   (user, group, permissions) might be a no-op and <b>no warning will be
--   issued</b>. This is a leaking abstraction of the <a>unix-compat</a>
--   package used internally.
--   
--   <b>NOTE</b>: This utility does not take care of type-checking and
--   normalizing the provided expression. This will raise a
--   <a>FilesystemError</a> exception or a <a>DhallErrors</a> exception
--   upon encountering an expression that cannot be converted as-is.
toDirectoryTree :: Bool -> FilePath -> Expr Void Void -> IO ()

-- | This error indicates that you supplied an invalid Dhall expression to
--   the <a>toDirectoryTree</a> function. The Dhall expression could not be
--   translated to a directory tree.
newtype FilesystemError
FilesystemError :: Expr Void Void -> FilesystemError
[unexpectedExpression] :: FilesystemError -> Expr Void Void

-- | A filesystem entry.
data FilesystemEntry
DirectoryEntry :: Entry (Seq FilesystemEntry) -> FilesystemEntry
FileEntry :: Entry Text -> FilesystemEntry

-- | A directory in the filesystem.
type DirectoryEntry = Entry (Seq FilesystemEntry)

-- | A file in the filesystem.
type FileEntry = Entry Text

-- | A generic filesystem entry. This type holds the metadata that apply to
--   all entries. It is parametric over the content of such an entry.
data Entry a
Entry :: String -> a -> Maybe User -> Maybe Group -> Maybe (Mode Maybe) -> Entry a
[entryName] :: Entry a -> String
[entryContent] :: Entry a -> a
[entryUser] :: Entry a -> Maybe User
[entryGroup] :: Entry a -> Maybe Group
[entryMode] :: Entry a -> Maybe (Mode Maybe)

-- | A user identified either by id or name.
data User
UserId :: UserID -> User
UserName :: String -> User

-- | A group identified either by id or name.
data Group
GroupId :: GroupID -> Group
GroupName :: String -> Group

-- | A filesystem mode. See chmod(1). The parameter is meant to be
--   instantiated by either <a>Identity</a> or <a>Maybe</a> depending on
--   the completeness of the information: * For data read from the
--   filesystem it will be <a>Identity</a>. * For user-supplied data it
--   will be <a>Maybe</a> as we want to be able to set only specific bits.
data Mode f
Mode :: f (Access f) -> f (Access f) -> f (Access f) -> Mode f
[modeUser] :: Mode f -> f (Access f)
[modeGroup] :: Mode f -> f (Access f)
[modeOther] :: Mode f -> f (Access f)

-- | The permissions for a subject (user<i>group</i>other).
data Access f
Access :: f Bool -> f Bool -> f Bool -> Access f
[accessExecute] :: Access f -> f Bool
[accessRead] :: Access f -> f Bool
[accessWrite] :: Access f -> f Bool

-- | A wrapper around <a>setFileMode</a>. On Windows, it does check the
--   resulting file mode of the file/directory and emits a warning if it
--   doesn't match the desired file mode. On all other OS it is identical
--   to <a>setFileMode</a> as it is assumed to work correctly.
setFileMode :: FilePath -> FileMode -> IO ()

-- | Pretty-print a <a>FileMode</a>. The format is similar to the one
--   ls(1): It is display as three blocks of three characters. The first
--   block are the permissions of the user, the second one are the ones of
--   the group and the third one the ones of other subjects. A <tt>r</tt>
--   denotes that the file or directory is readable by the subject, a
--   <tt>w</tt> denotes that it is writable and an <tt>x</tt> denotes that
--   it is executable. Unset permissions are represented by <tt>-</tt>.
prettyFileMode :: FileMode -> String

-- | Is setting metadata supported on this platform or not.
isMetadataSupported :: Bool

-- | Decode a fixpoint directory tree from a Dhall expression.
decodeDirectoryTree :: Expr s Void -> IO (Seq FilesystemEntry)

-- | The type of a fixpoint directory tree expression.
directoryTreeType :: Expector (Expr Src Void)
instance GHC.Exception.Type.Exception Dhall.DirectoryTree.MetadataUnsupportedError
instance GHC.Show.Show Dhall.DirectoryTree.MetadataUnsupportedError
instance GHC.Exception.Type.Exception Dhall.DirectoryTree.FilesystemError
instance GHC.Show.Show Dhall.DirectoryTree.FilesystemError


-- | Please read the <a>Dhall.Tutorial</a> module, which contains a
--   tutorial explaining how to use the language, the compiler, and this
--   library
module Dhall

-- | Type-check and evaluate a Dhall program, decoding the result into
--   Haskell
--   
--   The first argument determines the type of value that you decode:
--   
--   <pre>
--   &gt;&gt;&gt; input integer "+2"
--   2
--   
--   &gt;&gt;&gt; input (vector double) "[1.0, 2.0]"
--   [1.0,2.0]
--   </pre>
--   
--   Use <a>auto</a> to automatically select which type to decode based on
--   the inferred return type:
--   
--   <pre>
--   &gt;&gt;&gt; input auto "True" :: IO Bool
--   True
--   </pre>
--   
--   This uses the settings from <a>defaultInputSettings</a>.
input :: Decoder a -> Text -> IO a

-- | Extend <a>input</a> 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.
inputWithSettings :: InputSettings -> Decoder a -> Text -> IO a

-- | Type-check and evaluate a Dhall program that is read from the
--   file-system.
--   
--   This uses the settings from <a>defaultEvaluateSettings</a>.
inputFile :: Decoder a -> FilePath -> IO a

-- | Extend <a>inputFile</a> with a custom typing context and a custom
--   normalization process.
inputFileWithSettings :: EvaluateSettings -> Decoder a -> FilePath -> IO a

-- | Similar to <a>input</a>, but without interpreting the Dhall
--   <a>Expr</a> into a Haskell type.
--   
--   Uses the settings from <a>defaultInputSettings</a>.
inputExpr :: Text -> IO (Expr Src Void)

-- | Extend <a>inputExpr</a> 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.
inputExprWithSettings :: InputSettings -> Text -> IO (Expr Src Void)

-- | Interpret a Dhall Expression
--   
--   This takes care of import resolution, type-checking, and normalization
interpretExpr :: Expr Src Import -> IO (Expr Src Void)

-- | Like <a>interpretExpr</a>, but customizable using <a>InputSettings</a>
interpretExprWithSettings :: InputSettings -> Expr Src Import -> IO (Expr Src Void)

-- | Decode a Dhall expression
--   
--   This takes care of import resolution, type-checking and normalization
fromExpr :: Decoder a -> Expr Src Import -> IO a

-- | Like <a>fromExpr</a>, but customizable using <a>InputSettings</a>
fromExprWithSettings :: InputSettings -> Decoder a -> Expr Src Import -> IO a

-- | Access the directory to resolve imports relative to.
rootDirectory :: 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.
sourceName :: Functor f => LensLike' f InputSettings FilePath

-- | Access the starting context used for evaluation and type-checking.
startingContext :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Context (Expr Src Void))

-- | Access the custom substitutions.
substitutions :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Substitutions Src Void)

-- | Access the custom normalizer.
normalizer :: (Functor f, HasEvaluateSettings s) => LensLike' f s (Maybe (ReifiedNormalizer Void))

-- | Access the HTTP manager initializer.
newManager :: (Functor f, HasEvaluateSettings s) => LensLike' f s (IO Manager)

-- | Default input settings: resolves imports relative to <tt>.</tt> (the
--   current working directory), report errors as coming from
--   <tt>(input)</tt>, and default evaluation settings from
--   <a>defaultEvaluateSettings</a>.
defaultInputSettings :: InputSettings

data InputSettings

-- | Default evaluation settings: no extra entries in the initial context,
--   and no special normalizer behaviour.
defaultEvaluateSettings :: EvaluateSettings

data EvaluateSettings

class HasEvaluateSettings s
evaluateSettings :: (HasEvaluateSettings s, Functor f) => LensLike' f s EvaluateSettings

-- | Use this to provide more detailed error messages
--   
--   <pre>
--   &gt; input auto "True" :: IO Integer
--    *** Exception: Error: Expression doesn't match annotation
--   
--    True : Integer
--   
--    (input):1:1
--   </pre>
--   
--   <pre>
--   &gt; 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:
--   
--   
--        ┌───────────────────────────────┐
--        │ &gt;&gt;&gt; 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
--   </pre>
detailed :: IO a -> IO a

-- | Parse an expression, using the supplied <a>InputSettings</a>
parseWithSettings :: MonadThrow m => InputSettings -> Text -> m (Expr Src Import)

-- | Resolve an expression, using the supplied <a>InputSettings</a>
--   
--   Note that this also applies any substitutions specified in the
--   <a>InputSettings</a>
resolveWithSettings :: InputSettings -> Expr Src Import -> IO (Expr Src Void)

-- | Type-check an expression, using the supplied <a>InputSettings</a>
typecheckWithSettings :: MonadThrow m => InputSettings -> Expr Src Void -> m ()

-- | Type-check an expression against a type provided as a Dhall
--   expreession, using the supplied <a>InputSettings</a>
checkWithSettings :: MonadThrow m => InputSettings -> Expr Src Void -> Expr Src Void -> m ()

-- | Type-check an expression against a <a>Decoder</a>'s expected type,
--   using the supplied <a>InputSettings</a>. This is equivalent of using
--   the <a>expected</a> type of a <tt>Decoder</tt> as the second argument
--   to <a>checkWithSettings</a>.
expectWithSettings :: MonadThrow m => InputSettings -> Decoder a -> Expr Src Void -> m ()

-- | Normalize an expression, using the supplied <a>InputSettings</a>
normalizeWithSettings :: InputSettings -> Expr Src Void -> Expr Src Void

-- | 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 <a>normalizeWith</a> easier to use.
--   
--   For other use cases, use <a>input</a> from <a>Dhall</a> module. It
--   will give you a much better user experience.
rawInput :: Alternative f => Decoder a -> Expr s Void -> f a
instance Dhall.HasEvaluateSettings Dhall.InputSettings
instance Dhall.HasEvaluateSettings Dhall.EvaluateSettings


-- | Dhall is a programming language specialized for configuration files.
--   This module contains a tutorial explaining how to author configuration
--   files using this language
--   
--   You might also be interested in the <a>Language Tour</a>, a
--   Haskell-agnostic tour of Dhall's language features.
module Dhall.Tutorial


-- | Template Haskell utilities
module Dhall.TH

-- | This fully resolves, type checks, and normalizes the expression, so
--   the resulting AST is self-contained.
--   
--   This can be used to resolve all of an expression’s imports at compile
--   time, allowing one to reference Dhall expressions from Haskell without
--   having a runtime dependency on the location of Dhall files.
--   
--   For example, given a file <tt>"./Some/Type.dhall"</tt> containing
--   
--   <pre>
--   &lt; This : Natural | Other : ../Other/Type.dhall &gt;
--   </pre>
--   
--   ... rather than duplicating the AST manually in a Haskell <a>Type</a>,
--   you can do:
--   
--   <pre>
--   Dhall.Type
--   (\case
--       UnionLit "This" _ _  -&gt; ...
--       UnionLit "Other" _ _ -&gt; ...)
--   $(staticDhallExpression "./Some/Type.dhall")
--   </pre>
--   
--   This would create the Dhall Expr AST from the
--   <tt>"./Some/Type.dhall"</tt> file at compile time with all imports
--   resolved, making it easy to keep your Dhall configs and Haskell
--   interpreters in sync.
staticDhallExpression :: Text -> Q Exp

-- | A quasi-quoter for Dhall expressions.
--   
--   This quoter is build on top of <a>staticDhallExpression</a>. Therefore
--   consult the documentation of that function for further information.
--   
--   This quoter is meant to be used in expression context only; Other
--   contexts like pattern contexts or declaration contexts are not
--   supported and will result in an error.
dhall :: QuasiQuoter

-- | Generate a Haskell datatype declaration from a Dhall union type where
--   each union alternative corresponds to a Haskell constructor
--   
--   For example, this Template Haskell splice:
--   
--   <pre>
--   Dhall.TH.makeHaskellTypeFromUnion "T" "&lt; A : { x : Bool } | B &gt;"
--   </pre>
--   
--   ... generates this Haskell code:
--   
--   <pre>
--   data T = A {x :: GHC.Types.Bool} | B
--   </pre>
--   
--   This is a special case of <a>makeHaskellTypes</a>:
--   
--   <pre>
--   makeHaskellTypeFromUnion typeName code =
--       makeHaskellTypes [ MultipleConstructors{..} ]
--   </pre>
makeHaskellTypeFromUnion :: Text -> Text -> Q [Dec]

-- | Generate a Haskell datatype declaration with one constructor from a
--   Dhall type.
--   
--   This comes in handy if you need to keep Dhall types and Haskell types
--   in sync. You make the Dhall types the source of truth and use Template
--   Haskell to generate the matching Haskell type declarations from the
--   Dhall types.
--   
--   For example, given this Dhall code:
--   
--   <pre>
--   -- ./Department.dhall
--   &lt; Sales | Engineering | Marketing &gt;
--   </pre>
--   
--   <pre>
--   -- ./Employee.dhall
--   { name : Text, department : ./Department.dhall }
--   </pre>
--   
--   ... this Template Haskell splice:
--   
--   <pre>
--   {-# LANGUAGE DeriveAnyClass     #-}
--   {-# LANGUAGE DeriveGeneric      #-}
--   {-# LANGUAGE DerivingStrategies #-}
--   {-# LANGUAGE OverloadedStrings  #-}
--   {-# LANGUAGE TemplateHaskell    #-}
--   
--   Dhall.TH.makeHaskellTypes
--       [ MultipleConstructors "Department" "./tests/th/Department.dhall"
--       , SingleConstructor "Employee" "MakeEmployee" "./tests/th/Employee.dhall"
--       ]
--   </pre>
--   
--   ... generates this Haskell code:
--   
--   <pre>
--   data Department = Engineering | Marketing | Sales
--     deriving stock (GHC.Generics.Generic)
--     deriving anyclass (Dhall.FromDhall, Dhall.ToDhall)
--   
--   data Employee
--     = MakeEmployee {department :: Department,
--                     name :: Data.Text.Internal.Text}
--     deriving stock (GHC.Generics.Generic)
--     deriving anyclass (Dhall.FromDhall, Dhall.ToDhall)
--   </pre>
--   
--   Carefully note that the conversion makes a best-effort attempt to
--   auto-detect when a Dhall type (like <tt>./Employee.dhall</tt>) refers
--   to another Dhall type (like <tt>./Department.dhall</tt>) and replaces
--   that reference with the corresponding Haskell type.
--   
--   This Template Haskell splice requires you to enable the following
--   extensions:
--   
--   <ul>
--   <li><pre>DeriveGeneric</pre></li>
--   <li><pre>DerivingAnyClass</pre></li>
--   <li><pre>DerivingStrategies</pre></li>
--   </ul>
--   
--   By default, the generated types only derive <a>Generic</a>,
--   <a>FromDhall</a>, and <a>ToDhall</a>. To add any desired instances
--   (such as <a>Eq</a>/<a>Ord</a>/<a>Show</a>), you can use the
--   <tt>StandaloneDeriving</tt> language extension, like this:
--   
--   <pre>
--   {-# LANGUAGE DeriveAnyClass     #-}
--   {-# LANGUAGE DeriveGeneric      #-}
--   {-# LANGUAGE DerivingStrategies #-}
--   {-# LANGUAGE OverloadedStrings  #-}
--   {-# LANGUAGE StandaloneDeriving #-}
--   {-# LANGUAGE TemplateHaskell    #-}
--   
--   Dhall.TH.makeHaskellTypes
--       [ MultipleConstructors "Department" "./tests/th/Department.dhall"
--       , SingleConstructor "Employee" "MakeEmployee" "./tests/th/Employee.dhall"
--       ]
--   
--   deriving instance Eq   Department
--   deriving instance Ord  Department
--   deriving instance Show Department
--   
--   deriving instance Eq   Employee
--   deriving instance Ord  Employee
--   deriving instance Show Employee
--   </pre>
makeHaskellTypes :: [HaskellType Text] -> Q [Dec]

-- | Like <a>makeHaskellTypes</a>, but with the ability to customize the
--   generated Haskell code by passing <a>GenerateOptions</a>.
--   
--   For instance, <a>makeHaskellTypes</a> is implemented using this
--   function:
--   
--   <pre>
--   makeHaskellTypes = makeHaskellTypesWith defaultGenerateOptions
--   </pre>
makeHaskellTypesWith :: GenerateOptions -> [HaskellType Text] -> Q [Dec]

-- | Used by <a>makeHaskellTypes</a> and <a>makeHaskellTypesWith</a> to
--   specify how to generate Haskell types.
data HaskellType code

-- | Generate a Haskell type with more than one constructor from a Dhall
--   union type.
MultipleConstructors :: Text -> code -> HaskellType code

-- | Name of the generated Haskell type
[typeName] :: HaskellType code -> Text

-- | Dhall code that evaluates to a union type
[code] :: HaskellType code -> code

-- | Generate a Haskell type with one constructor from any Dhall type.
--   
--   To generate a constructor with multiple named fields, supply a Dhall
--   record type. This does not support more than one anonymous field.
SingleConstructor :: Text -> Text -> code -> HaskellType code

-- | Name of the generated Haskell type
[typeName] :: HaskellType code -> Text

-- | Name of the constructor
[constructorName] :: HaskellType code -> Text

-- | Dhall code that evaluates to a union type
[code] :: HaskellType code -> code

-- | This data type holds various options that let you control several
--   aspects how Haskell code is generated. In particular you can
--   
--   <ul>
--   <li>disable the generation of <a>FromDhall</a>/<a>ToDhall</a>
--   instances.</li>
--   <li>modify how a Dhall union field translates to a Haskell data
--   constructor.</li>
--   </ul>
data GenerateOptions
GenerateOptions :: (Text -> Text) -> (Text -> Text) -> Bool -> Bool -> Bool -> GenerateOptions

-- | How to map a Dhall union field name to a Haskell constructor. Note:
--   The <a>constructorName</a> of <a>SingleConstructor</a> will be passed
--   to this function, too.
[constructorModifier] :: GenerateOptions -> Text -> Text

-- | How to map a Dhall record field names to a Haskell record field names.
[fieldModifier] :: GenerateOptions -> Text -> Text

-- | Generate a <a>FromDhall</a> instance for the Haskell type
[generateFromDhallInstance] :: GenerateOptions -> Bool

-- | Generate a <a>ToDhall</a> instance for the Haskell type
[generateToDhallInstance] :: GenerateOptions -> Bool

-- | Make all fields strict.
[makeStrict] :: GenerateOptions -> Bool

-- | A default set of options used by <a>makeHaskellTypes</a>. That means:
--   
--   <ul>
--   <li>Constructors and fields are passed unmodified.</li>
--   <li>Both <a>FromDhall</a> and <a>ToDhall</a> instances are
--   generated.</li>
--   </ul>
--   
--   Note: `From/ToDhall` should be <a>False</a> if importing higher-kinded
--   types. In these cases one should use a standalone declaration.
defaultGenerateOptions :: GenerateOptions
instance Data.Traversable.Traversable Dhall.TH.HaskellType
instance Data.Foldable.Foldable Dhall.TH.HaskellType
instance GHC.Base.Functor Dhall.TH.HaskellType


-- | This module contains the implementation of the <tt>dhall freeze</tt>
--   subcommand
module Dhall.Freeze

-- | Implementation of the <tt>dhall freeze</tt> subcommand
freeze :: OutputMode -> Transitivity -> NonEmpty Input -> Scope -> Intent -> Maybe CharacterSet -> Censor -> IO ()

-- | Slightly more pure version of the <a>freeze</a> function
--   
--   This still requires <a>IO</a> to freeze the import, but now the input
--   and output expression are passed in explicitly
freezeExpression :: FilePath -> Scope -> Intent -> Expr s Import -> IO (Expr s Import)

-- | Retrieve an <a>Import</a> and update the hash to match the latest
--   contents
freezeImport :: FilePath -> Import -> IO Import

-- | Freeze an import only if the import is a <a>Remote</a> import
freezeRemoteImport :: FilePath -> Import -> IO Import

-- | See <a>freeze</a>.
freezeWithSettings :: EvaluateSettings -> OutputMode -> Transitivity -> NonEmpty Input -> Scope -> Intent -> Maybe CharacterSet -> Censor -> IO ()

-- | See <a>freezeExpression</a>.
freezeExpressionWithSettings :: EvaluateSettings -> FilePath -> Scope -> Intent -> Expr s Import -> IO (Expr s Import)

-- | See <a>freezeImport</a>.
freezeImportWithSettings :: EvaluateSettings -> FilePath -> Import -> IO Import

-- | See <a>freezeRemoteImport</a>.
freezeRemoteImportWithSettings :: EvaluateSettings -> FilePath -> Import -> IO Import

-- | Specifies which imports to freeze
data Scope

-- | Freeze only remote imports (i.e. URLs)
OnlyRemoteImports :: Scope

-- | Freeze all imports (including paths and environment variables)
AllImports :: Scope

-- | Specifies why we are adding semantic integrity checks
data Intent

-- | Protect imports with an integrity check without a fallback so that
--   import resolution fails if the import changes
Secure :: Intent

-- | Protect imports with an integrity check and also add a fallback import
--   import without an integrity check. This is useful if you only want to
--   cache imports when possible but still gracefully degrade to resolving
--   them if the semantic integrity check has changed.
Cache :: Intent

-- | See <a>freeze</a>.

-- | <i>Deprecated: Use freezeWithSettings directly</i>
freezeWithManager :: IO Manager -> OutputMode -> Transitivity -> NonEmpty Input -> Scope -> Intent -> Maybe CharacterSet -> Censor -> IO ()

-- | See <a>freezeExpression</a>.

-- | <i>Deprecated: Use freezeExpressionWithSettings directly</i>
freezeExpressionWithManager :: IO Manager -> FilePath -> Scope -> Intent -> Expr s Import -> IO (Expr s Import)

-- | See <a>freezeImport</a>.

-- | <i>Deprecated: Use freezeImportWithSettings directly</i>
freezeImportWithManager :: IO Manager -> FilePath -> Import -> IO Import

-- | See <a>freezeRemoteImport</a>.

-- | <i>Deprecated: Use freezeRemoteImportWithSettings directly</i>
freezeRemoteImportWithManager :: IO Manager -> FilePath -> Import -> IO Import


-- | Newtypes for writing customizable <a>FromDhall</a> and <a>ToDhall</a>
--   instances through the DerivingVia strategy.
--   
--   Inspired by Matt Parson's blog post <a>Mirror Mirror: Reflection and
--   Encoding Via</a>, but applied to Dhall instead of JSON.
--   
--   This module is intended to be used with <a>DerivingVia</a> so it's
--   only available for GHC &gt;= v8.6.1.
--   
--   Check the section <i>Letting DerivingVia do the work</i> if you want
--   to see this module in action. (Click <a>Dhall.Deriving#derivingVia</a>
--   to jump there)
module Dhall.Deriving

-- | Intended for use on <tt>deriving via</tt> clauses for types with a
--   <a>Generic</a> instance. The <tt>tag</tt> argument is used to
--   construct an <a>InterpretOptions</a> value which is used as the first
--   argument to <a>genericAutoWith</a>.
newtype Codec tag a
Codec :: a -> Codec tag a
[unCodec] :: Codec tag a -> a

-- | Convert a type into a <tt>InterpretOptions -&gt; InterpretOptions</tt>
--   function
class ModifyOptions a
modifyOptions :: ModifyOptions a => InterpretOptions -> InterpretOptions

-- | <tt>Field t</tt> post-composes the <tt>fieldModifier</tt> from
--   <tt>options</tt> with the value-level version of <tt>t</tt>, obtained
--   with <tt>TextFunction</tt>
data Field a

-- | <tt>Constructor t</tt> post-composes the <tt>constructorModifier</tt>
--   from <tt>options</tt> with the value-level version of <tt>t</tt>,
--   obtained with <tt>TextFunction</tt>
data Constructor a

-- | <tt>SetSingletonConstructors t</tt> replaces the
--   <tt>singletonConstructors</tt> from <tt>options</tt> with the
--   value-level version of <tt>t</tt>.
data SetSingletonConstructors a

-- | Convert a type into a <tt>Text -&gt; Text</tt> function
class TextFunction a
textFunction :: TextFunction a => Text -> Text

-- | <tt>DropPrefix prefix</tt> corresponds to the value level function
--   <tt><a>dropPrefix</a> prefix</tt>
data DropPrefix (s :: Symbol)

-- | Convert casing to <tt>Title Cased Phrase</tt>
data TitleCase

-- | Convert casing to <tt>camelCasedPhrase</tt>
data CamelCase

-- | Convert casing to <tt>PascalCasedPhrase</tt>
data PascalCase

-- | Convert casing to <tt>snake_cased_phrase</tt>
data SnakeCase

-- | Convert casing to <tt>spinal-cased-phrase</tt>
data SpinalCase

-- | Convert casing to <tt>Train-Cased-Phrase</tt>
data TrainCase

-- | Convert a type of kind <tt>SingletonConstructors</tt> into a value of
--   type <tt>SingletonConstructors</tt>
class ToSingletonConstructors (a :: SingletonConstructors)
asSingletonConstructors :: ToSingletonConstructors a => SingletonConstructors

-- | Type-level version of <a>Bare</a>. Never wrap the field of a singleton
--   constructor in a record
type Bare = 'Bare

-- | Type-level version of <a>Wrapped</a> Always wrap the field of a
--   singleton constructor in a record
type Wrapped = 'Wrapped

-- | Type-level version of <a>Smart</a> Wrap the field of a singleton
--   constructor in a record only if the field is named
type Smart = 'Smart

-- | The identity for functions on <a>InterpretOptions</a> and on
--   <tt>Text</tt>. Useful for deriving <tt>FromDhall</tt> and
--   <tt>ToDhall</tt> with the default options.
type AsIs = ()

-- | Composition for functions on <a>InterpretOptions</a> and on
--   <tt>Text</tt>. We use <tt>&lt;&lt;&lt;</tt> since <tt>.</tt> isn't a
--   valid type operator yet (it will be valid starting from ghc-8.8.1)
data a <<< b
infixr 1 <<<

-- | <tt>dropPrefix prefix text</tt> returns the suffix of <tt>text</tt> if
--   its prefix matches <tt>prefix</tt>, or the entire <tt>text</tt>
--   otherwise
dropPrefix :: Text -> Text -> Text

-- | <tt>addFieldModifier f options</tt> post-composes the
--   <tt>fieldModifier</tt> from <tt>options</tt> with <tt>f</tt>.
addFieldModifier :: (Text -> Text) -> InterpretOptions -> InterpretOptions

-- | <tt>addConstructorModifier f options</tt> post-composes the
--   <tt>constructorModifier</tt> from <tt>options</tt> with <tt>f</tt>.
addConstructorModifier :: (Text -> Text) -> InterpretOptions -> InterpretOptions

-- | <tt>setSingletonConstructors v options</tt> replaces the
--   <tt>singletonConstructors</tt> from <tt>options</tt> with <tt>v</tt>.
setSingletonConstructors :: SingletonConstructors -> InterpretOptions -> InterpretOptions
instance Dhall.Deriving.ToSingletonConstructors Dhall.Deriving.Smart
instance Dhall.Deriving.ToSingletonConstructors Dhall.Deriving.Wrapped
instance Dhall.Deriving.ToSingletonConstructors Dhall.Deriving.Bare
instance Dhall.Deriving.ToSingletonConstructors a => Dhall.Deriving.ModifyOptions (Dhall.Deriving.SetSingletonConstructors a)
instance Dhall.Deriving.TextFunction Dhall.Deriving.TrainCase
instance Dhall.Deriving.TextFunction Dhall.Deriving.SpinalCase
instance Dhall.Deriving.TextFunction Dhall.Deriving.SnakeCase
instance Dhall.Deriving.TextFunction Dhall.Deriving.PascalCase
instance Dhall.Deriving.TextFunction Dhall.Deriving.CamelCase
instance Dhall.Deriving.TextFunction Dhall.Deriving.TitleCase
instance GHC.TypeLits.KnownSymbol s => Dhall.Deriving.TextFunction (Dhall.Deriving.DropPrefix s)
instance Dhall.Deriving.TextFunction Dhall.Deriving.AsIs
instance forall k1 k2 (a :: k1) (b :: k2). (Dhall.Deriving.TextFunction a, Dhall.Deriving.TextFunction b) => Dhall.Deriving.TextFunction (a Dhall.Deriving.<<< b)
instance forall k (a :: k). Dhall.Deriving.TextFunction a => Dhall.Deriving.ModifyOptions (Dhall.Deriving.Field a)
instance forall k (a :: k). Dhall.Deriving.TextFunction a => Dhall.Deriving.ModifyOptions (Dhall.Deriving.Constructor a)
instance forall k1 k2 (a :: k1) (b :: k2). (Dhall.Deriving.ModifyOptions a, Dhall.Deriving.ModifyOptions b) => Dhall.Deriving.ModifyOptions (a Dhall.Deriving.<<< b)
instance Dhall.Deriving.ModifyOptions Dhall.Deriving.AsIs
instance forall k a (tag :: k). (GHC.Generics.Generic a, Dhall.Marshal.Decode.GenericFromDhall a (GHC.Generics.Rep a), Dhall.Deriving.ModifyOptions tag) => Dhall.Marshal.Decode.FromDhall (Dhall.Deriving.Codec tag a)
instance forall k a (tag :: k). (GHC.Generics.Generic a, Dhall.Marshal.Encode.GenericToDhall (GHC.Generics.Rep a), Dhall.Deriving.ModifyOptions tag) => Dhall.Marshal.Encode.ToDhall (Dhall.Deriving.Codec tag a)


-- | Utilities for getting the current version of the Haskell
--   implementation of Dhall
module Dhall.Version

-- | The current <a>Version</a> of the Haskell implementation
dhallVersion :: Version

-- | The current version <a>String</a> for the Haskell implementation
dhallVersionString :: String


-- | This module contains the implementation of the <tt>dhall repl</tt>
--   subcommand
module Dhall.Repl

-- | Implementation of the <tt>dhall repl</tt> subcommand
repl :: CharacterSet -> Bool -> IO ()


-- | This module contains the top-level entrypoint and options parsing for
--   the <tt>dhall</tt> executable
module Dhall.Main

-- | Top-level program options
data Options
Options :: Mode -> Bool -> Bool -> Maybe CharacterSet -> Censor -> Options
[mode] :: Options -> Mode
[explain] :: Options -> Bool
[plain] :: Options -> Bool
[chosenCharacterSet] :: Options -> Maybe CharacterSet
[censor] :: Options -> Censor

-- | The subcommands for the <tt>dhall</tt> executable
data Mode
Default :: Input -> Output -> Bool -> Bool -> SemanticCacheMode -> Bool -> Mode
[file] :: Mode -> Input
[output] :: Mode -> Output
[annotate] :: Mode -> Bool
[alpha] :: Mode -> Bool
[semanticCacheMode] :: Mode -> SemanticCacheMode
[version] :: Mode -> Bool
Version :: Mode
Resolve :: Input -> Maybe ResolveMode -> SemanticCacheMode -> Mode
[file] :: Mode -> Input
[resolveMode] :: Mode -> Maybe ResolveMode
[semanticCacheMode] :: Mode -> SemanticCacheMode
Type :: Input -> Bool -> SemanticCacheMode -> Mode
[file] :: Mode -> Input
[quiet] :: Mode -> Bool
[semanticCacheMode] :: Mode -> SemanticCacheMode
Normalize :: Input -> Bool -> Mode
[file] :: Mode -> Input
[alpha] :: Mode -> Bool
Repl :: Mode
Format :: Bool -> Transitivity -> OutputMode -> NonEmpty Input -> Mode
[deprecatedInPlace] :: Mode -> Bool
[transitivity] :: Mode -> Transitivity
[outputMode] :: Mode -> OutputMode
[inputs] :: Mode -> NonEmpty Input
Freeze :: Bool -> Transitivity -> Bool -> Bool -> OutputMode -> NonEmpty Input -> Mode
[deprecatedInPlace] :: Mode -> Bool
[transitivity] :: Mode -> Transitivity
[all_] :: Mode -> Bool
[cache] :: Mode -> Bool
[outputMode] :: Mode -> OutputMode
[inputs] :: Mode -> NonEmpty Input
Hash :: Input -> Bool -> Mode
[file] :: Mode -> Input
[cache] :: Mode -> Bool
Diff :: Text -> Text -> Mode
[expr1] :: Mode -> Text
[expr2] :: Mode -> Text
Lint :: Bool -> Transitivity -> OutputMode -> NonEmpty Input -> Mode
[deprecatedInPlace] :: Mode -> Bool
[transitivity] :: Mode -> Transitivity
[outputMode] :: Mode -> OutputMode
[inputs] :: Mode -> NonEmpty Input
Tags :: Input -> Output -> Maybe [Text] -> Bool -> Mode
[input] :: Mode -> Input
[output] :: Mode -> Output
[suffixes] :: Mode -> Maybe [Text]
[followSymlinks] :: Mode -> Bool
Encode :: Input -> Bool -> Mode
[file] :: Mode -> Input
[json] :: Mode -> Bool
Decode :: Input -> Bool -> Bool -> Mode
[file] :: Mode -> Input
[json] :: Mode -> Bool
[quiet] :: Mode -> Bool
Text :: Input -> Output -> Mode
[file] :: Mode -> Input
[output] :: Mode -> Output
DirectoryTree :: Bool -> Input -> FilePath -> Mode
[allowSeparators] :: Mode -> Bool
[file] :: Mode -> Input
[path] :: Mode -> FilePath
Schemas :: Input -> OutputMode -> Text -> Mode
[file] :: Mode -> Input
[outputMode] :: Mode -> OutputMode
[schemas] :: Mode -> Text
SyntaxTree :: Input -> Bool -> Mode
[file] :: Mode -> Input
[noted] :: Mode -> Bool
Package :: Maybe String -> NonEmpty FilePath -> Mode
[name] :: Mode -> Maybe String
[files] :: Mode -> NonEmpty FilePath

-- | This specifies how to resolve transitive dependencies
data ResolveMode

-- | Generate a DOT file for <tt>graphviz</tt>
Dot :: ResolveMode

-- | List all transitive dependencies as text, one per line
ListTransitiveDependencies :: ResolveMode

-- | List immediate dependencies as text, one per line
ListImmediateDependencies :: ResolveMode

-- | <a>Parser</a> for the <a>Options</a> type
parseOptions :: Parser Options

-- | <a>ParserInfo</a> for the <a>Options</a> type
parserInfoOptions :: ParserInfo Options

-- | Run the command specified by the <a>Options</a> type
command :: Options -> IO ()

-- | Entry point for the <tt>dhall</tt> executable
main :: IO ()
