-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Agda is a dependently typed functional programming language: It has -- inductive families, which are similar to Haskell's GADTs, but they can -- be indexed by values and not just types. It also has parameterised -- modules, mixfix operators, Unicode characters, and an interactive -- Emacs interface (the type checker can assist in the development of -- your code). -- -- Agda is also a proof assistant: It is an interactive system for -- writing and checking proofs. Agda is based on intuitionistic type -- theory, a foundational system for constructive mathematics developed -- by the Swedish logician Per Martin-Löf. It has many similarities with -- other proof assistants based on dependent types, such as Rocq -- (formerly known as Coq), Idris, Lean and NuPRL. -- -- This package includes both a command-line program (agda) and an Emacs -- mode. @package Agda @version 2.9.0 module Agda.Interaction.ExitCode data AgdaError -- | 1 UnknownError :: AgdaError -- | 42 TCMError :: AgdaError -- | 71 OptionError :: AgdaError -- | 113 CommandError :: AgdaError -- | 120 ImpossibleError :: AgdaError -- | Return the error corresponding to an exit code from the Agda process agdaErrorToInt :: AgdaError -> Int agdaErrorFromInt :: Int -> Maybe AgdaError -- | The computation exitSuccess is equivalent to exitWith -- ExitSuccess, It terminates the program successfully. exitSuccess :: IO a exitAgdaWith :: AgdaError -> IO a instance GHC.Internal.Enum.Bounded Agda.Interaction.ExitCode.AgdaError instance GHC.Internal.Enum.Enum Agda.Interaction.ExitCode.AgdaError instance GHC.Internal.Classes.Eq Agda.Interaction.ExitCode.AgdaError instance GHC.Internal.Show.Show Agda.Interaction.ExitCode.AgdaError module Agda.Interaction.Highlighting.HTML.Forester renderForesterHtml :: Html -> Text -- | The list of data files Agda uses. -- -- Because of TemplateHaskell state restrictions, this cannot be define -- in 'Setup'. module Agda.Setup.DataFiles -- | A data file path relative to the project root. dataPath :: FilePath -> FilePath -- | Agda's embedded data files. dataFiles :: [FilePath] -- | The subdirectory in the Agda data directory containing the emacs mode. emacsModeDir :: FilePath -- | The Agda mode's Emacs Lisp files, given in the order in which they -- should be compiled. emacsLispFiles :: [FilePath] module Agda.Setup.LockFile -- | Run an action with an exclusive lock over the given path withLockFile :: FilePath -> IO a -> IO a -- | Semirings. module Agda.Termination.Semiring -- | HasZero is needed for sparse matrices, to tell which is the -- element that does not have to be stored. It is a cut-down version of -- SemiRing which is definable without the implicit -- ?cutoff. class Eq a => HasZero a zeroElement :: HasZero a => a -- | Semirings. data Semiring a Semiring :: (a -> a -> a) -> (a -> a -> a) -> a -> Semiring a -- | Addition. [add] :: Semiring a -> a -> a -> a -- | Multiplication. [mul] :: Semiring a -> a -> a -> a -- | Zero. The one is never used in matrix multiplication , one :: a -- ^ -- One. [zero] :: Semiring a -> a integerSemiring :: Semiring Integer intSemiring :: Semiring Int -- | The standard semiring on Bools. boolSemiring :: Semiring Bool instance Agda.Termination.Semiring.HasZero GHC.Internal.Types.Int instance Agda.Termination.Semiring.HasZero GHC.Internal.Bignum.Integer.Integer -- | Contexts with at most one hole. module Agda.Utils.AffineHole data AffineHole r a -- | A constant term. ZeroHoles :: a -> AffineHole r a -- | A term with one hole and the (old) contents. OneHole :: (r -> a) -> r -> AffineHole r a -- | A term with many holes (error value). ManyHoles :: AffineHole r a instance GHC.Internal.Base.Applicative (Agda.Utils.AffineHole.AffineHole r) instance GHC.Internal.Base.Functor (Agda.Utils.AffineHole.AffineHole r) module Agda.Utils.Applicative -- | Guard: return the action f only if the boolean is -- True (?*>) :: Alternative f => Bool -> f a -> f a -- | Guard: return the value a only if the boolean is -- True (?$>) :: Alternative f => Bool -> a -> f a -- | Branch over a Foldable collection of values. foldA :: (Alternative f, Foldable t) => t a -> f a -- | Branch over a Foldable collection of values using the supplied -- action. foldMapA :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b -- | Better name for for. forA :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) liftA4 :: Applicative f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e -- | Wrappers around MVars which provides an atomic modification -- operation. module Agda.Utils.Atomic -- | A mutable variable which can be read from and *modified*. This -- provides a modifyAtomic combinator with atomic semantics for -- modification, unlike modifyMVar. data Atomic a -- | Create a new atomic variable with the given initial value. newAtomic :: MonadIO m => a -> m (Atomic a) -- | Read the current state of the atomic variable, waiting if any other -- thread is modifying it. -- -- Like readMVar, readAtomic is multiple-wakeup, which -- means that all threads waiting on a modification will be woken up when -- it finishes. readAtomic :: MonadIO m => Atomic a -> m a -- | Modify the contents of an atomic variable. If the continuation fails, -- or receives an asynchronous exception, the variable is returned to its -- old state. -- -- No thread, *including the calling thread*, can access the contents of -- the same Atomic while this function is executing, for reading -- *or* writing. This means that *any* nested use of the variable, as in -- --
--   f var = modifyAtomic var old ->
--     -- ...
--     modifyAtomic var old' -> ... -- (!)
--     readAtomic var                -- (!)
--   
-- -- will result in a deadlock. The new state of the variable is evaluated -- (to WHNF). modifyAtomic :: (MonadIO m, MonadMask m) => Atomic a -> (a -> m (a, b)) -> m b withAtomic :: (MonadIO m, MonadMask m) => Atomic a -> (a -> m ()) -> m () instance GHC.Internal.Classes.Eq (Agda.Utils.Atomic.Atomic a) instance Control.DeepSeq.NFData (Agda.Utils.Atomic.Atomic a) -- | Boolean algebras and types isomorphic to Bool. -- -- There are already solutions for Boolean algebras in the Haskell -- ecosystem, but they do not offer easy instantiations for types -- isomorphic to Bool. In particular, if type a is -- isomorphic to Bool, so it satisfies `IsBool a`, we would like -- to instantiate 'Boolean a' by just giving true and -- false. To facilitate this within the limits of the Haskell -- class system, we define the class Boolean mutually with class -- IsBool, so that operations not, (&&), and -- (||) can get default implementations. -- -- Usage: import Prelude hiding ( not, (&&), (||) ) import -- Agda.Utils.Boolean module Agda.Utils.Boolean -- | Boolean algebras. class Boolean a fromBool :: Boolean a => Bool -> a true :: Boolean a => a false :: Boolean a => a not :: Boolean a => a -> a ($dmnot) :: (Boolean a, IsBool a) => a -> a (&&) :: Boolean a => a -> a -> a ($dm&&) :: (Boolean a, IsBool a) => a -> a -> a (||) :: Boolean a => a -> a -> a ($dm||) :: (Boolean a, IsBool a) => a -> a -> a implies :: Boolean a => a -> a -> a -- | Set difference, dual to implies. butNot :: Boolean a => a -> a -> a infixr 3 && infixr 2 || -- | Types isomorphic to Bool. class (Boolean a, Eq a) => IsBool a toBool :: IsBool a => a -> Bool ifThenElse :: IsBool a => a -> b -> b -> b fromBool1 :: IsBool a => (Bool -> Bool) -> a -> a fromBool2 :: IsBool a => (Bool -> Bool -> Bool) -> a -> a -> a instance Agda.Utils.Boolean.Boolean GHC.Internal.Types.Bool instance Agda.Utils.Boolean.Boolean b => Agda.Utils.Boolean.Boolean (a -> b) instance Agda.Utils.Boolean.IsBool GHC.Internal.Types.Bool -- | Kinds of standard universes: Prop, Type, -- SSet. module Agda.Syntax.Internal.Univ -- | Flavor of standard universe (Prop < Type < SSet,). data Univ -- | Fibrant universe of propositions. UProp :: Univ -- | Fibrant universe. UType :: Univ -- | Non-fibrant universe. USSet :: Univ -- | We have IsFibrant < IsStrict. data IsFibrant -- | Fibrant universe. IsFibrant :: IsFibrant -- | Non-fibrant universe. IsStrict :: IsFibrant -- | The successor universe type of a universe. univUniv :: Univ -> Univ -- | Compute the universe type of a function space from the universe types -- of domain and codomain. funUniv :: Univ -> Univ -> Univ -- | Conclude u1 from funUniv u1 u2 and u2. domainUniv :: Bool -> Univ -> Univ -> Maybe Univ -- | Conclude u2 from funUniv u1 u2 and u1. codomainUniv :: Univ -> Univ -> Maybe Univ -- | Fibrancy of standard universes. univFibrancy :: Univ -> IsFibrant -- | Hacky showing of standard universes, does not take actual names into -- account. showUniv :: Univ -> String instance Agda.Utils.Boolean.Boolean Agda.Syntax.Internal.Univ.IsFibrant instance GHC.Internal.Enum.Bounded Agda.Syntax.Internal.Univ.Univ instance GHC.Internal.Enum.Enum Agda.Syntax.Internal.Univ.Univ instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Univ.IsFibrant instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Univ.Univ instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.Univ.IsFibrant instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.Univ.Univ instance Agda.Utils.Boolean.IsBool Agda.Syntax.Internal.Univ.IsFibrant instance Control.DeepSeq.NFData Agda.Syntax.Internal.Univ.Univ instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Univ.IsFibrant instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Univ.Univ instance GHC.Internal.Show.Show Agda.Syntax.Internal.Univ.IsFibrant instance GHC.Internal.Show.Show Agda.Syntax.Internal.Univ.Univ -- | Agda strings uses Data.Text [1], which can only represent unicode -- scalar values [2], excluding the surrogate code points 3. To -- allow primStringFromList to be injective we make sure -- character values also exclude surrogate code points, mapping them to -- the replacement character U+FFFD. -- -- See #4999 for more information. -- -- module Agda.Utils.Char -- | The unicode replacement character � . replacementChar :: Char -- | Is a character a surrogate code point. isSurrogateCodePoint :: Char -> Bool -- | Map surrogate code points to the unicode replacement character. replaceSurrogateCodePoint :: Char -> Char -- | Total function to convert an integer to a character. Maps surrogate -- code points to the replacement character U+FFFD. integerToChar :: Integer -> Char module Agda.Utils.CompactRegion data Compact Compact :: Compact# -> Compact -- | Create a new compact region with given initial block size. new :: Word -> IO Compact -- | Add a value to a compact region. add :: Compact -> a -> IO a compactWithSharing :: a -> IO a instance Control.DeepSeq.NFData Agda.Utils.CompactRegion.Compact -- | Expand environment variables in strings module Agda.Utils.Environment -- | List of environment variable bindings. type EnvVars = [(String, String)] expandEnvironmentVariables :: String -> IO String -- | Expand a telescope of environment variables (each value may refer to -- variables earlier in the list). expandEnvVarTelescope :: String -> EnvVars -> EnvVars instance GHC.Internal.Classes.Eq Agda.Utils.Environment.Token instance GHC.Internal.Show.Show Agda.Utils.Environment.Token -- | This module is intended for high-performance programming. Concretely, -- the ExpandCase class can be used to force GHC to avoid -- compiling Reader, Endo or State-based code to -- unnecessary closures. You can observe its usage in Generic. For -- a smaller example and some explanation, consider the following. -- --
--   f :: Bool -> Endo Int
--   f b = case b of
--     True  -> mempty
--     False -> Endo (+ 10)
--   
-- -- The desired -O1 output should be the following (ignoring -- newtype casts): -- --
--   f = b n -> case b of
--     True  -> n
--     False -> n + 10
--   
-- -- A typical undesired output would be -- --
--   f = b -> case b of
--     True  -> n -> n
--     False -> n -> n + 10
--   
-- -- Returning closures can be better or worse, depending on the program -- context. However, in high-performance situations we almost never want -- to return closures, and GHC is not nearly reliable enough at getting -- rid of the closures. -- -- Using ExpandCase, we can write code as follows. -- --
--   f :: Bool -> Endo Int
--   f b = expand ret -> case b of
--     True  -> ret mempty
--     False -> ret $ Endo (+10)
--   
-- -- Here, expand immediately introduces a lambda abstraction, and -- the ret continuation applies the "body" of the definition to -- the freshly abstracted variable. Hence, we get something like the -- following as an intermediate piece of Core: -- --
--   f :: Bool -> Endo Int
--   f b = Endo n -> case b of
--     True  -> appEndo mempty n
--     False -> appEndo (Endo (+10)) n
--   
-- -- which is then reliably optimized to -- --
--   f :: Bool -> Endo Int
--   f b = Endo n -> case b of
--     True  -> n
--     False -> n + 10
--   
-- -- NOTE: if you want to use this module, it is very strongly recommended -- that you check the Core of your code! module Agda.Utils.ExpandCase class ExpandCase a where { type Result a; } expand :: ExpandCase a => ((a -> Result a) -> Result a) -> a ($dmexpand) :: (ExpandCase a, Result a ~ a) => ((a -> Result a) -> Result a) -> a instance Agda.Utils.ExpandCase.ExpandCase GHC.Internal.Data.Semigroup.Internal.All instance Agda.Utils.ExpandCase.ExpandCase GHC.Internal.Data.Semigroup.Internal.Any instance Agda.Utils.ExpandCase.ExpandCase GHC.Internal.Types.Bool instance Agda.Utils.ExpandCase.ExpandCase (GHC.Internal.Data.Semigroup.Internal.Endo a) instance Agda.Utils.ExpandCase.ExpandCase (GHC.Internal.Types.IO a) instance Agda.Utils.ExpandCase.ExpandCase GHC.Internal.Types.Int instance Agda.Utils.ExpandCase.ExpandCase [a] instance Agda.Utils.ExpandCase.ExpandCase (GHC.Internal.Maybe.Maybe a) instance Agda.Utils.ExpandCase.ExpandCase (Data.Strict.Tuple.Pair a b) instance Agda.Utils.ExpandCase.ExpandCase () -- | A pure MonadFail. module Agda.Utils.Fail newtype Fail a Fail :: Either String a -> Fail a [runFail] :: Fail a -> Either String a runFail_ :: Fail a -> a instance GHC.Internal.Base.Applicative Agda.Utils.Fail.Fail instance GHC.Internal.Base.Functor Agda.Utils.Fail.Fail instance GHC.Internal.Base.Monad Agda.Utils.Fail.Fail instance GHC.Internal.Control.Monad.Fail.MonadFail Agda.Utils.Fail.Fail module Agda.Utils.Function -- | Left-associative strict application. ($$!) :: (a -> b) -> a -> b infixl 9 $$! -- | applyUnless b f a applies f to a unless -- b. applyUnless :: IsBool b => b -> (a -> a) -> a -> a -- | applyUnlessIts p f a applies f to a unless -- p a. applyUnlessIts :: IsBool b => (a -> b) -> (a -> a) -> a -> a -- | Monadic version of applyUnless applyUnlessM :: (IsBool b, Monad m) => m b -> (m a -> m a) -> m a -> m a -- | applyWhen b f a applies f to a when -- b. applyWhen :: IsBool b => b -> (a -> a) -> a -> a -- | applyWhenIts p f a applies f to a when -- p a. applyWhenIts :: IsBool b => (a -> b) -> (a -> a) -> a -> a -- | Maybe version of applyWhen. applyWhenJust :: Maybe b -> (b -> a -> a) -> a -> a -- | Monadic version of applyWhen applyWhenM :: (IsBool b, Monad m) => m b -> (m a -> m a) -> m a -> m a -- | Maybe version of applyUnless. applyWhenNothing :: Maybe b -> (a -> a) -> a -> a -- | Repeat a state transition f :: a -> (b, a) with output -- b while condition cond on the output is true. Return -- all intermediate results and the final result where cond is -- False. -- -- Postconditions (when it terminates): fst (last (iterWhile cond f -- a)) == False. all fst (init (interWhile cond f a)). iterWhile :: (b -> Bool) -> (a -> (b, a)) -> a -> [(b, a)] -- | iterate' n f x applies f to x -- n times and returns the result. -- -- The applications are calculated strictly. iterate' :: Integral i => i -> (a -> a) -> a -> a -- | Iteration to fixed-point. -- -- iterateUntil r f a0 iterates endofunction f, -- starting with a0, until r relates its result to its -- input, i.e., f a r a. -- -- This is the generic pattern behind saturation algorithms. -- -- If f is monotone with regard to r, meaning a -- r b implies f a r f b, and -- f-chains starting with a0 are finite then iteration -- is guaranteed to terminate. -- -- A typical instance will work on sets, and r could be set -- inclusion, and a0 the empty set, and f the step -- function of a saturation algorithm. iterateUntil :: (a -> a -> Bool) -> (a -> a) -> a -> a -- | Monadic version of iterateUntil. iterateUntilM :: Monad m => (a -> a -> Bool) -> (a -> m a) -> a -> m a -- | Repeat something while a condition on some state is true. Return the -- last state (including the changes of the last transition, even if the -- condition became false then). repeatWhile :: (a -> (Bool, a)) -> a -> a -- | Monadic version of repeatWhile. repeatWhileM :: Monad m => (a -> m (Bool, a)) -> a -> m a -- | More general trampoline, which allows some final computation from -- iteration state a into result type b. trampoline :: (a -> Either b a) -> a -> b -- | Monadic version of trampoline. trampolineM :: Monad m => (a -> m (Either b a)) -> a -> m b -- | A version of the trampoline function. -- -- The usual function iterates f :: a -> Maybe a as long as -- Just{} is returned, and returns the last value of a -- upon Nothing. -- -- usualTrampoline f = trampolineWhile $ a -> maybe (False,a) -- (True,) (f a). -- -- trampolineWhile is very similar to repeatWhile, only -- that it discards the state on which the condition went False, -- and returns the last state on which the condition was True. trampolineWhile :: (a -> (Bool, a)) -> a -> a -- | Monadic version of trampolineWhile. trampolineWhileM :: Monad m => (a -> m (Bool, a)) -> a -> m a -- | on b u x y runs the binary function b -- on the results of applying unary function u to two -- arguments x and y. From the opposite perspective, it -- transforms two inputs and combines the outputs. -- --
--   (op `on` f) x y = f x `op` f y
--   
-- --

Examples

-- --
--   >>> sortBy (compare `on` length) [[0, 1, 2], [0, 1], [], [0]]
--   [[],[0],[0,1],[0,1,2]]
--   
-- --
--   >>> ((+) `on` length) [1, 2, 3] [-1]
--   4
--   
-- --
--   >>> ((,) `on` (*2)) 2 3
--   (4,6)
--   
-- --

Algebraic properties

-- -- -- -- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 `on` -- | Utilities for functors. module Agda.Utils.Functor -- | Composition: pure function after functorial (monadic) function. (<.>) :: Functor m => (b -> c) -> (a -> m b) -> a -> m c infixr 9 <.> -- | The true pure for loop. for is a misnomer, it should -- be forA. for :: Functor m => m a -> (a -> b) -> m b -- | A decoration is a functor that is traversable into any functor. -- -- The Functor superclass is given because of the limitations of -- the Haskell class system. traverseF actually implies -- functoriality. -- -- Minimal complete definition: traverseF or -- distributeF. class Functor t => Decoration (t :: Type -> Type) -- | traverseF is the defining property. traverseF :: (Decoration t, Functor m) => (a -> m b) -> t a -> m (t b) -- | Decorations commute into any functor. distributeF :: (Decoration t, Functor m) => t (m a) -> m (t a) -- | Any decoration is traversable with traverse = traverseF. Just -- like any Traversable is a functor, so is any decoration, given -- by just traverseF, a functor. dmap :: Decoration t => (a -> b) -> t a -> t b -- | Any decoration is a lens. set is a special case of -- dmap. dget :: Decoration t => t a -> a -- | An infix synonym for fmap. -- -- The name of this operator is an allusion to $. Note the -- similarities between their types: -- --
--    ($)  ::              (a -> b) ->   a ->   b
--   (<$>) :: Functor f => (a -> b) -> f a -> f b
--   
-- -- Whereas $ is function application, <$> is function -- application lifted over a Functor. -- --

Examples

-- -- Convert from a Maybe Int to a Maybe -- String using show: -- --
--   >>> show <$> Nothing
--   Nothing
--   
-- --
--   >>> show <$> Just 3
--   Just "3"
--   
-- -- Convert from an Either Int Int to an -- Either Int String using show: -- --
--   >>> show <$> Left 17
--   Left 17
--   
-- --
--   >>> show <$> Right 17
--   Right "17"
--   
-- -- Double each element of a list: -- --
--   >>> (*2) <$> [1,2,3]
--   [2,4,6]
--   
-- -- Apply even to the second element of a pair: -- --
--   >>> even <$> (2,2)
--   (2,True)
--   
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 <$> -- | Flipped version of <$. -- --

Examples

-- -- Replace the contents of a Maybe Int with a -- constant String: -- --
--   >>> Nothing $> "foo"
--   Nothing
--   
-- --
--   >>> Just 90210 $> "foo"
--   Just "foo"
--   
-- -- Replace the contents of an Either Int -- Int with a constant String, resulting in an -- Either Int String: -- --
--   >>> Left 8675309 $> "foo"
--   Left 8675309
--   
-- --
--   >>> Right 8675309 $> "foo"
--   Right "foo"
--   
-- -- Replace each element of a list with a constant String: -- --
--   >>> [1,2,3] $> "foo"
--   ["foo","foo","foo"]
--   
-- -- Replace the second element of a pair with a constant String: -- --
--   >>> (1,2) $> "foo"
--   (1,"foo")
--   
($>) :: Functor f => f a -> b -> f b infixl 4 $> -- | Flipped version of <$>. -- --
--   (<&>) = flip fmap
--   
-- --

Examples

-- -- Apply (+1) to a list, a Just and a Right: -- --
--   >>> Just 2 <&> (+1)
--   Just 3
--   
-- --
--   >>> [1,2,3] <&> (+1)
--   [2,3,4]
--   
-- --
--   >>> Right 3 <&> (+1)
--   Right 4
--   
(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 <&> instance (Agda.Utils.Functor.Decoration d, Agda.Utils.Functor.Decoration t) => Agda.Utils.Functor.Decoration (Data.Functor.Compose.Compose d t) instance Agda.Utils.Functor.Decoration GHC.Internal.Data.Functor.Identity.Identity instance Agda.Utils.Functor.Decoration ((,) a) -- | A simple overlay over Data.Map to manage unordered sets with -- duplicates. module Agda.Utils.Bag -- | A set with duplicates. Faithfully stores elements which are equal with -- regard to (==). newtype Bag a Bag :: Map a (NonEmpty a) -> Bag a -- | The list contains all occurrences of a (not just the -- duplicates!). Hence, the invariant: the list is never empty. [bag] :: Bag a -> Map a (NonEmpty a) -- | Is the bag empty? null :: Bag a -> Bool -- | Number of elements in the bag. Duplicates count. O(n). size :: Bag a -> Int -- | (bag ! a) finds all elements equal to a. O(log n). -- Total function, returns [] if none are. (!) :: Ord a => Bag a -> a -> [a] -- | O(log n). member :: Ord a => a -> Bag a -> Bool -- | O(log n). notMember :: Ord a => a -> Bag a -> Bool -- | Return the multiplicity of the given element. O(log n + count _ _). count :: Ord a => a -> Bag a -> Int -- | O(1) empty :: Bag a -- | O(1) singleton :: a -> Bag a union :: Ord a => Bag a -> Bag a -> Bag a unions :: Ord a => [Bag a] -> Bag a -- |
--   insert a b = union b (singleton a)
--   
insert :: Ord a => a -> Bag a -> Bag a -- |
--   fromList = unions . map singleton
--   
fromList :: Ord a => [a] -> Bag a -- | Returns the elements of the bag, grouped by equality (==). groups :: Bag a -> [NonEmpty a] -- | Returns the bag, with duplicates. toList :: Bag a -> [a] -- | Returns the bag without duplicates. keys :: Bag a -> [a] -- | Returns the bag, with duplicates. elems :: Bag a -> [a] toAscList :: Bag a -> [a] -- | O(n). map :: Ord b => (a -> b) -> Bag a -> Bag b traverse' :: forall a b m. (Applicative m, Ord b) => (a -> m b) -> Bag a -> m (Bag b) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.Bag.Bag a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.Bag.Bag instance GHC.Internal.Classes.Ord a => GHC.Internal.Base.Monoid (Agda.Utils.Bag.Bag a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.Bag.Bag a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Base.Semigroup (Agda.Utils.Bag.Bag a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.Bag.Bag a) -- | This module provides facilities for parsing the command-line options -- in a standalone program. It is essentially a Haskell port of the GNU -- getopt library. -- -- It is a fork of System.Console.GetOpt from the base package of -- GHC, written by Sven Panne. -- -- We modify it to remove the "allow prefixes of long options" behavior. module Agda.Utils.GetOpt -- | Process the command-line, and return the list of values that matched -- (and those that didn't). The arguments are: -- -- -- -- getOpt returns a triple consisting of the option arguments, a -- list of non-options, and a list of error messages. getOpt :: ArgOrder a -> [OptDescr a] -> [String] -> ([a], [String], [String]) -- | This is almost the same as getOpt, but returns a quadruple -- consisting of the option arguments, a list of non-options, a list of -- unrecognized options, and a list of error messages. getOpt' :: ArgOrder a -> [OptDescr a] -> [String] -> ([a], [String], [String], [String]) -- | Return a string describing the usage of a command, derived from the -- header (first argument) and the options described by the second -- argument. usageInfo :: Int -> String -> [OptDescr a] -> String -- | What to do with options following non-options. data ArgOrder a -- | no option processing after first non-option RequireOrder :: ArgOrder a -- | freely intersperse options and non-options Permute :: ArgOrder a -- | wrap non-options into options ReturnInOrder :: (String -> a) -> ArgOrder a -- | Each OptDescr describes a single option. -- -- The arguments to Option are: -- -- data OptDescr a -- | description of a single options: Option :: [Char] -> [String] -> ArgDescr a -> String -> OptDescr a -- | Describes whether an option takes an argument or not, and if so how -- the argument is injected into a value of type a. data ArgDescr a -- | no argument expected NoArg :: a -> ArgDescr a -- | option requires argument ReqArg :: (String -> a) -> String -> ArgDescr a -- | optional argument OptArg :: (Maybe String -> a) -> String -> ArgDescr a instance GHC.Internal.Base.Functor Agda.Utils.GetOpt.ArgDescr instance GHC.Internal.Base.Functor Agda.Utils.GetOpt.ArgOrder instance GHC.Internal.Base.Functor Agda.Utils.GetOpt.OptDescr instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.GetOpt.ArgDescr a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.GetOpt.OptDescr a) -- | ASTs for subset of GHC Haskell syntax. module Agda.Utils.Haskell.Syntax data Module Module :: ModuleName -> [ModulePragma] -> [ImportDecl] -> [Decl] -> Module data ModulePragma LanguagePragma :: [Name] -> ModulePragma -- | Unstructured pragma (Andreas, 2017-08-23, issue #2712). OtherPragma :: String -> ModulePragma data ImportDecl ImportDecl :: ModuleName -> Bool -> Maybe (Bool, [ImportSpec]) -> ImportDecl [importModule] :: ImportDecl -> ModuleName [importQualified] :: ImportDecl -> Bool [importSpecs] :: ImportDecl -> Maybe (Bool, [ImportSpec]) data ImportSpec IVar :: Name -> ImportSpec -- | Importing a whole module qualified. qualifiedImport :: ModuleName -> ImportDecl data Decl TypeDecl :: Name -> [TyVarBind] -> Type -> Decl DataDecl :: DataOrNew -> Name -> [TyVarBind] -> [ConDecl] -> [Deriving] -> Decl TypeSig :: [Name] -> Type -> Decl -- | Should not be used when LocalBind could be used. FunBind :: [Match] -> Decl -- | Should only be used in let or where. LocalBind :: Strictness -> Name -> Rhs -> Decl PatSyn :: Pat -> Pat -> Decl FakeDecl :: String -> Decl Comment :: String -> Decl data DataOrNew DataType :: DataOrNew NewType :: DataOrNew data ConDecl ConDecl :: Name -> [(Maybe Strictness, Type)] -> ConDecl data Strictness Lazy :: Strictness Strict :: Strictness type Deriving = (QName, [Type]) data Binds BDecls :: [Decl] -> Binds data Rhs UnGuardedRhs :: Exp -> Rhs GuardedRhss :: [GuardedRhs] -> Rhs data GuardedRhs GuardedRhs :: [Stmt] -> Exp -> GuardedRhs data Match Match :: Name -> [Pat] -> Rhs -> Maybe Binds -> Match data Type TyForall :: [TyVarBind] -> Type -> Type TyFun :: Type -> Type -> Type TyCon :: QName -> Type TyVar :: Name -> Type TyApp :: Type -> Type -> Type FakeType :: String -> Type data Pat PVar :: Name -> Pat PLit :: Literal -> Pat PAsPat :: Name -> Pat -> Pat PWildCard :: Pat PBangPat :: Pat -> Pat PApp :: QName -> [Pat] -> Pat PatTypeSig :: Pat -> Type -> Pat PIrrPat :: Pat -> Pat data Stmt Qualifier :: Exp -> Stmt Generator :: Pat -> Exp -> Stmt data Exp Var :: QName -> Exp Con :: QName -> Exp Lit :: Literal -> Exp InfixApp :: Exp -> QOp -> Exp -> Exp Ann :: Exp -> Type -> Exp App :: Exp -> Exp -> Exp Lambda :: [Pat] -> Exp -> Exp Let :: Binds -> Exp -> Exp If :: Exp -> Exp -> Exp -> Exp Case :: Exp -> [Alt] -> Exp ExpTypeSig :: Exp -> Type -> Exp NegApp :: Exp -> Exp FakeExp :: String -> Exp data Alt Alt :: Pat -> Rhs -> Maybe Binds -> Alt data Literal Int :: Integer -> Literal Frac :: Rational -> Literal Char :: Char -> Literal String :: Text -> Literal data ModuleName ModuleName :: String -> ModuleName data QName Qual :: ModuleName -> Name -> QName UnQual :: Name -> QName data Name Ident :: String -> Name Symbol :: String -> Name data QOp QVarOp :: QName -> QOp data TyVarBind UnkindedVar :: Name -> TyVarBind unit_con :: Exp instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Alt instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Binds instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.ConDecl instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.DataOrNew instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Decl instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Exp instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.GuardedRhs instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Literal instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Match instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.ModuleName instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Name instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Pat instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.QName instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.QOp instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Rhs instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Stmt instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Strictness instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.TyVarBind instance GHC.Internal.Classes.Eq Agda.Utils.Haskell.Syntax.Type instance GHC.Internal.Classes.Ord Agda.Utils.Haskell.Syntax.ModuleName -- | Strictification of Haskell code module Agda.Compiler.MAlonzo.Strict -- | The function makeStrict makes every function argument and case -- and generator pattern strict (except for those patterns that are -- marked as irrefutable, and anything in a FakeDecl or -- FakeExp). Note that only the outermost patterns are made -- strict, and that LocalBind bindings are not made strict. class MakeStrict a makeStrict :: MakeStrict a => a -> a instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Alt instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Binds instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Decl instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Exp instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.GuardedRhs instance Agda.Compiler.MAlonzo.Strict.MakeStrict a => Agda.Compiler.MAlonzo.Strict.MakeStrict [a] instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Match instance Agda.Compiler.MAlonzo.Strict.MakeStrict a => Agda.Compiler.MAlonzo.Strict.MakeStrict (GHC.Internal.Maybe.Maybe a) instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Module instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Pat instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Rhs instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Stmt -- | Array utilities. module Agda.Utils.IArray -- | Binary IO. module Agda.Utils.IO.Binary -- | Returns a close function for the file together with the contents. readBinaryFile' :: FilePath -> IO (ByteString, IO ()) module Agda.Utils.IO.Directory -- | copyDirContent src dest recursively copies directory -- src onto dest. -- -- First, a to-do list of copy actions is created. Then, the to-do list -- is carried out. -- -- This avoids copying files we have just created again, which can happen -- if src and dest are not disjoint. (See issue #2705.) copyDirContent :: FilePath -> FilePath -> IO () -- | copyIfChanged src dst makes sure that dst exists and -- has the same content as dst. copyIfChanged :: FilePath -> FilePath -> IO () -- | Search a directory recursively, with recursion controlled by a -- RecursionPredicate. Lazily return a unsorted list of all -- files matching the given FilterPredicate. Any errors that -- occur are ignored, with warnings printed to stderr. findWithInfo :: RecursionPredicate -> FilterPredicate -> FilePath -> IO [FileInfo] -- | Common syntax highlighting functions for Emacs and JSON module Agda.Utils.IO.TempFile -- | Creates a temporary file, writes some stuff, and returns the filepath writeToTempFile :: String -> IO FilePath -- | Text IO using the UTF8 character encoding. module Agda.Utils.IO.UTF8 -- | A kind of exception that can be thrown by readTextFile and -- readFile. data ReadException -- | Reads a UTF8-encoded text file and converts many character sequences -- which may be interpreted as line or paragraph separators into 'n'. -- -- If the file cannot be decoded, then a ReadException is raised. readTextFile :: FilePath -> IO Text -- | Reads a UTF8-encoded text file and converts many character sequences -- which may be interpreted as line or paragraph separators into 'n'. -- -- If the file cannot be decoded, then a ReadException is raised. readFile :: FilePath -> IO String -- | Writes a UTF8-encoded text file. The native convention for line -- endings is used. writeFile :: FilePath -> String -> IO () -- | Writes a UTF8-encoded text file. The native convention for line -- endings is used. writeTextToFile :: FilePath -> Text -> IO () instance GHC.Internal.Exception.Type.Exception Agda.Utils.IO.UTF8.ReadException instance GHC.Internal.Show.Show Agda.Utils.IO.UTF8.ReadException -- | Utilities for Data.IORef. module Agda.Utils.IORef -- | Read IORef, modify it strictly, and return old value. readModifyIORef' :: IORef a -> (a -> a) -> IO a -- | A variant of IORef that ensures the value stored inside the -- reference is always in WHNF. -- -- This module should be imported qualified, ala -- --
--   import Agda.Utils.IORef.Strict qualified as Strict
--   
module Agda.Utils.IORef.Strict -- | Strict IO references. newtype IORef a StrictIORef :: IORef a -> IORef a -- | Create a new strict IORef. -- -- This will force the value to WHNF before creating the reference. newIORef :: a -> IO (IORef a) -- | Read the contents of a strict IORef. readIORef :: IORef a -> IO a -- | Write to a strict IORef. -- -- This will force the value to WHNF before writing. writeIORef :: IORef a -> a -> IO () -- | Modify a strict IORef by a applying a function to the value -- stored in the reference. -- -- This will force the value to WHNF before writing. modifyIORef :: IORef a -> (a -> a) -> IO () -- | Atomically modify the contents of a strict IORef. Both the -- stored value and the result are forced. atomicModifyIORef :: IORef a -> (a -> (a, b)) -> IO b module Agda.TypeChecking.SizedTypes.Utils debug :: IORef Bool setDebugging :: Bool -> IO () trace :: String -> a -> a traceM :: Applicative f => String -> f () class Eq a => Top a top :: Top a => a isTop :: Top a => a -> Bool class Plus a b c plus :: Plus a b c => a -> b -> c class MeetSemiLattice a meet :: MeetSemiLattice a => a -> a -> a -- | Semiring with idempotent + == dioid class (MeetSemiLattice a, Top a) => Dioid a compose :: Dioid a => a -> a -> a unitCompose :: Dioid a => a instance Agda.TypeChecking.SizedTypes.Utils.Plus GHC.Internal.Types.Int GHC.Internal.Types.Int GHC.Internal.Types.Int -- | An interface for reporting "impossible" errors module Agda.Utils.Impossible -- | "Impossible" errors, annotated with a file name and a line number -- corresponding to the source code location of the error. data Impossible -- | We reached a program point which should be unreachable. Impossible :: CallStack -> Impossible -- | Impossible with a different error message. Used when we reach -- a program point which can in principle be reached, but not for a -- certain run. Unreachable :: CallStack -> Impossible -- | We reached a program point without all the required primitives or -- BUILTIN to proceed forward. ImpMissingDefinitions neededDefs -- forThis ImpMissingDefinitions :: [String] -> String -> Impossible -- | Abort by throwing an "impossible" error. You should not use this -- function directly. Instead use IMPOSSIBLE throwImpossible :: Impossible -> a -- | Monads in which we can catch an "impossible" error, if possible. class CatchImpossible (m :: Type -> Type) -- | Catch any Impossible exception. catchImpossible :: CatchImpossible m => m a -> (Impossible -> m a) -> m a -- | Catch only Impossible exceptions selected by the filter. catchImpossibleJust :: CatchImpossible m => (Impossible -> Maybe b) -> m a -> (b -> m a) -> m a -- | Version of catchImpossible with argument order suiting short -- handlers. handleImpossible :: CatchImpossible m => (Impossible -> m a) -> m a -> m a -- | Version of catchImpossibleJust with argument order suiting -- short handlers. handleImpossibleJust :: CatchImpossible m => (Impossible -> Maybe b) -> (b -> m a) -> m a -> m a -- | Construct a value of Impossible reporting the location where -- you call this function. impossible :: HasCallStack => Impossible -- | Throw an Impossible error reporting the location where you -- place __IMPOSSIBLE__. __IMPOSSIBLE__ :: HasCallStack => a -- | Throw an Impossible error reporting the *caller's* call site. __IMPOSSIBLE__1 :: HasCallStack => a -- | Throw an Unreachable error reporting the *caller's* call site. -- Note that this call to "withFileAndLine" will be filtered out due its -- filter on the srcLocModule. __UNREACHABLE__ :: HasCallStack => a instance Agda.Utils.Impossible.CatchImpossible GHC.Internal.Types.IO instance GHC.Internal.Classes.Eq Agda.Utils.Impossible.Impossible instance GHC.Internal.Exception.Type.Exception Agda.Utils.Impossible.Impossible instance Control.DeepSeq.NFData Agda.Utils.Impossible.Impossible instance GHC.Internal.Classes.Ord Agda.Utils.Impossible.Impossible instance GHC.Internal.Show.Show Agda.Utils.Impossible.Impossible -- | An empty type with some useful instances. module Agda.Utils.Empty data Empty absurd :: Empty -> a -- | toImpossible e extracts the Impossible value raised -- via IMPOSSIBLE to create the element e of -- type Empty. It proceeds by evaluating e to weak head -- normal form and catching the exception. We are forced to wrap things -- in a Maybe because of catchImpossible's type. toImpossible :: Empty -> IO Impossible instance GHC.Internal.Classes.Eq Agda.Utils.Empty.Empty instance Control.DeepSeq.NFData Agda.Utils.Empty.Empty instance GHC.Internal.Classes.Ord Agda.Utils.Empty.Empty instance GHC.Internal.Show.Show Agda.Utils.Empty.Empty -- | Representation of Set Bool as a 4-element -- enum type. -- -- All operations in constant time and space. -- -- Mimics the interface of Set. -- -- Import as: import Agda.Utils.BoolSet (BoolSet) import -- Agda.Utils.BoolSet qualified as BoolSet module Agda.Utils.BoolSet -- | Isomorphic to Set Bool. data BoolSet (\\) :: BoolSet -> BoolSet -> BoolSet complement :: BoolSet -> BoolSet delete :: Bool -> BoolSet -> BoolSet difference :: BoolSet -> BoolSet -> BoolSet elems :: BoolSet -> [Bool] -- | The empty set. empty :: BoolSet fromList :: [Bool] -> BoolSet fromAscList :: [Bool] -> BoolSet fromDistinctAscList :: [Bool] -> BoolSet insert :: Bool -> BoolSet -> BoolSet intersection :: BoolSet -> BoolSet -> BoolSet isSubsetOf :: BoolSet -> BoolSet -> Bool lookupMin :: BoolSet -> Maybe Bool member :: Bool -> BoolSet -> Bool -- | not . member b. notMember :: Bool -> BoolSet -> Bool null :: BoolSet -> Bool -- | A singleton set. singleton :: Bool -> BoolSet size :: BoolSet -> Int toList :: BoolSet -> [Bool] toAscList :: BoolSet -> [Bool] -- | toSingleton s == Just b iff s == singleton b. toSingleton :: BoolSet -> Maybe Bool -- | The full set. total :: BoolSet union :: BoolSet -> BoolSet -> BoolSet instance GHC.Internal.Enum.Bounded Agda.Utils.BoolSet.BoolSet instance GHC.Internal.Enum.Enum Agda.Utils.BoolSet.BoolSet instance GHC.Internal.Classes.Eq Agda.Utils.BoolSet.BoolSet instance GHC.Internal.Classes.Ord Agda.Utils.BoolSet.BoolSet instance GHC.Internal.Show.Show Agda.Utils.BoolSet.BoolSet -- | Defines CutOff type which is used in -- Agda.Interaction.Options. This module's purpose is to eliminate -- the dependency of Agda.TypeChecking.Monad.Base on the -- termination checker and everything it imports. module Agda.Termination.CutOff -- | Cut off structural order comparison at some depth in termination -- checker? data CutOff -- | c >= 0 means: record decrease up to including -- c+1. CutOff :: Int -> CutOff DontCutOff :: CutOff -- | The default termination depth. defaultCutOff :: CutOff instance GHC.Internal.Classes.Eq Agda.Termination.CutOff.CutOff instance Control.DeepSeq.NFData Agda.Termination.CutOff.CutOff instance GHC.Internal.Num.Num Agda.Termination.CutOff.CutOff instance GHC.Internal.Classes.Ord Agda.Termination.CutOff.CutOff instance GHC.Internal.Show.Show Agda.Termination.CutOff.CutOff -- | Maps from de Bruijn indices, implemented using IntMaps from de -- Bruijn levels. module Agda.Utils.IndexMap -- | Maps from de Bruijn indices. data IndexMap a -- | The IndexMap invariant. invariant :: IndexMap a -> Bool -- | An empty map. nil :: IndexMap a -- | Inserts a new binding, which will have de Bruijn index 0, and shifts -- other bindings one step. snoc :: IndexMap a -> a -> IndexMap a -- | Inserts a number of new bindings. The last element in the list will -- have de Bruijn index 0. append :: IndexMap a -> [a] -> IndexMap a -- | Converts a list to an IndexMap. The last element in the list -- will have de Bruijn index 0. fromList :: [a] -> IndexMap a update :: Int -> a -> IndexMap a -> IndexMap a index :: Int -> IndexMap a -> a instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.IndexMap.IndexMap a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.IndexMap.IndexMap a) module Agda.Utils.IntMap forWithKey_ :: forall v m. Applicative m => IntMap v -> (Int -> v -> m ()) -> m () -- | Possibly infinite sets of integers (but with finitely many consecutive -- segments). Used for checking guard coverage in int/nat cases in the -- treeless compiler. module Agda.Utils.IntSet.Infinite -- | Represents a set of integers. Invariants: - All cannot be the argument -- to Below or Above - at most one IntsBelow - at -- most one IntsAbove - if `Below lo` and `Below hi`, then `lo -- < hi` - if `Below lo .. (Some xs)` then `all (> lo) xs` - if -- `Above hi .. (Some xs)` then `all (< hi - 1) xs` data IntSet -- | No integers. empty :: IntSet -- | All integers. full :: IntSet -- | All integers `< n` below :: Integer -> IntSet -- | All integers `>= n` above :: Integer -> IntSet -- | A single integer. singleton :: Integer -> IntSet difference :: IntSet -> IntSet -> IntSet -- | Membership member :: Integer -> IntSet -> Bool -- | If finite, return the list of elements. toFiniteList :: IntSet -> Maybe [Integer] -- | Invariant. invariant :: IntSet -> Bool instance GHC.Internal.Classes.Eq Agda.Utils.IntSet.Infinite.IntSet instance GHC.Internal.Base.Monoid Agda.Utils.IntSet.Infinite.IntSet instance GHC.Internal.Base.Semigroup Agda.Utils.IntSet.Infinite.IntSet instance GHC.Internal.Show.Show Agda.Utils.IntSet.Infinite.IntSet -- | A cut-down implementation of lenses, with names mostly taken from -- Edward Kmett's lens package. module Agda.Utils.Lens -- | Modify a part of the state monadically, and return some result. (%%=) :: MonadState o m => Lens' o i -> (i -> m (i, r)) -> m r infix 4 %%= -- | Strictly modify a part of the state monadically, and return some -- result. (%%=!) :: MonadState o m => Lens' o i -> (i -> m (i, r)) -> m r infix 4 %%=! -- | Modify a part of the state. (%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m () infix 4 %= -- | Strictly modify a part of the state. (%=!) :: MonadState s m => ASetter s s a b -> (a -> b) -> m () infix 4 %=! -- | Modify a part of the state monadically. (%==) :: MonadState s m => Lens' s a -> (a -> m a) -> m () infix 4 %== -- | Strictly modify a part of the state monadically. (%==!) :: MonadState s m => Lens' s a -> (a -> m a) -> m () infix 4 %==! (%~) :: ASetter s t a b -> (a -> b) -> s -> t infixr 4 %~ (%~!) :: ASetter s t a b -> (a -> b) -> s -> t infixr 4 %~! -- | Write a part of the state. (.=) :: MonadState s m => ASetter s s a b -> b -> m () infix 4 .= -- | Strictly write a part of the state. (.=!) :: MonadState s m => ASetter s s a b -> b -> m () infix 4 .=! (.~) :: ASetter s t a b -> b -> s -> t infixr 4 .~ -- | Get inner part i of structure o as designated by -- Lens' o i. (^.) :: s -> Getting a s a -> a infixl 8 ^. -- | Focus on given element in a set. contains :: Ord k => k -> Lens' (Set k) Bool -- | Build a lens out of an isomorphism. iso :: (o -> i) -> (i -> o) -> Lens' o i -- | Access a map value at a given key. key :: Ord k => k -> Lens' (Map k v) (Maybe v) -- | Build a lens from a getter and a setter. lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b -- | Only sound if the lenses are disjoint! lensProduct :: Lens' s a -> Lens' s b -> Lens' s (a, b) -- | Modify a part of the state in a subcomputation. locally :: MonadReader r m => ASetter r r a b -> (a -> b) -> m c -> m c -- | Modify a part of the state locally. locallyState :: MonadState o m => Lens' o i -> (i -> i) -> m r -> m r -- | Modify inner part i of structure o using a function -- i -> i. over :: ASetter s t a b -> (a -> b) -> s -> t -- | Strictly modify inner part i of structure o using a -- function i -> i. over' :: ASetter s t a b -> (a -> b) -> s -> t -- | Set inner part i of structure o as designated by -- Lens' o i. set :: ASetter s t a b -> b -> s -> t -- | Strictly set inner part i of structure o as -- designated by Lens' o i. set' :: ASetter s t a b -> b -> s -> t -- | Read a part of the state. use :: MonadState s m => Getting a s a -> m a -- | Read part of the environment. view :: MonadReader s m => Getting a s a -> m a type ASetter s t a b = a -> Identity b -> s -> Identity t class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s _1 :: Field1 s t a b => Lens s t a b _1' :: Field1 s t a b => Lens s t a b class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s _2 :: Field2 s t a b => Lens s t a b _2' :: Field2 s t a b => Lens s t a b class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s _3 :: Field3 s t a b => Lens s t a b _3' :: Field3 s t a b => Lens s t a b class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s _4 :: Field4 s t a b => Lens s t a b _4' :: Field4 s t a b => Lens s t a b class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s _5 :: Field5 s t a b => Lens s t a b _5' :: Field5 s t a b => Lens s t a b type Getting r s a = a -> Const r a -> s -> Const r s -- | Van Laarhoven style homogeneous lenses. Mnemoic: "Lens outer inner", -- same type argument order as 'get :: o -> i'. type Lens s t a b = forall (f :: Type -> Type). Functor f => a -> f b -> s -> f t type Lens' s a = Lens s s a a type LensGet o i = o -> i type LensMap o i = i -> i -> o -> o type LensSet o i = i -> o -> o -- | Flipped version of <$>. -- --
--   (<&>) = flip fmap
--   
-- --

Examples

-- -- Apply (+1) to a list, a Just and a Right: -- --
--   >>> Just 2 <&> (+1)
--   Just 3
--   
-- --
--   >>> [1,2,3] <&> (+1)
--   [2,3,4]
--   
-- --
--   >>> Right 3 <&> (+1)
--   Right 4
--   
(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 <&> -- | Fanout: send the input to both argument arrows and combine their -- output. -- -- The default definition may be overridden with a more efficient version -- if desired. -- --
--       ╭───────╮ c
--     b │ ┌─ f ─┼───>
--   >───┼─┤     │
--       │ └─ g ─┼───>
--       ╰───────╯ c'
--   
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 &&& -- | & is a reverse application operator. This provides -- notational convenience. Its precedence is one higher than that of the -- forward application operator $, which allows & to be -- nested in $. -- -- This is a version of flip id, where id -- is specialized from a -> a to (a -> b) -> (a -- -> b) which by the associativity of (->) is (a -- -> b) -> a -> b. flipping this yields a -> (a -- -> b) -> b which is the type signature of & -- --

Examples

-- --
--   >>> 5 & (+1) & show
--   "6"
--   
-- --
--   >>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
--   3.1406380562059946
--   
(&) :: a -> (a -> b) -> b infixl 1 & instance Agda.Utils.Lens.Field1 (a, b) (a', b) a a' instance Agda.Utils.Lens.Field1 (a, b, c) (a', b, c) a a' instance Agda.Utils.Lens.Field1 (a, b, c, d) (a', b, c, d) a a' instance Agda.Utils.Lens.Field1 (a, b, c, d, e) (a', b, c, d, e) a a' instance Agda.Utils.Lens.Field2 (a, b) (a, b') b b' instance Agda.Utils.Lens.Field2 (a, b, c) (a, b', c) b b' instance Agda.Utils.Lens.Field2 (a, b, c, d) (a, b', c, d) b b' instance Agda.Utils.Lens.Field2 (a, b, c, d, e) (a, b', c, d, e) b b' instance Agda.Utils.Lens.Field3 (a, b, c) (a, b, c') c c' instance Agda.Utils.Lens.Field3 (a, b, c, d) (a, b, c', d) c c' instance Agda.Utils.Lens.Field3 (a, b, c, d, e) (a, b, c', d, e) c c' instance Agda.Utils.Lens.Field4 (a, b, c, d) (a, b, c, d') d d' instance Agda.Utils.Lens.Field4 (a, b, c, d, e) (a, b, c, d', e) d d' instance Agda.Utils.Lens.Field5 (a, b, c, d, e) (a, b, c, d, e') e e' module Agda.Utils.IndexedList -- | Existential wrapper for indexed types. data Some (a :: k -> Type) [Some] :: forall {k} (a :: k -> Type) (i :: k). a i -> Some a -- | Unpacking a wrapped value. withSome :: Some b -> (forall (i :: k). () => b i -> a) -> a -- | Lists indexed by a type-level list. A value of type All p -- [x₁..xₙ] is a sequence of values of types p x₁, .., -- p xₙ. data All (a :: x -> Type) (b :: [x]) [Nil] :: forall {x} (a :: x -> Type). All a ('[] :: [x]) [Cons] :: forall {x} (a :: x -> Type) (x1 :: x) (xs :: [x]). a x1 -> All a xs -> All a (x1 ': xs) -- | Constructing an indexed list from a plain list. makeAll :: forall {x} a (b :: x -> Type). (a -> Some b) -> [a] -> Some (All b) -- | Turning an indexed list back into a plain list. forgetAll :: forall {x} b a (xs :: [x]). (forall (x1 :: x). () => b x1 -> a) -> All b xs -> [a] -- | An index into a type-level list. data Index (a :: [x]) (b :: x) [Zero] :: forall {x} (b :: x) (xs :: [x]). Index (b ': xs) b [Suc] :: forall {x} (xs :: [x]) (b :: x) (y :: x). Index xs b -> Index (y ': xs) b -- | Indices are just natural numbers. forgetIndex :: forall {x1} (xs :: [x1]) (x2 :: x1). Index xs x2 -> Int -- | Mapping over an indexed list. mapWithIndex :: forall {x} (xs :: [x]) p q. (forall (x1 :: x). () => Index xs x1 -> p x1 -> q x1) -> All p xs -> All q xs -- | If you have an index you can get a lens for the given element. lIndex :: forall {x1} (xs :: [x1]) (x2 :: x1) (p :: x1 -> Type). Index xs x2 -> Lens' (All p xs) (p x2) -- | Looking up an element in an indexed list. lookupIndex :: forall {x1} p (xs :: [x1]) (x2 :: x1). All p xs -> Index xs x2 -> p x2 -- | All indices into an indexed list. allIndices :: forall {x} (p :: x -> Type) (xs :: [x]). All p xs -> All (Index xs) xs -- | Examples how to use Agda.Utils.Lens. module Agda.Utils.Lens.Examples data Record a b Record :: a -> b -> Record a b [field1] :: Record a b -> a [field2] :: Record a b -> b -- | (View source:) This is how you implement a lens for a record field. lensField1 :: forall a b f. Functor f => (a -> f a) -> Record a b -> f (Record a b) lensField2 :: forall a b f. Functor f => (b -> f b) -> Record a b -> f (Record a b) -- | Utility functions for lists. module Agda.Utils.List -- | A variant of !! that might provide more informative error -- messages if the index is out of bounds. -- -- Precondition: The index should not be out of bounds. (!!) :: HasCallStack => [a] -> Int -> a -- | Lookup function (safe). O(min n index). (!!!) :: [a] -> Int -> Maybe a -- | Spine-strict (++). (++!) :: [a] -> [a] -> [a] infixr 5 ++! -- | Analogous to zip, combines two lists by taking the union using These -- (strict). align :: [a] -> [b] -> [These a b] -- | Check whether all consecutive elements of a list satisfy the given -- relation. O(n). allConsecutive :: (a -> a -> Bool) -> [a] -> Bool -- | Remove the first representative for each list element. Thus, returns -- all duplicate copies. O(n log n). -- -- allDuplicates xs == sort $ xs \ nub xs. allDuplicates :: Ord a => [a] -> [a] -- | Checks if all the elements in the list are equal. Assumes that the -- Eq instance stands for an equivalence relation. O(n). allEqual :: Eq a => [a] -> Bool -- | A version of asum that avoids a final empty. It is -- right-folding just like asum. -- -- Precondition: the right-unit law holds, i.e. m | A.empty = -- m. asum :: Alternative m => [m a] -> m a -- | A right-folding asum for nonempty lists, never producing -- empty. asum1 :: Alternative m => m a -> [m a] -> m a -- | Strict break. break' :: (a -> Bool) -> [a] -> ([a], [a]) -- | Breaks a list just after an element satisfying the predicate is -- found. -- --
--   >>> breakAfter even [1,3,5,2,4,7,8]
--   ([1,3,5,2],[4,7,8])
--   
breakAfter :: (a -> Bool) -> [a] -> ([a], [a]) -- | Breaks a list just after an element satisfying the predicate is -- found. -- --
--   >>> breakAfter1 even 1 [3,5,2,4,7,8]
--   (1 :| [3,5,2],[4,7,8])
--   
breakAfter1 :: (a -> Bool) -> a -> [a] -> (List1 a, [a]) -- | Break a list when the given predicate returns Just b and -- place b as pivot between the prefix (where the predicate -- returns Nothing) and the suffix. -- -- Crashes when the predicate holds nowhere. breakJust :: (a -> Maybe b) -> [a] -> (Prefix a, (b, Suffix a)) -- | Case distinction for lists, with list first. O(1). -- -- Cf. ifNull. caseList :: [a] -> b -> (a -> [a] -> b) -> b -- | Case distinction for lists, with list first. O(1). -- -- Cf. ifNull. caseListM :: Monad m => m [a] -> m b -> (a -> [a] -> m b) -> m b -- | Spine-strict catMaybe. catMaybe' :: [Maybe a] -> [a] -- | Chop up a list in chunks of a given length. O(n). chop :: Int -> [a] -> [[a]] -- | Chop a list at the positions when the predicate holds. Contrary to -- wordsBy, consecutive separator elements will result in an -- empty segment in the result. O(n). -- --
--   intercalate [x] (chopWhen (== x) xs) == xs
--   
chopWhen :: (a -> Bool) -> [a] -> [[a]] -- | Compute the common prefix of two lists. O(min n m). commonPrefix :: Eq a => [a] -> [a] -> Prefix a -- | Compute the common suffix of two lists. O(n + m). commonSuffix :: Eq a => [a] -> [a] -> Suffix a -- | Strict concat. concat' :: [[a]] -> [a] -- | Strict concatMap concatMap' :: (a -> [b]) -> [a] -> [b] -- | Check whether all elements in a list are distinct from each other. -- Assumes that the Eq instance stands for an equivalence -- relation. -- -- O(n²) in the worst case distinct xs == True. distinct :: Eq a => [a] -> Bool -- | downFrom n = [n-1,..1,0]. O(n). downFrom :: Integral a => a -> [a] -- | Drops from both lists simultaneously until one list is empty. O(min n -- m). dropCommon :: [a] -> [b] -> (Suffix a, Suffix b) -- | Drop from the end of a list. O(length). -- --
--   dropEnd n = reverse . drop n . reverse
--   
-- -- Forces the whole list even for n==0. dropEnd :: Int -> [a] -> Prefix a -- | dropFrom marker xs drops everything from xs starting -- with (and including) marker. -- -- If the marker does not appear, the string is returned unchanged. -- -- The following two properties hold provided marker has no -- overlap with xs: -- --
--   dropFrom marker (xs ++ marker ++ ys) == xs
--   dropFrom marker xs == xs
--   
dropFrom :: Eq a => List1 a -> [a] -> [a] -- | Returns an (arbitrary) representative for each list element that -- occurs more than once. O(n log n). duplicates :: Ord a => [a] -> [a] -- | Implemented using dynamic programming and Data.Array. O(n*m). editDistance :: Eq a => [a] -> [a] -> Int -- | Implemented using tree recursion, don't run me at home! O(3^(min n -- m)). editDistanceSpec :: Eq a => [a] -> [a] -> Int -- | An optimised version of distinct. O(n log n). -- -- Precondition: The list's length must fit in an Int. fastDistinct :: Ord a => [a] -> Bool -- | Strict filter. filter' :: (a -> Bool) -> [a] -> [a] -- | Like filter, but additionally return the last partition of the -- list where the predicate is False everywhere. O(n). filterAndRest :: (a -> Bool) -> [a] -> ([a], Suffix a) -- | Find the longest suffix of the first string xs that is a -- prefix of the second string ys. So, basically, find the -- overlap where the strings can be glued together. Returns the index -- where the overlap starts and the length of the overlap. The length of -- the overlap plus the index is the length of the first string. Note -- that in the worst case, the empty overlap (length xs,0) is -- returned. -- -- Worst-case time complexity is quadratic: O(min(n,m)²) where -- n = length xs and m = length ys. -- -- There might be asymptotically better implementations following -- Knuth-Morris-Pratt (KMP), but for rather short lists this is good -- enough. findOverlap :: Eq a => [a] -> [a] -> (Int, Int) -- | Find an element satisfying a predicate and return it with its index. -- O(n) in the worst case, e.g. findWithIndex f xs = Nothing. -- -- TODO: more efficient implementation!? findWithIndex :: (a -> Bool) -> [a] -> Maybe (a, Int) -- | The more efficient implementation. We return a CPS's Maybe result for -- reliable inlining. findWithIndex' :: (a -> Bool) -> [a] -> b -> (a -> Int -> b) -> b -- | A generalised variant of elemIndex. O(n). genericElemIndex :: (Eq a, Integral i) => a -> [a] -> Maybe i -- | Check membership for the same list often. Use partially applied to -- create membership predicate hasElem xs :: a -> Bool. -- -- -- -- Specification: hasElem xs == (elem xs). hasElem :: Ord a => [a] -> a -> Bool -- | Head function (safe). Returns a default value on empty lists. O(1). -- --
--   headWithDefault 42 []      = 42
--   headWithDefault 42 [1,2,3] = 1
--   
headWithDefault :: a -> [a] -> a -- | All ways of removing one element from a list. O(n²). holes :: [a] -> [(a, [a])] -- | Lookup function with default value for index out of range. O(min n -- index). -- -- The name is chosen akin to genericIndex. indexWithDefault :: a -> [a] -> Int -> a -- | init of non-empty list, safe. O(n). init1 a as = init -- (a:as) init1 :: a -> [a] -> [a] -- | init and last in one go, safe. O(n). initLast :: [a] -> Maybe ([a], a) -- | Spine-strict initLast. initLast' :: [a] -> Maybe ([a], a) -- | init and last of non-empty list, safe. O(n). -- initLast1 a as = (init (a:as), last (a:as) initLast1 :: a -> [a] -> ([a], a) -- | Spine-strict initLast1. initLast1' :: a -> [a] -> ([a], a) -- | init, safe. O(n). initMaybe :: [a] -> Maybe [a] -- | init, safe. O(n). initWithDefault :: [a] -> [a] -> [a] -- | Last element of non-empty list (safe). O(n). last1 a as = last (a -- : as) last1 :: a -> [a] -> a -- | Last two elements (safe). O(n). last2 :: [a] -> Maybe (a, a) -- | last2' x y zs computes the last two elements of -- x:y:zs. O(n). last2' :: a -> a -> [a] -> (a, a) -- | Last element (safe). O(n). lastMaybe :: [a] -> Maybe a -- | Last element (safe). Returns a default list on empty lists. O(n). lastWithDefault :: a -> [a] -> a -- | Case distinction for lists, with list last. O(1). listCase :: b -> (a -> [a] -> b) -> [a] -> b -- | Strict map. map' :: (a -> b) -> [a] -> [b] -- | Spine-strict map. map'' :: (a -> b) -> [a] -> [b] -- | Strict mapMaybe. mapMaybe' :: (a -> Maybe b) -> [a] -> [b] -- | Like mapMaybe, but additionally return the last partition of -- the list where the function always returns Nothing. O(n). mapMaybeAndRest :: (a -> Maybe b) -> [a] -> ([b], Suffix a) -- | Maybe cons. O(1). mcons ma as = maybeToList ma ++ as mcons :: Maybe a -> [a] -> [a] mergeStrictlyOrderedBy :: (a -> a -> Bool) -> [a] -> [a] -> Maybe [a] -- | Partition a list into first and later occurrences of elements (modulo -- some quotient given by a representation function). -- -- Time: O(n log n). -- -- Specification: -- --
--   nubAndDuplicatesOn f xs = (ys, xs List.\\ ys)
--     where ys = nubOn f xs
--   
nubAndDuplicatesOn :: Ord b => (a -> b) -> [a] -> ([a], [a]) -- | A variant of nubOn that is parametrised by a function that is -- used to select which element from a group of equal elements that is -- returned. The returned elements keep the order that they had in the -- input list. -- -- Precondition: The length of the input list must be at most -- maxBound :: Int. nubFavouriteOn :: forall a b c. (Ord b, Hashable c) => (a -> b) -> (a -> c) -> [a] -> [a] -- | Non-efficient, monadic nub. O(n²). nubM :: Monad m => (a -> a -> m Bool) -> [a] -> m [a] -- | Efficient variant of nubBy for lists, using a set to store -- already seen elements. O(n log n) -- -- Specification: -- --
--   nubOn f xs == 'nubBy' ((==) `'on'` f) xs.
--   
nubOn :: Ord b => (a -> b) -> [a] -> [a] -- | Strict partition partition' :: (a -> Bool) -> [a] -> ([a], [a]) -- | Strict partitionEithers. partitionEithers' :: [Either a b] -> ([a], [b]) -- | Partition a list into Nothings and Justs. O(n). -- --
--   partitionMaybe f = partitionEithers . map ( a -> maybe (Left a) Right (f a))
--   
-- -- Note: mapMaybe f = snd . partitionMaybe f. partitionMaybe :: (a -> Maybe b) -> [a] -> ([a], [b]) -- | Spine-strict replicate. replicate' :: Int -> a -> [a] -- | Append a single element at the end. Time: O(length); use only on small -- lists. snoc :: [a] -> a -> [a] -- | Monadic version of sortOn. The effect is executed exactly -- once for each list element. sortOnM :: (Monad m, Ord b) => (a -> m b) -> [a] -> m [a] -- | Check whether a list is sorted. O(n). -- -- Assumes that the Ord instance implements a partial order. sorted :: Ord a => [a] -> Bool -- | Split off the largest suffix whose elements satisfy a predicate. O(n). -- -- spanEnd p xs = (ys, zs) where xs = ys ++ zs and -- all p zs and maybe True (not . p) (lastMaybe yz). spanEnd :: (a -> Bool) -> [a] -> (Prefix a, Suffix a) -- | A generalized version of span. O(length . fst . spanJust -- f). spanJust :: (a -> Maybe b) -> [a] -> (Prefix b, Suffix a) -- | Spine-strict splitAt. splitAt' :: Int -> [a] -> ([a], [a]) -- | splitExactlyAt n xs = Just (ys, zs) iff xs = ys ++ -- zs and genericLength ys = n. splitExactlyAt :: Integral n => n -> [a] -> Maybe (Prefix a, Suffix a) -- | Check if a list has a given prefix. If so, return the list minus the -- prefix. O(length prefix). stripPrefixBy :: (a -> a -> Bool) -> Prefix a -> [a] -> Maybe (Suffix a) -- | stripReversedSuffix rsuf xs = Just pre iff xs = pre ++ -- reverse suf. O(n). stripReversedSuffix :: Eq a => ReversedSuffix a -> [a] -> Maybe (Prefix a) -- | stripSuffix suf xs = Just pre iff xs = pre ++ suf. -- O(n). stripSuffix :: Eq a => Suffix a -> [a] -> Maybe (Prefix a) -- | Returns a list with one boolean for each non-empty suffix of the list, -- starting with the longest suffix (the entire list). Each boolean is -- True exactly when every element in the corresponding suffix -- satisfies the predicate. -- -- An example: suffixesSatisfying isLower AbCde -- = [False, False, False, True, True] -- -- For total predicates p and finite and total lists xs -- the following holds: suffixesSatisfying p xs = map -- (all p) (init (tails xs)) suffixesSatisfying :: (a -> Bool) -> [a] -> [Bool] -- | Tail function (safe). O(1). tailMaybe :: [a] -> Maybe [a] -- | Tail function (safe). Returns a default list on empty lists. O(1). tailWithDefault :: [a] -> [a] -> [a] -- | Spine-strict take. take' :: Int -> [a] -> [a] -- |
--   takeExactly a n as == take n (as ++ repeat a)
--   
takeExactly :: forall a n. Integral n => a -> n -> [a] -> [a] -- | Strict takeWhile. takeWhile' :: (a -> Bool) -> [a] -> [a] -- | A generalized version of takeWhile. (Cf. mapMaybe -- vs. filter). @O(length . takeWhileJust f). -- -- takeWhileJust f = fst . spanJust f. takeWhileJust :: (a -> Maybe b) -> [a] -> Prefix b -- | Efficient variant of nubBy for finite lists. O(n log n). -- --
--   uniqOn f == 'List.sortBy' (compare `'on'` f) . 'nubBy' ((==) `'on'` f)
--   
-- -- If there are several elements with the same f-representative, -- the first of these is kept. uniqOn :: Ord b => (a -> b) -> [a] -> [a] unzipWith :: (a -> (b, c)) -> [a] -> ([b], [c]) -- | Update nth element of a list, if it exists. O(min index n). -- -- Precondition: the index is >= 0. updateAt :: Int -> (a -> a) -> [a] -> [a] -- | Update the first element of a list, if it exists. O(1). updateHead :: (a -> a) -> [a] -> [a] -- | Update the last element of a list, if it exists. O(n). updateLast :: (a -> a) -> [a] -> [a] -- | Spine-strict zipping. zip' :: [a] -> [b] -> [(a, b)] -- | Strict zipWith. zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c] -- | Spine-strict zipWith. zipWith'' :: (a -> b -> c) -> [a] -> [b] -> [c] -- | Like zipWith but keep the rest of the second list as-is (in -- case the second list is longer). O(n). -- --
--   zipWithKeepRest f as bs == zipWith f as bs ++ drop (length as) bs
--   
zipWithKeepRest :: (a -> b -> b) -> [a] -> [b] -> [b] -- | Requires both lists to have the same length. O(n). -- -- Otherwise, Nothing is returned. zipWithSameLen :: (a -> b -> c) -> [a] -> [b] -> Maybe [c] type Prefix a = [a] type ReversedSuffix a = [a] -- | Internal state for stripping suffix. data StrSufSt a -- | Error. SSSMismatch :: StrSufSt a -- | "Negative string" to remove from end. List may be empty. SSSStrip :: ReversedSuffix a -> StrSufSt a -- | "Positive string" (result). Non-empty list. SSSResult :: [a] -> StrSufSt a type Suffix a = [a] -- | <math>. Decompose a list into its head and tail. -- -- -- --

Examples

-- --
--   >>> uncons []
--   Nothing
--   
-- --
--   >>> uncons [1]
--   Just (1,[])
--   
-- --
--   >>> uncons [1, 2, 3]
--   Just (1,[2,3])
--   
uncons :: [a] -> Maybe (a, [a]) -- | Logically consistent comparison of floating point numbers. module Agda.Utils.Float -- | Return Just x if it's a finite number, otherwise return Nothing. asFinite :: Double -> Maybe Double isPosInf :: Double -> Bool isNegInf :: Double -> Bool isPosZero :: Double -> Bool isNegZero :: Double -> Bool -- | Checks whether or not the Double is within a safe range of operation. isSafeInteger :: Double -> Bool doubleEq :: Double -> Double -> Bool doubleLe :: Double -> Double -> Bool doubleLt :: Double -> Double -> Bool intToDouble :: Integral a => a -> Double doublePlus :: Double -> Double -> Double doubleMinus :: Double -> Double -> Double doubleTimes :: Double -> Double -> Double doubleNegate :: Double -> Double doubleDiv :: Double -> Double -> Double doublePow :: Double -> Double -> Double doubleSqrt :: Double -> Double doubleExp :: Double -> Double doubleLog :: Double -> Double doubleSin :: Double -> Double doubleCos :: Double -> Double doubleTan :: Double -> Double doubleASin :: Double -> Double doubleACos :: Double -> Double doubleATan :: Double -> Double doubleATan2 :: Double -> Double -> Double doubleSinh :: Double -> Double doubleCosh :: Double -> Double doubleTanh :: Double -> Double doubleASinh :: Double -> Double doubleACosh :: Double -> Double doubleATanh :: Double -> Double doubleRound :: Double -> Maybe Integer doubleFloor :: Double -> Maybe Integer doubleCeiling :: Double -> Maybe Integer -- | Denotational equality for floating point numbers, checks bitwise -- equality. -- -- NOTE: Denotational equality distinguishes NaNs, so its results may -- vary depending on the architecture and compilation flags. -- Unfortunately, this is a problem with floating-point numbers in -- general. doubleDenotEq :: Double -> Double -> Bool -- | I guess "denotational orderings" are now a thing? The point is that we -- need an Ord instance which provides a total ordering, and is -- consistent with the denotational equality. -- -- NOTE: The ordering induced via doubleToWord64 is total, and is -- consistent with doubleDenotEq. However, it is *deeply* -- unintuitive. For one, it considers all negative numbers to be larger -- than positive numbers. doubleDenotOrd :: Double -> Double -> Ordering doubleToWord64 :: Double -> Maybe Word64 -- | Decode a Double to an integer ratio. doubleToRatio :: Double -> (Integer, Integer) -- | Encode an integer ratio as a double. ratioToDouble :: Integer -> Integer -> Double -- | Decode a Double to its mantissa and its exponent, normalised such that -- the mantissa is the smallest possible number without loss of accuracy. doubleDecode :: Double -> Maybe (Integer, Integer) -- | Encode a mantissa and an exponent as a Double. doubleEncode :: Integer -> Integer -> Maybe Double -- | Remove suffix .0 from printed floating point number. toStringWithoutDotZero :: Double -> String -- | Infinite lists (streams). -- -- Wrapper for Data.List.Infinite from the infinite-list -- package that generalizes some type signatures, using Integral -- for indexing, and adds some missing functions. -- -- Import this module as follows: -- --
--   import Agda.Utils.ListInf (ListInf, pattern (:<))
--   import Agda.Utils.ListInf qualified as ListInf
--   
-- -- Motivation: lists constructed by repeat, iterate, -- cycle etc. are infinite, so the nil case can never arise when -- consuming them, e.g. in a take or zipWith. Constructing -- them as properly infinite lists (ListInf) should thus lead to -- slightly more efficient code, eliminating impossible cases. module Agda.Utils.ListInf (!!) :: Integral n => ListInf a -> n -> a -- | There is only one meaningful way to concatenate a finite and an -- infinite list, justifying the name append = prependList. append :: [a] -> ListInf a -> ListInf a drop :: Integral n => n -> ListInf a -> ListInf a -- | pad as b implements the frequent pattern as ++ repeat -- b. pad :: [a] -> a -> ListInf a -- |
--   splitAt n as == (take n as, drop n as)
--   
splitAt :: Integral n => n -> ListInf a -> ([a], ListInf a) take :: Integral n => n -> ListInf a -> [a] -- | upFrom n = [n..] as properly infinite list. upFrom :: Enum n => n -> ListInf n -- | Update the nth element of an infinite list. Θ(n). -- -- Precondition: the index n is >= 0. updateAt :: Integral n => n -> (a -> a) -> ListInf a -> ListInf a type ListInf = Infinite cycle :: NonEmpty a -> Infinite a head :: Infinite a -> a iterate :: (a -> a) -> a -> Infinite a prependList :: [a] -> Infinite a -> Infinite a repeat :: a -> Infinite a tail :: Infinite a -> Infinite a zip :: Infinite a -> Infinite b -> Infinite (a, b) zipWith :: (a -> b -> c) -> Infinite a -> Infinite b -> Infinite c pattern (:<) :: () => a -> Infinite a -> Infinite a module Agda.Utils.Map -- | Version of insertWith that's willing to be properly inlined. -- The extra c argument is passed down to the insertions -- unchanged. It can be used to avoid closure creation for the loop. insertWithGood :: forall k a c. Ord k => (c -> a -> a -> a) -> c -> k -> a -> Map k a -> Map k a -- | Version of forM_ that deigns to be properly lambda-lifted for -- State, Reader, etc. forGood_ :: forall k v m. Applicative m => Map k v -> (v -> m ()) -> m () forWithKey_ :: forall k v m. Applicative m => Map k v -> (k -> v -> m ()) -> m () -- | Update monadically the value at one position (must exist!). adjustM :: (Functor f, Ord k) => (v -> f v) -> k -> Map k v -> f (Map k v) -- | Wrapper for adjustM for convenience. adjustM' :: (Functor f, Ord k) => (v -> f (a, v)) -> k -> Map k v -> f (a, Map k v) -- | Filter a map and rewrite the keys. mapKeysMaybe :: Ord k => (k -> Maybe k) -> Map k a -> Map k a -- | Check whether a map is a singleton. isSingleMap :: Map k v -> Maybe (k, v) -- | partitionKeys m s = partition (member s) m but -- with potential for efficient implementation. partitionKeys :: Ord k => Map k a -> Set k -> (Map k a, Map k a) -- | partitionMap m m' = partition (member m') m but -- with potential for efficient implementation. partitionMap :: Ord k => Map k a -> Map k b -> (Map k a, Map k a) -- | Non-empty maps. -- -- Provides type Map1 of non-empty maps. -- -- Import: @ -- -- import Agda.Utils.Map1 (Map1) import Agda.Utils.Map1 qualified as Map1 -- -- @ module Agda.Utils.Map1 ifNull :: Map k a -> b -> (Map1 k a -> b) -> b -- | Map both keys and values where the map is monotonic for the keys. -- -- A function that maps both keys and values while preserving the map -- structure is missing in Data.Map.NonEmpty. We implement it -- simplistically here as a combination of mapKeysMonotonic and -- fmap. mapKeysAndValuesMonotonic :: (k -> k) -> (a -> b) -> Map1 k a -> Map1 k b -- | A more general type would be Null m => Map k a -> (Map1 k a -- -> m) -> m but this type is problematic as we do not have a -- general instance Applicative m => Null (m ()). unlessNull :: Applicative m => Map k a -> (Map1 k a -> m ()) -> m () unlessNullM :: Monad m => m (Map k a) -> (Map1 k a -> m ()) -> m () type Map1 = NEMap (!) :: Ord k => NEMap k a -> k -> a (!?) :: Ord k => NEMap k a -> k -> Maybe a pattern IsEmpty :: Map k a pattern IsNonEmpty :: NEMap k a -> Map k a (\\) :: Ord k => NEMap k a -> NEMap k b -> Map k a absurdNEMap :: NEMap Void a -> b adjust :: Ord k => (a -> a) -> k -> NEMap k a -> NEMap k a adjustAt :: (k -> a -> a) -> Int -> NEMap k a -> NEMap k a adjustMax :: (a -> a) -> NEMap k a -> NEMap k a adjustMaxWithKey :: (k -> a -> a) -> NEMap k a -> NEMap k a adjustMin :: (a -> a) -> NEMap k a -> NEMap k a adjustMinWithKey :: (k -> a -> a) -> NEMap k a -> NEMap k a adjustWithKey :: Ord k => (k -> a -> a) -> k -> NEMap k a -> NEMap k a alter :: Ord k => (Maybe a -> Maybe a) -> k -> NEMap k a -> Map k a alter' :: Ord k => (Maybe a -> a) -> k -> NEMap k a -> NEMap k a alterF :: (Ord k, Functor f) => (Maybe a -> f (Maybe a)) -> k -> NEMap k a -> f (Map k a) alterF' :: (Ord k, Functor f) => (Maybe a -> f a) -> k -> NEMap k a -> f (NEMap k a) assocs :: NEMap k a -> NonEmpty (k, a) delete :: Ord k => k -> NEMap k a -> Map k a deleteAt :: Int -> NEMap k a -> Map k a deleteFindMax :: NEMap k a -> ((k, a), Map k a) deleteFindMin :: NEMap k a -> ((k, a), Map k a) deleteMax :: NEMap k a -> Map k a deleteMaybe :: Ord k => k -> NEMap k a -> Maybe (NEMap k a) deleteMin :: NEMap k a -> Map k a difference :: Ord k => NEMap k a -> NEMap k b -> Map k a differenceWith :: Ord k => (a -> b -> Maybe a) -> NEMap k a -> NEMap k b -> Map k a differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> NEMap k a -> NEMap k b -> Map k a drop :: Int -> NEMap k a -> Map k a dropWhileAntitone :: (k -> Bool) -> NEMap k a -> Map k a elemAt :: Int -> NEMap k a -> (k, a) filter :: (a -> Bool) -> NEMap k a -> Map k a filterWithKey :: (k -> a -> Bool) -> NEMap k a -> Map k a findIndex :: Ord k => k -> NEMap k a -> Int findMax :: NEMap k a -> (k, a) findMin :: NEMap k a -> (k, a) findWithDefault :: Ord k => a -> k -> NEMap k a -> a foldl1' :: (a -> a -> a) -> NEMap k a -> a foldlWithKey :: (a -> k -> b -> a) -> a -> NEMap k b -> a foldlWithKey' :: (a -> k -> b -> a) -> a -> NEMap k b -> a foldr1' :: (a -> a -> a) -> NEMap k a -> a foldrWithKey :: (k -> a -> b -> b) -> b -> NEMap k a -> b foldrWithKey' :: (k -> a -> b -> b) -> b -> NEMap k a -> b fromAscList :: Eq k => NonEmpty (k, a) -> NEMap k a fromAscListWith :: Eq k => (a -> a -> a) -> NonEmpty (k, a) -> NEMap k a fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> NonEmpty (k, a) -> NEMap k a fromDescList :: Eq k => NonEmpty (k, a) -> NEMap k a fromDescListWith :: Eq k => (a -> a -> a) -> NonEmpty (k, a) -> NEMap k a fromDescListWithKey :: Eq k => (k -> a -> a -> a) -> NonEmpty (k, a) -> NEMap k a fromDistinctAscList :: NonEmpty (k, a) -> NEMap k a fromDistinctDescList :: NonEmpty (k, a) -> NEMap k a fromListWith :: Ord k => (a -> a -> a) -> NonEmpty (k, a) -> NEMap k a fromListWithKey :: Ord k => (k -> a -> a -> a) -> NonEmpty (k, a) -> NEMap k a fromSet :: (k -> a) -> NESet k -> NEMap k a insert :: Ord k => k -> a -> NEMap k a -> NEMap k a insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> NEMap k a -> (Maybe a, NEMap k a) insertMap :: Ord k => k -> a -> Map k a -> NEMap k a insertMapMax :: k -> a -> Map k a -> NEMap k a insertMapMin :: k -> a -> Map k a -> NEMap k a insertMapWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> NEMap k a insertMapWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> NEMap k a insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> NEMap k a -> NEMap k a intersection :: Ord k => NEMap k a -> NEMap k b -> Map k a intersectionWith :: Ord k => (a -> b -> c) -> NEMap k a -> NEMap k b -> Map k c intersectionWithKey :: Ord k => (k -> a -> b -> c) -> NEMap k a -> NEMap k b -> Map k c isProperSubmapOf :: (Ord k, Eq a) => NEMap k a -> NEMap k a -> Bool isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> NEMap k a -> NEMap k b -> Bool isSubmapOf :: (Ord k, Eq a) => NEMap k a -> NEMap k a -> Bool isSubmapOfBy :: Ord k => (a -> b -> Bool) -> NEMap k a -> NEMap k b -> Bool keys :: NEMap k a -> NonEmpty k keysSet :: NEMap k a -> NESet k lookup :: Ord k => k -> NEMap k a -> Maybe a lookupGE :: Ord k => k -> NEMap k a -> Maybe (k, a) lookupGT :: Ord k => k -> NEMap k a -> Maybe (k, a) lookupIndex :: Ord k => k -> NEMap k a -> Maybe Int lookupLE :: Ord k => k -> NEMap k a -> Maybe (k, a) lookupLT :: Ord k => k -> NEMap k a -> Maybe (k, a) mapAccum :: (a -> b -> (a, c)) -> a -> NEMap k b -> (a, NEMap k c) mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> NEMap k b -> (a, NEMap k c) mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> NEMap k b -> (a, NEMap k c) mapEither :: (a -> Either b c) -> NEMap k a -> These (NEMap k b) (NEMap k c) mapEitherWithKey :: (k -> a -> Either b c) -> NEMap k a -> These (NEMap k b) (NEMap k c) mapKeys :: Ord k2 => (k1 -> k2) -> NEMap k1 a -> NEMap k2 a mapKeysMonotonic :: (k1 -> k2) -> NEMap k1 a -> NEMap k2 a mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> NEMap k1 a -> NEMap k2 a mapMaybe :: (a -> Maybe b) -> NEMap k a -> Map k b mapMaybeWithKey :: (k -> a -> Maybe b) -> NEMap k a -> Map k b mapWithKey :: (k -> a -> b) -> NEMap k a -> NEMap k b maxView :: NEMap k a -> (a, Map k a) member :: Ord k => k -> NEMap k a -> Bool minView :: NEMap k a -> (a, Map k a) notMember :: Ord k => k -> NEMap k a -> Bool partition :: (a -> Bool) -> NEMap k a -> These (NEMap k a) (NEMap k a) partitionWithKey :: (k -> a -> Bool) -> NEMap k a -> These (NEMap k a) (NEMap k a) restrictKeys :: Ord k => NEMap k a -> Set k -> Map k a spanAntitone :: (k -> Bool) -> NEMap k a -> These (NEMap k a) (NEMap k a) split :: Ord k => k -> NEMap k a -> Maybe (These (NEMap k a) (NEMap k a)) splitAt :: Int -> NEMap k a -> These (NEMap k a) (NEMap k a) splitLookup :: Ord k => k -> NEMap k a -> These a (These (NEMap k a) (NEMap k a)) splitRoot :: NEMap k a -> NonEmpty (NEMap k a) take :: Int -> NEMap k a -> Map k a takeWhileAntitone :: (k -> Bool) -> NEMap k a -> Map k a toAscList :: NEMap k a -> NonEmpty (k, a) toDescList :: NEMap k a -> NonEmpty (k, a) traverseMaybeWithKey :: Applicative t => (k -> a -> t (Maybe b)) -> NEMap k a -> t (Map k b) traverseMaybeWithKey1 :: Apply t => (k -> a -> t (Maybe b)) -> NEMap k a -> t (Map k b) unionMapLeft :: Ord k => Map k a -> NEMap k a -> NEMap k a unionMapRight :: Ord k => NEMap k a -> Map k a -> NEMap k a unionMapWithKeyLeft :: Ord k => (k -> a -> a -> a) -> Map k a -> NEMap k a -> NEMap k a unionMapWithKeyRight :: Ord k => (k -> a -> a -> a) -> NEMap k a -> Map k a -> NEMap k a unionMapWithLeft :: Ord k => (a -> a -> a) -> Map k a -> NEMap k a -> NEMap k a unionMapWithRight :: Ord k => (a -> a -> a) -> NEMap k a -> Map k a -> NEMap k a unionWith :: Ord k => (a -> a -> a) -> NEMap k a -> NEMap k a -> NEMap k a unionWithKey :: Ord k => (k -> a -> a -> a) -> NEMap k a -> NEMap k a -> NEMap k a unionsWith :: (Foldable1 f, Ord k) => (a -> a -> a) -> f (NEMap k a) -> NEMap k a unsafeFromMap :: Map k a -> NEMap k a update :: Ord k => (a -> Maybe a) -> k -> NEMap k a -> Map k a updateAt :: (k -> a -> Maybe a) -> Int -> NEMap k a -> Map k a updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> NEMap k a -> (Maybe a, Map k a) updateMax :: (a -> Maybe a) -> NEMap k a -> Map k a updateMaxWithKey :: (k -> a -> Maybe a) -> NEMap k a -> Map k a updateMin :: (a -> Maybe a) -> NEMap k a -> Map k a updateMinWithKey :: (k -> a -> Maybe a) -> NEMap k a -> Map k a updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> NEMap k a -> Map k a withoutKeys :: Ord k => NEMap k a -> Set k -> Map k a elems :: NEMap k a -> NonEmpty a foldMapWithKey :: Semigroup m => (k -> a -> m) -> NEMap k a -> m foldl :: (a -> b -> a) -> a -> NEMap k b -> a foldl' :: (a -> b -> a) -> a -> NEMap k b -> a foldl1 :: (a -> a -> a) -> NEMap k a -> a foldr :: (a -> b -> b) -> b -> NEMap k a -> b foldr' :: (a -> b -> b) -> b -> NEMap k a -> b foldr1 :: (a -> a -> a) -> NEMap k a -> a fromList :: Ord k => NonEmpty (k, a) -> NEMap k a insertWith :: Ord k => (a -> a -> a) -> k -> a -> NEMap k a -> NEMap k a map :: (a -> b) -> NEMap k a -> NEMap k b nonEmptyMap :: Map k a -> Maybe (NEMap k a) singleton :: k -> a -> NEMap k a size :: NEMap k a -> Int toList :: NEMap k a -> NonEmpty (k, a) toMap :: NEMap k a -> Map k a traverseWithKey :: Applicative t => (k -> a -> t b) -> NEMap k a -> t (NEMap k b) traverseWithKey1 :: Apply t => (k -> a -> t b) -> NEMap k a -> t (NEMap k b) union :: Ord k => NEMap k a -> NEMap k a -> NEMap k a unions :: (Foldable1 f, Ord k) => f (NEMap k a) -> NEMap k a valid :: Ord k => NEMap k a -> Bool withNonEmpty :: r -> (NEMap k a -> r) -> Map k a -> r data NEMap k a module Agda.Utils.Maybe.Unboxable data Maybe# a Maybe# :: (# a | (# #) #) -> Maybe# a pattern Nothing# :: Maybe# a pattern Just# :: a -> Maybe# a module Agda.Utils.Memo -- | Simple, non-reentrant memoisation. memo :: MonadState s m => Lens' s (Maybe a) -> m a -> m a -- | Recursive memoisation, second argument is the value you get on -- recursive calls. memoRec :: MonadState s m => Lens' s (Maybe a) -> a -> m a -> m a memoUnsafe :: Ord a => (a -> b) -> a -> b memoUnsafeH :: Hashable a => (a -> b) -> a -> b memoUnsafeInt :: (Int -> a) -> Int -> a module Agda.Utils.MinimalArray.Prim newtype Array a Array :: PrimArray a -> Array a [unwrap] :: Array a -> PrimArray a size :: Prim a => Array a -> Int unsafeIndex :: Prim a => Array a -> Int -> a index :: Prim a => Array a -> Int -> a foldr' :: Prim a => (a -> b -> b) -> b -> Array a -> b foldl' :: Prim a => (b -> a -> b) -> b -> Array a -> b map :: (Prim a, Prim b) => (Int -> a -> b) -> Array a -> Array b toList :: Prim a => Array a -> [a] fromList :: Prim a => [a] -> Array a fromListN :: Prim a => Int -> [a] -> Array a instance (GHC.Internal.Classes.Eq a, Data.Primitive.Types.Prim a) => GHC.Internal.Classes.Eq (Agda.Utils.MinimalArray.Prim.Array a) instance Data.Primitive.Types.Prim a => GHC.Internal.IsList.IsList (Agda.Utils.MinimalArray.Prim.Array a) instance (GHC.Internal.Show.Show a, Data.Primitive.Types.Prim a) => GHC.Internal.Show.Show (Agda.Utils.MinimalArray.Prim.Array a) module Agda.Utils.MinimalArray.MutablePrim newtype Array s a Array :: MutablePrimArray s a -> Array s a [unwrap] :: Array s a -> MutablePrimArray s a type IOArray a = Array RealWorld a new :: (PrimMonad m, Prim a) => Int -> m (Array (PrimState m) a) size :: (PrimMonad m, Prim a) => Array (PrimState m) a -> m Int unsafeRead :: (PrimMonad m, Prim a) => Array (PrimState m) a -> Int -> m a unsafeWrite :: (PrimMonad m, Prim a) => Array (PrimState m) a -> Int -> a -> m () read :: (PrimMonad m, Prim a) => Array (PrimState m) a -> Int -> m a write :: (PrimMonad m, Prim a) => Array (PrimState m) a -> Int -> a -> m () freeze :: (PrimMonad m, Prim a) => Array (PrimState m) a -> m (Array a) set :: (PrimMonad m, Prim a) => Array (PrimState m) a -> a -> m () unsafeFreeze :: PrimMonad m => Array (PrimState m) a -> m (Array a) -- | More monoids. module Agda.Utils.Monoid -- | Maximum of on-negative (small) natural numbers. newtype MaxNat MaxNat :: Int -> MaxNat [getMaxNat] :: MaxNat -> Int -- | Function composition in the diagrammatic order. data Fwd a pattern Fwd :: (a -> a) -> Fwd a appFwd :: Fwd a -> a -> a instance GHC.Internal.Enum.Enum Agda.Utils.Monoid.MaxNat instance GHC.Internal.Classes.Eq Agda.Utils.Monoid.MaxNat instance GHC.Internal.Base.Monoid (Agda.Utils.Monoid.Fwd a) instance GHC.Internal.Base.Monoid Agda.Utils.Monoid.MaxNat instance GHC.Internal.Num.Num Agda.Utils.Monoid.MaxNat instance GHC.Internal.Classes.Ord Agda.Utils.Monoid.MaxNat instance GHC.Internal.Base.Semigroup (Agda.Utils.Monoid.Fwd a) instance GHC.Internal.Base.Semigroup Agda.Utils.Monoid.MaxNat instance GHC.Internal.Show.Show Agda.Utils.Monoid.MaxNat module Agda.Utils.PartialOrd -- | The result of comparing two things (of the same type). data PartialOrdering -- | Less than. POLT :: PartialOrdering -- | Less or equal than. POLE :: PartialOrdering -- | Equal POEQ :: PartialOrdering -- | Greater or equal. POGE :: PartialOrdering -- | Greater than. POGT :: PartialOrdering -- | No information (incomparable). POAny :: PartialOrdering -- | Comparing the information content of two elements of -- PartialOrdering. More precise information is smaller. -- -- Includes equality: x leqPO x == True. leqPO :: PartialOrdering -> PartialOrdering -> Bool -- | Opposites. -- -- related a po b iff related b (oppPO po) a. oppPO :: PartialOrdering -> PartialOrdering -- | Combining two pieces of information (picking the least information). -- Used for the dominance ordering on tuples. -- -- orPO is associative, commutative, and idempotent. -- orPO has dominant element POAny, but no neutral -- element. orPO :: PartialOrdering -> PartialOrdering -> PartialOrdering -- | Chains (transitivity) x R y S z. -- -- seqPO is associative, commutative, and idempotent. -- seqPO has dominant element POAny and neutral element -- (unit) POEQ. seqPO :: PartialOrdering -> PartialOrdering -> PartialOrdering -- | Embed Ordering. fromOrdering :: Ordering -> PartialOrdering -- | Represent a non-empty disjunction of Orderings as -- PartialOrdering. fromOrderings :: [Ordering] -> PartialOrdering -- | A PartialOrdering information is a disjunction of -- Ordering informations. toOrderings :: PartialOrdering -> [Ordering] type Comparable a = a -> a -> PartialOrdering -- | Decidable partial orderings. class PartialOrd a comparable :: PartialOrd a => Comparable a -- | Any Ord is a PartialOrd. comparableOrd :: Ord a => Comparable a -- | Are two elements related in a specific way? -- -- related a o b holds iff comparable a b is contained -- in o. related :: PartialOrd a => a -> PartialOrdering -> a -> Bool -- | Pointwise comparison wrapper. newtype Pointwise a Pointwise :: a -> Pointwise a [pointwise] :: Pointwise a -> a -- | Inclusion comparison wrapper. newtype Inclusion a Inclusion :: a -> Inclusion a [inclusion] :: Inclusion a -> a instance GHC.Internal.Enum.Bounded Agda.Utils.PartialOrd.PartialOrdering instance GHC.Internal.Enum.Enum Agda.Utils.PartialOrd.PartialOrdering instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.PartialOrd.Inclusion a) instance GHC.Internal.Classes.Eq Agda.Utils.PartialOrd.PartialOrdering instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.PartialOrd.Pointwise a) instance GHC.Internal.Base.Functor Agda.Utils.PartialOrd.Inclusion instance GHC.Internal.Base.Functor Agda.Utils.PartialOrd.Pointwise instance GHC.Internal.Base.Monoid Agda.Utils.PartialOrd.PartialOrdering instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.PartialOrd.Inclusion a) instance (Agda.Utils.PartialOrd.PartialOrd a, Agda.Utils.PartialOrd.PartialOrd b) => Agda.Utils.PartialOrd.PartialOrd (GHC.Internal.Data.Either.Either a b) instance GHC.Internal.Classes.Ord a => Agda.Utils.PartialOrd.PartialOrd (Agda.Utils.PartialOrd.Inclusion [a]) instance GHC.Internal.Classes.Ord a => Agda.Utils.PartialOrd.PartialOrd (Agda.Utils.PartialOrd.Inclusion (Data.Set.Internal.Set a)) instance Agda.Utils.PartialOrd.PartialOrd GHC.Internal.Types.Int instance Agda.Utils.PartialOrd.PartialOrd GHC.Internal.Bignum.Integer.Integer instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Utils.PartialOrd.PartialOrd (GHC.Internal.Maybe.Maybe a) instance Agda.Utils.PartialOrd.PartialOrd Agda.Utils.PartialOrd.PartialOrdering instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Utils.PartialOrd.PartialOrd (Agda.Utils.PartialOrd.Pointwise [a]) instance (Agda.Utils.PartialOrd.PartialOrd a, Agda.Utils.PartialOrd.PartialOrd b) => Agda.Utils.PartialOrd.PartialOrd (a, b) instance Agda.Utils.PartialOrd.PartialOrd () instance GHC.Internal.Base.Semigroup Agda.Utils.PartialOrd.PartialOrdering instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.PartialOrd.Inclusion a) instance GHC.Internal.Show.Show Agda.Utils.PartialOrd.PartialOrdering instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.PartialOrd.Pointwise a) -- | Partially ordered monoids. module Agda.Utils.POMonoid -- | Partially ordered semigroup. -- -- Law: composition must be monotone. -- --
--   related x POLE x' && related y POLE y' ==>
--   related (x <> y) POLE (x' <> y')
--   
class (PartialOrd a, Semigroup a) => POSemigroup a -- | Partially ordered monoid. -- -- Law: composition must be monotone. -- --
--   related x POLE x' && related y POLE y' ==>
--   related (x <> y) POLE (x' <> y')
--   
class (PartialOrd a, Semigroup a, Monoid a) => POMonoid a -- | Completing POMonoids with inverses to form a Galois connection. -- -- Law: composition and inverse composition form a Galois connection. -- --
--   related (inverseCompose p x) POLE y == related x POLE (p <> y)
--   
class POMonoid a => LeftClosedPOMonoid a inverseCompose :: LeftClosedPOMonoid a => a -> a -> a -- | hasLeftAdjoint x checks whether x^-1 := x -- inverseCompose mempty is such that x -- inverseCompose y == x^-1 <> y for any y. hasLeftAdjoint :: LeftClosedPOMonoid a => a -> Bool module Agda.Utils.SemiRing -- | Semirings (https://en.wikipedia.org/wiki/Semiring). class SemiRing a ozero :: SemiRing a => a oone :: SemiRing a => a oplus :: SemiRing a => a -> a -> a otimes :: SemiRing a => a -> a -> a -- | Star semirings -- (https://en.wikipedia.org/wiki/Semiring#Star_semirings). class SemiRing a => StarSemiRing a ostar :: StarSemiRing a => a -> a instance Agda.Utils.SemiRing.SemiRing a => Agda.Utils.SemiRing.SemiRing (GHC.Internal.Maybe.Maybe a) instance Agda.Utils.SemiRing.SemiRing () instance Agda.Utils.SemiRing.StarSemiRing a => Agda.Utils.SemiRing.StarSemiRing (GHC.Internal.Maybe.Maybe a) instance Agda.Utils.SemiRing.StarSemiRing () -- | Some semigroup instances used in several places module Agda.Utils.Semigroup instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Semigroup doc) => GHC.Internal.Base.Semigroup (Control.Monad.Trans.Except.ExceptT e m doc) instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Semigroup doc) => GHC.Internal.Base.Semigroup (Control.Monad.Trans.Maybe.MaybeT m doc) instance (GHC.Internal.Base.Applicative m, GHC.Internal.Base.Semigroup doc) => GHC.Internal.Base.Semigroup (Control.Monad.Trans.Reader.ReaderT s m doc) instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Semigroup doc) => GHC.Internal.Base.Semigroup (Control.Monad.Trans.State.Lazy.StateT s m doc) instance (GHC.Internal.Base.Monad m, GHC.Internal.Base.Semigroup doc, GHC.Internal.Base.Monoid w) => GHC.Internal.Base.Semigroup (Control.Monad.Trans.Writer.Lazy.WriterT w m doc) module Agda.Utils.Serialize class Serialize a size :: Serialize a => a -> Int put :: Serialize a => a -> Put get :: Serialize a => Get a serialize :: Serialize a => a -> IO ByteString deserialize :: Serialize a => ByteString -> IO a serializePure :: Serialize a => a -> ByteString deserializePure :: Serialize a => ByteString -> a ensure :: Int -> (Addr# -> Get a) -> Get a newtype Get a Get :: (Addr# -> Addr# -> RW -> (# Addr#, RW, a #)) -> Get a [unGet] :: Get a -> Addr# -> Addr# -> RW -> (# Addr#, RW, a #) newtype Put Put :: (Addr# -> RW -> (# Addr#, RW #)) -> Put [unPut] :: Put -> Addr# -> RW -> (# Addr#, RW #) putByteArray# :: ByteArray# -> Int# -> Int# -> Put getByteArray# :: Int# -> (ByteArray# -> Get a) -> Get a instance GHC.Internal.Base.Applicative Agda.Utils.Serialize.Get instance GHC.Internal.Base.Functor Agda.Utils.Serialize.Get instance GHC.Internal.Base.Monad Agda.Utils.Serialize.Get instance GHC.Internal.Base.Monoid Agda.Utils.Serialize.Put instance GHC.Internal.Base.Semigroup Agda.Utils.Serialize.Put instance Agda.Utils.Serialize.Serialize GHC.Internal.Types.Char instance Agda.Utils.Serialize.Serialize GHC.Internal.Types.Double instance Agda.Utils.Serialize.Serialize GHC.Internal.Types.Int instance Agda.Utils.Serialize.Serialize GHC.Internal.Bignum.Integer.Integer instance Agda.Utils.Serialize.Serialize a => Agda.Utils.Serialize.Serialize [a] instance Agda.Utils.Serialize.Serialize Data.Text.Internal.Lazy.Text instance Agda.Utils.Serialize.Serialize Data.Text.Internal.Text instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b) => Agda.Utils.Serialize.Serialize (a, b) instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b, Agda.Utils.Serialize.Serialize c) => Agda.Utils.Serialize.Serialize (a, b, c) instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b, Agda.Utils.Serialize.Serialize c, Agda.Utils.Serialize.Serialize d) => Agda.Utils.Serialize.Serialize (a, b, c, d) instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b, Agda.Utils.Serialize.Serialize c, Agda.Utils.Serialize.Serialize d, Agda.Utils.Serialize.Serialize e) => Agda.Utils.Serialize.Serialize (a, b, c, d, e) instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b, Agda.Utils.Serialize.Serialize c, Agda.Utils.Serialize.Serialize d, Agda.Utils.Serialize.Serialize e, Agda.Utils.Serialize.Serialize f) => Agda.Utils.Serialize.Serialize (a, b, c, d, e, f) instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b, Agda.Utils.Serialize.Serialize c, Agda.Utils.Serialize.Serialize d, Agda.Utils.Serialize.Serialize e, Agda.Utils.Serialize.Serialize f, Agda.Utils.Serialize.Serialize g) => Agda.Utils.Serialize.Serialize (a, b, c, d, e, f, g) instance (Agda.Utils.Serialize.Serialize a, Agda.Utils.Serialize.Serialize b, Agda.Utils.Serialize.Serialize c, Agda.Utils.Serialize.Serialize d, Agda.Utils.Serialize.Serialize e, Agda.Utils.Serialize.Serialize f, Agda.Utils.Serialize.Serialize g, Agda.Utils.Serialize.Serialize h) => Agda.Utils.Serialize.Serialize (a, b, c, d, e, f, g, h) instance Agda.Utils.Serialize.Serialize () instance Agda.Utils.Serialize.Serialize GHC.Internal.Types.Word instance Agda.Utils.Serialize.Serialize GHC.Internal.Word.Word16 instance Agda.Utils.Serialize.Serialize GHC.Internal.Word.Word32 instance Agda.Utils.Serialize.Serialize GHC.Internal.Word.Word64 instance Agda.Utils.Serialize.Serialize GHC.Internal.Word.Word8 module Agda.Utils.MinimalArray.Lifted newtype Array a Array :: Array a -> Array a [unwrap] :: Array a -> Array a size :: Array a -> Int unsafeIndex :: Array a -> Int -> a index :: Array a -> Int -> a toList :: Array a -> [a] fromList :: [a] -> Array a fromListN :: Int -> [a] -> Array a fromGHCArray :: Array i e -> Array e -- | Strict traversal. traverseIO' :: (a -> IO b) -> Array a -> IO (Array b) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.MinimalArray.Lifted.Array a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.MinimalArray.Lifted.Array instance GHC.Internal.Base.Functor Agda.Utils.MinimalArray.Lifted.Array instance GHC.Internal.IsList.IsList (Agda.Utils.MinimalArray.Lifted.Array a) instance Agda.Utils.Serialize.Serialize a => Agda.Utils.Serialize.Serialize (Agda.Utils.MinimalArray.Lifted.Array a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.MinimalArray.Lifted.Array a) instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.MinimalArray.Lifted.Array module Agda.Utils.MinimalArray.MutableLifted newtype Array s a Array :: MutableArray s a -> Array s a [unwrap] :: Array s a -> MutableArray s a type IOArray a = Array RealWorld a new :: forall a m. PrimMonad m => Int -> a -> m (Array (PrimState m) a) size :: Array s a -> Int unsafeRead :: PrimMonad m => Array (PrimState m) a -> Int -> m a unsafeWrite :: PrimMonad m => Array (PrimState m) a -> Int -> a -> m () read :: PrimMonad m => Array (PrimState m) a -> Int -> m a write :: PrimMonad m => Array (PrimState m) a -> Int -> a -> m () freeze :: PrimMonad m => Array (PrimState m) a -> m (Array a) unsafeFreeze :: PrimMonad m => Array (PrimState m) a -> m (Array a) fromGHCArray :: IOArray i e -> IOArray e module Agda.Utils.Set -- | O(log n). Find the given element and return the copy contained -- in the set. lookupKey :: Ord a => a -> Set a -> Maybe a -- | Non-empty sets. -- -- Provides type Set1 of non-empty sets. -- -- Import: @ -- -- import Agda.Utils.Set1 (Set1) import Agda.Utils.Set1 qualified as Set1 -- -- @ module Agda.Utils.Set1 ifNull :: Set a -> b -> (Set1 a -> b) -> b -- | Lossless toSet. Opposite of nonEmptySet. toSet' :: Maybe (Set1 a) -> Set a -- | A more general type would be Null m => Set a -> (Set1 a -- -> m) -> m but this type is problematic as we do not have a -- general instance Applicative m => Null (m ()). unlessNull :: Applicative m => Set a -> (Set1 a -> m ()) -> m () unlessNullM :: Monad m => m (Set a) -> (Set1 a -> m ()) -> m () type Set1 = NESet pattern IsEmpty :: Set a pattern IsNonEmpty :: NESet a -> Set a (\\) :: Ord a => NESet a -> NESet a -> Set a cartesianProduct :: NESet a -> NESet b -> NESet (a, b) delete :: Ord a => a -> NESet a -> Set a deleteAt :: Int -> NESet a -> Set a deleteFindMax :: NESet a -> (a, Set a) deleteFindMin :: NESet a -> (a, Set a) deleteMax :: NESet a -> Set a deleteMaybe :: Ord a => a -> NESet a -> Maybe (NESet a) deleteMin :: NESet a -> Set a difference :: Ord a => NESet a -> NESet a -> Set a disjoint :: Ord a => NESet a -> NESet a -> Bool disjointUnion :: NESet a -> NESet b -> NESet (Either a b) drop :: Int -> NESet a -> Set a dropWhileAntitone :: (a -> Bool) -> NESet a -> Set a elemAt :: Int -> NESet a -> a elems :: NESet a -> NonEmpty a filter :: (a -> Bool) -> NESet a -> Set a findIndex :: Ord a => a -> NESet a -> Int findMax :: NESet a -> a findMin :: NESet a -> a foldl1' :: (a -> a -> a) -> NESet a -> a foldr1' :: (a -> a -> a) -> NESet a -> a fromAscList :: Eq a => NonEmpty a -> NESet a fromDescList :: Eq a => NonEmpty a -> NESet a fromDistinctAscList :: NonEmpty a -> NESet a fromDistinctDescList :: NonEmpty a -> NESet a insert :: Ord a => a -> NESet a -> NESet a insertSet :: Ord a => a -> Set a -> NESet a insertSetMax :: a -> Set a -> NESet a insertSetMin :: a -> Set a -> NESet a intersection :: Ord a => NESet a -> NESet a -> Set a isProperSubsetOf :: Ord a => NESet a -> NESet a -> Bool isSubsetOf :: Ord a => NESet a -> NESet a -> Bool lookupGE :: Ord a => a -> NESet a -> Maybe a lookupGT :: Ord a => a -> NESet a -> Maybe a lookupIndex :: Ord a => a -> NESet a -> Maybe Int lookupLE :: Ord a => a -> NESet a -> Maybe a lookupLT :: Ord a => a -> NESet a -> Maybe a map :: Ord b => (a -> b) -> NESet a -> NESet b mapMonotonic :: (a -> b) -> NESet a -> NESet b member :: Ord a => a -> NESet a -> Bool notMember :: Ord a => a -> NESet a -> Bool partition :: (a -> Bool) -> NESet a -> These (NESet a) (NESet a) powerSet :: NESet a -> NESet (NESet a) spanAntitone :: (a -> Bool) -> NESet a -> These (NESet a) (NESet a) split :: Ord a => a -> NESet a -> Maybe (These (NESet a) (NESet a)) splitAt :: Int -> NESet a -> These (NESet a) (NESet a) splitMember :: Ord a => a -> NESet a -> (Bool, Maybe (These (NESet a) (NESet a))) splitRoot :: NESet a -> NonEmpty (NESet a) take :: Int -> NESet a -> Set a takeWhileAntitone :: (a -> Bool) -> NESet a -> Set a toAscList :: NESet a -> NonEmpty a toDescList :: NESet a -> NonEmpty a unionSetLeft :: Ord a => Set a -> NESet a -> NESet a unionSetRight :: Ord a => NESet a -> Set a -> NESet a unsafeFromSet :: Set a -> NESet a foldl :: (a -> b -> a) -> a -> NESet b -> a foldl' :: (a -> b -> a) -> a -> NESet b -> a foldr :: (a -> b -> b) -> b -> NESet a -> b foldr' :: (a -> b -> b) -> b -> NESet a -> b fromList :: Ord a => NonEmpty a -> NESet a nonEmptySet :: Set a -> Maybe (NESet a) singleton :: a -> NESet a size :: NESet a -> Int toList :: NESet a -> NonEmpty a toSet :: NESet a -> Set a union :: Ord a => NESet a -> NESet a -> NESet a unions :: (Foldable1 f, Ord a) => f (NESet a) -> NESet a valid :: Ord a => NESet a -> Bool withNonEmpty :: r -> (NESet a -> r) -> Set a -> r -- | A variant of foldl that has no base case, and thus may only be -- applied to non-empty structures. -- -- This function is non-total and will raise a runtime exception if the -- structure happens to be empty. -- --
--   foldl1 f = foldl1 f . toList
--   
-- --

Examples

-- -- Basic usage: -- --
--   >>> foldl1 (+) [1..4]
--   10
--   
-- --
--   >>> foldl1 (+) []
--   *** Exception: Prelude.foldl1: empty list
--   
-- --
--   >>> foldl1 (+) Nothing
--   *** Exception: foldl1: empty structure
--   
-- --
--   >>> foldl1 (-) [1..4]
--   -8
--   
-- --
--   >>> foldl1 (&&) [True, False, True, True]
--   False
--   
-- --
--   >>> foldl1 (||) [False, False, True, True]
--   True
--   
-- --
--   >>> foldl1 (+) [1..]
--   * Hangs forever *
--   
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a -- | A variant of foldr that has no base case, and thus may only be -- applied to non-empty structures. -- -- This function is non-total and will raise a runtime exception if the -- structure happens to be empty. -- --

Examples

-- -- Basic usage: -- --
--   >>> foldr1 (+) [1..4]
--   10
--   
-- --
--   >>> foldr1 (+) []
--   Exception: Prelude.foldr1: empty list
--   
-- --
--   >>> foldr1 (+) Nothing
--   *** Exception: foldr1: empty structure
--   
-- --
--   >>> foldr1 (-) [1..4]
--   -2
--   
-- --
--   >>> foldr1 (&&) [True, False, True, True]
--   False
--   
-- --
--   >>> foldr1 (||) [False, False, True, True]
--   True
--   
-- --
--   >>> foldr1 (+) [1..]
--   * Hangs forever *
--   
foldr1 :: Foldable t => (a -> a -> a) -> t a -> a data NESet a module Agda.Utils.StrictEndo newtype Endo a Endo :: (a -> a) -> Endo a [appEndo] :: Endo a -> a -> a instance Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictEndo.Endo a) instance GHC.Internal.Base.Monoid (Agda.Utils.StrictEndo.Endo a) instance GHC.Internal.Base.Semigroup (Agda.Utils.StrictEndo.Endo a) -- | Strict endomorphism monoid with flipped function composition order module Agda.Utils.StrictFlipEndo newtype Endo a Endo :: (a -> a) -> Endo a [appEndo] :: Endo a -> a -> a instance Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictFlipEndo.Endo a) instance GHC.Internal.Base.Monoid (Agda.Utils.StrictFlipEndo.Endo a) instance GHC.Internal.Base.Semigroup (Agda.Utils.StrictFlipEndo.Endo a) module Agda.Utils.StrictReader -- | See examples in Control.Monad.Reader. Note, the partially -- applied function type (->) r is a simple reader monad. See -- the instance declaration below. class Monad m => MonadReader r (m :: Type -> Type) | m -> r -- | Retrieves the monad environment. ask :: MonadReader r m => m r -- | Executes a computation in a modified environment. local :: MonadReader r m => (r -> r) -> m a -> m a -- | Retrieves a function of the current environment. reader :: MonadReader r m => (r -> a) -> m a newtype Reader r a Reader :: (r -> a) -> Reader r a [runReader] :: Reader r a -> r -> a newtype ReaderT r (m :: Type -> Type) a ReaderT :: (r -> m a) -> ReaderT r (m :: Type -> Type) a [runReaderT] :: ReaderT r (m :: Type -> Type) a -> r -> m a -- | Retrieves a function of the current environment. asks :: MonadReader r m => (r -> a) -> m a instance GHC.Internal.Base.Applicative (Agda.Utils.StrictReader.Reader r) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Applicative (Agda.Utils.StrictReader.ReaderT r m) instance Agda.Utils.ExpandCase.ExpandCase a => Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictReader.Reader r a) instance Agda.Utils.ExpandCase.ExpandCase (m a) => Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictReader.ReaderT r m a) instance GHC.Internal.Base.Functor (Agda.Utils.StrictReader.Reader r) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Functor (Agda.Utils.StrictReader.ReaderT r m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Agda.Utils.StrictReader.ReaderT r m) instance GHC.Internal.Control.Monad.Fail.MonadFail m => GHC.Internal.Control.Monad.Fail.MonadFail (Agda.Utils.StrictReader.ReaderT r m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.Utils.StrictReader.ReaderT r m) instance GHC.Internal.Base.Monad (Agda.Utils.StrictReader.Reader r) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Utils.StrictReader.ReaderT r m) instance Control.Monad.Reader.Class.MonadReader r (Agda.Utils.StrictReader.Reader r) instance GHC.Internal.Base.Monad m => Control.Monad.Reader.Class.MonadReader r (Agda.Utils.StrictReader.ReaderT r m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Agda.Utils.StrictReader.ReaderT r m) instance Control.Monad.Trans.Control.MonadTransControl (Agda.Utils.StrictReader.ReaderT r) instance Control.Monad.Trans.Class.MonadTrans (Agda.Utils.StrictReader.ReaderT r) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Agda.Utils.StrictReader.ReaderT r m) instance GHC.Internal.Base.Monoid a => GHC.Internal.Base.Monoid (Agda.Utils.StrictReader.Reader r a) instance (GHC.Internal.Base.Monoid a, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Monoid (Agda.Utils.StrictReader.ReaderT r m a) instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Agda.Utils.StrictReader.Reader r a) instance (GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Semigroup (Agda.Utils.StrictReader.ReaderT r m a) -- | This is a plain strict state monad, where state update, monadic -- binding and return are all strict. If you only need a single strict -- state effect, use this module. -- -- Do not use Control.Monad.State.Strict for the same purpose; -- it's not even strict in state updates and is much less amenable -- to GHC optimizations than this module. module Agda.Utils.StrictState -- | Minimal definition is either both of get and put or -- just state class Monad m => MonadState s (m :: Type -> Type) | m -> s -- | Return the state from the internals of the monad. get :: MonadState s m => m s -- | Replace the state inside the monad. put :: MonadState s m => s -> m () -- | Embed a simple state action into the monad. state :: MonadState s m => (s -> (a, s)) -> m a evalState :: State s a -> s -> a evalStateT :: Monad m => StateT s m a -> s -> m a execState :: State s a -> s -> s execStateT :: Monad m => StateT s m a -> s -> m s gets :: MonadState s m => (s -> a) -> m a modify :: MonadState s m => (s -> s) -> m () runState :: State s a -> s -> (a, s) runStateT :: Monad m => StateT s m a -> s -> m (a, s) newtype State s a State :: (s -> (# a, s #)) -> State s a [runState#] :: State s a -> s -> (# a, s #) newtype StateT s (m :: Type -> Type) a StateT :: (s -> m (Pair a s)) -> StateT s (m :: Type -> Type) a [runStateT#] :: StateT s (m :: Type -> Type) a -> s -> m (Pair a s) instance GHC.Internal.Base.Applicative (Agda.Utils.StrictState.State s) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Applicative (Agda.Utils.StrictState.StateT s m) instance Agda.Utils.ExpandCase.ExpandCase (m (Data.Strict.Tuple.Pair a s)) => Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictState.StateT s m a) instance GHC.Internal.Base.Functor (Agda.Utils.StrictState.State s) instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.Utils.StrictState.StateT s m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Agda.Utils.StrictState.StateT s m) instance GHC.Internal.Control.Monad.Fail.MonadFail m => GHC.Internal.Control.Monad.Fail.MonadFail (Agda.Utils.StrictState.StateT s m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.Utils.StrictState.StateT s m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Agda.Utils.StrictState.StateT s m) instance GHC.Internal.Base.Monad (Agda.Utils.StrictState.State s) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Utils.StrictState.StateT s m) instance Control.Monad.State.Class.MonadState s (Agda.Utils.StrictState.State s) instance GHC.Internal.Base.Monad m => Control.Monad.State.Class.MonadState s (Agda.Utils.StrictState.StateT s m) instance Control.Monad.Trans.Control.MonadTransControl (Agda.Utils.StrictState.StateT s) instance Control.Monad.Trans.Class.MonadTrans (Agda.Utils.StrictState.StateT s) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Agda.Utils.StrictState.StateT s m) -- | This is a strict state monad, where state update, monadic binding and -- return are all strict. It is specialized to the case where we have -- (s, t) for state, i.e. two state components. The reason for -- specialization is that GHC cannot reliably unbox State (s, t) -- for any definition of plain State, so we need to directly use -- unboxed tuples for two state components in the internals. -- -- If you need two strict state components and no other effects, use this -- module. Do not use Control.Monad.State.Strict for the same -- purpose; it's not even strict in state updates and is much less -- amenable to GHC optimizations than this module. module Agda.Utils.StrictState2 newtype State s t a State :: (s -> t -> (# a, s, t #)) -> State s t a [runState#] :: State s t a -> s -> t -> (# a, s, t #) put :: s -> t -> State s t () put1 :: s -> State s t () put2 :: t -> State s t () get :: State s t (s, t) get1 :: State s t s get2 :: State s t t gets :: ((s, t) -> a) -> State s t a modify :: ((s, t) -> (s, t)) -> State s t () modify1 :: (s -> s) -> State s t () modify2 :: (t -> t) -> State s t () execState :: State s t a -> (s, t) -> (s, t) runState :: State s t a -> (s, t) -> (a, (s, t)) evalState :: State s t a -> (s, t) -> a instance GHC.Internal.Base.Applicative (Agda.Utils.StrictState2.State s t) instance GHC.Internal.Base.Functor (Agda.Utils.StrictState2.State s t) instance GHC.Internal.Base.Monad (Agda.Utils.StrictState2.State s t) -- | This is a very strict Writer monad, as a wrapper on -- Agda.Utils.StrictState. module Agda.Utils.StrictWriter class (Monoid w, Monad m) => MonadWriter w (m :: Type -> Type) | m -> w -- | writer (a,w) embeds a simple writer action. writer :: MonadWriter w m => (a, w) -> m a -- | tell w is an action that produces the output -- w. tell :: MonadWriter w m => w -> m () -- | listen m is an action that executes the action -- m and adds its output to the value of the computation. listen :: MonadWriter w m => m a -> m (a, w) -- | pass m is an action that executes the action -- m, which returns a value and a function, and returns the -- value, applying the function to the output. pass :: MonadWriter w m => m (a, w -> w) -> m a -- | censor f m is an action that executes the action -- m and applies the function f to its output, leaving -- the return value unchanged. -- -- censor :: MonadWriter w m => (w -> w) -> m a -> m a execWriter :: Monoid w => Writer w a -> w execWriterT :: (Monoid w, Monad m) => WriterT w m a -> m w runWriter :: Monoid w => Writer w a -> (a, w) runWriterT :: (Monoid w, Monad m) => WriterT w m a -> m (a, w) newtype Writer w a Writer :: State w a -> Writer w a [unWriter] :: Writer w a -> State w a newtype WriterT w (m :: Type -> Type) a WriterT :: StateT w m a -> WriterT w (m :: Type -> Type) a [unWriterT] :: WriterT w (m :: Type -> Type) a -> StateT w m a instance GHC.Internal.Base.Applicative (Agda.Utils.StrictWriter.Writer w) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Applicative (Agda.Utils.StrictWriter.WriterT w m) instance Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictState.State w a) => Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictWriter.Writer w a) instance Agda.Utils.ExpandCase.ExpandCase (m (Data.Strict.Tuple.Pair a w)) => Agda.Utils.ExpandCase.ExpandCase (Agda.Utils.StrictWriter.WriterT w m a) instance GHC.Internal.Base.Functor (Agda.Utils.StrictWriter.Writer w) instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monad m, Control.Monad.Error.Class.MonadError e (Agda.Utils.StrictState.StateT w m)) => Control.Monad.Error.Class.MonadError e (Agda.Utils.StrictWriter.WriterT w m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monad m, Control.Monad.Reader.Class.MonadReader r (Agda.Utils.StrictState.StateT w m)) => Control.Monad.Reader.Class.MonadReader r (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monad m, Control.Monad.State.Class.MonadState s (Agda.Utils.StrictState.StateT w m)) => Control.Monad.State.Class.MonadState s (Agda.Utils.StrictWriter.WriterT w m) instance Control.Monad.Trans.Control.MonadTransControl (Agda.Utils.StrictWriter.WriterT w) instance Control.Monad.Trans.Class.MonadTrans (Agda.Utils.StrictWriter.WriterT w) instance GHC.Internal.Base.Monad (Agda.Utils.StrictWriter.Writer w) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Utils.StrictWriter.WriterT w m) instance GHC.Internal.Base.Monoid w => Control.Monad.Writer.Class.MonadWriter w (Agda.Utils.StrictWriter.Writer w) instance (GHC.Internal.Base.Monoid w, GHC.Internal.Base.Monad m) => Control.Monad.Writer.Class.MonadWriter w (Agda.Utils.StrictWriter.WriterT w m) module Agda.Utils.Suffix -- | Is the character one of the subscripts '₀'-'₉'? isSubscriptDigit :: Char -> Bool -- | Converts '0'-'9' to '₀'-'₉' -- -- Precondition: The digit needs to be in range. toSubscriptDigit :: Char -> Char -- | Converts '₀'-'₉' to '0'-'9'. -- -- Precondition: The digit needs to be in range. fromSubscriptDigit :: Char -> Char -- | Classification of identifier variants. data Suffix -- | Identifier ends in Integer many primes. Prime :: Integer -> Suffix -- | Identifier ends in number Integer (ordinary digits). Index :: Integer -> Suffix -- | Identifier ends in number Integer (subscript digits). Subscript :: Integer -> Suffix -- | Increase the suffix by one. nextSuffix :: Suffix -> Suffix -- | Parse suffix. suffixView :: String -> (String, Maybe Suffix) -- | Print suffix. renderSuffix :: Suffix -> String addSuffix :: String -> Suffix -> String -- | Tools for 3-way partitioning. module Agda.Utils.Three -- | Enum type with 3 elements. data Three One :: Three Two :: Three Three :: Three -- | Partition a list into 3 groups. -- -- Preserves the relative order or elements. partition3 :: (a -> Three) -> [a] -> ([a], [a], [a]) -- | Disjoint sum of three. data Either3 a b c In1 :: a -> Either3 a b c In2 :: b -> Either3 a b c In3 :: c -> Either3 a b c -- | Partition a list into 3 groups. -- -- Preserves the relative order or elements. partitionEithers3 :: [Either3 a b c] -> ([a], [b], [c]) mapEither3 :: (a -> Either3 b c d) -> [a] -> ([b], [c], [d]) mapEither3M :: Applicative m => (a -> m (Either3 b c d)) -> [a] -> m ([b], [c], [d]) forEither3M :: Applicative m => [a] -> (a -> m (Either3 b c d)) -> m ([b], [c], [d]) -- | Convert a Three tagged thing into an Either3. mkEither3 :: (Three, a) -> Either3 a a a instance GHC.Internal.Enum.Bounded Agda.Utils.Three.Three instance GHC.Internal.Enum.Enum Agda.Utils.Three.Three instance (GHC.Internal.Classes.Eq a, GHC.Internal.Classes.Eq b, GHC.Internal.Classes.Eq c) => GHC.Internal.Classes.Eq (Agda.Utils.Three.Either3 a b c) instance GHC.Internal.Classes.Eq Agda.Utils.Three.Three instance (GHC.Internal.Classes.Ord a, GHC.Internal.Classes.Ord b, GHC.Internal.Classes.Ord c) => GHC.Internal.Classes.Ord (Agda.Utils.Three.Either3 a b c) instance GHC.Internal.Classes.Ord Agda.Utils.Three.Three instance (GHC.Internal.Show.Show a, GHC.Internal.Show.Show b, GHC.Internal.Show.Show c) => GHC.Internal.Show.Show (Agda.Utils.Three.Either3 a b c) instance GHC.Internal.Show.Show Agda.Utils.Three.Three module Agda.Utils.Tuple -- | Strict pairing. (//) :: a -> b -> (a, b) infixr 4 // -- | Split the input between the two argument arrows and combine their -- output. Note that this is in general not a functor. -- -- The default definition may be overridden with a more efficient version -- if desired. -- --
--     b ╭─────╮ c
--   >───┼─ f ─┼───>
--   >───┼─ g ─┼───>
--     b'╰─────╯ c'
--   
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c') infixr 3 *** -- | Fanout: send the input to both argument arrows and combine their -- output. -- -- The default definition may be overridden with a more efficient version -- if desired. -- --
--       ╭───────╮ c
--     b │ ┌─ f ─┼───>
--   >───┼─┤     │
--       │ └─ g ─┼───>
--       ╰───────╯ c'
--   
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 &&& -- | Map covariantly over the first argument. -- --
--   first f ≡ bimap f id
--   
-- --

Examples

-- --
--   >>> first toUpper ('j', 3)
--   ('J',3)
--   
-- --
--   >>> first toUpper (Left 'j')
--   Left 'J'
--   
first :: Bifunctor p => (a -> b) -> p a c -> p b c -- | Map covariantly over the second argument. -- --
--   second ≡ bimap id
--   
-- --

Examples

-- --
--   >>> second (+1) ('j', 3)
--   ('j',4)
--   
-- --
--   >>> second (+1) (Right 3)
--   Right 4
--   
second :: Bifunctor p => (b -> c) -> p a b -> p a c -- | Order a pair. sortPair :: Ord a => (a, a) -> (a, a) fst3 :: (a, b, c) -> a snd3 :: (a, b, c) -> b thd3 :: (a, b, c) -> c -- | Swap the components of a pair. swap :: (a, b) -> (b, a) uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e -- | Monadic version of ***. mapPairM :: Applicative m => (a -> m c) -> (b -> m d) -> (a, b) -> m (c, d) -- | Monadic first. firstM :: Functor m => (a -> m c) -> (a, b) -> m (c, b) -- | Monadic second. secondM :: Functor m => (b -> m d) -> (a, b) -> m (a, d) data Pair a Pair :: a -> a -> Pair a instance GHC.Internal.Base.Applicative Agda.Utils.Tuple.Pair instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.Tuple.Pair a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.Tuple.Pair instance GHC.Internal.Base.Functor Agda.Utils.Tuple.Pair instance GHC.Internal.Generics.Generic (Agda.Utils.Tuple.Pair a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.Tuple.Pair a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.Tuple.Pair a) instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.Tuple.Pair -- | Additional functions for association lists. module Agda.Utils.AssocList -- | Lookup keys in the same association list often. Use partially applied -- to create partial function apply m :: k -> Maybe v. -- -- -- -- Specification: apply m == (lookup m). apply :: Ord k => AssocList k v -> k -> Maybe v -- | O(n). Delete a binding. The key must be in the domain of the finite -- map. Otherwise, an internal error is raised. delete :: Eq k => k -> AssocList k v -> AssocList k v -- | O(1). Add a new binding. Assumes the binding is not yet in the list. insert :: k -> v -> AssocList k v -> AssocList k v -- | O(n). Get the domain (list of keys) of the finite map. keys :: AssocList k v -> [k] -- | O(n). Named in analogy to mapKeysMonotonic. To preserve the -- invariant, it is sufficient that the key transformation is injective -- (rather than monotonic). mapKeysMonotonic :: (k -> k') -> AssocList k v -> AssocList k' v -- | O(n). Map over an association list, preserving the order. mapWithKey :: (k -> v -> v) -> AssocList k v -> AssocList k v -- | O(n). If called with a effect-producing function, violation of the -- invariant could matter here (duplicating effects). mapWithKeyM :: Applicative m => (k -> v -> m v) -> AssocList k v -> m (AssocList k v) -- | O(n). Update the value at a key. The key must be in the domain of the -- finite map. Otherwise, an internal error is raised. update :: Eq k => k -> v -> AssocList k v -> AssocList k v -- | O(n). Update the value at a key with a certain function. The key must -- be in the domain of the finite map. Otherwise, an internal error is -- raised. updateAt :: Eq k => k -> (v -> v) -> AssocList k v -> AssocList k v -- | A finite map, represented as a set of pairs. -- -- Invariant: at most one value per key. type AssocList k v = [(k, v)] -- | <math>. lookup key assocs looks up a key in an -- association list. For the result to be Nothing, the list must -- be finite. -- --

Examples

-- --
--   >>> lookup 2 []
--   Nothing
--   
-- --
--   >>> lookup 2 [(1, "first")]
--   Nothing
--   
-- --
--   >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")]
--   Just "second"
--   
lookup :: Eq a => a -> [(a, b)] -> Maybe b -- | Complement Data.Strict.Tuple. module Agda.Utils.Tuple.Strict -- | Strict version of (&&&). (&!&) :: (a -> b) -> (a -> c) -> a -> Pair b c infixr 3 &!& curry :: (Pair a b -> c) -> a -> b -> c fst :: Pair a b -> a snd :: Pair a b -> b swap :: Pair a b -> Pair b a uncurry :: (a -> b -> c) -> Pair a b -> c unzip :: [Pair a b] -> ([a], [b]) zip :: [a] -> [b] -> [Pair a b] type (:!:) = Pair data Pair a b (:!:) :: a -> b -> Pair a b module Agda.Utils.TypeLevel -- | All p as ensures that the constraint p is satisfied -- by all the types in as. (Types is between -- scare-quotes here because the code is actually kind polymorphic) type family All (p :: k -> Constraint) (as :: [k]) -- | On Booleans type family If (b :: Bool) (l :: k) (r :: k) :: k type Not (b :: Bool) = If b 'False 'True -- | On Lists type family Foldr (c :: k -> l -> l) (n :: l) (as :: [k]) :: l -- | Version of Foldr taking a defunctionalised argument so that -- we can use partially applied functions. type family Foldr' (c :: Function k Function l l -> Type -> Type) (n :: l) (as :: [k]) :: l type family Map (f :: Function k l -> Type) (as :: [k]) :: [l] data ConsMap0 (a :: Function k l -> Type) (b :: Function k Function [l] [l] -> Type) data ConsMap1 (a :: Function k l -> Type) (b :: k) (c :: Function [l] [l]) type family Constant b (as :: [k]) :: [Type] data Nat Zero :: Nat Suc :: Nat -> Nat type family Arity t :: Nat type family IsZero (n :: Nat) :: Bool type IsBase t = IsZero Arity t -- | Arrows [a1,..,an] r corresponds to a1 -> .. -> an -- -> r | Products [a1,..,an] corresponds to (a1, -- (..,( an, ())..)) type Arrows (as :: [Type]) r = Foldr (->) r as type Products (as :: [Type]) = Foldr (,) () as data StrictPair a b Pair :: a -> b -> StrictPair a b type StrictProducts (as :: [Type]) = Foldr StrictPair () as strictCurry :: (StrictPair a b -> c) -> a -> b -> c strictUncurry :: (a -> b -> c) -> StrictPair a b -> c -- | Using IsBase we can define notions of Domains and -- CoDomains which *reduce* under positive information -- IsBase t ~ 'True even though the shape of t is not -- formally exposed type family Domains t :: [Type] type family Domains' t :: [Type] type family CoDomain t type family CoDomain' t -- | Currying as b witnesses the isomorphism between Arrows as -- b and Products as -> b. It is defined as a type class -- rather than by recursion on a singleton for as so all of that -- these conversions are inlined at compile time for concrete arguments. class Currying (as :: [Type]) b uncurrys :: Currying as b => Proxy as -> Proxy b -> Arrows as b -> Products as -> b currys :: Currying as b => Proxy as -> Proxy b -> (Products as -> b) -> Arrows as b class StrictCurrying (as :: [Type]) b strictUncurrys :: StrictCurrying as b => Proxy as -> Proxy b -> Arrows as b -> StrictProducts as -> b strictCurrys :: StrictCurrying as b => Proxy as -> Proxy b -> (StrictProducts as -> b) -> Arrows as b data Function a b data Constant0 (c :: Function a Function b a -> Type) data Constant1 c (d :: Function b a) type family Apply (t :: Function k l -> Type) (u :: k) :: l instance Agda.Utils.TypeLevel.Currying as b => Agda.Utils.TypeLevel.Currying (a : as) b instance Agda.Utils.TypeLevel.Currying '[] b instance Agda.Utils.TypeLevel.StrictCurrying as b => Agda.Utils.TypeLevel.StrictCurrying (a : as) b instance Agda.Utils.TypeLevel.StrictCurrying '[] b -- | Type level literals, inspired by GHC.TypeLits. module Agda.Utils.TypeLits -- | Singleton for type level booleans. data SBool (b :: Bool) [STrue] :: SBool 'True [SFalse] :: SBool 'False eraseSBool :: forall (b :: Bool). SBool b -> Bool -- | A known boolean is one we can obtain a singleton for. Concrete values -- are trivially known. class KnownBool (b :: Bool) boolSing :: KnownBool b => SBool b boolVal :: forall proxy (b :: Bool). KnownBool b => proxy b -> Bool instance Agda.Utils.TypeLits.KnownBool 'GHC.Internal.Types.False instance Agda.Utils.TypeLits.KnownBool 'GHC.Internal.Types.True module Agda.Utils.Unsafe -- | Checks if two arguments are equal as pointers in memory. Please note, -- that this function is a hack, and it can worsen the behavior of -- compiler. See -- https://gitlab.haskell.org/ghc/ghc/-/blob/d151546e59a50158f25c3df6728b00d3c27bb4b9/compiler/GHC/Builtin/primops.txt.pp#L3455. unsafeComparePointers :: a -> a -> Bool module Agda.Utils.Update -- | The ChangeT monad transformer. data ChangeT (m :: Type -> Type) a -- | Run a ChangeT computation, returning result plus change flag. runChangeT :: Functor m => ChangeT m a -> m (a, Bool) -- | Map a ChangeT computation (monad transformer action). mapChangeT :: (m (a, Any) -> n (b, Any)) -> ChangeT m a -> ChangeT n b type UpdaterT (m :: Type -> Type) a = a -> ChangeT m a -- | Blindly run an updater. runUpdaterT :: Functor m => UpdaterT m a -> a -> m (a, Bool) type Change a = ChangeT Identity a -- | The class of change monads. class Monad m => MonadChange (m :: Type -> Type) tellDirty :: MonadChange m => m () listenDirty :: MonadChange m => m a -> m (a, Bool) -- | Run a Change computation, returning result plus change flag. runChange :: Change a -> (a, Bool) type Updater a = UpdaterT Identity a -- | Replace result of updating with original input if nothing has changed. sharing :: forall (m :: Type -> Type) a. Monad m => UpdaterT m a -> UpdaterT m a -- | Blindly run an updater. runUpdater :: Updater a -> a -> (a, Bool) -- | Mark a computation as dirty. dirty :: forall (m :: Type -> Type) a. Monad m => UpdaterT m a ifDirty :: MonadChange m => m a -> (a -> m b) -> (a -> m b) -> m b -- | Like Functor, but preserving sharing. class Traversable f => Updater1 (f :: Type -> Type) updater1 :: Updater1 f => Updater a -> Updater (f a) updates1 :: Updater1 f => Updater a -> Updater (f a) update1 :: Updater1 f => Updater a -> EndoFun (f a) -- | Like Bifunctor, but preserving sharing. class Updater2 (f :: Type -> Type -> Type) updater2 :: Updater2 f => Updater a -> Updater b -> Updater (f a b) updates2 :: Updater2 f => Updater a -> Updater b -> Updater (f a b) update2 :: Updater2 f => Updater a -> Updater b -> EndoFun (f a b) instance GHC.Internal.Base.Applicative m => GHC.Internal.Base.Applicative (Agda.Utils.Update.ChangeT m) instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.Utils.Update.ChangeT m) instance GHC.Internal.Base.Monad m => Agda.Utils.Update.MonadChange (Agda.Utils.Update.ChangeT m) instance Agda.Utils.Update.MonadChange GHC.Internal.Data.Functor.Identity.Identity instance GHC.Internal.Base.Monad m => Agda.Utils.Update.MonadChange (Control.Monad.Trans.Identity.IdentityT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Utils.Update.ChangeT m) instance GHC.Internal.Control.Monad.Fail.MonadFail m => GHC.Internal.Control.Monad.Fail.MonadFail (Agda.Utils.Update.ChangeT m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.Utils.Update.ChangeT m) instance Control.Monad.Trans.Class.MonadTrans Agda.Utils.Update.ChangeT instance Control.Monad.Trans.Control.MonadTransControl Agda.Utils.Update.ChangeT instance Agda.Utils.Update.Updater1 [] instance Agda.Utils.Update.Updater1 GHC.Internal.Maybe.Maybe instance Agda.Utils.Update.Updater2 GHC.Internal.Data.Either.Either instance Agda.Utils.Update.Updater2 (,) -- | Utilities for working with Word and Word#. module Agda.Utils.Word splitW64 :: Word64 -> (Word32, Word32) packW64 :: Word32 -> Word32 -> Word64 -- | Create a Word# with the ith bit set. -- -- The result of uncheckedBitWord# is undefined when i is -- not in the range [0..WORD_SIZE_IN_BITS]. uncheckedBitWord# :: Int# -> Word# -- | Clear a single bit in an unboxed word. -- -- The result of uncheckedClearBitWord# is undefined when -- i is not in the range [0..WORD_SIZE_IN_BITS]. uncheckedClearBitWord# :: Word# -> Int# -> Word# -- | Set a single bit in an unboxed word. -- -- The result of uncheckedSetBitWord# is undefined when i -- is not in the range [0..WORD_SIZE_IN_BITS]. uncheckedSetBitWord# :: Word# -> Int# -> Word# -- | Test a single bit in an unboxed word. -- -- The result of uncheckedTestBitWord# is undefined when -- i is not in the range [0..WORD_SIZE_IN_BITS]. uncheckedTestBitWord# :: Word# -> Int# -> Int# -- | Get the bit-index of the highest set bit. highestBitWord# :: Word# -> Word# -- | Get the bit-index of the lowest set bit. lowestBitWord# :: Word# -> Word# -- | Are the bit representations of two words disjoint? disjointWord# :: Word# -> Word# -> Int# -- | Take the bitwise AND of the first argument with the complement of the -- second. andNot# :: Word# -> Word# -> Word# -- | Create a Word# where the first n bits are 1. -- -- The result of uncheckedWordOnes# is undefined when i -- is not in the range [0..WORD_SIZE_IN_BITS]. uncheckedWordOnes# :: Int# -> Word# -- | wordFoldrBits# f a w performs a lazy right fold over the bits -- of w. wordFoldrBits# :: (Int -> a -> a) -> a -> Word# -> a -- | wordFoldlBits# f a w performs a lazy left fold over the bits -- of w. wordFoldlBits# :: (a -> Int -> a) -> a -> Word# -> a -- | wordFoldrBitsOffset# offset f a w performs a right fold over -- the bits of w, with every bit index passed to f -- offset by offset. wordFoldrBitsOffset# :: Int# -> (Int -> a -> a) -> a -> Word# -> a -- | wordFoldlBitsOffset# offset f a w performs a lazy left fold -- over the bits of w, with every bit index passed to f -- offset by offset. wordFoldlBitsOffset# :: Int# -> (a -> Int -> a) -> a -> Word# -> a -- | wordFoldrBitsStrict# f a w performs a strict right fold over -- the bits of w. wordFoldrBitsStrict# :: (Int -> a -> a) -> a -> Word# -> a -- | wordFoldlBitsStrict# f a w performs a strict left fold over -- the bits of w. wordFoldlBitsStrict# :: (a -> Int -> a) -> a -> Word# -> a -- | wordFoldrBitsOffsetStrict# offset f a w performs a strict -- right fold over the bits of w, with every bit index passed to -- f offset by offset. wordFoldrBitsOffsetStrict# :: Int# -> (Int -> a -> a) -> a -> Word# -> a -- | wordFoldrBitsOffsetStrict# offset f a w performs a strict -- right fold over the bits of w, with every bit index passed to -- f offset by offset. wordFoldlBitsOffsetStrict# :: Int# -> (a -> Int -> a) -> a -> Word# -> a -- | Utilities for working with ByteArray and ByteArray#. module Agda.Utils.ByteArray -- | Construct a ByteArray# consisting of n 1 bits. byteArrayOnes# :: Int# -> ByteArray# -- | Check that if the set bits of a ByteArray# are a subset of -- another ByteArray#. byteArrayIsSubsetOf# :: ByteArray# -> ByteArray# -> Int# -- | Check if two ByteArray#s are bitwise disjoint. byteArrayDisjoint# :: ByteArray# -> ByteArray# -> Int# -- | Perform a lazy right fold over the bit indicies of a -- ByteArray#. byteArrayFoldrBits# :: (Int -> a -> a) -> a -> ByteArray# -> a -- | Perform a lazy left fold over the bit indicies of a ByteArray#. byteArrayFoldlBits# :: (a -> Int -> a) -> a -> ByteArray# -> a -- | Perform a strict right fold over the bit indicies of a -- ByteArray#. byteArrayFoldrBitsStrict# :: (Int -> a -> a) -> a -> ByteArray# -> a -- | Perform a strict left fold over the bit indicies of a -- ByteArray#. byteArrayFoldlBitsStrict# :: (a -> Int -> a) -> a -> ByteArray# -> a -- | Manage sets of natural numbers (de Bruijn indices). -- -- This file contains an implementation of finite sets of integers that -- is optimized for storing sets of free variables. Notably, de Bruijn -- indices/levels are not uniformly distributed across the range of -- Int, and are always very small (EG: less than 64). -- -- This makes IntSet somewhat ill-suited for the task. -- IntSet is designed to be able to handle values distributed -- across the entire range of Int, at the cost of pointer -- indirections and poor memory locality. -- -- Instead, VarSet stores free variables as a bitvector. When the -- elements in the set are all smaller than 64, we can fit the entire set -- into a single unboxed Word#, which makes most of our set -- operations a single instruction. -- -- When we exceed this bound, we fall back to an unboxed -- ByteArray#. Experimentally, this happens less than 0.0001% of -- the time. -- --

Experimental Results

-- -- Agda builds instrumented with traceVarSetSize give the -- following statistics for VarSet sizes across the following -- libraries: -- -- TODO: table module Agda.Utils.VarSet -- | A set of de Bruijn indices/levels. data VarSet -- | A variable set whose maximum entry is greater than or equal to 64. VB# :: ByteArray# -> VarSet -- | A small variable set whose maximum entry is less than than 64. VS# :: Word# -> VarSet -- | The empty variable set. empty :: VarSet -- | A variable set with only a single entry. singleton :: Int -> VarSet -- | Construct a set of variables from a list of indices. fromList :: [Int] -> VarSet -- | Construct a set of variables from a list of indices sorted in -- descending order. This can be more efficient than fromList, as -- we only need to perform a single to determine that elements of the -- list are smaller than 64. -- -- The precondition that the variables are sorted in descending order is -- not checked by fromDescList. fromDescList :: [Int] -> VarSet -- | Construct a variable set that contains the indices [0..n-1]. full :: Int -> VarSet -- | Construct a variable set that contains the indices -- [lo+1..hi-1]. range :: Int -> Int -> VarSet -- | Insert an index into a variable set. insert :: Int -> VarSet -> VarSet -- | Insert a list of variables into a VarSet. inserts :: [Int] -> VarSet -> VarSet -- | Insert a list of variables sorted in descending order into a -- VarSet. This can be more efficient than inserts, as we -- only need to perform a single to determine that elements of the list -- are smaller than 64. -- -- The precondition that the variables are sorted in descending order is -- not checked by insertsDesc. insertsDesc :: [Int] -> VarSet -> VarSet -- | Delete an index from a variable set. delete :: Int -> VarSet -> VarSet -- | Is this the empty set? null :: VarSet -> Bool -- | Is a variable a member of a var set? member :: Int -> VarSet -> Bool -- | Find the smallest index in the variable set. lookupMin :: VarSet -> Maybe Int -- | Find the largest index in the variable set. lookupMax :: VarSet -> Maybe Int -- | The number of entries in the variable set. size :: VarSet -> Int -- | Check if two variable sets are disjoint. disjoint :: VarSet -> VarSet -> Bool -- | isSubsetOf vs1 vs2 determines if vs1 is a subset of -- vs2. isSubsetOf :: VarSet -> VarSet -> Bool -- | inRange lo hi vs determines if all the variables in -- vs are within the range [lo+1 .. hi-1]. inRange :: Int -> Int -> VarSet -> Bool -- | Union two variable sets. union :: VarSet -> VarSet -> VarSet -- | Union a collection of variable sets together. unions :: Foldable f => f VarSet -> VarSet -- | Take the intersection of two variable sets. intersection :: VarSet -> VarSet -> VarSet -- | Set difference of two variable sets. difference :: VarSet -> VarSet -> VarSet -- | Infix operator for difference. (\\) :: VarSet -> VarSet -> VarSet -- | Take a relative complement of a variable set. complement :: Int -> VarSet -> VarSet -- | Split a variable set into elements that are strictly smaller than -- n and elements that are strictly larger. -- -- Note that this is strict in both components of the pair. If you only -- need one half, use filterLT or filterGT. split :: Int -> VarSet -> (VarSet, VarSet) -- | Filter a variable set to elements that are less than to an index. filterLT :: Int -> VarSet -> VarSet -- | Filter a variable set to elements that are less than or equal to an -- index. filterLE :: Int -> VarSet -> VarSet -- | Filter a variable set to elements that are greater than to an index. filterGT :: Int -> VarSet -> VarSet -- | Filter a variable set to elements that are greater than or equal to an -- index. filterGE :: Int -> VarSet -> VarSet -- | Lazily fold over the elements of a variable set in ascending order. foldr :: (Int -> a -> a) -> a -> VarSet -> a -- | Lazily fold over the elements of a variable set in descending order. -- -- This does not have the same deficiencies foldl, as we can start -- the fold at the back of the VarSet. foldl :: (a -> Int -> a) -> a -> VarSet -> a -- | Strictly fold over the elements of a variable set in ascending order. -- -- This does not have the same deficiencies foldr', as we can -- start the fold at the back of the VarSet. foldr' :: (Int -> a -> a) -> a -> VarSet -> a -- | Strictly fold over the elements of a variable set in descending order. foldl' :: (Int -> a -> a) -> a -> VarSet -> a -- | Retrieve the smallest index in the variable set along with the set -- sans that element, or Nothing if the set was empty. minView :: VarSet -> Maybe (Int, VarSet) -- | Retrieve the smallest index in the variable set along with the set -- sans that element, or Nothing if the set was empty. maxView :: VarSet -> Maybe (Int, VarSet) -- | Remove the first n entries from the variable set, and shift -- the indices of all other entries down by n. strengthen :: Int -> VarSet -> VarSet -- | Shift all indices in the variable set up by n. weaken :: Int -> VarSet -> VarSet -- | Convert a variable set to a descending list of indices. toDescList :: VarSet -> [Int] -- | Convert a variable set to an ascending list of indices. toAscList :: VarSet -> [Int] instance GHC.Internal.Classes.Eq Agda.Utils.VarSet.VarSet instance Data.Hashable.Class.Hashable Agda.Utils.VarSet.VarSet instance GHC.Internal.Base.Monoid Agda.Utils.VarSet.VarSet instance Control.DeepSeq.NFData Agda.Utils.VarSet.VarSet instance GHC.Internal.Classes.Ord Agda.Utils.VarSet.VarSet instance GHC.Internal.Base.Semigroup Agda.Utils.VarSet.VarSet instance Agda.Utils.Serialize.Serialize Agda.Utils.VarSet.VarSet instance GHC.Internal.Show.Show Agda.Utils.VarSet.VarSet -- | Overloaded null and empty for collections and -- sequences. module Agda.Utils.Null class Null a empty :: Null a => a -- | Satisfying null empty == True. null :: Null a => a -> Bool -- | The default implementation of null compares with empty, -- first trying pointer equality, then falling back to Eq -- equality. ($dmnull) :: (Null a, Eq a) => a -> Bool ifNull :: Null a => a -> b -> (a -> b) -> b ifNotNull :: Null a => a -> (a -> b) -> b -> b ifNullM :: (Monad m, Null a) => m a -> m b -> (a -> m b) -> m b ifNotNullM :: (Monad m, Null a) => m a -> (a -> m b) -> m b -> m b whenNull :: (Monad m, Null a) => a -> m () -> m () unlessNull :: (Monad m, Null a) => a -> (a -> m ()) -> m () whenNullM :: (Monad m, Null a) => m a -> m () -> m () unlessNullM :: (Monad m, Null a) => m a -> (a -> m ()) -> m () applyUnlessNull :: Null a => a -> (a -> b -> b) -> b -> b -- | Disjunction (interpreting null _ as False). catchNull :: Null a => a -> a -> a instance Agda.Utils.Null.Null (Agda.Utils.Bag.Bag a) instance Agda.Utils.Null.Null GHC.Internal.Types.Bool instance Agda.Utils.Null.Null Data.ByteString.Lazy.Internal.ByteString instance Agda.Utils.Null.Null Data.ByteString.Internal.Type.ByteString instance Agda.Utils.Null.Null (Text.PrettyPrint.Annotated.HughesPJ.Doc a) instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (GHC.Internal.Data.Either.Either e a) instance Agda.Utils.Null.Null (Data.EnumMap.Base.EnumMap k a) instance Agda.Utils.Null.Null (Data.EnumSet.EnumSet a) instance (Agda.Utils.Null.Null (m a), GHC.Internal.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.Except.ExceptT e m a) instance Agda.Utils.Null.Null (Data.HashMap.Internal.HashMap k a) instance Agda.Utils.Null.Null (Data.HashSet.Internal.HashSet a) instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (GHC.Internal.Types.IO a) instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (GHC.Internal.Data.Functor.Identity.Identity a) instance Agda.Utils.Null.Null (Data.IntMap.Internal.IntMap a) instance Agda.Utils.Null.Null Data.IntSet.Internal.IntSet instance Agda.Utils.Null.Null [a] instance Agda.Utils.Null.Null (Data.Map.Internal.Map k a) instance Agda.Utils.Null.Null (GHC.Internal.Maybe.Maybe a) instance (Agda.Utils.Null.Null (m a), GHC.Internal.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.Maybe.MaybeT m a) instance (Agda.Utils.Null.Null (m a), GHC.Internal.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.Reader.ReaderT r m a) instance Agda.Utils.Null.Null (Data.Sequence.Internal.Seq a) instance Agda.Utils.Null.Null (Data.Set.Internal.Set a) instance (Agda.Utils.Null.Null (m a), GHC.Internal.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.State.Lazy.StateT s m a) instance Agda.Utils.Null.Null Data.Text.Internal.Text instance (Agda.Utils.Null.Null a, Agda.Utils.Null.Null b) => Agda.Utils.Null.Null (a, b) instance (Agda.Utils.Null.Null a, Agda.Utils.Null.Null b, Agda.Utils.Null.Null c) => Agda.Utils.Null.Null (a, b, c) instance (Agda.Utils.Null.Null a, Agda.Utils.Null.Null b, Agda.Utils.Null.Null c, Agda.Utils.Null.Null d) => Agda.Utils.Null.Null (a, b, c, d) instance Agda.Utils.Null.Null () instance Agda.Utils.Null.Null Agda.Utils.VarSet.VarSet instance Agda.Utils.Null.Null GHC.Internal.Word.Word32 instance Agda.Utils.Null.Null GHC.Internal.Word.Word64 instance (Agda.Utils.Null.Null (m a), GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid w) => Agda.Utils.Null.Null (Control.Monad.Trans.Writer.Lazy.WriterT w m a) -- | Potentially uninitialised Booleans. -- -- The motivation for this small library is to distinguish between a -- boolean option with a default value and an option which has been set -- to what happens to be the default value. In one case the default can -- be overriden (e.g. --cubical implies --without-K) -- while in the other case the user has made a mistake which they need to -- fix. module Agda.Utils.WithDefault -- | We don't want to have to remember for each flag whether its default -- value is True or False. So we bake it into the -- representation: the flag's type will mention its default value as a -- phantom parameter. data WithDefault' a (b :: Bool) Default :: WithDefault' a (b :: Bool) Value :: a -> WithDefault' a (b :: Bool) type WithDefault (b :: Bool) = WithDefault' Bool b -- | The main mode of operation of these flags, apart from setting them -- explicitly, is to toggle them one way or the other if they hadn't been -- set already. setDefault :: forall a (b :: Bool). a -> WithDefault' a b -> WithDefault' a b not' :: forall (b :: Bool). WithDefault b -> WithDefault (Not b) -- | Provided that the default value is a known boolean (in practice we -- only use True or False), we can collapse a -- potentially uninitialised value to a boolean. collapseDefault :: forall a (b :: Bool). (Boolean a, KnownBool b) => WithDefault' a b -> a -- | Focus, overwriting Default. lensCollapseDefault :: forall a (b :: Bool). (Boolean a, KnownBool b) => Lens' (WithDefault' a b) a -- | Update, but keep Default when new value is default value. lensKeepDefault :: forall a (b :: Bool). (Boolean a, Eq a, KnownBool b) => Lens' (WithDefault' a b) a instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.WithDefault.WithDefault' a b) instance Control.DeepSeq.NFData (Agda.Utils.WithDefault.WithDefault' a b) instance Agda.Utils.Null.Null (Agda.Utils.WithDefault.WithDefault' a b) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.WithDefault.WithDefault' a b) -- | Small sets represented as a bitmask for fast membership checking. -- -- With the exception of converting to/from lists, all operations are -- O(1). -- -- Mimics the interface of Set. -- -- Import as: import Agda.Utils.SmallSet (SmallSet) import -- Agda.Utils.SmallSet qualified as SmallSet module Agda.Utils.SmallSet newtype SmallSet a SmallSet :: Word64 -> SmallSet a [theSmallSet] :: SmallSet a -> Word64 -- | An element in a small set. -- -- This must implement Bounded and Ix, and contain at most -- 64 values. class (Bounded a, Ix a) => SmallSetElement a -- | The Ix class is used to map a contiguous subrange of values in -- a type onto integers. It is used primarily for array indexing (see the -- array package). -- -- The first argument (l,u) of each of these operations is a -- pair specifying the lower and upper bounds of a contiguous subrange of -- values. -- -- An implementation is entitled to assume the following laws about these -- operations: -- -- class Ord a => Ix a -- | Time O(1). (\\) :: SmallSet a -> SmallSet a -> SmallSet a -- | Time O(n). complement :: SmallSet a -> SmallSet a -- | Time O(1). delete :: SmallSetElement a => a -> SmallSet a -> SmallSet a -- | Time O(1). difference :: SmallSet a -> SmallSet a -> SmallSet a -- | Time O(n). elems :: SmallSetElement a => SmallSet a -> [a] -- | The empty set. Time O(1). empty :: SmallSet a -- | Time O(n). fromList :: SmallSetElement a => [a] -> SmallSet a -- | Time O(n). fromAscList :: SmallSetElement a => [a] -> SmallSet a -- | Time O(n). fromDistinctAscList :: SmallSetElement a => [a] -> SmallSet a -- | Time O(1). insert :: SmallSetElement a => a -> SmallSet a -> SmallSet a -- | Time O(1). intersection :: SmallSet a -> SmallSet a -> SmallSet a -- | Time O(1). member :: SmallSetElement a => a -> SmallSet a -> Bool -- | not . member a. Time O(1). notMember :: SmallSetElement a => a -> SmallSet a -> Bool -- | Time O(1). null :: SmallSet a -> Bool -- | A singleton set. Time O(1). singleton :: SmallSetElement a => a -> SmallSet a -- | Time O(n). toList :: SmallSetElement a => SmallSet a -> [a] -- | Time O(n). toAscList :: SmallSetElement a => SmallSet a -> [a] -- | The full set. Time O(1). total :: SmallSet a -- | Time O(n). union :: SmallSet a -> SmallSet a -> SmallSet a instance GHC.Internal.Classes.Eq (Agda.Utils.SmallSet.SmallSet a) instance GHC.Internal.Base.Monoid (Agda.Utils.SmallSet.SmallSet a) instance Control.DeepSeq.NFData (Agda.Utils.SmallSet.SmallSet a) instance Agda.Utils.Null.Null (Agda.Utils.SmallSet.SmallSet a) instance GHC.Internal.Classes.Ord (Agda.Utils.SmallSet.SmallSet a) instance GHC.Internal.Base.Semigroup (Agda.Utils.SmallSet.SmallSet a) instance GHC.Internal.Show.Show (Agda.Utils.SmallSet.SmallSet a) -- | Constructing singleton collections. module Agda.Utils.Singleton -- | A create-only possibly empty collection is a monoid with the -- possibility to inject elements. class (Semigroup coll, Monoid coll, Singleton el coll) => Collection el coll | coll -> el fromList :: Collection el coll => [el] -> coll -- | Create-only collection with at most one element. class (Null coll, Singleton el coll) => CMaybe el coll | coll -> el cMaybe :: CMaybe el coll => Maybe el -> coll -- | Overloaded singleton constructor for collections. class Singleton el coll | coll -> el singleton :: Singleton el coll => el -> coll instance Agda.Utils.Singleton.CMaybe a [a] instance Agda.Utils.Singleton.CMaybe a (GHC.Internal.Maybe.Maybe a) instance Agda.Utils.Singleton.Collection GHC.Internal.Types.Int Data.IntSet.Internal.IntSet instance GHC.Internal.Enum.Enum k => Agda.Utils.Singleton.Collection (k, a) (Data.EnumMap.Base.EnumMap k a) instance Data.Hashable.Class.Hashable k => Agda.Utils.Singleton.Collection (k, a) (Data.HashMap.Internal.HashMap k a) instance Agda.Utils.Singleton.Collection (GHC.Internal.Types.Int, a) (Data.IntMap.Internal.IntMap a) instance GHC.Internal.Classes.Ord k => Agda.Utils.Singleton.Collection (k, a) (Data.Map.Internal.Map k a) instance Agda.Utils.Singleton.Collection a (Data.DList.Internal.DList a) instance Agda.Utils.Singleton.Collection a (GHC.Internal.Data.Semigroup.Internal.Endo [a]) instance Agda.Utils.Singleton.Collection a ([a] -> [a]) instance Agda.Utils.Singleton.Collection a [a] instance Agda.Utils.Singleton.Collection a (Data.Sequence.Internal.Seq a) instance GHC.Internal.Enum.Enum k => Agda.Utils.Singleton.Collection k (Data.EnumSet.EnumSet k) instance Data.Hashable.Class.Hashable k => Agda.Utils.Singleton.Collection k (Data.HashSet.Internal.HashSet k) instance GHC.Internal.Classes.Ord k => Agda.Utils.Singleton.Collection k (Data.Set.Internal.Set k) instance Agda.Utils.SmallSet.SmallSetElement k => Agda.Utils.Singleton.Collection k (Agda.Utils.SmallSet.SmallSet k) instance Agda.Utils.Singleton.Singleton GHC.Internal.Types.Int Data.IntSet.Internal.IntSet instance Agda.Utils.Singleton.Singleton GHC.Internal.Types.Int Agda.Utils.VarSet.VarSet instance GHC.Internal.Enum.Enum k => Agda.Utils.Singleton.Singleton (k, a) (Data.EnumMap.Base.EnumMap k a) instance Data.Hashable.Class.Hashable k => Agda.Utils.Singleton.Singleton (k, a) (Data.HashMap.Internal.HashMap k a) instance Agda.Utils.Singleton.Singleton (GHC.Internal.Types.Int, a) (Data.IntMap.Internal.IntMap a) instance Agda.Utils.Singleton.Singleton (k, a) (Data.Map.Internal.Map k a) instance Agda.Utils.Singleton.Singleton (k, a) (Data.Map.NonEmpty.Lazy.Internal.NEMap k a) instance Agda.Utils.Singleton.Singleton a (Data.DList.Internal.DList a) instance Agda.Utils.Singleton.Singleton a (GHC.Internal.Data.Semigroup.Internal.Endo [a]) instance GHC.Internal.Enum.Enum a => Agda.Utils.Singleton.Singleton a (Data.EnumSet.EnumSet a) instance Agda.Utils.Singleton.Singleton a ([a] -> [a]) instance Agda.Utils.Singleton.Singleton a [a] instance Agda.Utils.Singleton.Singleton a (GHC.Internal.Maybe.Maybe a) instance Agda.Utils.Singleton.Singleton a (Data.Set.NonEmpty.Internal.NESet a) instance Agda.Utils.Singleton.Singleton a (GHC.Internal.Base.NonEmpty a) instance Agda.Utils.Singleton.Singleton a (Data.Sequence.Internal.Seq a) instance Agda.Utils.Singleton.Singleton a (Data.Set.Internal.Set a) instance Agda.Utils.SmallSet.SmallSetElement a => Agda.Utils.Singleton.Singleton a (Agda.Utils.SmallSet.SmallSet a) instance Data.Hashable.Class.Hashable k => Agda.Utils.Singleton.Singleton k (Data.HashSet.Internal.HashSet k) -- | Create clusters of non-overlapping things. module Agda.Utils.Cluster -- | Given a function f :: a -> NonEmpty c which returns a -- non-empty list of characteristics of a, partition a list of -- as into groups such that each element in a group shares at -- least one characteristic with at least one other element of the group. cluster :: Ord c => (a -> NonEmpty c) -> [a] -> [NonEmpty a] -- | Partition a list of as paired with a non-empty list of -- characteristics into groups such that each element in a group shares -- at least one characteristic with at least one other element of the -- group. cluster' :: Ord c => [(a, NonEmpty c)] -> [NonEmpty a] -- | Given a function f :: a -> NonEmpty c which returns a -- non-empty list of characteristics of a, partition a non-empty -- list of as into groups such that each element in a group -- shares at least one characteristic with at least one other element of -- the group. cluster1 :: Ord c => (a -> NonEmpty c) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | Partition a non-empty list of as paired with a non-empty list -- of characteristics into groups such that each element in a group -- shares at least one characteristic with at least one other element of -- the group. cluster1' :: Ord c => NonEmpty (a, NonEmpty c) -> NonEmpty (NonEmpty a) -- | A strict version of the Maybe type. -- -- Import qualified, as in import Agda.Utils.Maybe.Strict qualified -- as Strict module Agda.Utils.Maybe.Strict catMaybes :: [Maybe a] -> [a] fromJust :: Maybe a -> a fromMaybe :: a -> Maybe a -> a isJust :: Maybe a -> Bool isNothing :: Maybe a -> Bool listToMaybe :: [a] -> Maybe a mapMaybe :: (a -> Maybe b) -> [a] -> [b] maybe :: b -> (a -> b) -> Maybe a -> b maybeToList :: Maybe a -> [a] data Maybe a Nothing :: Maybe a Just :: a -> Maybe a class Strict lazy strict | lazy -> strict, strict -> lazy toStrict :: Strict lazy strict => lazy -> strict toLazy :: Strict lazy strict => strict -> lazy -- | Version of maybe with different argument ordering. Often, we -- want to case on a Maybe, do something interesting in the -- Just case, but only a default action in the Nothing -- case. Then, the argument ordering of caseMaybe is preferable. -- --
--   caseMaybe m err f = flip (maybe err) m f
--   
caseMaybe :: Maybe a -> b -> (a -> b) -> b -- | Monadic version of caseMaybe. That is, maybeM with a -- different argument ordering. caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b -- | Filtering a singleton list. -- --
--   filterMaybe p a = listToMaybe (filter p [a])
--   
filterMaybe :: (a -> Bool) -> a -> Maybe a -- | Version of mapMaybe with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] -- | Monadic version of fromMaybe. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a -- | caseMaybeM with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b lensMaybeLazy :: forall a f. Functor f => (Maybe a -> f (Maybe a)) -> Maybe a -> f (Maybe a) -- | Monadic version of maybe. maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b -- | unionWith for collections of size <= 1. unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a -- | Unzipping a list of length <= 1. unzipMaybe :: Maybe (a, b) -> (Maybe a, Maybe b) -- | A more telling name for forM for the Maybe collection -- type. Or: caseMaybe without the Nothing case. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () -- | caseMaybeM without the Nothing case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () instance GHC.Internal.Base.Applicative Data.Strict.Maybe.Maybe instance Agda.Utils.Null.Null (Data.Strict.Maybe.Maybe a) -- | Strict tries (based on Data.Map.Strict and -- Agda.Utils.Maybe.Strict). -- -- Note that if delete or adjust are used, one may end up -- with non-canonical subtries, i.e., those that do not contain any value -- (Data.List.null . toList) but may be Eq-different to -- other empty tries (/= empty). module Agda.Utils.Trie -- | Finite map from [k] to v. -- -- With the strict Maybe type, Trie is also strict in -- v. data Trie k v Trie :: Maybe v -> Map k (Trie k v) -> Trie k v empty :: Null a => a -- | Singleton trie. singleton :: [k] -> v -> Trie k v -- | everyPrefix k v is a trie where every prefix of k -- (including k itself) is mapped to v. everyPrefix :: [k] -> v -> Trie k v -- | Insert. Overwrites existing value if present. -- --
--   insert = insertWith ( new old -> new)
--   
insert :: Ord k => [k] -> v -> Trie k v -> Trie k v -- | Insert with function merging new value with old value. insertWith :: Ord k => (v -> v -> v) -> [k] -> v -> Trie k v -> Trie k v -- | Left biased union. -- -- union = unionWith ( new old -> new). union :: Ord k => Trie k v -> Trie k v -> Trie k v -- | Pointwise union with merge function for values. unionWith :: Ord k => (v -> v -> v) -> Trie k v -> Trie k v -> Trie k v fromList :: Ord k => [([k], v)] -> Trie k v -- | Prefix every key by the given prefix. prefixBy :: [k] -> Trie k v -> Trie k v -- | Adjust value at key, leave subtree intact. -- -- Disclaimer: may return a non-canoncial trie because it does not clean -- up subtries that become empty. adjust :: Ord k => [k] -> (Maybe v -> Maybe v) -> Trie k v -> Trie k v -- | Delete value at key, but leave subtree intact. -- -- Disclaimer: may return a non-canoncial trie because it does not clean -- up subtries that become empty. delete :: Ord k => [k] -> Trie k v -> Trie k v -- | Convert to ascending list. toList :: Ord k => Trie k v -> [([k], v)] -- | Convert to ascending list. toAscList :: Ord k => Trie k v -> [([k], v)] -- | Convert to list where nodes at the same level are ordered according to -- the given ordering. toListOrderedBy :: Ord k => (v -> v -> Ordering) -> Trie k v -> [([k], v)] -- | Returns the value associated with the given key, if any. lookup :: Ord k => [k] -> Trie k v -> Maybe v -- | Is the given key present in the trie? member :: Ord k => [k] -> Trie k v -> Bool -- | Collect all values along a given path. lookupPath :: Ord k => [k] -> Trie k v -> [v] -- | Get the subtrie rooted at the given key. lookupTrie :: Ord k => [k] -> Trie k v -> Trie k v -- | Create new values based on the entire subtrie. Almost, but not quite -- comonad extend. mapSubTries :: Ord k => (Trie k u -> Maybe v) -> Trie k u -> Trie k v -- | Filter a trie. filter :: Ord k => (v -> Bool) -> Trie k v -> Trie k v -- | Key lens. valueAt :: Ord k => [k] -> Lens' (Trie k v) (Maybe v) instance (GHC.Internal.Classes.Eq v, GHC.Internal.Classes.Eq k) => GHC.Internal.Classes.Eq (Agda.Utils.Trie.Trie k v) instance GHC.Internal.Data.Foldable.Foldable (Agda.Utils.Trie.Trie k) instance GHC.Internal.Base.Functor (Agda.Utils.Trie.Trie k) instance (Control.DeepSeq.NFData k, Control.DeepSeq.NFData v) => Control.DeepSeq.NFData (Agda.Utils.Trie.Trie k v) instance Agda.Utils.Null.Null (Agda.Utils.Trie.Trie k v) instance (GHC.Internal.Show.Show v, GHC.Internal.Show.Show k) => GHC.Internal.Show.Show (Agda.Utils.Trie.Trie k v) -- | Extend Maybe by common operations for the Maybe type. -- -- Note: since this module is usually imported unqualified, we do not use -- short names, but all names contain Maybe, Just, or -- 'Nothing. module Agda.Utils.Maybe -- | Lazy version of allJust . sequence. (allJust = -- mapM for the Maybe monad.) Only executes monadic effect -- while isJust. allJustM :: Monad m => [m (Maybe a)] -> m (Maybe [a]) -- | Retain object when tag is True. boolToMaybe :: Bool -> a -> Maybe a -- | Version of maybe with different argument ordering. Often, we -- want to case on a Maybe, do something interesting in the -- Just case, but only a default action in the Nothing -- case. Then, the argument ordering of caseMaybe is preferable. -- --
--   caseMaybe m d f = flip (maybe d) m f
--   
caseMaybe :: Maybe a -> b -> (a -> b) -> b -- | Monadic version of caseMaybe. That is, maybeM with a -- different argument ordering. caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b -- | Filtering a singleton list. -- --
--   filterMaybe p a = listToMaybe (filter p [a])
--   
filterMaybe :: (a -> Bool) -> a -> Maybe a -- | Version of mapMaybe with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] -- | Monadic version of fromMaybe. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a -- | Run a MaybeT with a default value for Nothing. fromMaybeT :: Monad m => a -> MaybeT m a -> m a -- | caseMaybe with flipped branches. ifJust :: Maybe a -> (a -> b) -> b -> b -- | caseMaybeM with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b -- | Lift a maybe to an Alternative. liftMaybe :: Alternative f => Maybe a -> f a -- | Monadic version of maybe. maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b -- | Unwrap a Maybe value, returning empty for -- Nothing. orEmpty :: Null a => Maybe a -> a -- | Retain object when it passes the given test. predicateToMaybe :: (a -> Bool) -> a -> Maybe a -- | Like span, takes the prefix of a list satisfying a predicate. -- Returns the run of Justs until the first Nothing, and -- the tail of the list. spanMaybe :: (a -> Maybe b) -> [a] -> ([b], [a]) -- | unionWith for collections of size <= 1. unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a -- | unionsWith for collections of size <= 1. unionsMaybeWith :: (a -> a -> a) -> [Maybe a] -> Maybe a -- | Unzipping a list of length <= 1. unzipMaybe :: Maybe (a, b) -> (Maybe a, Maybe b) -- | A more telling name for forM_ for the Maybe collection -- type. Or: caseMaybe without the Nothing case. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () -- | caseMaybeM without the Nothing case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () -- | Pendent to whenJust. whenNothing :: Monad m => Maybe a -> m () -> m () -- | caseMaybeM without the Just case. whenNothingM :: Monad m => m (Maybe a) -> m () -> m () -- | Ranges. module Agda.Utils.Range -- | Character ranges. The first character in the file has position 1. Note -- that the to position is considered to be outside of the range. -- -- Invariant: from <= to. data Range Range :: Int -> Int -> Range [from] :: Range -> Int [to] :: Range -> Int -- | The Range invariant. rangeInvariant :: Range -> Bool -- | Zero or more consecutive and separated ranges. newtype Ranges Ranges :: [Range] -> Ranges -- | The Ranges invariant. rangesInvariant :: Ranges -> Bool -- | True iff the ranges overlap. -- -- The ranges are assumed to be well-formed. overlapping :: Range -> Range -> Bool overlappings :: Ranges -> Ranges -> Bool empty :: Null a => a -- | Converts a range to a list of positions. rangeToPositions :: Range -> [Int] -- | Converts several ranges to a list of positions. rangesToPositions :: Ranges -> [Int] -- | minus xs ys computes the difference between xs and -- ys: the result contains those positions which are present in -- xs but not in ys. -- -- Linear in the lengths of the input ranges. minus :: Ranges -> Ranges -> Ranges instance GHC.Internal.Classes.Eq Agda.Utils.Range.Range instance GHC.Internal.Classes.Eq Agda.Utils.Range.Ranges instance Control.DeepSeq.NFData Agda.Utils.Range.Range instance Control.DeepSeq.NFData Agda.Utils.Range.Ranges instance Agda.Utils.Null.Null Agda.Utils.Range.Range instance GHC.Internal.Classes.Ord Agda.Utils.Range.Range instance GHC.Internal.Show.Show Agda.Utils.Range.Range instance GHC.Internal.Show.Show Agda.Utils.Range.Ranges -- | Maps containing non-overlapping intervals. module Agda.Utils.RangeMap -- | A class that is intended to make it easy to swap between different -- range map implementations. -- -- Note that some RangeMap operations are not included in this -- class. class IsBasicRangeMap a m | m -> a -- | The map singleton rs x contains the ranges from -- rs, and every position in those ranges is associated with -- x. singleton :: IsBasicRangeMap a m => Ranges -> a -> m -- | Converts range maps to IntMaps from positions to values. toMap :: IsBasicRangeMap a m => m -> IntMap a -- | Converts the map to a list. The ranges are non-overlapping and -- non-empty, and earlier ranges precede later ones in the list. toList :: IsBasicRangeMap a m => m -> [(Range, a)] -- | Returns the smallest range covering everything in the map (or -- Nothing, if the range would be empty). -- -- Note that the default implementation of this operation might be -- inefficient. coveringRange :: IsBasicRangeMap a m => m -> Maybe Range -- | Like singleton, but with several Ranges instead of only -- one. several :: (IsBasicRangeMap a hl, Monoid hl) => [Ranges] -> a -> hl -- | Maps containing non-overlapping intervals. -- -- The implementation does not use IntMap, because IntMap does not come -- with a constant-time size function. -- -- Note the invariant which RangeMaps should satisfy -- (rangeMapInvariant). newtype RangeMap a RangeMap :: Map Int (PairInt a) -> RangeMap a -- | The keys are starting points of ranges, and the pairs contain -- endpoints and values. [rangeMap] :: RangeMap a -> Map Int (PairInt a) -- | Invariant for RangeMap. -- -- The ranges must not be empty, and they must not overlap. rangeMapInvariant :: RangeMap a -> Bool -- | Converts a list of pairs of ranges and values to a RangeMap. -- The ranges have to be non-overlapping and non-empty, and earlier -- ranges have to precede later ones. fromNonOverlappingNonEmptyAscendingList :: [(Range, a)] -> RangeMap a -- | Inserts a value, along with a corresponding Range, into a -- RangeMap. No attempt is made to merge adjacent ranges with -- equal values. -- -- The function argument is used to combine values. The inserted value is -- given as the first argument to the function. insert :: (a -> a -> a) -> Range -> a -> RangeMap a -> RangeMap a -- | The value of splitAt p f is a pair (f1, f2) -- which contains everything from f. All the positions in -- f1 are less than p, and all the positions in -- f2 are greater than or equal to p. splitAt :: Int -> RangeMap a -> (RangeMap a, RangeMap a) -- | Returns a RangeMap overlapping the given range, as well as the -- rest of the map. insideAndOutside :: Range -> RangeMap a -> (RangeMap a, RangeMap a) -- | Restricts the RangeMap to the given range. restrictTo :: Range -> RangeMap a -> RangeMap a data PairInt a (:!:) :: Int -> a -> PairInt a instance Agda.Utils.RangeMap.IsBasicRangeMap a (Agda.Utils.RangeMap.RangeMap a) instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Monoid (Agda.Utils.RangeMap.RangeMap a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.RangeMap.PairInt a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.RangeMap.RangeMap a) instance Agda.Utils.Null.Null (Agda.Utils.RangeMap.RangeMap a) instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Agda.Utils.RangeMap.RangeMap a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.RangeMap.PairInt a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.RangeMap.RangeMap a) -- | Non-empty lists. -- -- Better name List1 for non-empty lists, plus missing -- functionality. -- -- Import: @ -- -- {-# LANGUAGE PatternSynonyms #-} -- -- import Agda.Utils.List1 (List1, pattern (:|)) import Agda.Utils.List1 -- qualified as List1 -- -- @ module Agda.Utils.List1 -- | Checks if all the elements in the list are equal. Assumes that the -- Eq instance stands for an equivalence relation. O(n). allEqual :: Eq a => List1 a -> Bool -- | Breaks a list just after an element satisfying the predicate is -- found. -- --
--   >>> breakAfter even [1,3,5,2,4,7,8]
--   (1 :| [3,5,2],[4,7,8])
--   
breakAfter :: (a -> Bool) -> List1 a -> (List1 a, [a]) -- | Like catMaybes. catMaybes :: List1 (Maybe a) -> [a] -- | Concatenate one or more non-empty lists. concat :: [List1 a] -> [a] concat' :: [List1 a] -> [a] concatMap1 :: (a -> List1 b) -> List1 a -> List1 b -- | Strict filter filter' :: (a -> Bool) -> List1 a -> [a] -- | Like find. find :: (a -> Bool) -> List1 a -> Maybe a -- | List foldr but with a base case for the singleton list. foldr :: (a -> b -> b) -> (a -> b) -> List1 a -> b -- | Safe version of fromList. fromListSafe :: List1 a -> [a] -> List1 a -- | More precise type for groupBy'. -- -- A variant of groupBy which applies the predicate to consecutive -- pairs. O(n). groupBy' :: (a -> a -> Bool) -> [a] -> [List1 a] -- | Group consecutive items that share the same first component. groupByFst :: Eq a => [(a, b)] -> [(a, List1 b)] -- | Group consecutive items that share the same first component. groupByFst1 :: Eq a => List1 (a, b) -> List1 (a, List1 b) -- | groupOn f = groupBy ((==) `on` f) . -- sortBy (compare `on` f). O(n log n). groupOn :: Ord b => (a -> b) -> [a] -> [List1 a] groupOn1 :: Ord b => (a -> b) -> List1 a -> List1 (List1 a) ifNotNull :: [a] -> (List1 a -> b) -> b -> b ifNull :: [a] -> b -> (List1 a -> b) -> b -- | Return the last element and the rest. initLast :: List1 a -> ([a], a) -- | Last two elements (safe). O(n). last2 :: List1 a -> Maybe (a, a) -- | Like lefts. lefts :: List1 (Either a b) -> [a] -- | Focus on the first element of a non-empty list. O(1). lensHead :: Functor f => (a -> f a) -> List1 a -> f (List1 a) -- | Focus on the last element of a non-empty list. O(n). lensLast :: Functor f => (a -> f a) -> List1 a -> f (List1 a) -- | Lift a function on non-empty lists to a function on lists. -- -- This is in essence fmap for Maybe, if we take [a] = -- Maybe (List1 a). liftList1 :: (List1 a -> List1 b) -> [a] -> [b] -- | Strict map. map' :: (a -> b) -> List1 a -> List1 b -- | Like mapMaybe. mapMaybe :: (a -> Maybe b) -> List1 a -> [b] -- | Non-efficient, monadic nub. O(n²). nubM :: Monad m => (a -> a -> m Bool) -> List1 a -> m (List1 a) -- | Like partitionEithers. partitionEithers :: List1 (Either a b) -> ([a], [b]) -- | Like rights. rights :: List1 (Either a b) -> [b] -- | More precise type for snoc. snoc :: [a] -> a -> List1 a -- | Append an element to a non-empty list. snoc1 :: List1 a -> a -> List1 a -- | Lossless toList, opposite of nonEmpty. toList' :: Maybe (List1 a) -> [a] -- | Like union. Duplicates in the first list are not removed. -- O(nm). union :: Eq a => List1 a -> List1 a -> List1 a -- | The more general type Null m => [a] -> (List1 a -> m) -- -> m often causes type inference to fail, as we do not in -- general have instance Applicative m => Null (m ()). unlessNull :: Applicative m => [a] -> (List1 a -> m ()) -> m () unlessNullM :: Monad m => m [a] -> (List1 a -> m ()) -> m () -- | Like unwords. unwords :: List1 String -> String -- | Like unzipWith. unzipWith :: (a -> (b, c)) -> List1 a -> (List1 b, List1 c) -- | Update the first element of a non-empty list. O(1). updateHead :: (a -> a) -> List1 a -> List1 a -- | Update the last element of a non-empty list. O(n). updateLast :: (a -> a) -> List1 a -> List1 a -- | Split a list into sublists. Generalisation of the prelude function -- words. Same as wordsBy and wordsBy, but with -- the non-emptyness guarantee on the chunks. O(n). -- --
--   words xs == wordsBy isSpace xs
--   
wordsBy :: (a -> Bool) -> [a] -> [List1 a] -- | Like zipWithM. zipWithM :: Applicative m => (a -> b -> m c) -> List1 a -> List1 b -> m (List1 c) -- | Like zipWithM. zipWithM_ :: Applicative m => (a -> b -> m c) -> List1 a -> List1 b -> m () type List1 = NonEmpty type String1 = List1 Char -- | xs !! n returns the element of the stream xs at -- index n. Note that the head of the stream has index 0. -- -- Beware: a negative or out-of-bounds index will cause an error. (!!) :: HasCallStack => NonEmpty a -> Int -> a infixl 9 !! -- | Prepend an element to the stream. (<|) :: a -> NonEmpty a -> NonEmpty a infixr 5 <| -- | A monomorphic version of <> for NonEmpty. -- --
--   >>> append (1 :| []) (2 :| [3])
--   1 :| [2,3]
--   
append :: NonEmpty a -> NonEmpty a -> NonEmpty a -- | Attach a list at the end of a NonEmpty. -- --
--   >>> appendList (1 :| [2,3]) []
--   1 :| [2,3]
--   
-- --
--   >>> appendList (1 :| [2,3]) [4,5]
--   1 :| [2,3,4,5]
--   
appendList :: NonEmpty a -> [a] -> NonEmpty a -- | The break p function is equivalent to span -- (not . p). break :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | Use compareLength xs n as a safer and faster -- alternative to compare (length xs) n. -- Similarly, it's better to write compareLength xs 10 == LT -- instead of length xs < 10. -- -- While length would force and traverse the entire spine of -- xs (which could even diverge if xs is infinite), -- compareLength traverses at most n elements to -- determine its result. -- --
--   >>> compareLength ('a' :| []) 1
--   EQ
--   
--   >>> compareLength ('a' :| ['b']) 3
--   LT
--   
--   >>> compareLength (0 :| [1..]) 100
--   GT
--   
--   >>> compareLength undefined 0
--   GT
--   
--   >>> compareLength ('a' :| 'b' : undefined) 1
--   GT
--   
compareLength :: NonEmpty a -> Int -> Ordering -- | Synonym for <|. cons :: a -> NonEmpty a -> NonEmpty a -- | cycle xs returns the infinite repetition of -- xs: -- --
--   cycle (1 :| [2,3]) = 1 :| [2,3,1,2,3,...]
--   
cycle :: NonEmpty a -> NonEmpty a -- | drop n xs drops the first n elements off the -- front of the sequence xs. drop :: Int -> NonEmpty a -> [a] -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs. dropWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | filter p xs removes any elements from xs that -- do not satisfy p. filter :: (a -> Bool) -> NonEmpty a -> [a] -- | The group function takes a stream and returns a list of streams -- such that flattening the resulting list is equal to the argument. -- Moreover, each stream in the resulting list contains only equal -- elements, and consecutive equal elements of the input end up in the -- same stream of the output list. For example, in list notation: -- --
--   >>> group "Mississippi"
--   ['M' :| "",'i' :| "",'s' :| "s",'i' :| "",'s' :| "s",'i' :| "",'p' :| "p",'i' :| ""]
--   
group :: (Foldable f, Eq a) => f a -> [NonEmpty a] -- | group1 operates like group, but uses the knowledge that -- its input is non-empty to produce guaranteed non-empty output. group1 :: Eq a => NonEmpty a -> NonEmpty (NonEmpty a) -- | groupAllWith operates like groupWith, but sorts the list -- first so that each equivalence class has, at most, one list in the -- output groupAllWith :: Ord b => (a -> b) -> [a] -> [NonEmpty a] -- | groupAllWith1 is to groupWith1 as groupAllWith is -- to groupWith groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | groupBy operates like group, but uses the provided -- equality predicate instead of ==. groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a] -- | groupBy1 is to group1 as groupBy is to -- group. groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | groupWith operates like group, but uses the provided -- projection when comparing for equality groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a] -- | groupWith1 is to group1 as groupWith is to -- group groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | Extract the first element of the stream. head :: NonEmpty a -> a -- | Extract everything except the last element of the stream. init :: NonEmpty a -> [a] -- | The inits function takes a stream xs and returns all -- the finite prefixes of xs, starting with the shortest. The -- result is NonEmpty because the result always contains the empty -- list as the first element. -- --
--   inits [1,2,3] == [] :| [[1], [1,2], [1,2,3]]
--   inits [1] == [] :| [[1]]
--   inits [] == [] :| []
--   
inits :: Foldable f => f a -> NonEmpty [a] -- | The inits1 function takes a NonEmpty stream xs -- and returns all the NonEmpty finite prefixes of xs, -- starting with the shortest. -- --
--   inits1 (1 :| [2,3]) == (1 :| []) :| [1 :| [2], 1 :| [2,3]]
--   inits1 (1 :| []) == (1 :| []) :| []
--   
inits1 :: NonEmpty a -> NonEmpty (NonEmpty a) -- | insert x xs inserts x into the last position -- in xs where it is still less than or equal to the next -- element. In particular, if the list is sorted beforehand, the result -- will also be sorted. insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a -- | 'intersperse x xs' alternates elements of the list with copies of -- x. -- --
--   intersperse 0 (1 :| [2,3]) == 1 :| [0,2,0,3]
--   
intersperse :: a -> NonEmpty a -> NonEmpty a -- | The isPrefixOf function returns True if the first -- argument is a prefix of the second. isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool -- | iterate f x produces the infinite sequence of repeated -- applications of f to x. -- --
--   iterate f x = x :| [f x, f (f x), ..]
--   
iterate :: (a -> a) -> a -> NonEmpty a -- | Extract the last element of the stream. last :: NonEmpty a -> a -- | Number of elements in NonEmpty list. length :: NonEmpty a -> Int -- | nonEmpty efficiently turns a normal list into a NonEmpty -- stream, producing Nothing if the input is empty. nonEmpty :: [a] -> Maybe (NonEmpty a) -- | The nub function removes duplicate elements from a list. In -- particular, it keeps only the first occurrence of each element. (The -- name nub means 'essence'.) It is a special case of -- nubBy, which allows the programmer to supply their own -- inequality test. nub :: Eq a => NonEmpty a -> NonEmpty a -- | The nubBy function behaves just like nub, except it uses -- a user-supplied equality predicate instead of the overloaded == -- function. nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a -- | The partition function takes a predicate p and a -- stream xs, and returns a pair of lists. The first list -- corresponds to the elements of xs for which p holds; -- the second corresponds to the elements of xs for which -- p does not hold. -- --
--   'partition' p xs = ('filter' p xs, 'filter' (not . p) xs)
--   
partition :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | The permutations function returns the list of all permutations -- of the argument. permutations :: [a] -> NonEmpty [a] -- | permutations1 operates like permutations, but uses the -- knowledge that its input is non-empty to produce output where every -- element is non-empty. -- --
--   permutations1 = fmap fromList . permutations . toList
--   
permutations1 :: NonEmpty a -> NonEmpty (NonEmpty a) -- | Attach a list at the beginning of a NonEmpty. -- --
--   >>> prependList [] (1 :| [2,3])
--   1 :| [2,3]
--   
-- --
--   >>> prependList [negate 1, 0] (1 :| [2, 3])
--   -1 :| [0,1,2,3]
--   
prependList :: [a] -> NonEmpty a -> NonEmpty a -- | repeat x returns a constant stream, where all elements -- are equal to x. repeat :: a -> NonEmpty a -- | reverse a finite NonEmpty stream. reverse :: NonEmpty a -> NonEmpty a -- | scanl is similar to foldl, but returns a stream of -- successive reduced values from the left: -- --
--   scanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...]
--   
-- -- Note that -- --
--   last (scanl f z xs) == foldl f z xs.
--   
scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b -- | scanl1 is a variant of scanl that has no starting value -- argument: -- --
--   scanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]
--   
scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a -- | scanr is the right-to-left dual of scanl. Note that -- --
--   head (scanr f z xs) == foldr f z xs.
--   
scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b -- | scanr1 is a variant of scanr that has no starting value -- argument. scanr1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a -- | Construct a NonEmpty list from a single element. singleton :: a -> NonEmpty a -- | some1 x sequences x one or more times. some1 :: Alternative f => f a -> f (NonEmpty a) -- | Sort a stream. sort :: Ord a => NonEmpty a -> NonEmpty a -- | sortBy for NonEmpty, behaves the same as sortBy sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a -- | Sort a NonEmpty on a user-supplied projection of its elements. -- See sortOn for more detailed information. -- --

Examples

-- --
--   >>> sortOn fst $ (2, "world") :| [(4, "!"), (1, "Hello")]
--   (1,"Hello") :| [(2,"world"),(4,"!")]
--   
-- --
--   >>> sortOn List.length ("jim" :| ["creed", "pam", "michael", "dwight", "kevin"])
--   "jim" :| ["pam","creed","kevin","dwight","michael"]
--   
-- --

Performance notes

-- -- This function minimises the projections performed, by materialising -- the projections in an intermediate list. -- -- For trivial projections, you should prefer using sortBy with -- comparing, for example: -- --
--   >>> sortBy (comparing fst) $ (3, 1) :| [(2, 2), (1, 3)]
--   (1,3) :| [(2,2),(3,1)]
--   
-- -- Or, for the exact same API as sortOn, you can use `sortBy . -- comparing`: -- --
--   >>> (sortBy . comparing) fst $ (3, 1) :| [(2, 2), (1, 3)]
--   (1,3) :| [(2,2),(3,1)]
--   
-- -- sortWith is an alias for `sortBy . comparing`. sortOn :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty a -- | sortWith for NonEmpty, behaves the same as: -- --
--   sortBy . comparing
--   
sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a -- | span p xs returns the longest prefix of xs -- that satisfies p, together with the remainder of the stream. -- --
--   'span' p xs == ('takeWhile' p xs, 'dropWhile' p xs)
--   xs == ys ++ zs where (ys, zs) = 'span' p xs
--   
span :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | splitAt n xs returns a pair consisting of the prefix -- of xs of length n and the remaining stream -- immediately following this prefix. -- --
--   'splitAt' n xs == ('take' n xs, 'drop' n xs)
--   xs == ys ++ zs where (ys, zs) = 'splitAt' n xs
--   
splitAt :: Int -> NonEmpty a -> ([a], [a]) -- | Extract the possibly-empty tail of the stream. tail :: NonEmpty a -> [a] -- | The tails function takes a stream xs and returns all -- the suffixes of xs, starting with the longest. The result is -- NonEmpty because the result always contains the empty list as -- the last element. -- --
--   tails [1,2,3] == [1,2,3] :| [[2,3], [3], []]
--   tails [1] == [1] :| [[]]
--   tails [] == [] :| []
--   
tails :: Foldable f => f a -> NonEmpty [a] -- | The tails1 function takes a NonEmpty stream xs -- and returns all the non-empty suffixes of xs, starting with -- the longest. -- --
--   tails1 (1 :| [2,3]) == (1 :| [2,3]) :| [2 :| [3], 3 :| []]
--   tails1 (1 :| []) == (1 :| []) :| []
--   
tails1 :: NonEmpty a -> NonEmpty (NonEmpty a) -- | take n xs returns the first n elements of -- xs. take :: Int -> NonEmpty a -> [a] -- | takeWhile p xs returns the longest prefix of the -- stream xs for which the predicate p holds. takeWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | transpose for NonEmpty, behaves the same as -- transpose The rows/columns need not be the same length, in -- which case > transpose . transpose /= id transpose :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a) -- | uncons produces the first element of the stream, and a stream -- of the remaining elements, if any. uncons :: NonEmpty a -> (a, Maybe (NonEmpty a)) -- | unfold produces a new stream by repeatedly applying the -- unfolding function to the seed value to produce an element of type -- b and a new seed value. When the unfolding function returns -- Nothing instead of a new seed value, the stream ends. -- | Deprecated: Use unfoldr unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b -- | The unfoldr function is analogous to Data.List's -- unfoldr operation. unfoldr :: (a -> (b, Maybe a)) -> a -> NonEmpty b -- | Compute n-ary logic exclusive OR operation on NonEmpty list. xor :: NonEmpty Bool -> Bool -- | The zip function takes two streams and returns a stream of -- corresponding pairs. zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) -- | The zipWith function generalizes zip. Rather than -- tupling the elements, the elements are combined using the function -- passed as the first argument. zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c -- | Map a function over a NonEmpty stream. map :: (a -> b) -> NonEmpty a -> NonEmpty b -- | Non-empty (and non-strict) list type. data NonEmpty a (:|) :: a -> [a] -> NonEmpty a infixr 5 :| -- | The IsList class and its methods are intended to be used in -- conjunction with the OverloadedLists extension. class IsList l where { -- | The Item type function returns the type of items of the -- structure l. type Item l; } -- | The fromList function constructs the structure l from -- the given list of Item l fromList :: IsList l => [Item l] -> l -- | The fromListN function takes the input list's length and -- potentially uses it to construct the structure l more -- efficiently compared to fromList. If the given number does not -- equal to the input list's length the behaviour of fromListN is -- not specified. -- --
--   fromListN (length xs) xs == fromList xs
--   
fromListN :: IsList l => Int -> [Item l] -> l -- | The toList function extracts a list of Item l from the -- structure l. It should satisfy fromList . toList = id. toList :: IsList l => l -> [Item l] -- | The Item type function returns the type of items of the -- structure l. type family Item l -- | Generalization of Data.List.unzip. -- --

Examples

-- --
--   >>> unzip (Just ("Hello", "World"))
--   (Just "Hello",Just "World")
--   
-- --
--   >>> unzip [("I", "love"), ("really", "haskell")]
--   (["I","really"],["love","haskell"])
--   
unzip :: Functor f => f (a, b) -> (f a, f b) -- | Collection size. -- -- For TermSize see Agda.Syntax.Internal. module Agda.Utils.Size -- | The size of a collection (i.e., its length). class Sized a -- | Strict size computation. -- -- Anti-patterns: size xs == n where n is 0, -- 1 or another number that is likely smaller than size -- xs. Similar for size xs >= 1 etc. Use natSize -- instead. -- -- See -- https://wiki.haskell.org/Haskell_programming_tips#Don.27t_ask_for_the_length_of_a_list_when_you_don.27t_need_it -- . size :: Sized a => a -> Int ($dmsize) :: forall (t :: Type -> Type) b. (Sized a, Foldable t, t b ~ a) => a -> Int -- | Lazily compute a (possibly infinite) size. -- -- Use when comparing a size against a fixed number. natSize :: Sized a => a -> Peano ($dmnatSize) :: forall (t :: Type -> Type) b. (Sized a, Foldable t, t b ~ a) => a -> Peano -- | Thing decorated with its size. The thing should fit into main memory, -- thus, the size is an Int. data SizedThing a SizedThing :: Int -> a -> SizedThing a [theSize] :: SizedThing a -> Int [sizedThing] :: SizedThing a -> a -- | Cache the size of an object. sizeThing :: Sized a => a -> SizedThing a data Peano Zero :: Peano Succ :: Peano -> Peano instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (Agda.Utils.Size.SizedThing a) instance Agda.Utils.Size.Sized (Data.HashMap.Internal.HashMap k a) instance Agda.Utils.Size.Sized (Data.HashSet.Internal.HashSet a) instance Agda.Utils.Size.Sized (Data.IntMap.Internal.IntMap a) instance Agda.Utils.Size.Sized Data.IntSet.Internal.IntSet instance Agda.Utils.Size.Sized [a] instance Agda.Utils.Size.Sized (Data.Map.Internal.Map k a) instance Agda.Utils.Size.Sized (Agda.Utils.Map1.Map1 k a) instance Agda.Utils.Size.Sized (Agda.Utils.Set1.Set1 a) instance Agda.Utils.Size.Sized (Agda.Utils.List1.List1 a) instance Agda.Utils.Size.Sized (Data.Sequence.Internal.Seq a) instance Agda.Utils.Size.Sized (Data.Set.Internal.Set a) instance Agda.Utils.Size.Sized (Agda.Utils.Size.SizedThing a) module Agda.Utils.String -- | quote adds double quotes around the string, replaces newline -- characters with n, and escapes double quotes and backslashes -- within the string. This is different from the behaviour of -- show: -- --
--   > putStrLn $ show "\x2200"
--   "\8704"
--   > putStrLn $ quote "\x2200"
--   "∀"
--   
-- -- (The code examples above have been tested using version 4.2.0.0 of the -- base library.) quote :: String -> String -- | Turns the string into a Haskell string literal, avoiding escape codes. haskellStringLiteral :: String -> String -- | Adds hyphens around the given string -- --
--   >>> putStrLn $ delimiter "Title"
--   ———— Title —————————————————————————————————————————————————
--   
delimiter :: String -> String -- | Adds a final newline if there is not already one. addFinalNewLine :: String -> String -- | Indents every line the given number of steps. indent :: Integral i => i -> String -> String -- | unwords, but remove empty words first. unwords1 :: [String] -> String -- | Append an "s" to the second argument if the first has -- cardinality /= 1. pluralS :: Sized a => a -> String -> String -- | Show a number using comma to separate powers of 1,000. showThousandSep :: Show a => a -> String -- | Remove leading whitespace. ltrim :: String -> String -- | Remove trailing whitespace. rtrim :: String -> String -- | Remove leading and trailing whitesapce. trim :: String -> String instance (GHC.Internal.Data.String.IsString (m a), GHC.Internal.Base.Monad m) => GHC.Internal.Data.String.IsString (Control.Monad.Trans.Except.ExceptT e m a) instance (GHC.Internal.Data.String.IsString (m a), GHC.Internal.Base.Monad m) => GHC.Internal.Data.String.IsString (Control.Monad.Trans.Maybe.MaybeT m a) instance GHC.Internal.Data.String.IsString Agda.Utils.List1.String1 instance (GHC.Internal.Data.String.IsString (m a), GHC.Internal.Base.Monad m) => GHC.Internal.Data.String.IsString (Control.Monad.Trans.Reader.ReaderT r m a) instance (GHC.Internal.Data.String.IsString (m a), GHC.Internal.Base.Monad m) => GHC.Internal.Data.String.IsString (Control.Monad.Trans.State.Lazy.StateT s m a) instance (GHC.Internal.Data.String.IsString (m a), GHC.Internal.Base.Monad m, GHC.Internal.Base.Monoid w) => GHC.Internal.Data.String.IsString (Control.Monad.Trans.Writer.Lazy.WriterT w m a) -- | Auxiliary functions for the IO monad. module Agda.Utils.IO -- | Catch Exceptions in an extension of the IO monad. class CatchIO (m :: Type -> Type) catchIO :: (CatchIO m, Exception e) => m a -> (e -> m a) -> m a -- | Print an IOException without the call stack. showIOException :: Exception e => e -> String instance Agda.Utils.IO.CatchIO m => Agda.Utils.IO.CatchIO (Control.Monad.Trans.Except.ExceptT e m) instance Agda.Utils.IO.CatchIO GHC.Internal.Types.IO instance Agda.Utils.IO.CatchIO m => Agda.Utils.IO.CatchIO (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.Utils.IO.CatchIO m => Agda.Utils.IO.CatchIO (Control.Monad.Trans.Writer.Lazy.WriterT w m) module Agda.Utils.Permutation -- | Partial permutations. Examples: -- -- permute [1,2,0] [x0,x1,x2] = [x1,x2,x0] (proper permutation). -- -- permute [1,0] [x0,x1,x2] = [x1,x0] (partial permuation). -- -- permute [1,0,1,2] [x0,x1,x2] = [x1,x0,x1,x2] (not a -- permutation because not invertible). -- -- Agda typing would be: Perm : {m : Nat}(n : Nat) -> Vec (Fin n) -- m -> Permutation m is the size of the -- permutation. data Permutation Perm :: Int -> [Int] -> Permutation [permRange] :: Permutation -> Int [permPicks] :: Permutation -> [Int] -- | permute [1,2,0] [x0,x1,x2] = [x1,x2,x0] More precisely, -- permute indices list = sublist, generates sublist -- from list by picking the elements of list as indicated by -- indices. permute [1,3,0] [x0,x1,x2,x3] = [x1,x3,x0] -- -- Agda typing: permute (Perm {m} n is) : Vec A m -> Vec A n -- -- Precondition for permute (Perm _ is) xs: Every -- index in is must be non-negative and, if xs is -- finite, then every index must also be smaller than the length of -- xs. -- -- The implementation is supposed to be extensionally equal to the -- following one (if different exceptions are identified), but in some -- cases more efficient: permute (Perm _ is) xs = map -- (xs !!) is permute :: Permutation -> [a] -> [a] -- | Invert a Permutation on a partial finite int map. inversePermute -- perm f = f' such that permute perm f' = f -- -- Example, with map represented as [Maybe a]: f = -- [Nothing, Just a, Just b ] perm = Perm 4 [3,0,2] f' = [ Just a , -- Nothing , Just b , Nothing ] Zipping perm with -- f gives [(0,a),(2,b)], after compression with -- catMaybes. This is an IntMap which can easily -- written out into a substitution again. class InversePermute a b inversePermute :: InversePermute a b => Permutation -> a -> b -- | Identity permutation. idP :: Int -> Permutation -- | Restrict a permutation to work on n elements, discarding -- picks >=n. takeP :: Int -> Permutation -> Permutation -- | Pick the elements that are not picked by the permutation. droppedP :: Permutation -> Permutation -- | liftP k takes a Perm {m} n to a Perm {m+k} -- (n+k). Analogous to liftS, but Permutations operate on de -- Bruijn LEVELS, not indices. liftP :: Int -> Permutation -> Permutation -- |
--   permute (compose p1 p2) == permute p1 . permute p2
--   
composeP :: Permutation -> Permutation -> Permutation -- | invertP err p is the inverse of p where defined, -- otherwise defaults to err. composeP p (invertP err p) == -- p invertP :: Int -> Permutation -> Permutation -- | lookupP π i applies π to i. lookupP :: Permutation -> Int -> Maybe Int -- | lookupRP π i applies invertP π to i. lookupRP :: Permutation -> Int -> Maybe Int -- | Turn a possible non-surjective permutation into a surjective -- permutation. compactP :: Permutation -> Permutation -- |
--   permute (reverseP p) xs ==
--       reverse $ permute p $ reverse xs
--   
-- -- Example: permute (reverseP (Perm 4 [1,3,0])) [x0,x1,x2,x3] == -- permute (Perm 4 $ map (3-) [0,3,1]) [x0,x1,x2,x3] == permute (Perm 4 -- [3,0,2]) [x0,x1,x2,x3] == [x3,x0,x2] == reverse [x2,x0,x3] == reverse -- $ permute (Perm 4 [1,3,0]) [x3,x2,x1,x0] == reverse $ permute (Perm 4 -- [1,3,0]) $ reverse [x0,x1,x2,x3] -- -- With reverseP, you can convert a permutation on de Bruijn -- indices to one on de Bruijn levels, and vice versa. reverseP :: Permutation -> Permutation -- | permPicks (flipP p) = permute p (downFrom (permRange p)) or -- permute (flipP (Perm n xs)) [0..n-1] = permute (Perm n xs) -- (downFrom n) -- -- Can be use to turn a permutation from (de Bruijn) levels to levels to -- one from levels to indices. -- -- See numberPatVars. flipP :: Permutation -> Permutation -- | expandP i n π in the domain of π replace the -- ith element by n elements. expandP :: Int -> Int -> Permutation -> Permutation -- | deleteP i π deletes the value i from the output of -- π. deleteP :: Int -> Permutation -> Permutation -- | Stable topologic sort. The first argument decides whether its first -- argument is an immediate parent to its second argument. topoSort :: (a -> a -> Bool) -> [a] -> Maybe Permutation topoSortM :: Monad m => (a -> a -> m Bool) -> [a] -> m (Maybe Permutation) -- | Delayed dropping which allows undropping. data Drop a Drop :: Int -> a -> Drop a -- | Non-negative number of things to drop. [dropN] :: Drop a -> Int -- | Where to drop from. [dropFrom] :: Drop a -> a -- | Things that support delayed dropping. class DoDrop a doDrop :: DoDrop a => Drop a -> a dropMore :: DoDrop a => Int -> Drop a -> Drop a unDrop :: DoDrop a => Int -> Drop a -> Drop a instance Agda.Utils.Permutation.DoDrop [a] instance Agda.Utils.Permutation.DoDrop Agda.Utils.Permutation.Permutation instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.Permutation.Drop a) instance GHC.Internal.Classes.Eq Agda.Utils.Permutation.Permutation instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.Permutation.Drop instance GHC.Internal.Base.Functor Agda.Utils.Permutation.Drop instance GHC.Internal.Generics.Generic Agda.Utils.Permutation.Permutation instance Agda.Utils.Permutation.InversePermute (GHC.Internal.Types.Int -> a) [GHC.Internal.Maybe.Maybe a] instance Agda.Utils.Permutation.InversePermute [GHC.Internal.Maybe.Maybe a] (Data.IntMap.Internal.IntMap a) instance Agda.Utils.Permutation.InversePermute [GHC.Internal.Maybe.Maybe a] [(GHC.Internal.Types.Int, a)] instance Agda.Utils.Permutation.InversePermute [GHC.Internal.Maybe.Maybe a] [GHC.Internal.Maybe.Maybe a] instance Control.DeepSeq.NFData Agda.Utils.Permutation.Permutation instance Agda.Utils.Null.Null Agda.Utils.Permutation.Permutation instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.Permutation.Drop a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.Permutation.Drop a) instance GHC.Internal.Show.Show Agda.Utils.Permutation.Permutation instance Agda.Utils.Size.Sized Agda.Utils.Permutation.Permutation instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.Permutation.Drop -- | Lists of length at least 2. -- -- Import as: import Agda.Utils.List2 (List2(List2)) import -- Agda.Utils.List2 qualified as List2 module Agda.Utils.List2 -- | O(length first list). append :: List1 a -> List1 a -> List2 a -- | O(length first list). appendList :: List2 a -> [a] -> List2 a break :: (a -> Bool) -> List2 a -> ([a], [a]) -- | Concatenate at least 2 lists of length at least 1. concat21 :: List2 (List1 a) -> List2 a -- | O(1). cons :: a -> List1 a -> List2 a -- | Unsafe! O(1). fromList1 :: List1 a -> List2 a -- | Any List1 is either a singleton or a List2. O(1). fromList1Either :: List1 a -> Either a (List2 a) -- | Safe. O(1). fromList1Maybe :: List1 a -> Maybe (List2 a) -- | Safe. O(1). fromListMaybe :: [a] -> Maybe (List2 a) -- | Safe. O(1). head :: List2 a -> a -- | Safe. O(n). init :: List2 a -> List1 a -- | O(n). snoc :: List1 a -> a -> List2 a -- | Safe. O(1). tail :: List2 a -> List1 a -- | Safe. O(1). toList1 :: List2 a -> List1 a -- | Inverse of fromList1Either. O(1). toList1Either :: Either a (List2 a) -> List1 a zip :: List2 a -> List2 b -> List2 (a, b) zipWith :: (a -> b -> c) -> List2 a -> List2 b -> List2 c -- | Lists of length ≥2. data List2 a List2 :: a -> a -> [a] -> List2 a -- | The toList function extracts a list of Item l from the -- structure l. It should satisfy fromList . toList = id. toList :: IsList l => l -> [Item l] instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.List2.List2 a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.List2.List2 instance GHC.Internal.Base.Functor Agda.Utils.List2.List2 instance GHC.Internal.IsList.IsList (Agda.Utils.List2.List2 a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.List2.List2 a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.List2.List2 a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.List2.List2 a) instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.List2.List2 -- | Utilities for the Either type. module Agda.Utils.Either -- | Loop while we have an exception. whileLeft :: Monad m => (a -> Either b c) -> (a -> b -> m a) -> (a -> c -> m d) -> a -> m d -- | Monadic version of either with a different argument ordering. caseEitherM :: Monad m => m (Either a b) -> (a -> m c) -> (b -> m c) -> m c -- | 'Either _ b' is a functor. mapLeft :: (a -> c) -> Either a b -> Either c b -- | 'Either a' is a functor. mapRight :: (b -> d) -> Either a b -> Either a d -- | Either is bitraversable. Note: From base >= -- 4.10.0.0 already present in Bitraversable. traverseEither :: Functor f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) -- | Return True if the given value is a Left-value, -- False otherwise. -- --

Examples

-- -- Basic usage: -- --
--   >>> isLeft (Left "foo")
--   True
--   
--   >>> isLeft (Right 3)
--   False
--   
-- -- Assuming a Left value signifies some sort of error, we can use -- isLeft to write a very simple error-reporting function that -- does absolutely nothing in the case of success, and outputs "ERROR" if -- any error occurred. -- -- This example shows how isLeft might be used to avoid pattern -- matching when one does not care about the value contained in the -- constructor: -- --
--   >>> import Control.Monad ( when )
--   
--   >>> let report e = when (isLeft e) $ putStrLn "ERROR"
--   
--   >>> report (Right 1)
--   
--   >>> report (Left "parse error")
--   ERROR
--   
isLeft :: Either a b -> Bool -- | Return True if the given value is a Right-value, -- False otherwise. -- --

Examples

-- -- Basic usage: -- --
--   >>> isRight (Left "foo")
--   False
--   
--   >>> isRight (Right 3)
--   True
--   
-- -- Assuming a Left value signifies some sort of error, we can use -- isRight to write a very simple reporting function that only -- outputs "SUCCESS" when a computation has succeeded. -- -- This example shows how isRight might be used to avoid pattern -- matching when one does not care about the value contained in the -- constructor: -- --
--   >>> import Control.Monad ( when )
--   
--   >>> let report e = when (isRight e) $ putStrLn "SUCCESS"
--   
--   >>> report (Left "parse error")
--   
--   >>> report (Right 1)
--   SUCCESS
--   
isRight :: Either a b -> Bool -- | Analogue of fromMaybe. fromLeft :: (b -> a) -> Either a b -> a -- | Analogue of fromMaybe. fromRight :: (a -> b) -> Either a b -> b -- | Analogue of fromMaybeM. fromLeftM :: Monad m => (b -> m a) -> m (Either a b) -> m a -- | Analogue of fromMaybeM. fromRightM :: Monad m => (a -> m b) -> m (Either a b) -> m b -- | Safe projection from Left. -- --
--   maybeLeft (Left a) = Just a
--   maybeLeft Right{}  = Nothing
--   
maybeLeft :: Either a b -> Maybe a -- | Safe projection from Right. -- --
--   maybeRight (Right b) = Just b
--   maybeRight Left{}    = Nothing
--   
maybeRight :: Either a b -> Maybe b -- | Returns Just input_with_tags_stripped if all elements -- are to the Left, and otherwise Nothing. allLeft :: [Either a b] -> Maybe [a] -- | Returns Just input_with_tags_stripped if all elements -- are to the right, and otherwise Nothing. -- --
--   allRight xs ==
--     if all isRight xs then
--       Just (map ((Right x) -> x) xs)
--      else
--       Nothing
--   
allRight :: [Either a b] -> Maybe [b] -- | Groups a list into alternating chunks of Left and Right -- values groupByEither :: [Either a b] -> [Either (List1 a) (List1 b)] -- | Convert Maybe to Either e, given an error -- e for the Nothing case. maybeToEither :: e -> Maybe a -> Either e a -- | Swap tags Left and Right. swapEither :: Either a b -> Either b a module Agda.Utils.Monad -- | Strict ap (<*!>) :: Monad m => m (a -> b) -> m a -> m b infixl 4 <*!> -- | Binary bind. (==<<) :: Monad m => (a -> b -> m c) -> (m a, m b) -> m c allM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m Bool -- | Lazy monadic disjunction with Either truth values. Returns -- the last error message if all fail. altM1 :: Monad m => (a -> m (Either err b)) -> [a] -> m (Either err b) -- | Lazy monadic conjunction. and2M :: Monad m => m Bool -> m Bool -> m Bool andM :: (Foldable f, Monad m) => f (m Bool) -> m Bool anyM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m Bool -- | Bracket without failure. Typically used to preserve state. bracket_ :: Monad m => m a -> (a -> m ()) -> m b -> m b -- | Generalises the catMaybes function from lists to an arbitrary -- MonadPlus. catMaybesMP :: MonadPlus m => m (Maybe a) -> m a -- | Handle errors thrown in ExceptT. catchExceptT :: Monad m => ExceptT e m a -> (e -> m a) -> m a concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b] -- | A monadic version of dropWhileEnd :: (a -> Bool) -> -- [a] -> m [a]. Effects happen starting at the end of the list -- until p becomes false. dropWhileEndM :: Monad m => (a -> m Bool) -> [a] -> m [a] -- | A monadic version of dropWhile :: (a -> Bool) -> [a] -- -> [a]. dropWhileM :: Monad m => (a -> m Bool) -> [a] -> m [a] embedWriter :: forall (m :: Type -> Type) w a. Monad m => Writer w a -> WriterT w m a existsM :: (Foldable f, Monad m) => f a -> (a -> m Bool) -> m Bool -- | Finally for the Error class. Errors in the finally part take -- precedence over prior errors. finally :: MonadError e m => m a -> m () -> m a findM :: (Foldable f, Monad m) => (a -> m Bool) -> f a -> m (Maybe a) -- | Generalized version of for_ :: Applicative m => [a] -> (a -- -> m ()) -> m () forM' :: (Foldable t, Applicative m, Monoid b) => t a -> (a -> m b) -> m b forMGood :: (Monad m, ExpandCase (m [b])) => [a] -> (a -> m b) -> m [b] forMGood_ :: (Monad m, ExpandCase (m ())) => [a] -> (a -> m ()) -> m () forMM :: (Traversable t, Monad m) => m (t a) -> (a -> m b) -> m (t b) forMM_ :: (Foldable t, Monad m) => m (t a) -> (a -> m ()) -> m () -- | The for version of mapMaybeM. forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b] -- | The for version of mapMaybeMM. forMaybeMM :: Monad m => m [a] -> (a -> m (Maybe b)) -> m [b] forallM :: (Foldable f, Monad m) => f a -> (a -> m Bool) -> m Bool -- | Translates Maybe to MonadPlus. fromMaybeMP :: MonadPlus m => Maybe a -> m a guard :: (IsBool b, MonadPlus m) => b -> m () -- | Monadic guard. guardM :: MonadPlus m => m Bool -> m () -- | Like guard, but raise given error when condition fails. guardWithError :: MonadError e m => e -> Bool -> m () -- | Monadic if-then-else. ifM :: Monad m => m Bool -> m a -> m a -> m a -- |
--   ifNotM mc = ifM (not $ mc)
--   
ifNotM :: Monad m => m Bool -> m a -> m a -> m a -- | Restore state after computation. localState :: MonadState s m => m a -> m a -- | Generalized version of traverse_ :: Applicative m => (a -> m -- ()) -> [a] -> m () Executes effects and collects results in -- left-to-right order. Works best with left-associative monoids. -- -- Note that there is an alternative -- --
--   mapM' f t = foldr mappend mempty $ mapM f t
--   
-- -- that collects results in right-to-left order (effects still -- left-to-right). It might be preferable for right associative monoids. mapM' :: (Foldable t, Applicative m, Monoid b) => (a -> m b) -> t a -> m b -- | Variant of mapM which gets compiled to good code, assuming that -- we're mapping over an actual runtime list and don't intend for list -- fusion to fire. mapMGood :: (Monad m, ExpandCase (m [b])) => (a -> m b) -> [a] -> m [b] -- | Variant of mapM_ which gets compiled to good code, assuming -- that we're mapping over an actual runtime list and don't intend for -- list fusion to fire. mapMGood_ :: (Monad m, ExpandCase (m ())) => (a -> m ()) -> [a] -> m () mapMM :: (Traversable t, Monad m) => (a -> m b) -> m (t a) -> m (t b) mapMM_ :: (Foldable t, Monad m) => (a -> m ()) -> m (t a) -> m () -- | A monadic version of mapMaybe :: (a -> Maybe b) -> -- [a] -> [b]. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] -- | A version of mapMaybeM with a computation for the -- input list. mapMaybeMM :: Monad m => (a -> m (Maybe b)) -> m [a] -> m [b] -- | Lazy monadic disjunction. or2M :: Monad m => m Bool -> m Bool -> m Bool -- | Lazy monadic disjunction with accumulation of errors in a monoid. -- Errors are discarded if we succeed. orEitherM :: (Monoid e, Monad m) => [m (Either e b)] -> m (Either e b) orM :: (Foldable f, Monad m) => f (m Bool) -> m Bool -- | A `monadic' version of @partition :: (a -> Bool) -- -> [a] -> ([a],[a]) partitionM :: Applicative m => (a -> m Bool) -> [a] -> m ([a], [a]) -- | Performing an action for an inclusive range of Int-s, counting -- up by one. rangeM_ :: (Monad m, ExpandCase (m ())) => Int -> Int -> (Int -> m ()) -> m () -- | Branch over elements of a monadic Foldable data structure. scatterMP :: (MonadPlus m, Foldable t) => m (t a) -> m a -- | Output a single value. tell1 :: (Singleton w ws, MonadWriter ws m) => w -> m () -- | Run a command, catch the exception and return it. tryCatch :: MonadError e m => m () -> m (Maybe e) -- | Try a computation, return Nothing if an Error occurs. tryMaybe :: MonadError e m => m a -> m (Maybe a) unless :: (IsBool b, Monad m) => b -> m () -> m () unlessM :: Monad m => m Bool -> m () -> m () when :: (IsBool b, Monad m) => b -> m () -> m () whenM :: Monad m => m Bool -> m () -> m () -- | The join function is the conventional monad join operator. It -- is used to remove one level of monadic structure, projecting its bound -- argument into the outer level. -- -- 'join bss' can be understood as the do -- expression -- --
--   do bs <- bss
--      bs
--   
-- --

Examples

-- --
--   >>> join [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
--   [1,2,3,4,5,6,7,8,9]
--   
-- --
--   >>> join (Just (Just 3))
--   Just 3
--   
-- -- A common use of join is to run an IO computation -- returned from an STM transaction, since STM transactions -- can't perform IO directly. Recall that -- --
--   atomically :: STM a -> IO a
--   
-- -- is used to run STM transactions atomically. So, by specializing -- the types of atomically and join to -- --
--   atomically :: STM (IO b) -> IO (IO b)
--   join       :: IO (IO b)  -> IO b
--   
-- -- we can compose them as -- --
--   join . atomically :: STM (IO b) -> IO b
--   
-- -- to run an STM transaction and the IO action it returns. join :: Monad m => m (m a) -> m a -- | Promote a function to a monad, scanning the monadic arguments from -- left to right. -- --

Examples

-- --
--   >>> liftM2 (+) [0,1] [0,2]
--   [0,2,1,3]
--   
-- --
--   >>> liftM2 (+) (Just 1) Nothing
--   Nothing
--   
-- --
--   >>> liftM2 (+) (+ 3) (* 2) 5
--   18
--   
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. liftM2). liftM3 :: Monad m => (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r -- | Promote a function to a monad, scanning the monadic arguments from -- left to right (cf. liftM2). liftM4 :: Monad m => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r -- | Strict version of <$>. (<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 <$!> -- | Right-to-left composition of Kleisli arrows. -- (>=>), with the arguments flipped. -- -- Note how this operator resembles function composition -- (.): -- --
--   (.)   ::            (b ->   c) -> (a ->   b) -> a ->   c
--   (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
--   
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c infixr 1 <=< -- | Left-to-right composition of Kleisli arrows. -- -- '(bs >=> cs) a' can be understood as the -- do expression -- --
--   do b <- bs a
--      cs b
--   
-- -- or in terms of (>>=) as -- --
--   bs a >>= cs
--   
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 >=> -- | This generalizes the list-based filter function. -- --
--   runIdentity (filterM (Identity . p) xs) == filter p xs
--   
-- --

Examples

-- --
--   >>> filterM (\x -> do
--         putStrLn ("Keep: " ++ show x ++ "?")
--         answer <- getLine
--         pure (answer == "y"))
--       [1, 2, 3]
--   Keep: 1?
--   y
--   Keep: 2?
--   n
--   Keep: 3?
--   y
--   [1,3]
--   
-- --
--   >>> filterM (\x -> do
--         putStr (show x)
--         x' <- readLn
--         pure (x == x'))
--       [1, 2, 3]
--   12
--   22
--   33
--   [2,3]
--   
filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a] -- | The foldM function is analogous to foldl, except that -- its result is encapsulated in a monad. Note that foldM works -- from left-to-right over the list arguments. This could be an issue -- where (>>) and the `folded function' are not -- commutative. -- --
--   foldM f a1 [x1, x2, ..., xm]
--   
--   ==
--   
--   do
--     a2 <- f a1 x1
--     a3 <- f a2 x2
--     ...
--     f am xm
--   
-- -- If right-to-left evaluation is required, the input list should be -- reversed. -- -- Note: foldM is the same as foldlM foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b -- | The zipWithM function generalizes zipWith to arbitrary -- applicative functors. zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c] -- | zipWithM_ is the extension of zipWithM which ignores the -- final result. zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m () -- | forM_ is mapM_ with its arguments flipped. For a version -- that doesn't ignore the results see forM. -- -- forM_ is just like for_, but specialised to monadic -- actions. forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m () -- | The sum of a collection of actions using (<|>), -- generalizing concat. -- -- msum is just like asum, but specialised to -- MonadPlus. -- --

Examples

-- -- Basic usage, using the MonadPlus instance for Maybe: -- --
--   >>> msum [Just "Hello", Nothing, Just "World"]
--   Just "Hello"
--   
msum :: (Foldable t, MonadPlus m) => t (m a) -> m a -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- --

Examples

-- -- Replace the contents of a Maybe Int with unit: -- --
--   >>> void Nothing
--   Nothing
--   
-- --
--   >>> void (Just 3)
--   Just ()
--   
-- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int (): -- --
--   >>> void (Left 8675309)
--   Left 8675309
--   
-- --
--   >>> void (Right 8675309)
--   Right ()
--   
-- -- Replace every element of a list with unit: -- --
--   >>> void [1,2,3]
--   [(),(),()]
--   
-- -- Replace the second element of a pair with unit: -- --
--   >>> void (1,2)
--   (1,())
--   
-- -- Discard the result of an IO action: -- --
--   >>> mapM print [1,2]
--   1
--   2
--   [(),()]
--   
-- --
--   >>> void $ mapM print [1,2]
--   1
--   2
--   
void :: Functor f => f a -> f () -- | forM is mapM with its arguments flipped. For a version -- that ignores the results see forM_. forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b) -- | MonadError analogue to the try function. tryError :: MonadError e m => m a -> m (Either e a) -- | MonadError analogue to the withExceptT function. -- Modify the value (but not the type) of an error. The type is fixed -- because of the functional dependency m -> e. If you need -- to change the type of e use mapError or -- modifyError. withError :: MonadError e m => (e -> e) -> m a -> m a -- | Lift a binary function to actions. -- -- Some functors support an implementation of liftA2 that is more -- efficient than the default one. In particular, if fmap is an -- expensive operation, it is likely better to use liftA2 than to -- fmap over the structure and then use <*>. -- -- This became a typeclass method in 4.10.0.0. Prior to that, it was a -- function defined in terms of <*> and fmap. -- --

Example

-- --
--   >>> liftA2 (,) (Just 3) (Just 5)
--   Just (3,5)
--   
-- --
--   >>> liftA2 (+) [1, 2, 3] [4, 5, 6]
--   [5,6,7,6,7,8,7,8,9]
--   
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c -- | Monads that also support choice and failure. class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type) -- | The identity of mplus. It should also satisfy the equations -- --
--   mzero >>= f  =  mzero
--   v >> mzero   =  mzero
--   
-- -- The default definition is -- --
--   mzero = empty
--   
mzero :: MonadPlus m => m a -- | An associative operation. The default definition is -- --
--   mplus = (<|>)
--   
mplus :: MonadPlus m => m a -> m a -> m a -- | The class of monad transformers. For any monad m, the result -- t m should also be a monad, and lift should be a monad -- transformation from m to t m, i.e. it should satisfy -- the following laws: -- -- -- -- Since 0.6.0.0 and for GHC 8.6 and later, the requirement that t -- m be a Monad is enforced by the implication constraint -- forall m. Monad m => Monad (t m) enabled by -- the QuantifiedConstraints extension. -- --

Ambiguity error with GHC 9.0 to 9.2.2

-- -- These versions of GHC have a bug -- (https://gitlab.haskell.org/ghc/ghc/-/issues/20582) which -- causes constraints like -- --
--   (MonadTrans t, forall m. Monad m => Monad (t m)) => ...
--   
-- -- to be reported as ambiguous. For transformers 0.6 and later, this can -- be fixed by removing the second constraint, which is implied by the -- first. class forall (m :: Type -> Type). Monad m => Monad t m => MonadTrans (t :: Type -> Type -> Type -> Type) -- | Lift a computation from the argument monad to the constructed monad. lift :: (MonadTrans t, Monad m) => m a -> t m a -- | An infix synonym for fmap. -- -- The name of this operator is an allusion to $. Note the -- similarities between their types: -- --
--    ($)  ::              (a -> b) ->   a ->   b
--   (<$>) :: Functor f => (a -> b) -> f a -> f b
--   
-- -- Whereas $ is function application, <$> is function -- application lifted over a Functor. -- --

Examples

-- -- Convert from a Maybe Int to a Maybe -- String using show: -- --
--   >>> show <$> Nothing
--   Nothing
--   
-- --
--   >>> show <$> Just 3
--   Just "3"
--   
-- -- Convert from an Either Int Int to an -- Either Int String using show: -- --
--   >>> show <$> Left 17
--   Left 17
--   
-- --
--   >>> show <$> Right 17
--   Right "17"
--   
-- -- Double each element of a list: -- --
--   >>> (*2) <$> [1,2,3]
--   [2,4,6]
--   
-- -- Apply even to the second element of a pair: -- --
--   >>> even <$> (2,2)
--   (2,True)
--   
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 <$> -- | Sequential application. -- -- A few functors support an implementation of <*> that is -- more efficient than the default one. -- --

Example

-- -- Used in combination with (<$>), -- (<*>) can be used to build a record. -- --
--   >>> data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
--   
-- --
--   >>> produceFoo :: Applicative f => f Foo
--   
--   >>> produceBar :: Applicative f => f Bar
--   
--   >>> produceBaz :: Applicative f => f Baz
--   
-- --
--   >>> mkState :: Applicative f => f MyState
--   
--   >>> mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz
--   
(<*>) :: Applicative f => f (a -> b) -> f a -> f b infixl 4 <*> -- | Replace all locations in the input with the same value. The default -- definition is fmap . const, but this may be -- overridden with a more efficient version. -- --

Examples

-- -- Perform a computation with Maybe and replace the result with a -- constant value if it is Just: -- --
--   >>> 'a' <$ Just 2
--   Just 'a'
--   
--   >>> 'a' <$ Nothing
--   Nothing
--   
(<$) :: Functor f => a -> f b -> f a infixl 4 <$ -- | ListT done right, see -- https://www.haskell.org/haskellwiki/ListT_done_right_alternative -- -- There is also the list-t package on hackage (Nikita Volkov) -- but it again depends on other packages we do not use yet, so we rather -- implement the few bits we need afresh. module Agda.Utils.ListT -- | Lazy monadic computation of a list of results. newtype ListT (m :: Type -> Type) a ListT :: m (Maybe (a, ListT m a)) -> ListT (m :: Type -> Type) a [runListT] :: ListT (m :: Type -> Type) a -> m (Maybe (a, ListT m a)) -- | Boilerplate function to lift MonadReader through the -- ListT transformer. mapListT :: (m (Maybe (a, ListT m a)) -> n (Maybe (b, ListT n b))) -> ListT m a -> ListT n b -- | Inverse to mapListT. unmapListT :: (ListT m a -> ListT n b) -> m (Maybe (a, ListT m a)) -> n (Maybe (b, ListT n b)) -- | The empty lazy list. nilListT :: forall (m :: Type -> Type) a. Monad m => ListT m a -- | Consing a value to a lazy list. consListT :: forall (m :: Type -> Type) a. Monad m => a -> ListT m a -> ListT m a -- | Singleton lazy list. sgListT :: forall (m :: Type -> Type) a. Monad m => a -> ListT m a -- | Case distinction over lazy list. caseListT :: Monad m => ListT m a -> m b -> (a -> ListT m a -> m b) -> m b -- | Folding a lazy list, effects left-to-right. foldListT :: Monad m => (a -> m b -> m b) -> m b -> ListT m a -> m b -- | Lazy monadic disjunction of lazy monadic list, effects left-to-right anyListT :: Monad m => ListT m a -> (a -> m Bool) -> m Bool -- | Lazy monadic conjunction of lazy monadic list, effects left-to-right allListT :: Monad m => ListT m a -> (a -> m Bool) -> m Bool -- | Force all values in the lazy list, effects left-to-right sequenceListT :: Monad m => ListT m a -> m [a] -- | The join operation of the ListT m monad. concatListT :: forall (m :: Type -> Type) a. Monad m => ListT m (ListT m a) -> ListT m a -- | We can `run' a computation of a ListT as it is monadic -- itself. runMListT :: Monad m => m (ListT m a) -> ListT m a -- | Monadic cons. consMListT :: Monad m => m a -> ListT m a -> ListT m a -- | Monadic singleton. sgMListT :: Monad m => m a -> ListT m a -- | Extending a monadic function to ListT. mapMListT :: Monad m => (a -> m b) -> ListT m a -> ListT m b -- | Alternative implementation using foldListT. mapMListT_alt :: Monad m => (a -> m b) -> ListT m a -> ListT m b -- | Change from one monad to another liftListT :: (Monad m, Monad m') => (forall a1. () => m a1 -> m' a1) -> ListT m a -> ListT m' a instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Alternative (Agda.Utils.ListT.ListT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Applicative (Agda.Utils.ListT.ListT m) instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.Utils.ListT.ListT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Control.Monad.Fail.MonadFail (Agda.Utils.ListT.ListT m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.Utils.ListT.ListT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Utils.ListT.ListT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.MonadPlus (Agda.Utils.ListT.ListT m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Agda.Utils.ListT.ListT m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Agda.Utils.ListT.ListT m) instance Control.Monad.Trans.Class.MonadTrans Agda.Utils.ListT.ListT instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monoid (Agda.Utils.ListT.ListT m a) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Semigroup (Agda.Utils.ListT.ListT m a) -- | Utilities for interacting with the terminal. module Agda.Utils.IO.Terminal -- | Is the NO_COLOR environment variable unset? environmentColor :: IO Bool stdoutSupportsANSI :: IO Bool -- | Hash tables. module Agda.Utils.HashTable -- | Hash tables. A very limited amount of (possibly outdated) testing -- indicates that, for the use in Agda's serialiser/deserialiser, -- Data.HashTable.IO.CuckooHashTable is somewhat slower than -- Data.HashTable.IO.BasicHashTable, and that -- Data.HashTable.IO.LinearHashTable and the hashtables from -- Data.Hashtable are much slower. However, other (also possibly -- outdated) testing suggests that Data.HashTable.IO.CuckooHashTable is -- quite a bit faster than Data.HashTable.IO.BasicHashTable for 64-bit -- Windows. Some more recent, also limited, testing suggests that the -- following hash table implementation from Data.Vector.Hashtables is -- quite a bit faster than Data.HashTable.IO.BasicHashTable (see issue -- #5966). newtype HashTable (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v HashTable :: Dictionary (PrimState IO) ks k vs v -> HashTable (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v -- | Hashtable with lifted keys and unboxed values. type HashTableLU k v = HashTable MVector k MVector v -- | Hashtable with lifted keys and lifted values. type HashTableLL k v = HashTable MVector k MVector v -- | Hashtable with unboxed keys and lifted values. type HashTableUL k v = HashTable MVector k MVector v -- | Hashtable with unboxed keys and values. type HashTableUU k v = HashTable MVector k MVector v -- | An empty hash table. empty :: forall (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v. (MVector ks k, MVector vs v) => IO (HashTable ks k vs v) -- | Inserts the key and the corresponding value into the hash table. insert :: forall k (vs :: Type -> Type -> Type) v (ks :: Type -> Type -> Type). (Hashable k, MVector vs v, MVector ks k) => HashTable ks k vs v -> k -> v -> IO () -- | Tries to find a value corresponding to the key in the hash table. lookup :: forall k (ks :: Type -> Type -> Type) (vs :: Type -> Type -> Type) v. (Hashable k, MVector ks k, MVector vs v) => HashTable ks k vs v -> k -> IO (Maybe v) -- | Converts the hash table to a list. -- -- The order of the elements in the list is unspecified. toList :: forall k (ks :: Type -> Type -> Type) (vs :: Type -> Type -> Type) v. (Hashable k, MVector ks k, MVector vs v) => HashTable ks k vs v -> IO [(k, v)] -- | Make a copy. clone :: forall (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v. (MVector ks k, MVector vs v) => HashTable ks k vs v -> IO (HashTable ks k vs v) -- | Iterate over key-value pairs in IO. Caution: don't modify the table -- while iterating over it! forAssocs :: forall (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v. (MVector ks k, MVector vs v) => HashTable ks k vs v -> (k -> v -> IO ()) -> IO () -- | Iterate over key-value pairs in IO while accummulating a value. -- Caution: don't modify the table while iterating over it! forAssocsAccum :: forall (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v acc. (MVector ks k, MVector vs v) => HashTable ks k vs v -> acc -> (k -> v -> acc -> IO acc) -> IO acc hasKey :: forall k (ks :: Type -> Type -> Type) (vs :: Type -> Type -> Type) v. (Hashable k, MVector ks k, MVector vs v) => HashTable ks k vs v -> k -> IO Bool size :: forall (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v. MVector ks k => HashTable ks k vs v -> IO Int -- | Look up a key in the table. If it's already there, proceed with the -- first (v -> m a) argument. Otherwise run the (m v) -- argument, insert the result value in the table and pass it to the -- second @(v -> m a) argument. insertingIfAbsent :: forall (ks :: Type -> Type -> Type) k (vs :: Type -> Type -> Type) v a. (Hashable k, MVector ks k, MVector vs v) => HashTable ks k vs v -> k -> (v -> IO a) -> IO v -> (v -> IO a) -> IO a -- | Properly inlinable CPS-d lookup function. lookupCPS :: forall a k v (ks :: Type -> Type -> Type) (vs :: Type -> Type -> Type). (MVector ks k, MVector vs v, Hashable k) => k -> HashTable ks k vs v -> (v -> IO a) -> IO a -> IO a module Agda.Interaction.Options.Warnings -- | A WarningMode has two components: a set of warnings to be -- displayed and a flag stating whether warnings should be turned into -- fatal errors. data WarningMode WarningMode :: Set WarningName -> Bool -> WarningMode -- | Invariant: When UnusedImportsAll_ is in the warning set, so -- must be UnusedImports_. [_warningSet] :: WarningMode -> Set WarningName [_warn2Error] :: WarningMode -> Bool warningSet :: Lens' WarningMode (Set WarningName) warn2Error :: Lens' WarningMode Bool lensSingleWarning :: WarningName -> Lens' WarningMode Bool -- | The defaultWarningMode is a curated set of warnings covering -- non-fatal errors and disabling style-related ones defaultWarningSet :: String allWarnings :: Set WarningName usualWarnings :: Set WarningName noWarnings :: Set WarningName unsolvedWarnings :: Set WarningName -- | Both of these warnings are disabled by -WnoUnusedImports. unusedImportsWarnings :: Set WarningName incompleteMatchWarnings :: Set WarningName errorWarnings :: Set WarningName -- | Warnings enabled by --exact-split. exactSplitWarnings :: Set WarningName defaultWarningMode :: WarningMode -- | Some warnings are errors and cannot be turned off. data WarningModeError -- | Unknown warning. Unknown :: Text -> WarningModeError -- | Warning that cannot be disabled. NoNoError :: Text -> WarningModeError -- | -WnoUnusedImports=all is not supported, use -- -WnoUnusedImports instead. NoUnusedImportsAll :: WarningModeError prettyWarningModeError :: WarningModeError -> Text -- | warningModeUpdate str computes the action of str -- over the current WarningMode: it may reset the set of -- warnings, add or remove a specific flag or demand that any warning be -- turned into an error warningModeUpdate :: String -> Either WarningModeError WarningModeUpdate -- | Common sets of warnings warningSets :: [(String, (Set WarningName, String))] -- | The WarningName data enumeration is meant to have a -- one-to-one correspondance to existing warnings in the codebase. data WarningName OptionRenamed_ :: WarningName -- | Some warning could not be set or unset. WarningProblem_ :: WarningName LocalRewritingConfluenceCheck_ :: WarningName OverlappingTokensWarning_ :: WarningName MisplacedAttributes_ :: WarningName UnknownPolarity_ :: WarningName UnknownAttribute_ :: WarningName UnsupportedAttribute_ :: WarningName MultipleAttributes_ :: WarningName MismatchedBrackets_ :: WarningName LibUnknownField_ :: WarningName DefinitionBeforeDeclaration_ :: WarningName DivergentModalityInClause_ :: WarningName EmptyAbstract_ :: WarningName EmptyConstructor_ :: WarningName EmptyField_ :: WarningName EmptyGeneralize_ :: WarningName EmptyInstance_ :: WarningName EmptyMacro_ :: WarningName EmptyMutual_ :: WarningName EmptyPostulate_ :: WarningName EmptyPrimitive_ :: WarningName EmptyPrivate_ :: WarningName EmptyRewritePragma_ :: WarningName EmptyWhere_ :: WarningName EmptyPolarityPragma_ :: WarningName FixityDeclarationForNonOperator_ :: WarningName HiddenGeneralize_ :: WarningName InvalidCatchallPragma_ :: WarningName InvalidConstructorBlock_ :: WarningName InvalidCoverageCheckPragma_ :: WarningName InvalidDataOrRecDefParameter_ :: WarningName InvalidEtaEqualityPragma_ :: WarningName InvalidNoPositivityCheckPragma_ :: WarningName InvalidNoUniverseCheckPragma_ :: WarningName DuplicateRecordDirective_ :: WarningName InvalidTerminationCheckPragma_ :: WarningName InvalidTacticAttribute_ :: WarningName MissingDataDeclaration_ :: WarningName MissingDefinitions_ :: WarningName NotAllowedInMutual_ :: WarningName OpenImportAbstract_ :: WarningName OpenImportPrivate_ :: WarningName PolarityPragmasButNotPostulates_ :: WarningName PragmaCompiled_ :: WarningName PragmaNoTerminationCheck_ :: WarningName ShadowingInTelescope_ :: WarningName UnknownFixityInMixfixDecl_ :: WarningName UnknownNamesInFixityDecl_ :: WarningName UnknownNamesInPolarityPragmas_ :: WarningName UselessAbstract_ :: WarningName UselessImport_ :: WarningName UselessInstance_ :: WarningName UselessMacro_ :: WarningName UselessPrivate_ :: WarningName AbsurdPatternRequiresAbsentRHS_ :: WarningName AsPatternShadowsConstructorOrPatternSynonym_ :: WarningName PatternShadowsConstructor_ :: WarningName CantGeneralizeOverSorts_ :: WarningName ClashesViaRenaming_ :: WarningName CoverageIssue_ :: WarningName CoverageNoExactSplit_ :: WarningName InlineNoExactSplit_ :: WarningName DeprecationWarning_ :: WarningName DuplicateUsing_ :: WarningName FixingCohesion_ :: WarningName FixingPolarity_ :: WarningName FixingRelevance_ :: WarningName MisplacedRewrite_ :: WarningName FixityInRenamingModule_ :: WarningName InvalidCharacterLiteral_ :: WarningName UnusedImports_ :: WarningName UnusedImportsAll_ :: WarningName UselessPragma_ :: WarningName IllegalDeclarationInDataDefinition_ :: WarningName IllformedAsClause_ :: WarningName InstanceArgWithExplicitArg_ :: WarningName InstanceWithExplicitArg_ :: WarningName InstanceNoOutputTypeName_ :: WarningName InteractionMetaBoundaries_ :: WarningName InversionDepthReached_ :: WarningName ModuleDoesntExport_ :: WarningName NotInScope_ :: WarningName NotStrictlyPositive_ :: WarningName ConstructorDoesNotFitInData_ :: WarningName CoinductiveEtaRecord_ :: WarningName UnguardedEtaRecordW_ :: WarningName UnsupportedIndexedMatch_ :: WarningName OldBuiltin_ :: WarningName BuiltinDeclaresIdentifier_ :: WarningName PlentyInHardCompileTimeMode_ :: WarningName PragmaCompileErased_ :: WarningName PragmaCompileList_ :: WarningName PragmaCompileMaybe_ :: WarningName PragmaCompileUnparsable_ :: WarningName PragmaCompileWrong_ :: WarningName PragmaCompileWrongName_ :: WarningName PragmaExpectsDefinedSymbol_ :: WarningName PragmaExpectsUnambiguousConstructorOrFunction_ :: WarningName PragmaExpectsUnambiguousProjectionOrFunction_ :: WarningName UnknownJSPrimitive_ :: WarningName NoMain_ :: WarningName NotARewriteRule_ :: WarningName RewriteLHSNotDefinitionOrConstructor_ :: WarningName RewriteVariablesNotBoundByLHS_ :: WarningName RewriteVariablesBoundMoreThanOnce_ :: WarningName RewriteVariablesBoundInSingleton_ :: WarningName RewriteLHSReduces_ :: WarningName RewriteHeadSymbolIsProjectionLikeFunction_ :: WarningName RewriteHeadSymbolIsTypeConstructor_ :: WarningName RewriteHeadSymbolContainsMetas_ :: WarningName RewriteConstructorParametersNotGeneral_ :: WarningName RewriteContainsUnsolvedMetaVariables_ :: WarningName RewriteBlockedOnProblems_ :: WarningName RewriteRequiresDefinitions_ :: WarningName RewriteDoesNotTargetRewriteRelation_ :: WarningName RewriteBeforeFunctionDefinition_ :: WarningName RewriteBeforeMutualFunctionDefinition_ :: WarningName ConfluenceCheckingIncompleteBecauseOfMeta_ :: WarningName ConfluenceForCubicalNotSupported_ :: WarningName RewriteMaybeNonConfluent_ :: WarningName RewriteNonConfluent_ :: WarningName RewriteAmbiguousRules_ :: WarningName RewriteMissingRule_ :: WarningName DuplicateRewriteRule_ :: WarningName LocalRewriteOutsideTelescope_ :: WarningName InferredLocalRewrite_ :: WarningName SafeFlagInjective_ :: WarningName SafeFlagNoCoverageCheck_ :: WarningName SafeFlagNonTerminating_ :: WarningName SafeFlagNoPositivityCheck_ :: WarningName SafeFlagNoUniverseCheck_ :: WarningName SafeFlagPolarity_ :: WarningName SafeFlagPostulate_ :: WarningName SafeFlagPragma_ :: WarningName SafeFlagTerminating_ :: WarningName SafeFlagWithoutKFlagPrimEraseEquality_ :: WarningName ShouldBeEtaRecordPattern_ :: WarningName TerminationIssue_ :: WarningName TooManyArgumentsToSort_ :: WarningName UnreachableClauses_ :: WarningName UnsolvedConstraints_ :: WarningName UnsolvedInteractionMetas_ :: WarningName UnsolvedMetaVariables_ :: WarningName UselessHiding_ :: WarningName UselessInline_ :: WarningName UselessPatternDeclarationForRecord_ :: WarningName UselessPublic_ :: WarningName UselessTactic_ :: WarningName UserWarning_ :: WarningName InvalidDisplayForm_ :: WarningName UnusedVariablesInDisplayForm_ :: WarningName RewritesNothing_ :: WarningName RecursiveRecordNeedsInductivity_ :: WarningName WithClauseProjectionFixityMismatch_ :: WarningName WithoutKFlagPrimEraseEquality_ :: WarningName ConflictingPragmaOptions_ :: WarningName WrongInstanceDeclaration_ :: WarningName TooManyPolarities_ :: WarningName TopLevelPolarity_ :: WarningName CoInfectiveImport_ :: WarningName InfectiveImport_ :: WarningName DuplicateFields_ :: WarningName TooManyFields_ :: WarningName MissingTypeSignatureForOpaque_ :: WarningName NotAffectedByOpaque_ :: WarningName UnfoldingWrongName_ :: WarningName UnfoldTransparentName_ :: WarningName UselessOpaque_ :: WarningName HiddenNotInArgumentPosition_ :: WarningName InstanceNotInArgumentPosition_ :: WarningName MacroInLetBindings_ :: WarningName AbstractInLetBindings_ :: WarningName FaceConstraintCannotBeHidden_ :: WarningName FaceConstraintCannotBeNamed_ :: WarningName CustomBackendWarning_ :: WarningName warningNameToString :: WarningName -> String -- | The flag corresponding to a warning is precisely the name of the -- constructor minus the trailing underscore. string2WarningName :: String -> Maybe WarningName -- | warningUsage generated using warningNameDescription usageWarning :: String instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Warnings.WarningName instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Warnings.WarningName instance GHC.Internal.Classes.Eq Agda.Interaction.Options.Warnings.WarningMode instance GHC.Internal.Classes.Eq Agda.Interaction.Options.Warnings.WarningName instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Warnings.WarningMode instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Warnings.WarningModeError instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Warnings.WarningName instance Control.DeepSeq.NFData Agda.Interaction.Options.Warnings.WarningMode instance Control.DeepSeq.NFData Agda.Interaction.Options.Warnings.WarningModeError instance Control.DeepSeq.NFData Agda.Interaction.Options.Warnings.WarningName instance GHC.Internal.Classes.Ord Agda.Interaction.Options.Warnings.WarningName instance GHC.Internal.Read.Read Agda.Interaction.Options.Warnings.WarningName instance GHC.Internal.Show.Show Agda.Interaction.Options.Warnings.WarningMode instance GHC.Internal.Show.Show Agda.Interaction.Options.Warnings.WarningModeError instance GHC.Internal.Show.Show Agda.Interaction.Options.Warnings.WarningName -- | Binary trees, used for O(1) append. module Agda.Utils.BinTree1 data BinTree1 a prependToList :: BinTree1 a -> [a] -> [a] toList :: BinTree1 a -> [a] toList1 :: BinTree1 a -> List1 a instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.BinTree1.BinTree1 a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.BinTree1.BinTree1 instance GHC.Internal.Base.Functor Agda.Utils.BinTree1.BinTree1 instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.BinTree1.BinTree1 a) instance GHC.Internal.Base.Semigroup (Agda.Utils.BinTree1.BinTree1 a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.BinTree1.BinTree1 a) instance Agda.Utils.Singleton.Singleton a (Agda.Utils.BinTree1.BinTree1 a) instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.BinTree1.BinTree1 -- | Operations on file names. module Agda.Utils.FileName -- | Paths which are known to be absolute. -- -- Note that the Eq and Ord instances do not check if -- different paths point to the same files or directories. newtype AbsolutePath AbsolutePath :: Text -> AbsolutePath -- | Extract the AbsolutePath to be used as FilePath. filePath :: AbsolutePath -> FilePath -- | Constructs AbsolutePaths. -- -- Precondition: The path must be absolute and valid. mkAbsolute :: FilePath -> AbsolutePath -- | Makes the path absolute. -- -- This function may raise an __IMPOSSIBLE__ error if -- canonicalizePath does not return an absolute path. absolute :: FilePath -> IO AbsolutePath -- | Resolve symlinks etc. Preserves sameFile. canonicalizeAbsolutePath :: AbsolutePath -> IO AbsolutePath -- | Tries to establish if the two file paths point to the same file (or -- directory). False negatives may be returned. sameFile :: AbsolutePath -> AbsolutePath -> IO Bool -- | Case-sensitive doesFileExist for Windows. -- -- This is case-sensitive only on the file name part, not on the -- directory part. (Ideally, path components coming from module name -- components should be checked case-sensitively and the other path -- components should be checked case insensitively.) doesFileExistCaseSensitive :: FilePath -> IO Bool -- | True if the first file is newer than the second file. If a file -- doesn't exist it is considered to be infinitely old. isNewerThan :: FilePath -> FilePath -> IO Bool -- | A partial version of makeRelative with flipped arguments, -- returning Nothing if the given path cannot be relativized to -- the given root. relativizeAbsolutePath :: AbsolutePath -> AbsolutePath -> Maybe FilePath -- | Makes a path relative to a root without assuming that either path is -- canonical. makeRelativeCanonical :: FilePath -> FilePath -> IO FilePath -- | Generalizes stripExtension. stripAnyOfExtensions :: [String] -> FilePath -> Maybe FilePath instance GHC.Internal.Classes.Eq Agda.Utils.FileName.AbsolutePath instance Data.Hashable.Class.Hashable Agda.Utils.FileName.AbsolutePath instance Control.DeepSeq.NFData Agda.Utils.FileName.AbsolutePath instance Agda.Utils.Null.Null Agda.Utils.FileName.AbsolutePath instance GHC.Internal.Classes.Ord Agda.Utils.FileName.AbsolutePath instance GHC.Internal.Show.Show Agda.Utils.FileName.AbsolutePath -- | Instead of checking time-stamps we compute a hash of the module source -- and store it in the interface file. This module contains the functions -- to do that. module Agda.Utils.Hash type Hash = Word64 hashSize :: Int hashByteString :: ByteString -> Hash hashTextFile :: AbsolutePath -> IO Hash -- | Hashes a piece of Text. hashText :: Text -> Hash combineHashes :: [Hash] -> Hash -- | Hashing a module name for unique identifiers. hashString :: String -> Word64 factor :: Word combineWord :: Word -> Word -> Word combineInt :: Int -> Int -> Int -- | Maintaining a list of favorites of some partially ordered type. Only -- the best elements are kept. -- -- To avoid name clashes, import this module qualified, as in import -- Agda.Utils.Favorites (Favorites) import Agda.Utils.Favorites qualified -- as Fav module Agda.Utils.Favorites -- | A list of incomparable favorites. newtype Favorites a Favorites :: [a] -> Favorites a [toList] :: Favorites a -> [a] -- | Result of comparing a candidate with the current favorites. data CompareResult a -- | Great, you are dominating a possibly (empty list of favorites) but -- there is also a rest that is not dominated. If null -- dominated, then notDominated is necessarily the complete -- list of favorites. Dominates :: [a] -> [a] -> CompareResult a [dominated] :: CompareResult a -> [a] [notDominated] :: CompareResult a -> [a] -- | Sorry, but you are dominated by that favorite. IsDominated :: a -> CompareResult a [dominator] :: CompareResult a -> a -- | Gosh, got some pretty a here, compare with my current -- favorites! Discard it if there is already one that is better or equal. -- (Skewed conservatively: faithful to the old favorites.) If there is no -- match for it, add it, and dispose of all that are worse than -- a. -- -- We require a partial ordering. Less is better! (Maybe paradoxically.) compareWithFavorites :: PartialOrd a => a -> Favorites a -> CompareResult a -- | Compare a new set of favorites to an old one and discard the new -- favorites that are dominated by the old ones and vice verse. (Skewed -- conservatively: faithful to the old favorites.) -- --
--   compareFavorites new old = (new', old')
--   
compareFavorites :: PartialOrd a => Favorites a -> Favorites a -> (Favorites a, Favorites a) unionCompared :: (Favorites a, Favorites a) -> Favorites a -- | After comparing, do the actual insertion. insertCompared :: a -> Favorites a -> CompareResult a -> Favorites a -- | Compare, then insert accordingly. insert a l = insertCompared a l -- (compareWithFavorites a l) insert :: PartialOrd a => a -> Favorites a -> Favorites a -- | Insert all the favorites from the first list into the second. union :: PartialOrd a => Favorites a -> Favorites a -> Favorites a -- | Construct favorites from elements of a partial order. The result -- depends on the order of the list if it contains equal elements, since -- earlier seen elements are favored over later seen equals. The first -- element of the list is seen first. fromList :: PartialOrd a => [a] -> Favorites a instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Eq (Agda.Utils.Favorites.Favorites a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.Favorites.Favorites instance GHC.Internal.Base.Functor Agda.Utils.Favorites.Favorites instance Agda.Utils.PartialOrd.PartialOrd a => GHC.Internal.Base.Monoid (Agda.Utils.Favorites.Favorites a) instance Agda.Utils.Null.Null (Agda.Utils.Favorites.Favorites a) instance Agda.Utils.PartialOrd.PartialOrd a => GHC.Internal.Base.Semigroup (Agda.Utils.Favorites.Favorites a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.Favorites.Favorites a) instance Agda.Utils.Singleton.Singleton a (Agda.Utils.Favorites.Favorites a) -- | A simple document tree to render Doc ann but preserve -- annotations. -- -- DocTree and renderToTree' originally taken from -- https://github.com/plt-amy/agda/blob/9fd50b883f14a05792ed79a0b693fbecb2165bf5/src/full/Agda/LSP/Output.hs -- but rewritten to encode more invariants. module Agda.Utils.DocTree -- | A rendered document with annotations from type ann. data DocTree ann -- | Stuff annotated by ann. Node :: ann -> [DocTree ann] -> DocTree ann -- | Atom. Text :: Text -> DocTree ann prettyDocTree :: DocTree ann -> Doc ann -- | Render a Doc ann to a DocTree ann -- using standard layout parameters. renderToTree :: Null ann => Doc ann -> DocTree ann -- | Render a Doc ann to a DocTree ann with -- the given layout parameters. E.g. width=100 -- fill=1.5. renderToTree' :: Null ann => Width -> Fill -> Doc ann -> DocTree ann -- | Generic DocTree linearization. renderTree' :: forall ann t. Monoid t => (Text -> t) -> (ann -> t -> t) -> DocTree ann -> t -- | Linearize a DocTree to Text with the given -- Text-rendering of the annotations. treeToText :: (ann -> Text -> Text) -> DocTree ann -> Text -- | Linearize a DocTree to Text dropping all annotations. treeToTextNoAnn :: DocTree ann -> Text treeToTextWithAnn :: (Monoid ann, Null ann) => DocTree ann -> (Text, RangeMap ann) instance GHC.Internal.Generics.Generic (Agda.Utils.DocTree.DocTree ann) instance Control.DeepSeq.NFData ann => Control.DeepSeq.NFData (Agda.Utils.DocTree.DocTree ann) instance Agda.Utils.Null.Null (Agda.Utils.DocTree.DocTree ann) instance Agda.Utils.Null.Null ann => Agda.Utils.Null.Null (Agda.Utils.DocTree.Item ann) instance Agda.Utils.Null.Null ann => Agda.Utils.Null.Null (Agda.Utils.DocTree.St ann) instance GHC.Internal.Show.Show ann => GHC.Internal.Show.Show (Agda.Utils.DocTree.DocTree ann) -- | Strict compressed tries (based on Data.Map.Strict and -- Agda.Utils.Maybe.Strict). -- -- In contrast to Agda.Utils.Trie, branches from a node can be -- labeled with non-empty lists of keys that do not overlap, meaning they -- start with different first elements. This way, non-branching -- unlabelled pathes can be stored more efficiently. -- -- As a side effect, the notion of height changes which we utilize in the -- truncate function. -- -- An Trie is usually constructed from an Trie via the -- compress function. module Agda.Utils.CompressedTrie -- | Finite map from [k] to v. -- -- With the strict Maybe type, Trie is also strict in -- v. -- -- Invariant: only the root of the tree may be of the form Trie -- Nothing (Map.singleton ks t). A node inside of the trie of that -- form must be fused into its branch. data Trie k v Trie :: Maybe v -> Map (List1 k) (Trie k v) -> Trie k v [trieValue] :: Trie k v -> Maybe v [trieBranches] :: Trie k v -> Map (List1 k) (Trie k v) -- | Singleton tree with value at the root. root :: v -> Trie k v -- | Singleton trie. singleton :: [k] -> v -> Trie k v -- | Singleton tree with empty root. singleton1 :: List1 k -> v -> Trie k v -- | A single branch with the given subtree. Precondition: the given -- subtree has a value at the root. singleBranch :: List1 k -> Trie k v -> (List1 k, Trie k v) -- | Is the trie starting with a single branch? isSingleBranch :: Trie k v -> Maybe (List1 k, Trie k v) -- | Turn a trie into a compressed trie. compress :: Ord k => Trie k v -> Trie k v -- | Turn a compressed trie into an uncompressed trie. uncompress :: Ord k => Trie k v -> Trie k v -- | Convert to ascending list. toList :: Ord k => Trie k v -> [([k], v)] -- | Convert to ascending list. toAscList :: Ord k => Trie k v -> [([k], v)] -- | The number of labeled nodes. size :: Trie k v -> Int -- | The number of nodes that are labeled or leaves.. sizeWithLeaves :: Trie k v -> Int -- | Modify the leaves (input and output may be non-canonical). substLeaves :: (Maybe v -> Trie k v) -> Trie k v -> Trie k v -- | Truncate tree at given depth. truncate 0 t returns the root. truncate :: Int -> Trie k v -> Trie k v -- | Truncate the tree so that it has at most the given size according to -- the given sizing function. truncateSize sizing 0 t returns -- the trie truncate 0 t. truncateSize :: (Trie k v -> Int) -> Int -> Trie k v -> Trie k v -- |
--   truncateSize sizeWithLeaves
--   
truncateSizeWithLeaves :: Int -> Trie k v -> Trie k v instance (GHC.Internal.Classes.Eq v, GHC.Internal.Classes.Eq k) => GHC.Internal.Classes.Eq (Agda.Utils.CompressedTrie.Trie k v) instance GHC.Internal.Data.Foldable.Foldable (Agda.Utils.CompressedTrie.Trie k) instance GHC.Internal.Base.Functor (Agda.Utils.CompressedTrie.Trie k) instance (Control.DeepSeq.NFData k, Control.DeepSeq.NFData v) => Control.DeepSeq.NFData (Agda.Utils.CompressedTrie.Trie k v) instance Agda.Utils.Null.Null (Agda.Utils.CompressedTrie.Trie k v) instance (GHC.Internal.Show.Show v, GHC.Internal.Show.Show k) => GHC.Internal.Show.Show (Agda.Utils.CompressedTrie.Trie k v) instance Agda.Utils.Singleton.Singleton ([k], v) (Agda.Utils.CompressedTrie.Trie k v) -- | Binary trees, used for O(1) append. module Agda.Utils.BinTree data BinTree a prependToList :: BinTree a -> [a] -> [a] toList :: BinTree a -> [a] instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.BinTree.BinTree a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.BinTree.BinTree instance GHC.Internal.Base.Functor Agda.Utils.BinTree.BinTree instance GHC.Internal.Base.Monoid (Agda.Utils.BinTree.BinTree a) instance Agda.Utils.Null.Null (Agda.Utils.BinTree.BinTree a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.BinTree.BinTree a) instance GHC.Internal.Base.Semigroup (Agda.Utils.BinTree.BinTree a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.BinTree.BinTree a) instance Agda.Utils.Singleton.Singleton a (Agda.Utils.BinTree.BinTree a) instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.BinTree.BinTree -- | Partly invertible finite maps. -- -- Time complexities are given under the assumption that all relevant -- instance functions, as well as arguments of function type, take -- constant time, and "n" is the number of keys involved in the -- operation. module Agda.Utils.BiMap -- | Partial injections from a type to some tag type. -- -- The idea is that tag should be injective on its domain: if -- tag x = tag y = Just i, then x = -- y. However, this property does not need to hold globally. The -- preconditions of the BiMap operations below specify for which -- sets of values tag must be injective. class HasTag a where { type Tag a; } tag :: HasTag a => a -> Maybe (Tag a) -- | Checks if the function tag is injective for the values in the -- given list for which the function is defined. tagInjectiveFor :: (Eq v, Eq (Tag v), HasTag v) => [v] -> Bool -- | Finite maps from k to v, with a way to quickly get -- from v to k for certain values of type v -- (those for which tag is defined). -- -- Every value of this type must satisfy biMapInvariant. data BiMap k v BiMap :: Map k v -> Map (Tag v) k -> BiMap k v [biMapThere] :: BiMap k v -> Map k v [biMapBack] :: BiMap k v -> Map (Tag v) k -- | The invariant for BiMap. biMapInvariant :: (Eq k, Eq v, Ord (Tag v), HasTag v) => BiMap k v -> Bool -- | Is the value a source key? O(log n). source :: Ord k => k -> BiMap k v -> Bool -- | Is the value a target key? O(log n). target :: Ord (Tag v) => Tag v -> BiMap k v -> Bool -- | Lookup. O(log n). lookup :: Ord k => k -> BiMap k v -> Maybe v -- | Inverse lookup. O(log n). invLookup :: Ord (Tag v) => Tag v -> BiMap k v -> Maybe k -- | Singleton map. O(1). singleton :: HasTag v => k -> v -> BiMap k v -- | Insertion. Overwrites existing values. O(log n). -- -- Precondition: See insertPrecondition. insert :: (Ord k, HasTag v, Ord (Tag v)) => k -> v -> BiMap k v -> BiMap k v -- | The precondition for insert k v m: If v has a -- tag (tag v ≠ Nothing), then m -- must not contain any mapping k' ↦ v' for which k ≠ -- k' and tag v = tag v'. insertPrecondition :: (Eq k, Eq (Tag v), HasTag v) => k -> v -> BiMap k v -> Bool -- | Modifies the value at the given position, if any. If the function -- returns Nothing, then the value is removed. O(log n). -- -- The precondition for alterM f k m is that, if the -- value v is inserted into m, and tag -- v is defined, then no key other than k may map to a -- value v' for which tag v' = tag v. alterM :: (Ord k, Ord (Tag v), HasTag v, Monad m) => (Maybe v -> m (Maybe v)) -> k -> BiMap k v -> m (BiMap k v) -- | Modifies the value at the given position, if any. If the function -- returns Nothing, then the value is removed. O(log n). -- -- Precondition: See alterPrecondition. alter :: (Ord k, Ord (Tag v), HasTag v) => (Maybe v -> Maybe v) -> k -> BiMap k v -> BiMap k v -- | The precondition for alter f k m is that, if the value -- v is inserted into m, and tag v is -- defined, then no key other than k may map to a value -- v' for which tag v' = tag v. alterPrecondition :: (Ord k, Eq (Tag v), HasTag v) => (Maybe v -> Maybe v) -> k -> BiMap k v -> Bool -- | Modifies the value at the given position, if any. If the function -- returns Nothing, then the value is removed. O(log n). -- -- Precondition: See updatePrecondition. update :: (Ord k, Ord (Tag v), HasTag v) => (v -> Maybe v) -> k -> BiMap k v -> BiMap k v -- | The precondition for update f k m is that, if the -- value v is inserted into m, and tag -- v is defined, then no key other than k may map to a -- value v' for which tag v' = tag v. updatePrecondition :: (Ord k, Eq (Tag v), HasTag v) => (v -> Maybe v) -> k -> BiMap k v -> Bool -- | Modifies the value at the given position, if any. O(log n). -- -- Precondition: See adjustPrecondition. adjust :: (Ord k, Ord (Tag v), HasTag v) => (v -> v) -> k -> BiMap k v -> BiMap k v -- | The precondition for adjust f k m is that, if the -- value v is inserted into m, and tag -- v is defined, then no key other than k may map to a -- value v' for which tag v' = tag v. adjustPrecondition :: (Ord k, Eq (Tag v), HasTag v) => (v -> v) -> k -> BiMap k v -> Bool -- | Inserts a binding into the map. If a binding for the key already -- exists, then the value obtained by applying the function to the key, -- the new value and the old value is inserted, and the old value is -- returned. -- -- Precondition: See insertLookupWithKeyPrecondition. insertLookupWithKey :: (Ord k, Ord (Tag v), HasTag v) => (k -> v -> v -> v) -> k -> v -> BiMap k v -> (Maybe v, BiMap k v) -- | The precondition for insertLookupWithKey f k v m is -- that, if the value v' is inserted into m, and -- tag v' is defined, then no key other than k -- may map to a value v'' for which tag v'' = -- tag v'. insertLookupWithKeyPrecondition :: (Ord k, Eq (Tag v), HasTag v) => (k -> v -> v -> v) -> k -> v -> BiMap k v -> Bool -- | Changes all the values using the given function, which is also given -- access to keys. O(n log n). -- -- Precondition: See mapWithKeyPrecondition. mapWithKey :: (Ord k, Ord (Tag v), HasTag v) => (k -> v -> v) -> BiMap k v -> BiMap k v -- | The precondition for mapWithKey f m: For any two -- distinct mappings k₁ ↦ v₁, k₂ ↦ v₂ in m for -- which the tags of f k₁ v₁ and f k₂ v₂ are defined -- the values of f must be distinct (f k₁ v₁ ≠ f k₂ -- v₂). Furthermore tag must be injective for { f k v | -- (k, v) ∈ m }. mapWithKeyPrecondition :: (Eq k, Eq v, Eq (Tag v), HasTag v) => (k -> v -> v) -> BiMap k v -> Bool -- | Changes all the values using the given function, which is also given -- access to keys. O(n). -- -- Precondition: See mapWithKeyFixedTagsPrecondition. Note that -- tags must not change. mapWithKeyFixedTags :: (k -> v -> v) -> BiMap k v -> BiMap k v -- | The precondition for mapWithKeyFixedTags f m is that, -- if m maps k to v, then tag (f k -- v) == tag v. mapWithKeyFixedTagsPrecondition :: (Eq (Tag v), HasTag v) => (k -> v -> v) -> BiMap k v -> Bool -- | Left-biased union. For the time complexity, see union. -- -- Precondition: See unionPrecondition. union :: (Ord k, Ord (Tag v)) => BiMap k v -> BiMap k v -> BiMap k v unionPrecondition :: (Ord k, Eq v, Eq (Tag v), HasTag v) => BiMap k v -> BiMap k v -> Bool -- | Conversion from lists of pairs. Later entries take precedence over -- earlier ones. O(n log n). -- -- Precondition: See fromListPrecondition. fromList :: (Ord k, Ord (Tag v), HasTag v) => [(k, v)] -> BiMap k v fromListPrecondition :: (Eq k, Eq v, Eq (Tag v), HasTag v) => [(k, v)] -> Bool -- | Conversion to lists of pairs, with the keys in ascending order. O(n). toList :: BiMap k v -> [(k, v)] -- | The keys, in ascending order. O(n). keys :: BiMap k v -> [k] -- | The values, ordered according to the corresponding keys. O(n). elems :: BiMap k v -> [v] -- | Conversion from two lists that contain distinct keys/tags, with the -- keys/tags in ascending order. O(n). -- -- Precondition: See fromDistinctAscendingListsPrecondition. fromDistinctAscendingLists :: ([(k, v)], [(Tag v, k)]) -> BiMap k v fromDistinctAscendingListsPrecondition :: (Ord k, Eq v, Ord (Tag v), HasTag v) => ([(k, v)], [(Tag v, k)]) -> Bool -- | Generates input suitable for fromDistinctAscendingLists. O(n). toDistinctAscendingLists :: BiMap k v -> ([(k, v)], [(Tag v, k)]) instance (GHC.Internal.Classes.Eq k, GHC.Internal.Classes.Eq v) => GHC.Internal.Classes.Eq (Agda.Utils.BiMap.BiMap k v) instance GHC.Internal.Generics.Generic (Agda.Utils.BiMap.BiMap k v) instance Agda.Utils.Null.Null (Agda.Utils.BiMap.BiMap k v) instance (GHC.Internal.Classes.Ord k, GHC.Internal.Classes.Ord v) => GHC.Internal.Classes.Ord (Agda.Utils.BiMap.BiMap k v) instance (GHC.Internal.Show.Show k, GHC.Internal.Show.Show v) => GHC.Internal.Show.Show (Agda.Utils.BiMap.BiMap k v) module Agda.Syntax.TopLevelModuleName.Boot newtype ModuleNameHash ModuleNameHash :: Word64 -> ModuleNameHash [moduleNameHash] :: ModuleNameHash -> Word64 noModuleNameHash :: ModuleNameHash type TopLevelModuleNameParts = List1 Text data TopLevelModuleName' range TopLevelModuleName :: range -> ModuleNameHash -> TopLevelModuleNameParts -> Bool -> TopLevelModuleName' range [moduleNameRange] :: TopLevelModuleName' range -> range [moduleNameId] :: TopLevelModuleName' range -> ModuleNameHash [moduleNameParts] :: TopLevelModuleName' range -> TopLevelModuleNameParts -- | Was this module name constructed from a file name rather than declared -- in the file? [moduleNameInferred] :: TopLevelModuleName' range -> Bool instance GHC.Internal.Classes.Eq Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance GHC.Internal.Classes.Eq (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) instance GHC.Internal.Generics.Generic (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) instance Agda.Utils.BiMap.HasTag Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance Agda.Utils.BiMap.HasTag (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) instance Data.Hashable.Class.Hashable Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance Data.Hashable.Class.Hashable (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) instance Control.DeepSeq.NFData Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance Control.DeepSeq.NFData (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) instance Agda.Utils.Null.Null Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance GHC.Internal.Classes.Ord Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance GHC.Internal.Classes.Ord (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) instance GHC.Internal.Show.Show Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance GHC.Internal.Show.Show range => GHC.Internal.Show.Show (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' range) module Agda.Interaction.Options.ProfileOptions -- | Various things that can be measured when checking an Agda development. -- Turned on with the `--profile` flag, for instance `--profile=sharing` -- to turn on the Sharing option. Internal, Modules, -- and Definitions are mutually exclusive. -- -- NOTE: Changing this data type requires bumping the interface version -- number in currentInterfaceVersion. data ProfileOption -- | Measure time taken by various parts of the system (type checking, -- serialization, etc) Internal :: ProfileOption -- | Measure time spent on individual (Agda) modules Modules :: ProfileOption -- | Measure time spent on individual (Agda) definitions Definitions :: ProfileOption -- | Measure things related to sharing Sharing :: ProfileOption -- | Collect detailed statistics about serialization Serialize :: ProfileOption -- | Collect statistics about constraint solving Constraints :: ProfileOption -- | Count number of created metavariables Metas :: ProfileOption -- | Measure time of interactive commands Interactive :: ProfileOption -- | Collect statistics about conversion checking Conversion :: ProfileOption -- | Collect statistics about instance search Instances :: ProfileOption -- | Collect statistics about section applications Sections :: ProfileOption -- | A set of ProfileOptions data ProfileOptions -- | The empty set of profiling options. noProfileOptions :: ProfileOptions -- | Parse and add a profiling option to a set of profiling options. -- Returns Left with a helpful error message if the option doesn't -- parse or if it's incompatible with existing options. The special -- string "all" adds all options compatible with the given set and -- prefering the first of incompatible options. So `--profile=all` sets -- Internal over Modules and Definitions, but -- `--profile=modules --profile=all` sets Modules and not -- Internal. addProfileOption :: String -> ProfileOptions -> Either String ProfileOptions -- | Check if a given profiling option is present in a set of profiling -- options. containsProfileOption :: ProfileOption -> ProfileOptions -> Bool -- | Use only for serialization. profileOptionsToList :: ProfileOptions -> [ProfileOption] -- | Use only for serialization. profileOptionsFromList :: [ProfileOption] -> ProfileOptions -- | Strings accepted by addProfileOption validProfileOptionStrings :: [String] instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.ProfileOptions.ProfileOption instance GHC.Internal.Enum.Enum Agda.Interaction.Options.ProfileOptions.ProfileOption instance GHC.Internal.Classes.Eq Agda.Interaction.Options.ProfileOptions.ProfileOption instance GHC.Internal.Classes.Eq Agda.Interaction.Options.ProfileOptions.ProfileOptions instance GHC.Internal.Generics.Generic Agda.Interaction.Options.ProfileOptions.ProfileOption instance Control.DeepSeq.NFData Agda.Interaction.Options.ProfileOptions.ProfileOption instance Control.DeepSeq.NFData Agda.Interaction.Options.ProfileOptions.ProfileOptions instance Agda.Utils.Null.Null Agda.Interaction.Options.ProfileOptions.ProfileOptions instance GHC.Internal.Classes.Ord Agda.Interaction.Options.ProfileOptions.ProfileOption instance GHC.Internal.Show.Show Agda.Interaction.Options.ProfileOptions.ProfileOption instance GHC.Internal.Show.Show Agda.Interaction.Options.ProfileOptions.ProfileOptions module Agda.TypeChecking.Serialise.Node -- | Constructor tag (maybe omitted) and argument indices. data Node N0 :: Node N1# :: Word32 -> Node N2# :: Word64 -> Node N3# :: Word64 -> Word32 -> Node N4# :: Word64 -> Word64 -> Node N5# :: Word64 -> Word64 -> Word32 -> Node N6# :: Word64 -> Word64 -> Word64 -> Node -> Node pattern N1 :: Word32 -> Node pattern N2 :: Word32 -> Word32 -> Node pattern N3 :: Word32 -> Word32 -> Word32 -> Node pattern N4 :: Word32 -> Word32 -> Word32 -> Word32 -> Node pattern N5 :: Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Node pattern N6 :: Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Node -> Node instance GHC.Internal.Classes.Eq Agda.TypeChecking.Serialise.Node.Node instance Data.Hashable.Class.Hashable Agda.TypeChecking.Serialise.Node.Node instance Agda.Utils.Serialize.Serialize Agda.TypeChecking.Serialise.Node.Node instance GHC.Internal.Show.Show Agda.TypeChecking.Serialise.Node.Node -- | Position information for syntax. Crucial for giving good error -- messages. module Agda.Syntax.Position type Position = Position' SrcFile type PositionWithoutFile = Position' () -- | Represents a point in the input. -- -- If two positions have the same srcFile and posPos -- components, then the final two components should be the same as well, -- but since this can be hard to enforce the program should not rely too -- much on the last two components; they are mainly there to improve -- error messages for the user. -- -- Note the invariant which positions have to satisfy: -- positionInvariant. data Position' a Pn' :: a -> Word32 -> Word64 -> Position' a -- | File. [srcFile] :: Position' a -> a -- | Position, counting from 1. [posPos] :: Position' a -> Word32 -- | Line and position numbers as Word32, both counting from 1. [posLineCol] :: Position' a -> Word64 pattern Pn :: a -> Word32 -> Word32 -> Word32 -> Position' a posLine :: Position' a -> Word32 posCol :: Position' a -> Word32 type SrcFile = Maybe RangeFile -- | File information used in the Position, Interval and -- Range types. data RangeFile RangeFile :: AbsolutePath -> Maybe (TopLevelModuleName' Range) -> RangeFile -- | The file's path. [rangeFilePath] :: RangeFile -> AbsolutePath -- | The file's top-level module name (if applicable). -- -- This field is optional, but some things may break if the field is not -- instantiated with an actual top-level module name. For instance, the -- Eq and Ord instances only make use of this field. -- -- The field uses Maybe rather than Maybe because it should -- be possible to instantiate it with something that is not yet defined -- (see parseSource). -- -- This '(TopLevelModuleName' Range)' should not contain a range. [rangeFileName] :: RangeFile -> Maybe (TopLevelModuleName' Range) -- | A smart constructor for RangeFile. mkRangeFile :: AbsolutePath -> Maybe (TopLevelModuleName' Range) -> RangeFile positionInvariant :: Position' a -> Bool -- | The first position in a file: position 1, line 1, column 1. startPos :: Maybe RangeFile -> Position -- | The first position in a file: position 1, line 1, column 1. startPos' :: a -> Position' a -- | Advance the position by one character. A newline character -- ('n') moves the position to the first character in the next -- line. Any other character moves the position to the next column. movePos :: Position' a -> Char -> Position' a -- | Advance the position by a string. -- --
--   movePosByString = foldl' movePos
--   
movePosByString :: Foldable t => Position' a -> t Char -> Position' a -- | Backup the position by one character. -- -- Precondition: The character must not be 'n'. backupPos :: Position' a -> Position' a type Interval = Interval' SrcFile type IntervalWithoutFile = Interval' () -- | Tolerably efficient representation of IntervalWithoutFile data IntervalWithoutFile' pattern PackIWF :: IntervalWithoutFile -> IntervalWithoutFile' unpackIWF :: IntervalWithoutFile' -> IntervalWithoutFile -- | An interval. The iEnd position is not included in the -- interval. -- -- Note the invariant which intervals have to satisfy: -- intervalInvariant. data Interval' a Interval :: a -> PositionWithoutFile -> PositionWithoutFile -> Interval' a intervalInvariant :: Ord a => Interval' a -> Bool iStart :: Interval' a -> Position' a iEnd :: Interval' a -> Position' a -- | Converts a file name and two positions to an interval. Sort the -- positions ascendingly. posToInterval :: a -> PositionWithoutFile -> PositionWithoutFile -> Interval' a getIntervalFile :: Interval' a -> a -- | The length of an interval. iLength :: Interval' a -> Word32 -- | Finds the least interval which covers the arguments. fuseIntervals :: IntervalWithoutFile -> IntervalWithoutFile -> IntervalWithoutFile type Range = Range' SrcFile type RangeWithoutFile = Range' () -- | A range is a file name, plus a sequence of intervals, assumed to point -- to the given file. The intervals should be consecutive and separated. -- -- Note the invariant which ranges have to satisfy: -- rangeInvariant. data Range' a NoRange :: Range' a Range :: a -> Seq IntervalWithoutFile' -> Range' a -- | Range invariant. rangeInvariant :: Range' a -> Bool -- | Are the intervals consecutive and separated, do they all point to the -- same file, and do they satisfy the interval invariant? consecutiveAndSeparated :: Ord a => [Interval' a] -> Bool -- | Turns a file name plus a list of intervals into a range. -- -- Precondition: consecutiveAndSeparated. intervalsToRange :: a -> [IntervalWithoutFile] -> Range' a -- | Converts a file name and an interval to a range. intervalToRange :: a -> IntervalWithoutFile -> Range' a -- | Range pointing to the first position in the given file. rangeFromAbsolutePath :: AbsolutePath -> Range -- | The intervals that make up the range. The intervals are consecutive -- and separated (consecutiveAndSeparated). rangeIntervals :: Range' a -> [IntervalWithoutFile] -- | The file the range is pointing to. rangeFile :: Range -> SrcFile -- | The range's top-level module name, if any. -- -- If there is no range, then Nothing is returned. If there is a -- range without a module name, then Just Nothing -- is returned. rangeModule' :: Range -> Maybe (Maybe (TopLevelModuleName' Range)) -- | The range's top-level module name, if any. rangeModule :: Range -> Maybe (TopLevelModuleName' Range) -- | Conflate a range to its right margin. rightMargin :: Range -> Range -- | Ranges between two unknown positions noRange :: Range' a -- | Converts two positions to a range. -- -- Precondition: The positions have to point to the same file. posToRange :: Position' a -> Position' b -> Range' a -- | Converts a file name and two positions to a range. posToRange' :: a -> PositionWithoutFile -> PositionWithoutFile -> Range' a -- | The initial position in the range, if any. rStart :: Range' a -> Maybe (Position' a) -- | The initial position in the range, if any. rStart' :: Range' a -> Maybe PositionWithoutFile -- | The position after the final position in the range, if any. rEnd :: Range' a -> Maybe (Position' a) -- | The position after the final position in the range, if any. rEnd' :: Range' a -> Maybe PositionWithoutFile -- | Converts a range to an interval, if possible. Note that the -- information about the source file is lost. rangeToInterval :: Range' a -> Maybe IntervalWithoutFile -- | Converts a range to an interval, if possible. rangeToIntervalWithFile :: Range' a -> Maybe (Interval' a) -- | Returns the shortest continuous range containing the given one. continuous :: Range' a -> Range' a -- | Removes gaps between intervals on the same line. continuousPerLine :: Range' a -> Range' a -- | Wrapper to indicate that range should be printed. newtype PrintRange a PrintRange :: a -> PrintRange a -- | Things that have a range are instances of this class. class HasRange a getRange :: HasRange a => a -> Range ($dmgetRange) :: forall (t :: Type -> Type) b. (HasRange a, Foldable t, HasRange b, t b ~ a) => a -> Range -- | Things that have a RangeWithoutFile are instances of this -- class. class HasRangeWithoutFile a getRangeWithoutFile :: HasRangeWithoutFile a => a -> RangeWithoutFile ($dmgetRangeWithoutFile) :: forall (t :: Type -> Type) b. (HasRangeWithoutFile a, Foldable t, HasRangeWithoutFile b, t b ~ a) => a -> RangeWithoutFile -- | If it is also possible to set the range, this is the class. -- -- Instances should satisfy getRange (setRange r x) == -- r. class HasRange a => SetRange a setRange :: SetRange a => Range -> a -> a ($dmsetRange) :: forall (f :: Type -> Type) b. (SetRange a, Functor f, SetRange b, f b ~ a) => Range -> a -> a -- | Killing the range of an object sets all range information to -- noRange. class KillRange a killRange :: KillRange a => KillRangeT a ($dmkillRange) :: forall (f :: Type -> Type) b. (KillRange a, Functor f, KillRange b, f b ~ a) => KillRangeT a type KillRangeT a = a -> a -- | Remove ranges in keys and values of a map. killRangeMap :: (KillRange k, KillRange v) => KillRangeT (Map k v) class KILLRANGE t (b :: Bool) killRangeN :: KILLRANGE t b => t -> t -- | x `withRangeOf` y sets the range of x to the range -- of y. withRangeOf :: (SetRange t, HasRange u) => t -> u -> t -- | Precondition: The ranges must point to the same file (or be empty). fuseRange :: (HasRange u, HasRange t) => u -> t -> Range -- | fuseRanges r r' unions the ranges r and r'. -- -- Meaning it finds the least range r0 that covers r -- and r'. -- -- Precondition: The ranges must point to the same file (or be empty). fuseRanges :: Range' a -> Range' a -> Range' a -- | beginningOf r is an empty range (a single, empty interval) -- positioned at the beginning of r. If r does not have -- a beginning, then noRange is returned. beginningOf :: Range -> Range -- | Return an empty range (a single, empty interval) at the beginning of -- the file. beginningOfFile :: BeginningOfFile a => a -> Range -- | Interleaves two streams of ranged elements -- -- It will report the conflicts as a list of conflicting pairs. In case -- of conflict, the element with the earliest start position is placed -- first. In case of a tie, the element with the earliest ending position -- is placed first. If both tie, the element from the first list is -- placed first. interleaveRanges :: HasRangeWithoutFile a => [a] -> [a] -> ([a], [(a, a)]) instance Agda.Syntax.Position.BeginningOfFile Agda.Utils.FileName.AbsolutePath instance Agda.Syntax.Position.BeginningOfFile Agda.Syntax.Position.SrcFile instance Agda.Syntax.Position.BeginningOfFile Agda.Syntax.Position.Range instance Agda.Syntax.Position.BeginningOfFile Agda.Syntax.Position.RangeFile instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Position.Interval' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Position.IntervalWithoutFile' instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Position.Position' a) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Position.PrintRange a) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Position.Range' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Position.RangeFile instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Position.Interval' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Position.Position' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Position.Range' instance GHC.Internal.Base.Functor Agda.Syntax.Position.Interval' instance GHC.Internal.Base.Functor Agda.Syntax.Position.Position' instance GHC.Internal.Base.Functor Agda.Syntax.Position.Range' instance GHC.Internal.Generics.Generic (Agda.Syntax.Position.Interval' a) instance GHC.Internal.Generics.Generic (Agda.Syntax.Position.Position' a) instance GHC.Internal.Generics.Generic (Agda.Syntax.Position.Range' a) instance GHC.Internal.Generics.Generic Agda.Syntax.Position.RangeFile instance Agda.Syntax.Position.HasRange GHC.Internal.Types.Bool instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Position.HasRange Agda.Syntax.Position.Interval instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange [a] instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Utils.List2.List2 a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Utils.Set1.Set1 a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Utils.List1.List1 a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Position.Range instance Agda.Syntax.Position.HasRange (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' Agda.Syntax.Position.Range) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (a, b) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b, Agda.Syntax.Position.HasRange c) => Agda.Syntax.Position.HasRange (a, b, c) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b, Agda.Syntax.Position.HasRange c, Agda.Syntax.Position.HasRange d) => Agda.Syntax.Position.HasRange (a, b, c, d) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b, Agda.Syntax.Position.HasRange c, Agda.Syntax.Position.HasRange d, Agda.Syntax.Position.HasRange e) => Agda.Syntax.Position.HasRange (a, b, c, d, e) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b, Agda.Syntax.Position.HasRange c, Agda.Syntax.Position.HasRange d, Agda.Syntax.Position.HasRange e, Agda.Syntax.Position.HasRange f) => Agda.Syntax.Position.HasRange (a, b, c, d, e, f) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b, Agda.Syntax.Position.HasRange c, Agda.Syntax.Position.HasRange d, Agda.Syntax.Position.HasRange e, Agda.Syntax.Position.HasRange f, Agda.Syntax.Position.HasRange g) => Agda.Syntax.Position.HasRange (a, b, c, d, e, f, g) instance Agda.Syntax.Position.HasRange () instance Agda.Syntax.Position.HasRangeWithoutFile GHC.Internal.Types.Bool instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b) => Agda.Syntax.Position.HasRangeWithoutFile (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Position.HasRangeWithoutFile Agda.Syntax.Position.IntervalWithoutFile instance Agda.Syntax.Position.HasRangeWithoutFile a => Agda.Syntax.Position.HasRangeWithoutFile [a] instance Agda.Syntax.Position.HasRangeWithoutFile a => Agda.Syntax.Position.HasRangeWithoutFile (Agda.Utils.List2.List2 a) instance Agda.Syntax.Position.HasRangeWithoutFile a => Agda.Syntax.Position.HasRangeWithoutFile (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Position.HasRangeWithoutFile a => Agda.Syntax.Position.HasRangeWithoutFile (Agda.Utils.Set1.Set1 a) instance Agda.Syntax.Position.HasRangeWithoutFile a => Agda.Syntax.Position.HasRangeWithoutFile (Agda.Utils.List1.List1 a) instance Agda.Syntax.Position.HasRangeWithoutFile Agda.Syntax.Position.RangeWithoutFile instance Agda.Syntax.Position.HasRangeWithoutFile Agda.Syntax.Position.Range instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b) => Agda.Syntax.Position.HasRangeWithoutFile (a, b) instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b, Agda.Syntax.Position.HasRangeWithoutFile c) => Agda.Syntax.Position.HasRangeWithoutFile (a, b, c) instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b, Agda.Syntax.Position.HasRangeWithoutFile c, Agda.Syntax.Position.HasRangeWithoutFile d) => Agda.Syntax.Position.HasRangeWithoutFile (a, b, c, d) instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b, Agda.Syntax.Position.HasRangeWithoutFile c, Agda.Syntax.Position.HasRangeWithoutFile d, Agda.Syntax.Position.HasRangeWithoutFile e) => Agda.Syntax.Position.HasRangeWithoutFile (a, b, c, d, e) instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b, Agda.Syntax.Position.HasRangeWithoutFile c, Agda.Syntax.Position.HasRangeWithoutFile d, Agda.Syntax.Position.HasRangeWithoutFile e, Agda.Syntax.Position.HasRangeWithoutFile f) => Agda.Syntax.Position.HasRangeWithoutFile (a, b, c, d, e, f) instance (Agda.Syntax.Position.HasRangeWithoutFile a, Agda.Syntax.Position.HasRangeWithoutFile b, Agda.Syntax.Position.HasRangeWithoutFile c, Agda.Syntax.Position.HasRangeWithoutFile d, Agda.Syntax.Position.HasRangeWithoutFile e, Agda.Syntax.Position.HasRangeWithoutFile f, Agda.Syntax.Position.HasRangeWithoutFile g) => Agda.Syntax.Position.HasRangeWithoutFile (a, b, c, d, e, f, g) instance Agda.Syntax.Position.HasRangeWithoutFile () instance Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (Agda.Syntax.Position.Interval' a) instance Data.Hashable.Class.Hashable Agda.Syntax.Position.IntervalWithoutFile' instance Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (Agda.Syntax.Position.Position' a) instance Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (Agda.Syntax.Position.Range' a) instance Data.Hashable.Class.Hashable Agda.Syntax.Position.RangeFile instance Agda.Syntax.Position.KILLRANGE t (Agda.Utils.TypeLevel.IsBase t) => Agda.Syntax.Position.KILLRANGE (a -> t) 'GHC.Internal.Types.False instance (Agda.Utils.TypeLevel.IsBase t GHC.Internal.Types.~ 'GHC.Internal.Types.True) => Agda.Syntax.Position.KILLRANGE t 'GHC.Internal.Types.True instance Agda.Syntax.Position.KillRange GHC.Internal.Types.Bool instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.Permutation.Drop a) instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Position.KillRange GHC.Internal.Types.Int instance Agda.Syntax.Position.KillRange GHC.Internal.Bignum.Integer.Integer instance Agda.Syntax.Position.KillRange GHC.Internal.Base.String instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange [a] instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.List2.List2 a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Data.Map.Internal.Map k a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Data.Strict.Maybe.Maybe a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.Map1.Map1 k a) instance (GHC.Internal.Classes.Ord a, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Agda.Utils.Set1.Set1 a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.List1.List1 a) instance Agda.Syntax.Position.KillRange Agda.Utils.Permutation.Permutation instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Position.Range instance (GHC.Internal.Classes.Ord a, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Data.Set.Internal.Set a) instance Agda.Syntax.Position.KillRange (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' Agda.Syntax.Position.Range) instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (a, b) instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b, Agda.Syntax.Position.KillRange c) => Agda.Syntax.Position.KillRange (a, b, c) instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b, Agda.Syntax.Position.KillRange c, Agda.Syntax.Position.KillRange d) => Agda.Syntax.Position.KillRange (a, b, c, d) instance Agda.Syntax.Position.KillRange () instance Agda.Syntax.Position.KillRange GHC.Internal.Base.Void instance GHC.Internal.Classes.Eq a => GHC.Internal.Base.Monoid (Agda.Syntax.Position.Range' a) instance Control.DeepSeq.NFData Agda.Syntax.Position.Interval instance Control.DeepSeq.NFData Agda.Syntax.Position.IntervalWithoutFile instance Control.DeepSeq.NFData Agda.Syntax.Position.IntervalWithoutFile' instance Control.DeepSeq.NFData Agda.Syntax.Position.Position instance Control.DeepSeq.NFData Agda.Syntax.Position.PositionWithoutFile instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Position.Range' a) instance Control.DeepSeq.NFData Agda.Syntax.Position.RangeFile instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (Agda.Syntax.Position.Position' a) instance Agda.Utils.Null.Null (Agda.Syntax.Position.Range' a) instance Agda.Utils.Null.Null Agda.Syntax.Position.RangeFile instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Position.Interval' a) instance GHC.Internal.Classes.Ord Agda.Syntax.Position.IntervalWithoutFile' instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Position.Position' a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Position.PrintRange a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Position.Range' a) instance GHC.Internal.Classes.Ord Agda.Syntax.Position.RangeFile instance GHC.Internal.Classes.Eq a => GHC.Internal.Base.Semigroup (Agda.Syntax.Position.Range' a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange [a] instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Position.SetRange Agda.Syntax.Position.Range instance Agda.Syntax.Position.SetRange (Agda.Syntax.TopLevelModuleName.Boot.TopLevelModuleName' Agda.Syntax.Position.Range) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Position.Interval' a) instance GHC.Internal.Show.Show Agda.Syntax.Position.IntervalWithoutFile' instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Position.Position' a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Position.Range' a) instance GHC.Internal.Show.Show Agda.Syntax.Position.RangeFile instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Position.Interval' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Position.Position' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Position.Range' module Agda.Syntax.Common.Aspect data Induction Inductive :: Induction CoInductive :: Induction data Aspect Comment :: Aspect Keyword :: Aspect String :: Aspect Number :: Aspect Hole :: Aspect -- | Symbols like forall, =, ->, etc. Symbol :: Aspect -- | Things like Set and Prop. PrimitiveType :: Aspect -- | Bool: Is the name an operator part? Name :: Maybe NameKind -> Bool -> Aspect -- | Text occurring in pragmas that does not have a more specific aspect. Pragma :: Aspect -- | Non-code contents in literate Agda. Background :: Aspect -- | Delimiters used to separate the Agda code blocks from the other -- contents in literate Agda. Markup :: Aspect -- | Uniform Resource Locator aka clickable link. URL :: Text -> Aspect -- | NameKinds are figured out during scope checking. data NameKind -- | Bound variable. Bound :: NameKind -- | Generalizable variable. (This includes generalizable variables that -- have been generalized). Generalizable :: NameKind -- | Inductive or coinductive constructor. Constructor :: Induction -> NameKind Datatype :: NameKind -- | Record field. Field :: NameKind Function :: NameKind -- | Module name. Module :: NameKind Postulate :: NameKind -- | Primitive. Primitive :: NameKind -- | Record type. Record :: NameKind -- | Named argument, like x in {x = v} Argument :: NameKind -- | Macro. Macro :: NameKind -- | Other aspects, generated by type checking. (These can overlap with -- each other and with Aspects.) data OtherAspect Error :: OtherAspect -- | A warning that is considered fatal in the end. ErrorWarning :: OtherAspect DottedPattern :: OtherAspect UnsolvedMeta :: OtherAspect -- | Unsolved constraint not connected to meta-variable. This could for -- instance be an emptyness constraint. UnsolvedConstraint :: OtherAspect TerminationProblem :: OtherAspect PositivityProblem :: OtherAspect -- | Used for highlighting unreachable clauses, unreachable RHS (because of -- an absurd pattern), etc. Deadcode :: OtherAspect -- | Used for shadowed repeated variable names in telescopes. ShadowingInTelescope :: OtherAspect CoverageProblem :: OtherAspect -- | Code which is being type-checked. TypeChecks :: OtherAspect -- | Function declaration without matching definition. MissingDefinition :: OtherAspect -- | Unusable instance etc. InstanceProblem :: OtherAspect -- | Nothing serious, just a beauty flaw. CosmeticProblem :: OtherAspect CatchallClause :: OtherAspect ConfluenceProblem :: OtherAspect -- | Syntactic aspects of the code. (These cannot overlap.) -- -- Meta information which can be associated with a character/character -- range. data Aspects Aspects :: Maybe Aspect -> Set OtherAspect -> String -> Maybe DefinitionSite -> TokenBased -> Aspects [aspect] :: Aspects -> Maybe Aspect [otherAspects] :: Aspects -> Set OtherAspect -- | This note, if not null, can be displayed as a tool-tip or something -- like that. It should contain useful information about the range (like -- the module containing a certain identifier, or the fixity of an -- operator). [note] :: Aspects -> String -- | The definition site of the annotated thing, if applicable and known. [definitionSite] :: Aspects -> Maybe DefinitionSite -- | Is this entry token-based? [tokenBased] :: Aspects -> TokenBased data DefinitionSite DefinitionSite :: TopLevelModuleName' Range -> Int -> Bool -> Maybe String -> DefinitionSite -- | The defining module. [defSiteModule] :: DefinitionSite -> TopLevelModuleName' Range -- | The file position in that module. File positions are counted from 1. [defSitePos] :: DefinitionSite -> Int -- | Has this DefinitionSite been created at the defining site of -- the name? [defSiteHere] :: DefinitionSite -> Bool -- | A pretty name for the HTML linking. [defSiteAnchor] :: DefinitionSite -> Maybe String -- | Is the highlighting "token-based", i.e. based only on information from -- the lexer? data TokenBased TokenBased :: TokenBased NotOnlyTokenBased :: TokenBased -- | Compute the Aspects which (possibly) contain a -- DefinitionSite for the given thing-with-range. rangeDefinitionSite :: HasRange a => a -> Aspects instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.Aspect.OtherAspect instance GHC.Internal.Enum.Enum Agda.Syntax.Common.Aspect.OtherAspect instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.Aspect instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.Aspects instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.DefinitionSite instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.Induction instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.NameKind instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.OtherAspect instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Aspect.TokenBased instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.Aspect instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.Aspects instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.DefinitionSite instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.Induction instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.NameKind instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.OtherAspect instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Aspect.TokenBased instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.Aspect instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.Aspects instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.DefinitionSite instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.Induction instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.NameKind instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.OtherAspect instance Control.DeepSeq.NFData Agda.Syntax.Common.Aspect.TokenBased instance Agda.Utils.Null.Null Agda.Syntax.Common.Aspect.Aspects instance Agda.Utils.Null.Null Agda.Syntax.Common.Aspect.TokenBased instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Aspect.Induction instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Aspect.OtherAspect instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Aspect.Aspect instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Aspect.NameKind instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.Aspect instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.Aspects instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.DefinitionSite instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.Induction instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.NameKind instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.OtherAspect instance GHC.Internal.Show.Show Agda.Syntax.Common.Aspect.TokenBased -- | Pretty printing functions. module Agda.Syntax.Common.Pretty -- |
--   a ? b = hang a 2 b
--   
() :: Doc -> Doc -> Doc infixl 6 -- | align max rows lays out the elements of rows in two -- columns, with the second components aligned. The alignment column of -- the second components is at most max characters to the right -- of the left-most column. -- -- Precondition: max > 0. align :: Int -> [(String, Doc)] -> Doc -- | Only adds an annotation node if the Aspects is non-null. annotate :: Aspects -> Doc -> Doc -- | Attach a simple Aspect, rather than a full set of -- Aspects, to a document. annotateAspect :: Aspect -> Doc -> Doc braces :: Doc -> Doc brackets :: Doc -> Doc colon :: Doc comma :: Doc -- | Attach the position of something as the "binding site" of a -- Doc. definedAt :: HasRange a => Doc -> a -> Doc dot :: Doc doubleQuotes :: Doc -> Doc equals :: Doc fsep :: Foldable t => t Doc -> Doc fwords :: String -> Doc -- | Link to an issue on the Agda bug tracker. githubIssue :: Int -> Doc hcat :: Foldable t => t Doc -> Doc hlArgument :: Doc -> Doc hlBound :: Doc -> Doc hlComment :: Doc -> Doc hlConstructor :: Induction -> Doc -> Doc hlDatatype :: Doc -> Doc hlField :: Doc -> Doc hlFunction :: Doc -> Doc hlGeneralizable :: Doc -> Doc hlHole :: Doc -> Doc hlKeyword :: Doc -> Doc hlMacro :: Doc -> Doc hlModule :: Doc -> Doc hlNameKind :: NameKind -> Doc -> Doc hlNumber :: Doc -> Doc hlPostulate :: Doc -> Doc hlPragma :: Doc -> Doc hlPrimitive :: Doc -> Doc hlPrimitiveType :: Doc -> Doc hlRecord :: Doc -> Doc hlString :: Doc -> Doc hlSymbol :: Doc -> Doc -- | Attach a link to a document (cf. LaTeX href). href :: Text -> Doc -> Doc hsep :: Foldable t => t Doc -> Doc -- | Separate, but only if both separees are not null. hsepWith :: Doc -> Doc -> Doc -> Doc lbrace :: Doc lbrack :: Doc lparen :: Doc -- | Apply parens to Doc if boolean is true. mparens :: Bool -> Doc -> Doc -- | Handles strings with newlines properly (preserving indentation) multiLineText :: String -> Doc parens :: Doc -> Doc -- | Only wrap in parens if not empty parensNonEmpty :: Doc -> Doc pipe :: Doc pluralS :: Sized a => a -> Doc -> Doc -- | Used for with-like telescopes prefixedThings :: Doc -> [Doc] -> Doc -- | Pretty print a single association. prettyAssign :: (Pretty k, Pretty v) => (k, v) -> Doc prettyInterval :: Eq a => Position' a -> Position' a -> Doc prettyLineColumn :: Position' a -> Doc -- | Comma separated list, without the brackets. prettyList_ :: Pretty a => [a] -> Doc -- | Pretty print an association list. prettyMap :: (Pretty k, Pretty v) => [(k, v)] -> Doc -- | Pretty print a set. prettySet :: Pretty a => [a] -> Doc -- | Use instead of show when printing to world. prettyShow :: Pretty a => a -> String -- |
--   pshow = text . show
--   
pshow :: Show a => a -> Doc punctuate :: Foldable t => Doc -> t Doc -> [Doc] pwords :: String -> [Doc] quotes :: Doc -> Doc rbrace :: Doc rbrack :: Doc rparen :: Doc semi :: Doc sep :: Foldable t => t Doc -> Doc singPlural :: Sized a => a -> c -> c -> c -- | Return empty for empty strings. textNonEmpty :: String -> Doc twords :: Text -> [Doc] -- | A URL formatted as link (cf. LaTeX url). url :: String -> Doc vcat :: Foldable t => t Doc -> Doc vsep :: [Doc] -> Doc -- | The type of documents. We use documents annotated by Aspects to -- record syntactic highlighting information that is generated during -- pretty-printing. type Doc = Doc Aspects type DocTree = DocTree Aspects -- | While Show is for rendering data in Haskell syntax, -- Pretty is for displaying data to the world, i.e., the user and -- the environment. -- -- Atomic data has no inner document structure, so just implement -- pretty as pretty a = text $ ... a .... class Pretty a pretty :: Pretty a => a -> Doc prettyPrec :: Pretty a => Int -> a -> Doc prettyList :: Pretty a => [a] -> Doc -- | Above, except that if the last line of the first argument stops at -- least one position before the first line of the second begins, these -- two lines are overlapped. For example: -- --
--   text "hi" $$ nest 5 (text "there")
--   
-- -- lays out as -- --
--   hi   there
--   
-- -- rather than -- --
--   hi
--        there
--   
-- -- $$ is associative, with identity empty, and also -- satisfies -- -- ($$) :: Doc a -> Doc a -> Doc a infixl 5 $$ -- | Above, with no overlapping. $+$ is associative, with identity -- empty. ($+$) :: Doc a -> Doc a -> Doc a infixl 5 $+$ -- | Beside, separated by space, unless one of the arguments is -- empty. <+> is associative, with identity -- empty. (<+>) :: Doc a -> Doc a -> Doc a infixl 6 <+> -- | Either hcat or vcat. cat :: [Doc a] -> Doc a -- | A document of height and width 1, containing a literal character. char :: Char -> Doc a double :: Double -> Doc a -- | "Paragraph fill" version of cat. fcat :: [Doc a] -> Doc a float :: Float -> Doc a -- | The general rendering interface. Please refer to the Style -- and Mode types for a description of rendering mode, line -- length and ribbons. fullRender :: Mode -> Int -> Float -> (TextDetails -> a -> a) -> a -> Doc b -> a -- | The general rendering interface, supporting annotations. Please refer -- to the Style and Mode types for a description of -- rendering mode, line length and ribbons. fullRenderAnn :: Mode -> Int -> Float -> (AnnotDetails b -> a -> a) -> a -> Doc b -> a -- |
--   hang d1 n d2 = sep [d1, nest n d2]
--   
hang :: Doc a -> Int -> Doc a -> Doc a int :: Int -> Doc a integer :: Integer -> Doc a -- | Returns True if the document is empty isEmpty :: Doc a -> Bool -- | Nest (or indent) a document by a given number of positions (which may -- also be negative). nest satisfies the laws: -- -- -- -- The side condition on the last law is needed because empty is a -- left identity for <>. nest :: Int -> Doc a -> Doc a -- | Same as text. Used to be used for Bytestrings. ptext :: String -> Doc a rational :: Rational -> Doc a -- | Render the Doc to a String using the default Style -- (see style). render :: Doc a -> String -- | Render an annotated Doc to a String and list of annotations -- (see Span) using the default Style (see style). renderSpans :: Doc ann -> (String, [Span ann]) -- | Render the Doc to a String using the given Style. renderStyle :: Style -> Doc a -> String -- | Some text with any width. (text s = sizedText (length s) s) sizedText :: Int -> String -> Doc a -- | The default style (mode=PageMode, lineLength=100, -- ribbonsPerLine=1.5). style :: Style -- | A document of height 1 containing a literal string. text -- satisfies the following laws: -- -- -- -- The side condition on the last law is necessary because -- text "" has height 1, while empty has no -- height. text :: String -> Doc a -- | Some text, but without any width. Use for non-printing text such as a -- HTML or Latex tags zeroWidthText :: String -> Doc a -- | Rendering mode. data Mode -- | Normal rendering (lineLength and ribbonsPerLine -- respected'). PageMode :: Mode -- | With zig-zag cuts. ZigZagMode :: Mode -- | No indentation, infinitely long lines (lineLength ignored), but -- explicit new lines, i.e., text "one" $$ text "two", are -- respected. LeftMode :: Mode -- | All on one line, lineLength ignored and explicit new lines -- ($$) are turned into spaces. OneLineMode :: Mode -- | A Span represents the result of an annotation after a -- Doc has been rendered, capturing where the annotation now -- starts and ends in the rendered output. data Span a Span :: Int -> Int -> a -> Span a [spanStart] :: Span a -> Int [spanLength] :: Span a -> Int [spanAnnotation] :: Span a -> a -- | A rendering style. Allows us to specify constraints to choose among -- the many different rendering options. data Style Style :: Mode -> Int -> Float -> Style -- | The rendering mode. [mode] :: Style -> Mode -- | Maximum length of a line, in characters. [lineLength] :: Style -> Int -- | Ratio of line length to ribbon length. A ribbon refers to the -- characters on a line excluding indentation. So a -- lineLength of 100, with a ribbonsPerLine of 2.0 -- would only allow up to 50 characters of ribbon to be displayed on a -- line, while allowing it to be indented up to 50 characters. [ribbonsPerLine] :: Style -> Float -- | A single Char fragment pattern Chr :: () => Char -> TextDetails -- | Used to represent a Fast String fragment but now deprecated and -- identical to the Str constructor. pattern PStr :: () => String -> TextDetails instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.FileName.AbsolutePath instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Types.Bool instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Types.Char instance (a GHC.Internal.Types.~ Agda.Syntax.Common.Aspect.Aspects) => Agda.Syntax.Common.Pretty.Pretty (Text.PrettyPrint.Annotated.HughesPJ.Doc a) instance (a GHC.Internal.Types.~ Agda.Syntax.Common.Aspect.Aspects) => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.DocTree.DocTree a) instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Types.Double instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Types.Int instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Int.Int32 instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Data.IntMap.Internal.IntMap a) instance Agda.Syntax.Common.Pretty.Pretty Data.IntSet.Internal.IntSet instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Bignum.Integer.Integer instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Position.Interval' a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty [a] instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.List2.List2 a) instance (Agda.Syntax.Common.Pretty.Pretty k, Agda.Syntax.Common.Pretty.Pretty v) => Agda.Syntax.Common.Pretty.Pretty (Data.Map.Internal.Map k v) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Data.Strict.Maybe.Maybe a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.List1.List1 a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Position.Position' (Data.Strict.Maybe.Maybe a)) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Position.PositionWithoutFile instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Position.HasRange a) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Position.Range' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Position.RangeFile instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Data.Set.Internal.Set a) instance Agda.Syntax.Common.Pretty.Pretty Data.Text.Internal.Text instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (a, b) instance Agda.Syntax.Common.Pretty.Pretty () instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Word.Word32 instance Agda.Syntax.Common.Pretty.Pretty GHC.Internal.Word.Word64 -- | Time-related utilities. module Agda.Utils.Time -- | Timestamps. type ClockTime = UTCTime -- | The current time. getClockTime :: IO ClockTime getCPUTime :: MonadIO m => m CPUTime -- | Measure the time of a computation. Of course, does not work with -- exceptions. measureTime :: MonadIO m => m a -> m (a, CPUTime) -- | CPU time in pico (10^-12) seconds. newtype CPUTime CPUTime :: Integer -> CPUTime fromMilliseconds :: Integer -> CPUTime instance GHC.Internal.Enum.Enum Agda.Utils.Time.CPUTime instance GHC.Internal.Classes.Eq Agda.Utils.Time.CPUTime instance GHC.Internal.Real.Integral Agda.Utils.Time.CPUTime instance Control.DeepSeq.NFData Agda.Utils.Time.CPUTime instance GHC.Internal.Num.Num Agda.Utils.Time.CPUTime instance GHC.Internal.Classes.Ord Agda.Utils.Time.CPUTime instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Time.CPUTime instance GHC.Internal.Real.Real Agda.Utils.Time.CPUTime instance GHC.Internal.Show.Show Agda.Utils.Time.CPUTime -- | Parser combinators with support for left recursion, following -- Johnson's "Memoization in Top-Down Parsing". -- -- This implementation is based on an implementation due to Atkey -- (attached to an edlambda-members mailing list message from 2011-02-15 -- titled 'Slides for "Introduction to Parser Combinators"'). -- -- Note that non-memoised left recursion is not guaranteed to work. -- -- The code contains an important deviation from Johnson's paper: the -- check for subsumed results is not included. This means that one can -- get the same result multiple times when parsing using ambiguous -- grammars. As an example, parsing the empty string using S ∷= ε | -- ε succeeds twice. This change also means that parsing fails to -- terminate for some cyclic grammars that would otherwise be handled -- successfully, such as S ∷= S | ε. However, the library is not -- intended to handle infinitely ambiguous grammars. (It is unclear to -- the author of this module whether the change leads to more -- non-termination for grammars that are not cyclic.) module Agda.Utils.Parser.MemoisedCPS class (Functor p, Applicative p, Alternative p, Monad p) => ParserClass (p :: Type -> Type) k r tok | p -> k, p -> r, p -> tok -- | Runs the parser. parse :: ParserClass p k r tok => p a -> [tok] -> [a] -- | Tries to print the parser, or returns empty, depending on the -- implementation. This function might not terminate. grammar :: (ParserClass p k r tok, Show k) => p a -> Doc -- | Parses a token satisfying the given predicate. The computed value is -- returned. sat' :: ParserClass p k r tok => (tok -> Maybe a) -> p a -- | Uses the given function to modify the printed representation (if any) -- of the given parser. annotate :: ParserClass p k r tok => (DocP -> DocP) -> p a -> p a -- | Memoises the given parser. -- -- Every memoised parser must be annotated with a unique key. -- (Parametrised parsers must use distinct keys for distinct inputs.) memoise :: ParserClass p k r tok => k -> p r -> p r -- | Memoises the given parser, but only if printing, not if parsing. -- -- Every memoised parser must be annotated with a unique key. -- (Parametrised parsers must use distinct keys for distinct inputs.) memoiseIfPrinting :: ParserClass p k r tok => k -> p r -> p r -- | Parses a token satisfying the given predicate. sat :: ParserClass p k r tok => (tok -> Bool) -> p tok -- | Parses a single token. token :: ParserClass p k r tok => p tok -- | Parses a given token. tok :: (ParserClass p k r tok, Eq tok, Show tok) => tok -> p tok -- | Uses the given document as the printed representation of the given -- parser. The document's precedence is taken to be atomP. doc :: ParserClass p k r tok => Doc -> p a -> p a -- | Documents paired with precedence levels. type DocP = (Doc, Int) -- | Precedence of >>=. bindP :: Int -- | Precedence of |. choiceP :: Int -- | Precedence of *. seqP :: Int -- | Precedence of ⋆ and +. starP :: Int -- | Precedence of atoms. atomP :: Int -- | The parser type. -- -- The parameters of the type Parser k r tok a have the -- following meanings: -- -- data Parser k r tok a -- | An extended parser type, with some support for printing parsers. data ParserWithGrammar k r tok a instance GHC.Internal.Base.Alternative (Agda.Utils.Parser.MemoisedCPS.Parser k r tok) instance GHC.Internal.Base.Alternative (Agda.Utils.Parser.MemoisedCPS.ParserWithGrammar k r tok) instance GHC.Internal.Base.Applicative (Agda.Utils.Parser.MemoisedCPS.Parser k r tok) instance GHC.Internal.Base.Applicative (Agda.Utils.Parser.MemoisedCPS.ParserWithGrammar k r tok) instance GHC.Internal.Base.Functor (Agda.Utils.Parser.MemoisedCPS.Parser k r tok) instance GHC.Internal.Base.Functor (Agda.Utils.Parser.MemoisedCPS.ParserWithGrammar k r tok) instance GHC.Internal.Base.Monad (Agda.Utils.Parser.MemoisedCPS.Parser k r tok) instance GHC.Internal.Base.Monad (Agda.Utils.Parser.MemoisedCPS.ParserWithGrammar k r tok) instance Agda.Utils.Parser.MemoisedCPS.ParserClass (Agda.Utils.Parser.MemoisedCPS.ParserWithGrammar k r tok) k r tok instance Agda.Utils.Parser.MemoisedCPS.ParserClass (Agda.Utils.Parser.MemoisedCPS.Parser k r tok) k r tok -- | Directed graphs (can of course simulate undirected graphs). -- -- Represented as adjacency maps in direction from source to target. -- -- Each source node maps to an adjacency map of outgoing edges, which is -- a map from target nodes to edges. -- -- Listed time complexities are for the worst case (and possibly -- amortised), with n standing for the number of nodes in the -- graph and e standing for the number of edges. Comparisons, -- predicates etc. are assumed to take constant time (unless otherwise -- stated). module Agda.Utils.Graph.AdjacencyMap.Unidirectional -- | Graph n e is a type of directed graphs with nodes in -- n and edges in e. -- -- At most one edge is allowed between any two nodes. Multigraphs can be -- simulated by letting the edge type e be a collection type. -- -- The graphs are represented as adjacency maps (adjacency lists, but -- using finite maps instead of arrays and lists). This makes it possible -- to compute a node's outgoing edges in logarithmic time (O(log -- n)). However, computing the incoming edges may be more expensive. -- -- Note that neither the number of nodes nor the number of edges may -- exceed maxBound :: Int. newtype Graph n e Graph :: Map n (Map n e) -> Graph n e -- | Forward edges. [graph] :: Graph n e -> Map n (Map n e) -- | Internal invariant. invariant :: Ord n => Graph n e -> Bool -- | Edges. data Edge n e Edge :: n -> n -> e -> Edge n e -- | Outgoing node. [source] :: Edge n e -> n -- | Incoming node. [target] :: Edge n e -> n -- | Edge label (weight). [label] :: Edge n e -> e -- | If there is an edge from s to t, then lookup s t -- g is Just e, where e is the edge's -- label. O(log n). lookup :: Ord n => n -> n -> Graph n e -> Maybe e -- | The graph's edges. O(n + e). edges :: Graph n e -> [Edge n e] -- | neighbours u g consists of all nodes v for which -- there is an edge from u to v in g, along -- with the corresponding edge labels. O(log n + |neighbours u -- g|). neighbours :: Ord n => n -> Graph n e -> [(n, e)] -- | neighboursMap u g consists of all nodes v for which -- there is an edge from u to v in g, along -- with the corresponding edge labels. O(log n). neighboursMap :: Ord n => n -> Graph n e -> Map n e -- | edgesFrom g ns is a list containing all edges originating in -- the given nodes (i.e., all outgoing edges for the given nodes). If -- ns does not contain duplicates, then the resulting list does -- not contain duplicates. O(|ns| log |n| + -- |edgesFrom g ns|). edgesFrom :: Ord n => Graph n e -> [n] -> [Edge n e] -- | edgesTo g ns is a list containing all edges ending in the -- given nodes (i.e., all incoming edges for the given nodes). If -- ns does not contain duplicates, then the resulting list does -- not contain duplicates. O(|ns| n log n). edgesTo :: Ord n => Graph n e -> [n] -> [Edge n e] -- | All self-loops. O(n log n). diagonal :: Ord n => Graph n e -> [Edge n e] -- | All self-loops. O(n log n). loops :: Ord n => Graph n e -> [(n, e)] -- | All nodes. O(n). nodes :: Graph n e -> Set n -- | Nodes with outgoing edges. O(n). sourceNodes :: Graph n e -> Set n -- | Nodes with incoming edges. O(n + e log n). targetNodes :: Ord n => Graph n e -> Set n -- | Nodes without incoming or outgoing edges. O(n + e log n). isolatedNodes :: Ord n => Graph n e -> Set n -- | Various kinds of nodes. data Nodes n Nodes :: Set n -> Set n -> Set n -> Nodes n -- | Nodes with outgoing edges. [srcNodes] :: Nodes n -> Set n -- | Nodes with incoming edges. [tgtNodes] :: Nodes n -> Set n -- | All nodes, with or without edges. [allNodes] :: Nodes n -> Set n -- | Constructs a Nodes structure. O(n + e log n). computeNodes :: Ord n => Graph n e -> Nodes n -- | Checks whether the graph is discrete (containing no edges other than -- null edges). O(n + e). discrete :: Null e => Graph n e -> Bool -- | Returns True iff the graph is acyclic. acyclic :: Ord n => Graph n e -> Bool -- | Constructs a completely disconnected graph containing the given nodes. -- O(n log n). fromNodes :: Ord n => [n] -> Graph n e -- | Constructs a completely disconnected graph containing the given nodes. -- O(n). fromNodeSet :: Set n -> Graph n e -- | fromEdges es is a graph containing the edges in es, -- with the caveat that later edges overwrite earlier edges. -- O(|es| log n). fromEdges :: Ord n => [Edge n e] -> Graph n e -- | fromEdgesWith f es is a graph containing the edges in -- es. Later edges are combined with earlier edges using the -- supplied function. O(|es| log n). fromEdgesWith :: Ord n => (e -> e -> e) -> [Edge n e] -> Graph n e -- | Empty graph (no nodes, no edges). O(1). empty :: Graph n e -- | A graph with two nodes and a single connecting edge. O(1). singleton :: Ord n => n -> n -> e -> Graph n e -- | Inserts an edge into the graph. O(log n). insert :: Ord n => n -> n -> e -> Graph n e -> Graph n e -- | insertWith f s t new inserts an edge from s to -- t into the graph. If there is already an edge from s -- to t with label old, then this edge gets replaced by -- an edge with label f new old, and otherwise the edge's label -- is new. O(log n). insertWith :: Ord n => (e -> e -> e) -> n -> n -> e -> Graph n e -> Graph n e -- | Inserts an edge into the graph. O(log n). insertEdge :: Ord n => Edge n e -> Graph n e -> Graph n e -- | A variant of insertWith. O(log n). insertEdgeWith :: Ord n => (e -> e -> e) -> Edge n e -> Graph n e -> Graph n e -- | Left-biased union. -- -- Time complexity: See unionWith. union :: Ord n => Graph n e -> Graph n e -> Graph n e -- | Union. The function is used to combine edge labels for edges that -- occur in both graphs (labels from the first graph are given as the -- first argument to the function). -- -- Time complexity: O(n₁ log (n₂n₁ + 1) + e₁ log e₂), where -- n₁/ is the number of nodes in the graph with the smallest number -- of nodes and n₂ is the number of nodes in the other graph, and -- e₁ is the number of edges in the graph with the smallest number -- of edges and e₂ is the number of edges in the other graph. -- -- Less complicated time complexity: O((n + e) log n (where -- n and e refer to the resulting graph). unionWith :: Ord n => (e -> e -> e) -> Graph n e -> Graph n e -> Graph n e -- | Union. O((n + e) log n (where n and e refer to -- the resulting graph). unions :: Ord n => [Graph n e] -> Graph n e -- | Union. The function is used to combine edge labels for edges that -- occur in several graphs. O((n + e) log n (where n and -- e refer to the resulting graph). unionsWith :: Ord n => (e -> e -> e) -> [Graph n e] -> Graph n e -- | A variant of fmap that provides extra information to the -- function argument. O(n + e). mapWithEdge :: (Edge n e -> e') -> Graph n e -> Graph n e' -- | Only transform the self-loops. mapLoops :: Ord n => (e -> e) -> Graph n e -> Graph n e -- | Reverses an edge. O(1). transposeEdge :: Edge n e -> Edge n e -- | The opposite graph (with all edges reversed). O((n + e) log n). transpose :: Ord n => Graph n e -> Graph n e -- | Removes null edges. O(n + e). clean :: Null e => Graph n e -> Graph n e -- | removeNode n g removes the node n (and all -- corresponding edges) from g. O(n + e). removeNode :: Ord n => n -> Graph n e -> Graph n e -- | removeNodes ns g removes the nodes in ns (and all -- corresponding edges) from g. O((n + e) log -- |ns|). removeNodes :: Ord n => Set n -> Graph n e -> Graph n e -- | removeEdge s t g removes the edge going from s to -- t, if any. O(log n). removeEdge :: Ord n => n -> n -> Graph n e -> Graph n e -- | The graph filterNodes p g contains exactly those nodes from -- g that satisfy the predicate p. Edges to or from -- nodes that are removed are also removed. O(n + e). filterNodes :: (n -> Bool) -> Graph n e -> Graph n e -- | Keep only the edges that satisfy the predicate. O(n + e). filterEdges :: (Edge n e -> Bool) -> Graph n e -> Graph n e -- | Removes the nodes that do not satisfy the predicate from the graph, -- but keeps the edges: if there is a path in the original graph between -- two nodes that are retained, then there is a path between these two -- nodes also in the resulting graph. -- -- Precondition: The graph must be acyclic. -- -- Worst-case time complexity: O(e n log n) (this has not been -- verified carefully). filterNodesKeepingEdges :: (Ord n, SemiRing e) => (n -> Bool) -> Graph n e -> Graph n e -- | Renames the nodes. -- -- Precondition: The renaming function must be injective. -- -- Time complexity: O((n + e) log n). renameNodes :: Ord n2 => (n1 -> n2) -> Graph n1 e -> Graph n2 e -- | Renames the nodes. -- -- Precondition: The renaming function ren must be strictly -- increasing (if x < y then ren x < ren -- y). -- -- Time complexity: O(n + e). renameNodesMonotonic :: (n1 -> n2) -> Graph n1 e -> Graph n2 e -- | WithUniqueInt n consists of pairs of (unique) Ints and -- values of type n. -- -- Values of this type are compared by comparing the Ints. data WithUniqueInt n WithUniqueInt :: Int -> n -> WithUniqueInt n [uniqueInt] :: WithUniqueInt n -> Int [otherValue] :: WithUniqueInt n -> n -- | Combines each node label with a unique Int. -- -- Precondition: The number of nodes in the graph must not be larger than -- maxBound :: Int. -- -- Time complexity: O(n + e log n). addUniqueInts :: Ord n => Graph n e -> Graph (WithUniqueInt n) e -- | Unzips the graph. O(n + e). unzip :: Graph n (e, e') -> (Graph n e, Graph n e') -- | composeWith times plus g g' finds all edges s --c_i--> -- t_i --d_i--> u with s --c_i--> t_i in g -- and t_i --d_i--> u in g' and constructs the -- result graph from edge(s,u) = sum_i (c_i times d_i). -- -- Complexity: For each edge s --> t in g we look up -- all edges starting with t in g'. -- -- Precondition: The two graphs must have exactly the same nodes. composeWith :: forall c d e n. Ord n => (c -> d -> e) -> (e -> e -> e) -> Graph n c -> Graph n d -> Graph n e -- | The graph's strongly connected components, in reverse topological -- order. -- -- The time complexity is likely O(n + e log n) (but this depends -- on the, at the time of writing undocumented, time complexity of -- stronglyConnComp). sccs' :: Ord n => Graph n e -> [SCC n] -- | The graph's strongly connected components, in reverse topological -- order. -- -- The time complexity is likely O(n + e log n) (but this depends -- on the, at the time of writing undocumented, time complexity of -- stronglyConnComp). sccs :: Ord n => Graph n e -> [List1 n] -- | SCC DAGs. -- -- The maps map SCC indices to and from SCCs/nodes. data DAG n DAG :: Graph -> IntMap (SCC n) -> Map n Int -> DAG n [dagGraph] :: DAG n -> Graph [dagComponentMap] :: DAG n -> IntMap (SCC n) [dagNodeMap] :: DAG n -> Map n Int -- | DAG invariant. dagInvariant :: Ord n => DAG n -> Bool -- | The opposite DAG. oppositeDAG :: DAG n -> DAG n -- | The nodes reachable from the given SCC. reachable :: Ord n => DAG n -> SCC n -> [n] -- | Constructs a DAG containing the graph's strongly connected components. sccDAG' :: Ord n => Graph n e -> [SCC n] -> DAG n -- | Constructs a DAG containing the graph's strongly connected components. sccDAG :: Ord n => Graph n e -> DAG n -- | reachableFrom g n is a map containing all nodes reachable -- from n in g. For each node a simple path to the node -- is given, along with its length (the number of edges). The paths are -- as short as possible (in terms of the number of edges). -- -- Precondition: n must be a node in g. The number of -- nodes in the graph must not be larger than maxBound :: -- Int. -- -- Amortised time complexity (assuming that comparisons take constant -- time): O(e log n), if the lists are not inspected. Inspection -- of a prefix of a list is linear in the length of the prefix. reachableFrom :: Ord n => Graph n e -> n -> Map n (Int, [Edge n e]) -- | reachableFromSet g ns is a set containing all nodes reachable -- from ns in g. -- -- Precondition: Every node in ns must be a node in g. -- The number of nodes in the graph must not be larger than -- maxBound :: Int. -- -- Amortised time complexity (assuming that comparisons take constant -- time): O((|ns| + e) log n). reachableFromSet :: Ord n => Graph n e -> Set n -> Set n -- | walkSatisfying every some g from to determines if there is a -- walk from from to to in g, in which every -- edge satisfies the predicate every, and some edge satisfies -- the predicate some. If there are several such walks, then a -- shortest one (in terms of the number of edges) is returned. -- -- Precondition: from and to must be nodes in -- g. The number of nodes in the graph must not be larger than -- maxBound :: Int. -- -- Amortised time complexity (assuming that comparisons and the -- predicates take constant time to compute): O(n + e log n). walkSatisfying :: Ord n => (Edge n e -> Bool) -> (Edge n e -> Bool) -> Graph n e -> n -> n -> Maybe [Edge n e] -- | Constructs a graph g' with the same nodes as the original -- graph g. In g' there is an edge from n1 to -- n2 if and only if there is a (possibly empty) simple path -- from n1 to n2 in g. In that case the edge -- is labelled with all of the longest (in terms of numbers of edges) -- simple paths from n1 to n2 in g, as well as -- the lengths of these paths. -- -- Precondition: The graph must be acyclic. The number of nodes in the -- graph must not be larger than maxBound :: Int. -- -- Worst-case time complexity (if the paths are not inspected): O(e n -- log n) (this has not been verified carefully). -- -- The algorithm is based on one found on Wikipedia. longestPaths :: Ord n => Graph n e -> Graph n (Int, [[Edge n e]]) -- | Computes the transitive closure of the graph. -- -- Uses the Gauss-Jordan-Floyd-Warshall-McNaughton-Yamada algorithm (as -- described by Russell O'Connor in "A Very General Method of Computing -- Shortest Paths" http://r6.ca/blog/20110808T035622Z.html), -- implemented using Graph, and with some shortcuts: -- -- -- -- The graph's strongly connected components (in reverse topological -- order) are returned along with the transitive closure. gaussJordanFloydWarshallMcNaughtonYamada :: (Ord n, Eq e, StarSemiRing e) => Graph n e -> (Graph n e, [SCC n]) -- | Computes the transitive closure of the graph. -- -- Uses the Gauss-Jordan-Floyd-Warshall-McNaughton-Yamada algorithm (as -- described by Russell O'Connor in "A Very General Method of Computing -- Shortest Paths" http://r6.ca/blog/20110808T035622Z.html), -- implemented using matrices. -- -- The resulting graph does not contain any zero edges. -- -- This algorithm should be seen as a reference implementation. In -- practice gaussJordanFloydWarshallMcNaughtonYamada is likely to -- be more efficient. gaussJordanFloydWarshallMcNaughtonYamadaReference :: (Ord n, Eq e, StarSemiRing e) => Graph n e -> Graph n e -- | The transitive closure. Using -- gaussJordanFloydWarshallMcNaughtonYamada. NOTE: DO NOT USE () -- AS EDGE LABEL SINCE THIS MEANS EVERY EDGE IS CONSIDERED A ZERO EDGE -- AND NO NEW EDGES WILL BE ADDED! Use 'Maybe ()' instead. transitiveClosure :: (Ord n, Eq e, StarSemiRing e) => Graph n e -> Graph n e -- | The transitive reduction of the graph: a graph with the same -- reachability relation as the graph, but with as few edges as possible. -- -- Precondition: The graph must be acyclic. The number of nodes in the -- graph must not be larger than maxBound :: Int. -- -- Worst-case time complexity: O(e n log n) (this has not been -- verified carefully). -- -- The algorithm is based on one found on Wikipedia. transitiveReduction :: Ord n => Graph n e -> Graph n () -- | Transitive closure ported from Agda.Termination.CallGraph. -- -- Relatively efficient, see Issue 1560. complete :: (Eq e, Null e, SemiRing e, Ord n) => Graph n e -> Graph n e -- | Version of complete that produces a list of intermediate -- results paired to the left with a difference that lead to the new -- intermediat result. -- -- The last element in the list is the transitive closure, paired with -- the empty graph. -- --
--   complete g = snd $ last $ completeIter g
--   
completeIter :: (Eq e, Null e, SemiRing e, Ord n) => Graph n e -> [(Graph n e, Graph n e)] instance (GHC.Internal.Classes.Eq n, GHC.Internal.Classes.Eq e) => GHC.Internal.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance (GHC.Internal.Classes.Eq n, GHC.Internal.Classes.Eq e) => GHC.Internal.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) instance GHC.Internal.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance GHC.Internal.Base.Functor (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n) instance GHC.Internal.Base.Functor (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n) instance GHC.Internal.Base.Functor Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt instance (GHC.Internal.Classes.Ord n, GHC.Internal.Classes.Ord e) => GHC.Internal.Classes.Ord (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance GHC.Internal.Classes.Ord (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance (Agda.Syntax.Common.Pretty.Pretty n, Agda.Syntax.Common.Pretty.Pretty e) => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance (GHC.Internal.Classes.Ord n, Agda.Syntax.Common.Pretty.Pretty n, Agda.Syntax.Common.Pretty.Pretty e) => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) instance Agda.Syntax.Common.Pretty.Pretty n => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance (GHC.Internal.Show.Show n, GHC.Internal.Show.Show e) => GHC.Internal.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance (GHC.Internal.Classes.Ord n, GHC.Internal.Show.Show n, GHC.Internal.Show.Show e) => GHC.Internal.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) instance GHC.Internal.Show.Show n => GHC.Internal.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) module Agda.Utils.Graph.TopSort -- | topoligical sort with smallest-numbered available vertex first | -- input: nodes, edges | output is Nothing if the graph is not a DAG -- Note: should be stable to preserve order of generalizable variables. -- Algorithm due to Richard Eisenberg, and works by walking over the list -- left-to-right and moving each node the minimum distance left to -- guarantee topological ordering. topSort :: Ord n => Set n -> [(n, n)] -> Maybe [n] -- | Generate an import dependency graph for a given module. module Agda.Interaction.Highlighting.Dot.Base renderDotToFile :: MonadIO m => DotGraph -> FilePath -> m () renderDot :: DotGraph -> Text -- | Graph structure type DotGraph = Graph WithUniqueInt Text () module Agda.Utils.CallStack -- | Transform a CallStack by filtering each CallSite filterCallStack :: CallSiteFilter -> CallStack -> CallStack -- | Get the most recent CallSite in a CallStack, if -- there is one. headCallSite :: CallStack -> Maybe CallSite -- | Transform a CallStack by transforming its list of -- CallSite overCallSites :: ([CallSite] -> [CallSite]) -> CallStack -> CallStack -- | Pops n entries off a CallStack using popCallStack. -- Note that frozen callstacks are unaffected. popnCallStack :: Word -> CallStack -> CallStack -- | The same as the un-exported internal function in GHC.Exceptions -- (prettyCallStackLines) Prints like: doFoo, called at -- foo.hs:190:24 in main:Main prettyCallSite :: CallSite -> String -- | Pretty-print a CallStack. This has a few differences from -- GHC.Stack.prettyCallStackLines. We omit the "CallStack (from -- GetCallStack)" header line for brevity. If there is only one entry -- (which is common, due to the manual nature of the -- HasCallStack constraint), shows the entry on one line. If -- there are multiple, then the following lines are indented. prettyCallStack :: CallStack -> String -- | CallStack comprising only the most recent CallSite truncatedCallStack :: CallStack -> CallStack withCallerCallStack :: HasCallStack => (CallStack -> b) -> b withCurrentCallStack :: HasCallStack => (CallStack -> b) -> b withNBackCallStack :: HasCallStack => Word -> (CallStack -> b) -> b -- | Return the current CallStack. -- -- Does *not* include the call-site of callStack. callStack :: HasCallStack => CallStack -- | Pretty print a SrcLoc. prettySrcLoc :: SrcLoc -> String -- | Convert a list of call-sites to a CallStack. fromCallSiteList :: [([Char], SrcLoc)] -> CallStack -- | Extract a list of call-sites from the CallStack. -- -- The list is ordered by most recent call. getCallStack :: CallStack -> [([Char], SrcLoc)] -- | Type of an entry in a CallStack newtype CallSite CallSite :: (SrcFun, SrcLoc) -> CallSite [unCallSite] :: CallSite -> (SrcFun, SrcLoc) -- | Type of a filter for CallSite type CallSiteFilter = CallSite -> Bool -- | Type of the name of a function in a CallSite | e.g. -- proveEverything type SrcFun = String -- | Type of a column of a SrcLoc type SrcLocCol = Int -- | Type of a filename of a SrcLoc | e.g. -- `srcfullAgdaUtilsFoo.hs` type SrcLocFile = String -- | Type of a line number of a SrcLoc type SrcLocLine = Int -- | Type of the module name of a SrcLoc | e.g. Foo type SrcLocModule = String -- | Type of the package name of a SrcLoc | e.g. `Agda-2.…` type SrcLocPackage = String -- | CallStacks are a lightweight method of obtaining a partial -- call-stack at any point in the program. -- -- A function can request its call-site with the HasCallStack -- constraint. For example, we can define -- --
--   putStrLnWithCallStack :: HasCallStack => String -> IO ()
--   
-- -- as a variant of putStrLn that will get its call-site and -- print it, along with the string given as argument. We can access the -- call-stack inside putStrLnWithCallStack with -- callStack. -- --
--   >>> :{
--   putStrLnWithCallStack :: HasCallStack => String -> IO ()
--   putStrLnWithCallStack msg = do
--     putStrLn msg
--     putStrLn (prettyCallStack callStack)
--   :}
--   
-- -- Thus, if we call putStrLnWithCallStack we will get a -- formatted call-stack alongside our string. -- --
--   >>> putStrLnWithCallStack "hello"
--   hello
--   CallStack (from HasCallStack):
--     putStrLnWithCallStack, called at <interactive>:... in interactive:Ghci...
--   
-- -- GHC solves HasCallStack constraints in three steps: -- --
    --
  1. If there is a CallStack in scope -- i.e. the enclosing -- function has a HasCallStack constraint -- GHC will append the -- new call-site to the existing CallStack.
  2. --
  3. If there is no CallStack in scope -- e.g. in the GHCi -- session above -- and the enclosing definition does not have an -- explicit type signature, GHC will infer a HasCallStack -- constraint for the enclosing definition (subject to the monomorphism -- restriction).
  4. --
  5. If there is no CallStack in scope and the enclosing -- definition has an explicit type signature, GHC will solve the -- HasCallStack constraint for the singleton CallStack -- containing just the current call-site.
  6. --
-- -- CallStacks do not interact with the RTS and do not require -- compilation with -prof. On the other hand, as they are built -- up explicitly via the HasCallStack constraints, they will -- generally not contain as much information as the simulated call-stacks -- maintained by the RTS. -- -- A CallStack is a [(String, SrcLoc)]. The -- String is the name of function that was called, the -- SrcLoc is the call-site. The list is ordered with the most -- recently called function at the head. -- -- NOTE: The intrepid user may notice that HasCallStack is just an -- alias for an implicit parameter ?callStack :: CallStack. This -- is an implementation detail and should not be considered part -- of the CallStack API, we may decide to change the -- implementation in the future. data CallStack -- | Request a CallStack. -- -- NOTE: The implicit parameter ?callStack :: CallStack is an -- implementation detail and should not be considered part of the -- CallStack API, we may decide to change the implementation in -- the future. type HasCallStack = ?callStack :: CallStack -- | A single location in the source code. data SrcLoc SrcLoc :: [Char] -> [Char] -> [Char] -> Int -> Int -> Int -> Int -> SrcLoc [srcLocPackage] :: SrcLoc -> [Char] [srcLocModule] :: SrcLoc -> [Char] [srcLocFile] :: SrcLoc -> [Char] [srcLocStartLine] :: SrcLoc -> Int [srcLocStartCol] :: SrcLoc -> Int [srcLocEndLine] :: SrcLoc -> Int [srcLocEndCol] :: SrcLoc -> Int -- | Translating between file paths and ids. -- -- This module allows you to build a dictionary from file paths to some -- unique identifier and to look up both file paths and identifiers in -- that dictionary. module Agda.Utils.FileId type File = AbsolutePath -- | Unique identifier of a file. newtype FileId FileId :: Word32 -> FileId [theFileId] :: FileId -> Word32 type FileToId = Map File FileId type IdToFile = EnumMap FileId File data FileDict FileDict :: FileToId -> IdToFile -> FileDict [fileToId] :: FileDict -> FileToId [idToFile] :: FileDict -> IdToFile -- | Translate a file to an ID; mapping must exist. class GetFileId a getFileId :: GetFileId a => a -> File -> FileId -- | Translate a ID to a file; mapping must exist. class GetIdFile a getIdFile :: GetIdFile a => a -> FileId -> File data FileDictBuilder FileDictBuilder :: FileId -> FileDict -> FileDictBuilder [nextFileId] :: FileDictBuilder -> FileId [fileDict] :: FileDictBuilder -> FileDict -- | Register a new file identifier or retrieve an existing one. registerFileId :: File -> FileDictBuilder -> (FileId, FileDictBuilder) -- | Register a new file identifier (True) or retrieve an existing -- one (False). registerFileId' :: File -> FileDictBuilder -> ((FileId, Bool), FileDictBuilder) -- | Register a new file identifier or retrieve an existing one. -- -- If Nothing is returned, the file was already registered. registerFileId'' :: File -> FileDictBuilder -> (FileId, Maybe FileDictBuilder) class Monad m => MonadFileId (m :: Type -> Type) fileFromId :: MonadFileId m => FileId -> m File ($dmfileFromId) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadFileId m, MonadTrans t, MonadFileId n, m ~ t n) => FileId -> m File idFromFile :: MonadFileId m => File -> m FileId ($dmidFromFile) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadFileId m, MonadTrans t, MonadFileId n, m ~ t n) => File -> m FileId instance GHC.Internal.Enum.Enum Agda.Utils.FileId.FileId instance GHC.Internal.Classes.Eq Agda.Utils.FileId.FileId instance GHC.Internal.Generics.Generic Agda.Utils.FileId.FileDict instance GHC.Internal.Generics.Generic Agda.Utils.FileId.FileDictBuilder instance GHC.Internal.Generics.Generic Agda.Utils.FileId.FileId instance Agda.Utils.FileId.GetFileId Agda.Utils.FileId.FileDict instance Agda.Utils.FileId.GetFileId Agda.Utils.FileId.FileDictBuilder instance Agda.Utils.FileId.GetFileId Agda.Utils.FileId.FileToId instance Agda.Utils.FileId.GetIdFile Agda.Utils.FileId.IdToFile instance Agda.Utils.FileId.GetIdFile Agda.Utils.FileId.FileDict instance Agda.Utils.FileId.GetIdFile Agda.Utils.FileId.FileDictBuilder instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.Utils.Update.ChangeT m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Control.Monad.Trans.Except.ExceptT e m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Control.Monad.Trans.Identity.IdentityT m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.Utils.ListT.ListT m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.Utils.StrictReader.ReaderT r m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.Utils.StrictState.StateT s m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Control.Monad.Trans.State.Lazy.StateT s m) instance (Agda.Utils.FileId.MonadFileId m, GHC.Internal.Base.Monoid w) => Agda.Utils.FileId.MonadFileId (Agda.Utils.StrictWriter.WriterT w m) instance (Agda.Utils.FileId.MonadFileId m, GHC.Internal.Base.Monoid w) => Agda.Utils.FileId.MonadFileId (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Control.DeepSeq.NFData Agda.Utils.FileId.FileDict instance Control.DeepSeq.NFData Agda.Utils.FileId.FileDictBuilder instance Control.DeepSeq.NFData Agda.Utils.FileId.FileId instance Agda.Utils.Null.Null Agda.Utils.FileId.FileDict instance Agda.Utils.Null.Null Agda.Utils.FileId.FileDictBuilder instance GHC.Internal.Num.Num Agda.Utils.FileId.FileId instance GHC.Internal.Classes.Ord Agda.Utils.FileId.FileId instance GHC.Internal.Show.Show Agda.Utils.FileId.FileId -- | Tools for benchmarking and accumulating results. Nothing Agda-specific -- in here. module Agda.Utils.Benchmark -- | Account we can bill computation time to. type Account a = [a] -- | Record when we started billing the current account. type CurrentAccount a = Maybe (Account a, CPUTime) type Timings a = Trie a CPUTime data BenchmarkOn a BenchmarkOff :: BenchmarkOn a BenchmarkOn :: BenchmarkOn a BenchmarkSome :: (Account a -> Bool) -> BenchmarkOn a isBenchmarkOn :: Account a -> BenchmarkOn a -> Bool -- | Benchmark structure is a trie, mapping accounts (phases and subphases) -- to CPU time spent on their performance. data Benchmark a Benchmark :: BenchmarkOn a -> CurrentAccount a -> Timings a -> Benchmark a -- | Are we benchmarking at all? [benchmarkOn] :: Benchmark a -> BenchmarkOn a -- | What are we billing to currently? [currentAccount] :: Benchmark a -> CurrentAccount a -- | The accounts and their accumulated timing bill. [timings] :: Benchmark a -> Timings a -- | Semantic editor combinator. mapBenchmarkOn :: (BenchmarkOn a -> BenchmarkOn a) -> Benchmark a -> Benchmark a -- | Semantic editor combinator. mapCurrentAccount :: (CurrentAccount a -> CurrentAccount a) -> Benchmark a -> Benchmark a -- | Semantic editor combinator. mapTimings :: (Timings a -> Timings a) -> Benchmark a -> Benchmark a -- | Add to specified CPU time account. addCPUTime :: Ord a => Account a -> CPUTime -> Benchmark a -> Benchmark a -- | Monad with access to benchmarking data. class (Ord BenchPhase m, Functor m, MonadIO m) => MonadBench (m :: Type -> Type) where { type BenchPhase (m :: Type -> Type); } getBenchmark :: MonadBench m => m (Benchmark (BenchPhase m)) putBenchmark :: MonadBench m => Benchmark (BenchPhase m) -> m () modifyBenchmark :: MonadBench m => (Benchmark (BenchPhase m) -> Benchmark (BenchPhase m)) -> m () -- | We need to be able to terminate benchmarking in case of an exception. finally :: MonadBench m => m b -> m c -> m b getsBenchmark :: MonadBench m => (Benchmark (BenchPhase m) -> c) -> m c -- | Turn benchmarking on/off. setBenchmarking :: MonadBench m => BenchmarkOn (BenchPhase m) -> m () -- | Bill current account with time up to now. Switch to new account. -- Return old account (if any). switchBenchmarking :: MonadBench m => Maybe (Account (BenchPhase m)) -> m (Maybe (Account (BenchPhase m))) -- | Resets the account and the timing information. reset :: MonadBench m => m () -- | Bill a computation to a specific account. Works even if the -- computation is aborted by an exception. billTo :: MonadBench m => Account (BenchPhase m) -> m c -> m c -- | Bill a CPS function to an account. Can't handle exceptions. billToCPS :: MonadBench m => Account (BenchPhase m) -> ((b -> m c) -> m c) -> (b -> m c) -> m c -- | Bill a pure computation to a specific account. billPureTo :: MonadBench m => Account (BenchPhase m) -> c -> m c instance GHC.Internal.Generics.Generic (Agda.Utils.Benchmark.Benchmark a) instance GHC.Internal.Generics.Generic (Agda.Utils.Benchmark.BenchmarkOn a) instance Agda.Utils.Benchmark.MonadBench m => Agda.Utils.Benchmark.MonadBench (Control.Monad.Trans.Except.ExceptT e m) instance Agda.Utils.Benchmark.MonadBench m => Agda.Utils.Benchmark.MonadBench (Agda.Utils.ListT.ListT m) instance Agda.Utils.Benchmark.MonadBench m => Agda.Utils.Benchmark.MonadBench (Agda.Utils.StrictReader.ReaderT r m) instance Agda.Utils.Benchmark.MonadBench m => Agda.Utils.Benchmark.MonadBench (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.Utils.Benchmark.MonadBench m => Agda.Utils.Benchmark.MonadBench (Control.Monad.Trans.State.Lazy.StateT r m) instance (Agda.Utils.Benchmark.MonadBench m, GHC.Internal.Base.Monoid w) => Agda.Utils.Benchmark.MonadBench (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.Benchmark.Benchmark a) instance Control.DeepSeq.NFData (Agda.Utils.Benchmark.BenchmarkOn a) instance Agda.Utils.Null.Null (Agda.Utils.Benchmark.Benchmark a) instance (GHC.Internal.Classes.Ord a, Agda.Syntax.Common.Pretty.Pretty a) => Agda.Syntax.Common.Pretty.Pretty (Agda.Utils.Benchmark.Benchmark a) -- | Sparse matrices. -- -- We assume the matrices to be very sparse, so we just implement them as -- sorted association lists. -- -- Most operations are linear in the number of non-zero elements. -- -- An exception is transposition, which needs to sort the association -- list again; it has the complexity of sorting: n log n where -- n is the number of non-zero elements. -- -- Another exception is matrix multiplication, of course. module Agda.Termination.SparseMatrix -- | Type of matrices, parameterised on the type of values. -- -- Sparse matrices are implemented as an ordered association list, -- mapping coordinates to values. data Matrix i b Matrix :: Size i -> [(MIx i, b)] -> Matrix i b -- | Association of indices to values. unM :: Matrix i b -> [(MIx i, b)] -- | Size of a matrix. data Size i Size :: i -> i -> Size i -- | Number of rows, >= 0. [rows] :: Size i -> i -- | Number of columns, >= 0. [cols] :: Size i -> i -- | Type of matrix indices (row, column). data MIx i MIx :: i -> i -> MIx i -- | Row index, 1 <= row <= rows. [row] :: MIx i -> i -- | Column index 1 <= col <= cols. [col] :: MIx i -> i -- | fromLists sz rs constructs a matrix from a list of -- lists of values (a list of rows). O(size) where size = -- rows × cols. -- -- Precondition: length rs == rows sz and -- all ((cols sz ==) . length) rs. fromLists :: (Ord i, Num i, Enum i, HasZero b) => Size i -> [[b]] -> Matrix i b -- | Constructs a matrix from a list of (index, value)-pairs. -- O(n) where n is size of the list. -- -- Precondition: indices are unique. fromIndexList :: (Ord i, HasZero b) => Size i -> [(MIx i, b)] -> Matrix i b -- | Converts a matrix to a list of row lists. O(size) where -- size = rows × cols. toLists :: (Integral i, HasZero b) => Matrix i b -> [[b]] -- | Dimensions of the matrix. size :: Matrix i b -> Size i -- | True iff the matrix is square. square :: Ix i => Matrix i b -> Bool -- | Returns True iff the matrix is empty. isEmpty :: (Num i, Ix i) => Matrix i b -> Bool -- | Returns 'Just b' iff it is a 1x1 matrix with just one entry -- b. O(1). isSingleton :: (Eq i, Num i, HasZero b) => Matrix i b -> Maybe b -- | General pointwise combination function for sparse matrices. O(n1 + -- n2). zipMatrices :: forall a b c i. Ord i => (a -> c) -> (b -> c) -> (a -> b -> c) -> (c -> Bool) -> Matrix i a -> Matrix i b -> Matrix i c -- | add (+) m1 m2 adds m1 and m2, using -- (+) to add values. O(n1 + n2). -- -- Returns a matrix of size supSize m1 m2. add :: (Ord i, HasZero a) => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a -- | intersectWith f m1 m2 build the pointwise conjunction -- m1 and m2. Uses f to combine non-zero -- values. O(n1 + n2). -- -- Returns a matrix of size infSize m1 m2. intersectWith :: Ord i => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a -- | Association list intersection. O(n1 + n2). -- --
--   interAssocWith f l l' = { (i, f a b) | (i,a) ∈ l and (i,b) ∈ l' }
--   
-- -- Used to combine sparse matrices, it might introduce zero elements if -- f can return zero for non-zero arguments. interAssocWith :: Ord i => (a -> a -> a) -> [(i, a)] -> [(i, a)] -> [(i, a)] -- | Apply the given function to all non-zero elements. -- -- O(n) where n is the number of non-zero elements in -- the matrix. mapNonZeros :: forall i a b. HasZero b => (i -> i -> a -> b) -> Matrix i a -> Matrix i b -- | Apply the given function to the non-zero diagonal elements of a -- matrix. -- -- O(n) where n is the number of non-zero elements in -- the matrix. mapDiagonalNonZeros :: (Integral i, HasZero a) => (a -> a) -> Matrix i a -> Matrix i a -- | mul semiring m1 m2 multiplies matrices m1 and -- m2. Uses the operations of the semiring semiring to -- perform the multiplication. -- -- O(n1 + n2 log n2 + Σ(i <= r1) Σ(j <= c2) d(i,j)) where -- r1 is the number of non-empty rows in m1 and -- c2 is the number of non-empty columns in m2 and -- d(i,j) is the bigger one of the following two quantifies: the -- length of sparse row i in m1 and the length of -- sparse column j in m2. -- -- Given dimensions m1 : r1 × c1 and m2 : r2 × c2, a -- matrix of size r1 × c2 is returned. It is not necessary that -- c1 == r2, the matrices are implicitly patched with zeros to -- match up for multiplication. For sparse matrices, this patching is a -- no-op. mul :: (Ix i, Eq a) => Semiring a -> Matrix i a -> Matrix i a -> Matrix i a transpose :: Transpose a => a -> a -- | diagonal m extracts the diagonal of m. -- -- For non-square matrices, the length of the diagonal is the minimum of -- the dimensions of the matrix. class Diagonal m e | m -> e diagonal :: Diagonal m e => m -> [e] -- | Converts a sparse matrix to a sparse list of rows. O(n) where -- n is the number of non-zero entries of the matrix. -- -- Only non-empty rows are generated. toSparseRows :: Eq i => Matrix i b -> [(i, [(i, b)])] -- | Compute the matrix size of the union of two matrices. supSize :: Ord i => Matrix i a -> Matrix i b -> Size i -- | General pointwise combination function for association lists. O(n1 -- + n2) where ni is the number of non-zero element in -- matrix i. -- -- In zipAssocWith fs gs f g h l l', -- -- fs is possibly more efficient version of mapMaybe -- ( (i, a) -> (i,) $ f a), and same for gs and -- g. zipAssocWith :: Ord i => ([(i, a)] -> [(i, c)]) -> ([(i, b)] -> [(i, c)]) -> (a -> Maybe c) -> (b -> Maybe c) -> (a -> b -> Maybe c) -> [(i, a)] -> [(i, b)] -> [(i, c)] -- | addRow x m adds a new row to m, after the -- rows already existing in the matrix. All elements in the new row get -- set to x. addRow :: (Num i, HasZero b) => b -> Matrix i b -> Matrix i b -- | addColumn x m adds a new column to m, after -- the columns already existing in the matrix. All elements in the new -- column get set to x. addColumn :: (Num i, HasZero b) => b -> Matrix i b -> Matrix i b instance (GHC.Internal.Real.Integral i, Agda.Termination.Semiring.HasZero b) => Agda.Termination.SparseMatrix.Diagonal (Agda.Termination.SparseMatrix.Matrix i b) b instance GHC.Internal.Classes.Eq i => GHC.Internal.Classes.Eq (Agda.Termination.SparseMatrix.MIx i) instance (GHC.Internal.Classes.Eq i, GHC.Internal.Classes.Eq b) => GHC.Internal.Classes.Eq (Agda.Termination.SparseMatrix.Matrix i b) instance GHC.Internal.Classes.Eq i => GHC.Internal.Classes.Eq (Agda.Termination.SparseMatrix.Size i) instance GHC.Internal.Data.Foldable.Foldable (Agda.Termination.SparseMatrix.Matrix i) instance GHC.Internal.Base.Functor (Agda.Termination.SparseMatrix.Matrix i) instance GHC.Internal.Ix.Ix i => GHC.Internal.Ix.Ix (Agda.Termination.SparseMatrix.MIx i) instance GHC.Internal.Classes.Ord i => GHC.Internal.Classes.Ord (Agda.Termination.SparseMatrix.MIx i) instance (GHC.Internal.Classes.Ord i, GHC.Internal.Classes.Ord b) => GHC.Internal.Classes.Ord (Agda.Termination.SparseMatrix.Matrix i b) instance GHC.Internal.Classes.Ord i => GHC.Internal.Classes.Ord (Agda.Termination.SparseMatrix.Size i) instance (GHC.Internal.Classes.Ord i, Agda.Utils.PartialOrd.PartialOrd a) => Agda.Utils.PartialOrd.PartialOrd (Agda.Termination.SparseMatrix.Matrix i a) instance (GHC.Internal.Real.Integral i, Agda.Termination.Semiring.HasZero b, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Termination.SparseMatrix.Matrix i b) instance GHC.Internal.Show.Show i => GHC.Internal.Show.Show (Agda.Termination.SparseMatrix.MIx i) instance (GHC.Internal.Real.Integral i, Agda.Termination.Semiring.HasZero b, GHC.Internal.Show.Show i, GHC.Internal.Show.Show b) => GHC.Internal.Show.Show (Agda.Termination.SparseMatrix.Matrix i b) instance GHC.Internal.Show.Show i => GHC.Internal.Show.Show (Agda.Termination.SparseMatrix.Size i) instance Agda.Termination.SparseMatrix.Transpose (Agda.Termination.SparseMatrix.MIx i) instance GHC.Internal.Classes.Ord i => Agda.Termination.SparseMatrix.Transpose (Agda.Termination.SparseMatrix.Matrix i b) instance Agda.Termination.SparseMatrix.Transpose (Agda.Termination.SparseMatrix.Size i) instance GHC.Internal.Data.Traversable.Traversable (Agda.Termination.SparseMatrix.Matrix i) -- | An Abstract domain of relative sizes, i.e., differences between size -- of formal function parameter and function argument in recursive call; -- used in the termination checker. module Agda.Termination.Order -- | In the paper referred to above, there is an order R with -- Unknown <= Le <= -- Lt. -- -- This is generalized to Unknown <= 'Decr k' -- where Decr 1 replaces Lt and Decr 0 -- replaces Le. A negative decrease means an increase. The -- generalization allows the termination checker to record an increase by -- 1 which can be compensated by a following decrease by 2 which results -- in an overall decrease. -- -- However, the termination checker of the paper itself terminates -- because there are only finitely many different call-matrices. To -- maintain termination of the terminator we set a cutoff point -- which determines how high the termination checker can count. This -- value should be set by a global or file-wise option. -- -- See Call for more information. -- -- TODO: document orders which are call-matrices themselves. data Order -- | Decrease of callee argument wrt. caller parameter. -- -- The Bool indicates whether the decrease (if any) is usable. -- In any chain, there needs to be one usable decrease. Unusable -- decreases come from SIZELT constraints which are not in inductive -- pattern match or a coinductive copattern match. See issue #2331. -- -- UPDATE: Andreas, 2017-07-26: Feature #2331 is unsound due to size -- quantification in terms. While the infrastructure for usable/unusable -- decrease remains in place, no unusable decreases are generated by -- TermCheck. Decr :: Bool -> Int -> Order -- | No relation, infinite increase, or increase beyond termination depth. Unknown :: Order -- | Matrix-shaped order, currently UNUSED. Mat :: Matrix Int Order -> Order -- | Smart constructor for Decr k :: Order which cuts off too big -- values. -- -- Possible values for k: - ?cutoff <= k -- <= ?cutoff + 1. decr :: (?cutoff :: CutOff) => Bool -> Int -> Order -- | Raw increase which does not cut off. increase :: Int -> Order -> Order -- | Raw decrease which does not cut off. decrease :: Int -> Order -> Order setUsability :: Bool -> Order -> Order -- | Turn any increase into infinite increase (Unknown). makeIncreaseInfinite :: Order -> Order -- | Multiplication of Orders. (Corresponds to sequential -- composition.) (.*.) :: (?cutoff :: CutOff) => Order -> Order -> Order -- | The supremum of a (possibly empty) list of Orders. More -- information (i.e., more decrease) is bigger. Unknown is no -- information, thus, smallest. supremum :: (?cutoff :: CutOff) => [Order] -> Order -- | The infimum of a (non empty) list of Orders. Gets the worst -- information. Unknown is the least element, thus, dominant. infimum :: (?cutoff :: CutOff) => [Order] -> Order -- | We use a record for semiring instead of a type class since implicit -- arguments cannot occur in instance constraints, like instance -- (?cutoff :: Int) => SemiRing Order. orderSemiring :: (?cutoff :: CutOff) => Semiring Order -- | le, lt, decreasing, unknown: for -- backwards compatibility, and for external use. le :: Order -- | Usable decrease. lt :: Order unknown :: Order -- | Smart constructor for matrix shaped orders, avoiding empty and -- singleton matrices. orderMat :: Matrix Int Order -> Order collapseO :: (?cutoff :: CutOff) => Order -> Order nonIncreasing :: Order -> Bool -- | Decreasing and usable? decreasing :: Order -> Bool -- | Matrix-shaped order is decreasing if any diagonal element is -- decreasing. isDecr :: Order -> Bool -- | A partial order, aimed at deciding whether a call graph gets worse -- during the completion. class NotWorse a notWorse :: NotWorse a => a -> a -> Bool isOrder :: (?cutoff :: CutOff) => Order -> Bool instance GHC.Internal.Classes.Eq Agda.Termination.Order.Order instance Agda.Termination.Semiring.HasZero Agda.Termination.Order.Order instance (GHC.Internal.Classes.Ord i, Agda.Termination.Semiring.HasZero o, Agda.Termination.Order.NotWorse o) => Agda.Termination.Order.NotWorse (Agda.Termination.SparseMatrix.Matrix i o) instance Agda.Termination.Order.NotWorse Agda.Termination.Order.Order instance GHC.Internal.Classes.Ord Agda.Termination.Order.Order instance Agda.Utils.PartialOrd.PartialOrd Agda.Termination.Order.Order instance Agda.Syntax.Common.Pretty.Pretty Agda.Termination.Order.Order instance GHC.Internal.Show.Show Agda.Termination.Order.Order module Agda.Termination.CallMatrix -- | Call matrix indices = function argument indices. -- -- Machine integer Int is sufficient, since we cannot index more -- arguments than we have addresses on our machine. type ArgumentIndex = Int -- | Call matrices. -- -- A call matrix for a call f --> g has dimensions ar(g) -- × ar(f). -- -- Each column corresponds to one formal argument of caller f. -- Each row corresponds to one argument in the call to g. -- -- In the presence of dot patterns, a call argument can be related to -- several different formal arguments of f. -- -- See e.g. testsucceedDotPatternTermination.agda: -- --
--   data D : Nat -> Set where
--     cz : D zero
--     c1 : forall n -> D n -> D (suc n)
--     c2 : forall n -> D n -> D n
--   
--   f : forall n -> D n -> Nat
--   f .zero    cz        = zero
--   f .(suc n) (c1  n d) = f n (c2 n d)
--   f n        (c2 .n d) = f n d
--   
--   
-- -- Call matrices (without guardedness) are -- --
--   -1 -1   n < suc n  and       n <  c1 n d
--    ?  =                   c2 n d <= c1 n d
--   
--    = -1   n <= n     and  n < c2 n d
--    ? -1                   d < c2 n d
--   
--   
-- -- Here is a part of the original documentation for call matrices (kept -- for historical reasons): -- -- This datatype encodes information about a single recursive function -- application. The columns of the call matrix stand for source -- function arguments (patterns). The rows of the matrix stand for -- target function arguments. Element (i, j) in the -- matrix should be computed as follows: -- -- newtype CallMatrix' a CallMatrix :: Matrix ArgumentIndex a -> CallMatrix' a [mat] :: CallMatrix' a -> Matrix ArgumentIndex a type CallMatrix = CallMatrix' Order mapCallMatrix :: (Matrix ArgumentIndex a -> Matrix ArgumentIndex a) -> CallMatrix' a -> CallMatrix' a -- | Call matrix multiplication and call combination. class CallComb a (>*<) :: CallComb a => a -> a -> a -- | Call matrix augmented with path information. data CallMatrixAug cinfo CallMatrixAug :: CallMatrix -> cinfo -> CallMatrixAug cinfo -- | The matrix of the (composed call). [augCallMatrix] :: CallMatrixAug cinfo -> CallMatrix -- | Meta info, like call path. [augCallInfo] :: CallMatrixAug cinfo -> cinfo -- | Non-augmented call matrix. noAug :: Monoid cinfo => CallMatrix -> CallMatrixAug cinfo mapCallMatrixAug :: (CallMatrix -> CallMatrix) -> CallMatrixAug cinfo -> CallMatrixAug cinfo -- | Sets of incomparable call matrices augmented with path information. -- Use overloaded null, empty, singleton, -- mappend. newtype CMSet cinfo CMSet :: Favorites (CallMatrixAug cinfo) -> CMSet cinfo [cmSet] :: CMSet cinfo -> Favorites (CallMatrixAug cinfo) mapCMSet :: (Favorites (CallMatrixAug cinfo) -> Favorites (CallMatrixAug cinfo)) -> CMSet cinfo -> CMSet cinfo -- | Insert into a call matrix set. insert :: CallMatrixAug cinfo -> CMSet cinfo -> CMSet cinfo -- | Union two call matrix sets. union :: CMSet cinfo -> CMSet cinfo -> CMSet cinfo -- | Convert into a list of augmented call matrices. toList :: CMSet cinfo -> [CallMatrixAug cinfo] instance GHC.Internal.Base.Monoid cinfo => Agda.Termination.CallMatrix.CallComb (Agda.Termination.CallMatrix.CMSet cinfo) instance Agda.Termination.CallMatrix.CallComb Agda.Termination.CallMatrix.CallMatrix instance GHC.Internal.Base.Monoid cinfo => Agda.Termination.CallMatrix.CallComb (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance Agda.Termination.Semiring.HasZero a => Agda.Termination.SparseMatrix.Diagonal (Agda.Termination.CallMatrix.CallMatrix' a) a instance Agda.Termination.SparseMatrix.Diagonal (Agda.Termination.CallMatrix.CallMatrixAug cinfo) Agda.Termination.Order.Order instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Termination.CallMatrix.CallMatrix' a) instance GHC.Internal.Classes.Eq cinfo => GHC.Internal.Classes.Eq (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance GHC.Internal.Data.Foldable.Foldable Agda.Termination.CallMatrix.CallMatrix' instance GHC.Internal.Base.Functor Agda.Termination.CallMatrix.CallMatrix' instance GHC.Internal.Base.Monoid (Agda.Termination.CallMatrix.CMSet cinfo) instance Agda.Termination.Order.NotWorse Agda.Termination.CallMatrix.CallMatrix instance Agda.Termination.Order.NotWorse (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance Agda.Utils.Null.Null (Agda.Termination.CallMatrix.CMSet cinfo) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Termination.CallMatrix.CallMatrix' a) instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Utils.PartialOrd.PartialOrd (Agda.Termination.CallMatrix.CallMatrix' a) instance Agda.Utils.PartialOrd.PartialOrd (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance Agda.Syntax.Common.Pretty.Pretty cinfo => Agda.Syntax.Common.Pretty.Pretty (Agda.Termination.CallMatrix.CMSet cinfo) instance Agda.Syntax.Common.Pretty.Pretty Agda.Termination.CallMatrix.CallMatrix instance Agda.Syntax.Common.Pretty.Pretty cinfo => Agda.Syntax.Common.Pretty.Pretty (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance GHC.Internal.Base.Semigroup (Agda.Termination.CallMatrix.CMSet cinfo) instance GHC.Internal.Show.Show cinfo => GHC.Internal.Show.Show (Agda.Termination.CallMatrix.CMSet cinfo) instance (Agda.Termination.Semiring.HasZero a, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Agda.Termination.CallMatrix.CallMatrix' a) instance GHC.Internal.Show.Show cinfo => GHC.Internal.Show.Show (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance Agda.Utils.Singleton.Singleton (Agda.Termination.CallMatrix.CallMatrixAug cinfo) (Agda.Termination.CallMatrix.CMSet cinfo) instance GHC.Internal.Data.Traversable.Traversable Agda.Termination.CallMatrix.CallMatrix' -- | Call graphs and related concepts, more or less as defined in "A -- Predicative Analysis of Structural Recursion" by Andreas Abel and -- Thorsten Altenkirch. module Agda.Termination.CallGraph -- | Call graph nodes. -- -- Machine integer Int is sufficient, since we cannot index more -- than we have addresses on our machine. type Node = Int -- | Calls are edges in the call graph. It can be labelled with several -- call matrices if there are several pathes from one function to -- another. type Call cinfo = Edge Node CMSet cinfo -- | Outgoing node. source :: Edge n e -> n -- | Incoming node. target :: Edge n e -> n callMatrixSet :: Call cinfo -> CMSet cinfo -- | Make a call with a single matrix. mkCall :: Node -> Node -> CallMatrix -> cinfo -> Call cinfo -- | Make a call with empty cinfo. mkCall' :: Monoid cinfo => Node -> Node -> CallMatrix -> Call cinfo (>*<) :: CallComb a => a -> a -> a -- | A call graph is a set of calls. Every call also has some associated -- meta information, which should be Monoidal so that the meta -- information for different calls can be combined when the calls are -- combined. newtype CallGraph cinfo CallGraph :: Graph Node (CMSet cinfo) -> CallGraph cinfo [theCallGraph] :: CallGraph cinfo -> Graph Node (CMSet cinfo) -- | Returns all nodes with self-loops. loops :: CallGraph cinfo -> [(Node, CMSet cinfo)] -- | Returns all the nodes with incoming edges. Somewhat expensive. -- O(e). targetNodes :: CallGraph cinfo -> Set Node fromList :: Collection el coll => [el] -> coll -- | Converts a call graph to a list of calls with associated meta -- information. toList :: CallGraph cinfo -> [Call cinfo] -- | Takes the union of two call graphs. union :: CallGraph cinfo -> CallGraph cinfo -> CallGraph cinfo -- | Inserts a call into a call graph. insert :: Node -> Node -> CallMatrix -> cinfo -> CallGraph cinfo -> CallGraph cinfo -- | Call graph comparison. A graph cs' is `worse' than -- cs if it has a new edge (call) or a call got worse, which -- means that one of its elements that was better or equal to Le -- moved a step towards Un. -- -- A call graph is complete if combining it with itself does not make it -- any worse. This is sound because of monotonicity: By combining a graph -- with itself, it can only get worse, but if it does not get worse after -- one such step, it gets never any worse. -- -- complete cs completes the call graph cs. A -- call graph is complete if it contains all indirect calls; if f -- -> g and g -> h are present in the graph, then -- f -> h should also be present. complete :: (Monoid cinfo, ?cutoff :: CutOff) => CallGraph cinfo -> CallGraph cinfo completionStep :: (Monoid cinfo, ?cutoff :: CutOff) => CallGraph cinfo -> CallGraph cinfo -> (CallGraph cinfo, CallGraph cinfo) instance Agda.Utils.Singleton.Collection (Agda.Termination.CallGraph.Call cinfo) (Agda.Termination.CallGraph.CallGraph cinfo) instance Agda.Termination.CallGraph.CombineNewOld (Agda.Termination.CallMatrix.CMSet cinfo) instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Termination.CallGraph.CombineNewOld (Agda.Utils.Favorites.Favorites a) instance (GHC.Internal.Base.Monoid a, Agda.Termination.CallGraph.CombineNewOld a, GHC.Internal.Classes.Ord n) => Agda.Termination.CallGraph.CombineNewOld (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n a) instance GHC.Internal.Base.Monoid (Agda.Termination.CallGraph.CallGraph cinfo) instance Agda.Utils.Null.Null (Agda.Termination.CallGraph.CallGraph cinfo) instance Agda.Syntax.Common.Pretty.Pretty cinfo => Agda.Syntax.Common.Pretty.Pretty (Agda.Termination.CallGraph.CallGraph cinfo) instance GHC.Internal.Base.Semigroup (Agda.Termination.CallGraph.CallGraph cinfo) instance GHC.Internal.Show.Show cinfo => GHC.Internal.Show.Show (Agda.Termination.CallGraph.CallGraph cinfo) instance Agda.Utils.Singleton.Singleton (Agda.Termination.CallGraph.Call cinfo) (Agda.Termination.CallGraph.CallGraph cinfo) -- | Termination checker, based on "A Predicative Analysis of Structural -- Recursion" by Andreas Abel and Thorsten Altenkirch (JFP'01), and "The -- Size-Change Principle for Program Termination" by Chin Soon Lee, Neil -- Jones, and Amir Ben-Amram (POPL'01). module Agda.Termination.Termination -- | Result of running the termination checker. data Terminates cinfo -- | Termination proved without considering guardedness. Terminates :: Terminates cinfo -- | Termination could not be proven, witnessed by the supplied problematic -- call path. Guardedness could help, though. TerminatesNot :: GuardednessHelps -> cinfo -> Terminates cinfo -- | Would termination go through with guardedness? data GuardednessHelps -- | Guardedness would provide termination evidence. GuardednessHelpsYes :: GuardednessHelps -- | Guardedness does not help with termination. GuardednessHelpsNot :: GuardednessHelps -- | terminates cs checks if the functions represented by -- cs terminate. The call graph cs should have one -- entry (Call) per recursive function application. -- -- The termination criterion is taken from Jones et al. In the completed -- call graph, each idempotent call-matrix from a function to itself must -- have a decreasing argument. Idempotency is wrt. matrix multiplication. -- -- This criterion is strictly more liberal than searching for a -- lexicographic order (and easier to implement, but harder to justify). -- -- terminates does not use guardedness, terminatesFilter is -- more general. terminates :: (Monoid cinfo, ?cutoff :: CutOff) => CallGraph cinfo -> Terminates cinfo -- | While no counterexample to termination is found, complete the given -- call graph step-by-step. terminatesFilter :: (Monoid cinfo, ?cutoff :: CutOff) => Bool -> (Node -> Bool) -> CallGraph cinfo -> Terminates cinfo -- | Does the given callgraph contain a counterexample to termination? terminationCounterexample :: (?cutoff :: CutOff) => Bool -> (Node -> Bool) -> CallGraph cinfo -> Terminates cinfo -- | Get all idempotent call-matrixes of loops in the call graph. idempotentEndos :: (?cutoff :: CutOff) => CallGraph cinfo -> [CallMatrixAug cinfo] instance Agda.Utils.Boolean.Boolean Agda.Termination.Termination.GuardednessHelps instance GHC.Internal.Enum.Bounded Agda.Termination.Termination.GuardednessHelps instance GHC.Internal.Enum.Enum Agda.Termination.Termination.GuardednessHelps instance GHC.Internal.Classes.Eq Agda.Termination.Termination.GuardednessHelps instance GHC.Internal.Generics.Generic Agda.Termination.Termination.GuardednessHelps instance Agda.Utils.Boolean.IsBool Agda.Termination.Termination.GuardednessHelps instance Control.DeepSeq.NFData Agda.Termination.Termination.GuardednessHelps instance Agda.Utils.Null.Null Agda.Termination.Termination.GuardednessHelps instance GHC.Internal.Show.Show Agda.Termination.Termination.GuardednessHelps -- | Choice of Unicode or ASCII glyphs. module Agda.Syntax.Concrete.Glyph -- | We want to know whether we are allowed to insert unicode characters or -- not. data UnicodeOrAscii -- | true: Unicode characters are allowed. UnicodeOk :: UnicodeOrAscii -- | 'false: Stick to ASCII. AsciiOnly :: UnicodeOrAscii unsafeSetUnicodeOrAscii :: UnicodeOrAscii -> IO () -- | Return the glyph set based on a given (unicode or ascii) glyph mode specialCharactersForGlyphs :: UnicodeOrAscii -> SpecialCharacters braces' :: Doc -> Doc dbraces :: Doc -> Doc forallQ :: Doc leftIdiomBrkt :: Doc rightIdiomBrkt :: Doc emptyIdiomBrkt :: Doc arrow :: Doc lambda :: Doc fromArrow :: Doc -- | Picking the appropriate set of special characters depending on whether -- we are allowed to use unicode or have to limit ourselves to ascii. data SpecialCharacters SpecialCharacters :: (Doc -> Doc) -> Doc -> Doc -> Doc -> Doc -> Doc -> Doc -> Doc -> SpecialCharacters [_dbraces] :: SpecialCharacters -> Doc -> Doc [_lambda] :: SpecialCharacters -> Doc [_arrow] :: SpecialCharacters -> Doc [_forallQ] :: SpecialCharacters -> Doc [_leftIdiomBrkt] :: SpecialCharacters -> Doc [_rightIdiomBrkt] :: SpecialCharacters -> Doc [_emptyIdiomBrkt] :: SpecialCharacters -> Doc [_fromArrow] :: SpecialCharacters -> Doc instance Agda.Utils.Boolean.Boolean Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Internal.Enum.Bounded Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Internal.Enum.Enum Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance Agda.Utils.Boolean.IsBool Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Glyph.UnicodeOrAscii -- | A abstract Range type dedicated to keyword occurrences in the -- source. module Agda.Syntax.Common.KeywordRange -- | Range dedicated to a keyword or fixed token sequence. -- -- Motivation: by lacking a SetRange instance we indicate that it -- cannot be updated. data KwRange -- | Create a keyword range. kwRange :: HasRange a => a -> KwRange instance GHC.Internal.Classes.Eq Agda.Syntax.Common.KeywordRange.KwRange instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.KeywordRange.KwRange instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.KeywordRange.KwRange instance Control.DeepSeq.NFData Agda.Syntax.Common.KeywordRange.KwRange instance Agda.Utils.Null.Null Agda.Syntax.Common.KeywordRange.KwRange instance GHC.Internal.Classes.Ord Agda.Syntax.Common.KeywordRange.KwRange instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.KeywordRange.KwRange instance GHC.Internal.Show.Show Agda.Syntax.Common.KeywordRange.KwRange -- | Abstract elisp syntax. module Agda.Interaction.Emacs.Lisp -- | Simple Emacs Lisp expressions. data Lisp a -- | Atom. A :: a -> Lisp a Cons :: Lisp a -> Lisp a -> Lisp a -- | List. L :: [Lisp a] -> Lisp a Q :: Lisp a -> Lisp a -- | Formats a response command. -- -- Replaces 'n' with spaces to ensure that each command is a -- single line. response :: Lisp String -> String -- | Writes a response command to standard output. putResponse :: Lisp String -> IO () instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Interaction.Emacs.Lisp.Lisp a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Interaction.Emacs.Lisp.Lisp a) -- | Some common syntactic entities are defined in this module. module Agda.Syntax.Common pattern IsRecord_ :: DataOrRecord_ _fixityAssoc :: Lens' Fixity Associativity _fixityLevel :: Lens' Fixity FixityLevel -- | Combine inferred Cohesion. The unit is Squash. addCohesion :: Cohesion -> Cohesion -> Cohesion -- | Modality forms a pointwise additive monoid. addModality :: Modality -> Modality -> Modality -- | Combine inferred PolarityModality. addPolarity :: PolarityModality -> PolarityModality -> PolarityModality -- | Combine inferred ModalPolarity. The unit is -- UnusedPolarity. addPolarity' :: ModalPolarity -> ModalPolarity -> ModalPolarity -- | Quantity forms an additive monoid with zero Quantity0. addQuantity :: Quantity -> Quantity -> Quantity -- | Combine inferred Relevance. The unit is Irrelevant. addRelevance :: Relevance -> Relevance -> Relevance allCohesions :: [Cohesion] allModalPolarities :: [ModalPolarity] appendArgNames :: ArgName -> ArgName -> ArgName -- | Compose with cohesion flag from the left. This function is e.g. used -- to update the cohesion information on pattern variables a -- after a match against something of cohesion rel. applyCohesion :: LensCohesion a => Cohesion -> a -> a -- | Compose with modality flag from the left. This function is e.g. used -- to update the modality information on pattern variables a -- after a match against something of modality q. applyModality :: LensModality a => Modality -> a -> a -- | Compose with polarity flag from the left. This function is e.g. used -- to update the polarity information on pattern variables a -- after a match against something of polarity pol. applyPolarity :: LensModalPolarity a => PolarityModality -> a -> a -- | Compose with quantity flag from the left. This function is e.g. used -- to update the quantity information on pattern variables a -- after a match against something of quantity q. applyQuantity :: LensQuantity a => Quantity -> a -> a -- | Compose with relevance flag from the left. This function is e.g. used -- to update the relevance information on pattern variables a -- after a match against something rel. applyRelevance :: LensRelevance a => Relevance -> a -> a argNameToString :: ArgName -> String -- | Erased can be embedded into Quantity. asQuantity :: Erased -> Quantity bareNameOf :: (LensNamed a, NameOf a ~ NamedName) => a -> Maybe ArgName bareNameWithDefault :: (LensNamed a, NameOf a ~ NamedName) => ArgName -> a -> ArgName -- | Prefer user-written over system-inserted. bestConInfo :: ConOrigin -> ConOrigin -> ConOrigin -- | Cohesion composition. Squash is dominant, -- Continuous is neutral. composeCohesion :: Cohesion -> Cohesion -> Cohesion -- | Composition of values of type Erased. -- -- Erased is dominant. NotErased is neutral. -- -- Right-biased for the origin. composeErased :: Erased -> Erased -> Erased -- | Multiplicative monoid (standard monoid). composeModality :: Modality -> Modality -> Modality -- | PolarityModality composition. composePolarity :: PolarityModality -> PolarityModality -> PolarityModality -- | ModalPolarity composition. UnusedPolarity is dominant, -- StrictlyPositive is neutral. composePolarity' :: ModalPolarity -> ModalPolarity -> ModalPolarity -- | Composition of quantities (multiplication). -- -- Quantity0 is dominant. Quantity1 is neutral. -- -- Right-biased for origin. composeQuantity :: Quantity -> Quantity -> Quantity -- | Relevance composition. Irrelevant is dominant, -- Relevant is neutral. Composition coincides with max. composeRelevance :: Relevance -> Relevance -> Relevance cubicalOptionString :: Cubical -> String defaultAnnotation :: Annotation defaultArg :: a -> Arg a defaultArgInfo :: ArgInfo -- | The default Modality terms are checked against. defaultCheckModality :: Modality -- | Default Cohesion is the identity element under composition defaultCohesion :: Cohesion -- | The default value of type Erased: not erased. defaultErased :: Erased defaultFixity :: Fixity -- | Default is directive is private (use everything, but do not -- export). defaultImportDir :: ImportDirective' n m defaultIrrelevantArgInfo :: ArgInfo defaultLock :: Lock -- | The default Modality Beware that this is neither the additive unit nor -- the unit under composition, because the default quantity is ω. defaultModality :: Modality defaultNamedArg :: a -> NamedArg a -- | Default used when not caring about polarity defaultPolarity :: PolarityModality -- | Absorptive element! This differs from Relevance and Cohesion whose -- default is the multiplicative unit. defaultQuantity :: Quantity -- | Default Relevance is the identity element under composition defaultRelevance :: Relevance defaultRewrite :: RewriteAnn -- | Is []-cong allowed? emRestricted :: AllowedErasedMatches -> Bool -- | Are unrestricted erased matches allowed for indexed types? emUnrestricted :: AllowedErasedMatches -> Bool emptyRecordDirectives :: Null a => RecordDirectives' a -- | Quantity can be projected onto Erased. erasedFromQuantity :: Quantity -> Maybe Erased -- | Does an argument arg fit the shape dom of the next -- expected argument? -- -- The hiding has to match, and if the argument has a name, it should -- match the name of the domain. -- -- Nothing should be __IMPOSSIBLE__, so use as @ -- fromMaybe IMPOSSIBLE $ fittingNamedArg arg dom @ fittingNamedArg :: (LensNamed arg, NameOf arg ~ NamedName, LensHiding arg, LensNamed dom, NameOf dom ~ NamedName, LensHiding dom) => arg -> dom -> Maybe Bool freeVariablesFromList :: [Int] -> FreeVariables fromImportedName :: ImportedName' a a -> a getCohesionMod :: LensModality a => LensGet a Cohesion getFreeVariablesArgInfo :: LensArgInfo a => LensGet a FreeVariables getHidingArgInfo :: LensArgInfo a => LensGet a Hiding getModalityArgInfo :: LensArgInfo a => LensGet a Modality getNameOf :: LensNamed a => a -> Maybe (NameOf a) getOriginArgInfo :: LensArgInfo a => LensGet a Origin getPolarityMod :: LensModality a => LensGet a PolarityModality getQuantityMod :: LensModality a => LensGet a Quantity getRelevanceMod :: LensModality a => LensGet a Relevance hasNoFreeVariables :: LensFreeVariables a => a -> Bool -- | Check for Quantity0. hasQuantity0 :: LensQuantity a => a -> Bool -- | Check for Quantity1. hasQuantity1 :: LensQuantity a => a -> Bool -- | Check for Quantityω. hasQuantityω :: LensQuantity a => a -> Bool -- | Hidden arguments are hidden. hidden :: LensHiding a => a -> Bool hide :: LensHiding a => a -> a hideOrKeepInstance :: LensHiding a => a -> a hidingToString :: Hiding -> String ignoreRew :: (Monad m, LensRewriteAnn a) => (RewriteAnn -> m ()) -> a -> m a -- | Left division by a Cohesion. Used e.g. to modify context when -- going into a rel argument. inverseApplyCohesion :: LensCohesion a => Cohesion -> a -> a -- | Left division by a Modality. Used e.g. to modify context when -- going into a m argument. -- -- Note that this function does not change quantities. inverseApplyModalityButNotQuantity :: LensModality a => Modality -> a -> a -- | Left division by a PolarityModality. Used e.g. to modify -- context when going into a pol argument. inverseApplyPolarity :: LensModalPolarity a => PolarityModality -> a -> a -- | Left division by a Quantity. Used e.g. to modify context when -- going into a q argument. inverseApplyQuantity :: LensQuantity a => Quantity -> a -> a -- | Left division by a Relevance. Used e.g. to modify context when -- going into a rel argument. inverseApplyRelevance :: LensRelevance a => Relevance -> a -> a -- | inverseComposeCohesion r x returns the least y such -- that forall x, y we have x `moreCohesion` (r -- `composeCohesion` y) iff (r `inverseComposeCohesion` x) -- `moreCohesion` y (Galois connection). The above law fails for -- r = Squash. inverseComposeCohesion :: Cohesion -> Cohesion -> Cohesion -- | inverseComposeModality r x returns the least modality -- y such that forall x, y we have x -- `moreUsableModality` (r `composeModality` y) iff (r -- `inverseComposeModality` x) `moreUsableModality` y (Galois -- connection). inverseComposeModality :: Modality -> Modality -> Modality -- | inverseComposePolarity r x returns the least y such -- that forall x, y we have x `morePolarity'\` (r -- `composePolarity` y) iff (r `inverseComposePolarity` x) -- `morePolarity'\` y (Galois connection). inverseComposePolarity :: PolarityModality -> PolarityModality -> PolarityModality -- | inverseComposePolarity r x returns the least y such -- that forall x, y we have x `morePolarity'\` (r -- `composePolarity` y) iff (r `inverseComposePolarity` x) -- `morePolarity'\` y (Galois connection). inverseComposePolarity' :: ModalPolarity -> ModalPolarity -> ModalPolarity -- | inverseComposeQuantity r x returns the least quantity -- y such that forall x, y we have x -- `moreQuantity` (r `composeQuantity` y) iff (r -- `inverseComposeQuantity` x) `moreQuantity` y (Galois connection). inverseComposeQuantity :: Quantity -> Quantity -> Quantity -- | inverseComposeRelevance r x returns the most irrelevant -- y such that forall x, y we have x -- `moreRelevant` (r `composeRelevance` y) iff (r -- `inverseComposeRelevance` x) `moreRelevant` y (Galois -- connection). inverseComposeRelevance :: Relevance -> Relevance -> Relevance irrelevant :: Relevance -- | Irrelevant function arguments may appear non-strictly in the codomain -- type. irrelevantToShapeIrrelevant :: Relevance -> Relevance isContinuous :: LensCohesion a => a -> Bool -- | isDefaultImportDir implies null, but not the other -- way round. isDefaultImportDir :: ImportDirective' n m -> Bool -- | Is the value "erased"? isErased :: Erased -> Bool isIncoherent :: HasOverlapMode a => a -> Bool isInsertedHidden :: (LensHiding a, LensOrigin a) => a -> Bool isInstance :: LensHiding a => a -> Bool isIrrelevant :: LensRelevance a => a -> Bool isKindPattern :: ExprKind -> Bool isOverlappable :: HasOverlapMode a => a -> Bool isOverlapping :: HasOverlapMode a => a -> Bool isQuantity0 :: LensQuantity a => a -> Bool isQuantityω :: LensQuantity a => a -> Bool isRelevant :: LensRelevance a => a -> Bool isRewrite :: LensRewriteAnn a => a -> Bool isShapeIrrelevant :: LensRelevance a => a -> Bool isUnnamed :: Named name a -> Maybe a isYesOverlap :: LensHiding a => a -> Bool lModCohesion :: Lens' Modality Cohesion lModPolarity :: Lens' Modality PolarityModality lModQuantity :: Lens' Modality Quantity lModRelevance :: Lens' Modality Relevance makeInstance :: LensHiding a => a -> a makeInstance' :: LensHiding a => Overlappable -> a -> a mapCohesionMod :: LensModality a => LensMap a Cohesion mapFreeVariablesArgInfo :: LensArgInfo a => LensMap a FreeVariables mapHidingArgInfo :: LensArgInfo a => LensMap a Hiding mapModalityArgInfo :: LensArgInfo a => LensMap a Modality mapNameOf :: LensNamed a => (Maybe (NameOf a) -> Maybe (NameOf a)) -> a -> a mapOriginArgInfo :: LensArgInfo a => LensMap a Origin mapPolarityMod :: LensModality a => LensMap a PolarityModality mapQuantityMod :: LensModality a => LensMap a Quantity mapRelevanceMod :: LensModality a => LensMap a Relevance mapUsing :: ([ImportedName' n1 m1] -> [ImportedName' n2 m2]) -> Using' n1 m1 -> Using' n2 m2 -- | Monoidal composition of Hiding information in some data. mergeHiding :: LensHiding a => WithHiding a -> a -- | Alias for Mixed polarity. mixedPolarity :: PolarityModality -- | Information ordering. Flat `moreCohesion` Continuous -- `moreCohesion` Sharp `moreCohesion` Squash moreCohesion :: Cohesion -> Cohesion -> Bool morePolarity :: PolarityModality -> PolarityModality -> Bool -- | morePolarity' x y is True whenever a variable of polarity x -- can be used anywhere where a variable of polarity y is expected. Note -- that morePolarity' x y actually means x <= y. morePolarity' :: ModalPolarity -> ModalPolarity -> Bool -- | m moreUsableQuantity m' means that an m can -- be used where ever an m' is required. moreQuantity :: Quantity -> Quantity -> Bool -- | Information ordering. Relevant `moreRelevant` ShapeIrrelevant -- `moreRelevant` Irrelevant moreRelevant :: Relevance -> Relevance -> Bool -- | m moreUsableModality m' means that an m can -- be used where ever an m' is required. moreUsableModality :: Modality -> Modality -> Bool named :: name -> a -> Named name a -- | Get the content of a NamedArg. namedArg :: NamedArg a -> a -- | Equality of argument names of things modulo Range and -- Origin. namedSame :: (LensNamed a, LensNamed b, NameOf a ~ NamedName, NameOf b ~ NamedName) => a -> b -> Bool -- | Alias for Negative polarity. negativePolarity :: PolarityModality noFixity :: Fixity noFixity' :: Fixity' noFreeVariables :: FreeVariables noNotation :: Notation -- | An abbreviation: noPlaceholder = NoPlaceholder -- Nothing. noPlaceholder :: e -> MaybePlaceholder e -- | Did the user supply a quantity annotation? noUserQuantity :: LensQuantity a => a -> Bool -- | Non-inlined equality that's sometimes useful to prevent GHC from -- ballooning code size. noinlineEqModality :: Modality -> Modality -> Bool -- | Instance and Hidden arguments are notVisible. notVisible :: LensHiding a => a -> Bool oneFreeVariable :: Int -> FreeVariables -- | Like partitionEithers. partitionImportedNames :: [ImportedName' n m] -> ([n], [m]) -- | Extract the positional modality components (cohesion and polarity) for -- checks regarding only them. positionalModalityComponent :: Modality -> Modality prettyCohesion :: LensCohesion a => a -> Doc -> Doc prettyErased :: Erased -> Doc -> Doc -- | prettyHiding info visible doc puts the correct braces around -- doc according to info info and returns visible -- doc if the we deal with a visible thing. prettyHiding :: LensHiding a => a -> (Doc -> Doc) -> Doc -> Doc prettyLock :: LensLock a => a -> Doc -> Doc prettyPolarity :: LensModalPolarity a => a -> Doc -> Doc prettyQuantity :: LensQuantity a => a -> Doc -> Doc prettyRelevance :: LensRelevance a => a -> Doc -> Doc prettyRewriteAnn :: LensRewriteAnn a => a -> Doc -> Doc privateAccessInserted :: Access rawNameToString :: RawName -> String relevant :: Relevance -- | Equality ignoring origin. TODO: add origin to Cohesion. sameCohesion :: Cohesion -> Cohesion -> Bool -- | Equality ignoring origin. sameErased :: Erased -> Erased -> Bool -- | Ignores Overlappable. sameHiding :: (LensHiding a, LensHiding b) => a -> b -> Bool -- | Equality ignoring origin. sameModality :: (LensModality a, LensModality b) => a -> b -> Bool -- | Equality of argument names of things modulo Range and -- Origin. sameName :: NamedName -> NamedName -> Bool -- | Equality for polarities. samePolarity :: PolarityModality -> PolarityModality -> Bool -- | Equality ignoring origin. sameQuantity :: Quantity -> Quantity -> Bool -- | Equality ignoring origin. sameRelevance :: Relevance -> Relevance -> Bool setCohesionMod :: LensModality a => LensSet a Cohesion setFreeVariablesArgInfo :: LensArgInfo a => LensSet a FreeVariables setHidingArgInfo :: LensArgInfo a => LensSet a Hiding setImportedName :: ImportedName' a a -> a -> ImportedName' a a setModalityArgInfo :: LensArgInfo a => LensSet a Modality setNameOf :: LensNamed a => Maybe (NameOf a) -> a -> a -- |
--   setNamedArg a b = updateNamedArg (const b) a
--   
setNamedArg :: NamedArg a -> b -> NamedArg b setOriginArgInfo :: LensArgInfo a => LensSet a Origin setPolarityMod :: LensModality a => LensSet a PolarityModality setQuantityMod :: LensModality a => LensSet a Quantity setRelevanceMod :: LensModality a => LensSet a Relevance shapeIrrelevant :: Relevance shapeIrrelevantToIrrelevant :: Relevance -> Relevance -- | Applied when working on types (unless --experimental-irrelevance). shapeIrrelevantToRelevant :: Relevance -> Relevance -- | splittablePolarity pol == False iff we cannot split on a -- variable of pol. splittablePolarity :: LensModalPolarity a => a -> Bool stringToArgName :: String -> ArgName stringToRawName :: String -> RawName -- | Absorptive element under addition. topCohesion :: Cohesion -- | Absorptive element under addition. topModality :: Modality -- | Absorptive element under addition. topPolarity :: PolarityModality -- | Absorptive element is ω. topQuantity :: Quantity -- | Absorptive element under addition. topRelevance :: Relevance unArgKeepHiding :: Arg a -> WithHiding a -- | Identity under composition unitCohesion :: Cohesion -- | Identity under composition unitModality :: Modality -- | Identity under composition. unitPolarity :: PolarityModality -- | Identity element under composition unitQuantity :: Quantity -- | Identity element under composition unitRelevance :: Relevance unknownFreeVariables :: FreeVariables unnamed :: a -> Named name a unnamedArg :: ArgInfo -> a -> NamedArg a -- | Thing with no range info. unranged :: a -> Ranged a -- | The functor instance for NamedArg would be ambiguous, so we -- give it another name here. updateNamedArg :: (a -> b) -> NamedArg a -> NamedArg b updateNamedArgA :: Applicative f => (a -> f b) -> NamedArg a -> f (NamedArg b) -- | usableCohesion rel == False iff we cannot use a variable of -- rel. usableCohesion :: LensCohesion a => a -> Bool usableModality :: LensModality a => a -> Bool -- | usablePolarity pol == False iff we cannot use a variable of -- pol. usablePolarity :: LensModalPolarity a => a -> Bool -- | A thing of quantity 0 is unusable, all others are usable. usableQuantity :: LensQuantity a => a -> Bool -- | usableRelevance rel == False iff we cannot use a variable of -- rel. usableRelevance :: LensRelevance a => a -> Bool userNamed :: Ranged ArgName -> a -> Named_ a -- | NotHidden arguments are visible. visible :: LensHiding a => a -> Bool -- | xs `withArgsFrom` args translates xs into a list of -- Args, using the elements in args to fill in the -- non-unArg fields. -- -- Precondition: The two lists should have equal length. withArgsFrom :: [a] -> [Arg b] -> [Arg a] withNamedArgsFrom :: [a] -> [NamedArg b] -> [NamedArg a] withStandardLock :: ModalPolarity -> PolarityModality -- | Cohesion forms a monoid under addition, and even a semiring. zeroCohesion :: Cohesion -- | Identity under addition zeroModality :: Modality -- | ModalPolarity forms a monoid under addition, and even a -- semiring. zeroPolarity :: PolarityModality -- | Identity element under addition zeroQuantity :: Quantity -- | Relevance forms a monoid under addition, and even a semiring. zeroRelevance :: Relevance -- | Access modifier. data Access -- | Store the Origin of the private block that lead to this -- qualifier. This is needed for more faithful printing of declarations. -- KwRange is the range of the private keyword. PrivateAccess :: KwRange -> Origin -> Access PublicAccess :: Access class AllAreOpaque a jointOpacity :: AllAreOpaque a => a -> JointOpacity ($dmjointOpacity) :: forall (t :: Type -> Type) b. (AllAreOpaque a, Foldable t, AllAreOpaque b, t b ~ a) => a -> JointOpacity -- | What kinds of erased matches are allowed? data AllowedErasedMatches AllowedErasedMatches :: Bool -> Bool -> Maybe AllowedErasedMatchesIndexed -> AllowedErasedMatches -- | Erased matches are allowed for the empty type. [emEmpty] :: AllowedErasedMatches -> Bool -- | Erased matches are allowed for single-constructor, non-indexed data -- types. [emNonDependent] :: AllowedErasedMatches -> Bool -- | What kinds of erased matches, if any, are allowed for -- single-constructor, indexed data types? [emDependent] :: AllowedErasedMatches -> Maybe AllowedErasedMatchesIndexed -- | What kinds of erased matches are allowed for indexed, -- single-constructor data types? data AllowedErasedMatchesIndexed -- | []-cong is allowed. Restricted :: AllowedErasedMatchesIndexed -- | All erased matches are allowed. Unrestricted :: AllowedErasedMatchesIndexed -- | A variant of AllowedErasedMatches that supports default values -- that depend on other flags. data AllowedErasedMatchesWithDefaults -- | No flag has been given, the default is used. (The default depends on -- whether the K rule is allowed or not.) ErasedMatchesDefault :: AllowedErasedMatchesWithDefaults -- | The flag --erased-matches has been given without any options, -- the "default on" value is used. (The default depends on whether the K -- rule is allowed or not.) ErasedMatchesDefaultOn :: AllowedErasedMatchesWithDefaults -- | The flag --erased-matches has been given with (valid) -- options. ErasedMatches :: AllowedErasedMatches -> AllowedErasedMatchesWithDefaults -- | We have a tuple of annotations, which might not be fully orthogonal. data Annotation Annotation :: Lock -> RewriteAnn -> Annotation -- | Fitch-style dependent right adjoints. See Modal Dependent Type Theory -- and Dependent Right Adjoints, arXiv:1804.05236. [annLock] :: Annotation -> Lock [annRewrite] :: Annotation -> RewriteAnn -- | Is any element of a collection an AbstractDef. class AnyIsAbstract a anyIsAbstract :: AnyIsAbstract a => a -> IsAbstract ($dmanyIsAbstract) :: forall (t :: Type -> Type) b. (AnyIsAbstract a, Foldable t, AnyIsAbstract b, t b ~ a) => a -> IsAbstract data Arg e Arg :: ArgInfo -> e -> Arg e [argInfo] :: Arg e -> ArgInfo [unArg] :: Arg e -> e -- | A function argument can be hidden and/or irrelevant. data ArgInfo ArgInfo :: Hiding -> Modality -> Origin -> FreeVariables -> Annotation -> ArgInfo [argInfoHiding] :: ArgInfo -> Hiding [argInfoModality] :: ArgInfo -> Modality [argInfoOrigin] :: ArgInfo -> Origin [argInfoFreeVariables] :: ArgInfo -> FreeVariables -- | Sometimes we want a different kind of binder/pi-type, without it -- supporting any of the Modality interface. [argInfoAnnotation] :: ArgInfo -> Annotation -- | Names in binders and arguments. type ArgName = String type Arity = Nat -- | Associativity. data Associativity NonAssoc :: Associativity LeftAssoc :: Associativity RightAssoc :: Associativity type BackendName = Text data BinderNameOrigin UserBinderName :: BinderNameOrigin InsertedBinderName :: BinderNameOrigin -- | Positions of variables in syntax declarations. data BoundVariablePosition BoundVariablePosition :: Int -> Int -> BoundVariablePosition -- | The position (in the left-hand side of the syntax declaration) of the -- hole in which the variable is bound, counting from zero (and excluding -- parts that are not holes). For instance, for syntax Σ A (λ x → B) -- = B , A , x the number for x is 1, -- corresponding to B (0 would correspond to -- A). [holeNumber] :: BoundVariablePosition -> Int -- | The position in the list of variables for this particular variable, -- counting from zero, and including wildcards. For instance, for -- syntax F (λ x _ y → A) = y ! A ! x the number for x -- is 0, the number for _ is 1, and the number -- for y is 2. [varNumber] :: BoundVariablePosition -> Int -- | Range of the CATCHALL pragma for a clause, if any. -- Nothing means no such pragma. data Catchall YesCatchall :: Range -> Catchall NoCatchall :: Catchall -- | Cohesion modalities see "Brouwer's fixed-point theorem in -- real-cohesive homotopy type theory" (arXiv:1509.07584) types are now -- given an additional topological layer which the modalities interact -- with. data Cohesion -- | same points, discrete topology, idempotent comonad, box-like. Flat :: Cohesion -- | identity modality. Continuous :: Cohesion -- | same points, codiscrete topology, idempotent monad, diamond-like. Sharp :: Cohesion -- | single point space, artificially added for Flat left-composition. Squash :: Cohesion -- | Where does the ConP or Con come from? data ConOrigin -- | Inserted by system or expanded from an implicit pattern. ConOSystem :: ConOrigin -- | User wrote a constructor (pattern). ConOCon :: ConOrigin -- | User wrote a record (pattern). ConORec :: ConOrigin -- | Generated by interactive case splitting. ConOSplit :: ConOrigin newtype Constr a Constr :: a -> Constr a -- | Distinguish constructors from pattern synonyms. data ConstructorOrPatternSynonym IsConstructor :: ConstructorOrPatternSynonym IsPatternSynonym :: ConstructorOrPatternSynonym -- | Can we construct a record by copattern matching? class CopatternMatchingAllowed a copatternMatchingAllowed :: CopatternMatchingAllowed a => a -> Bool -- | Coverage check? (Default is yes). data CoverageCheck YesCoverageCheck :: CoverageCheck NoCoverageCheck :: CoverageCheck -- | Variants of Cubical Agda. data Cubical CWithoutGlue :: Cubical CErased :: Cubical CFull :: Cubical type DataOrRecord = DataOrRecord' PatternOrCopattern data DataOrRecord' p IsData :: DataOrRecord' p IsRecord :: p -> DataOrRecord' p type DataOrRecordEta = DataOrRecord' ForceRecordEta type DataOrRecord_ = DataOrRecord' () -- | Distinguish parsing a DISPLAY pragma from an ordinary left hand side. data DisplayLHS YesDisplayLHS :: DisplayLHS NoDisplayLHS :: DisplayLHS -- | A special case of Quantity: erased or not. -- -- Note that the Ord instance does *not* ignore the origin -- arguments. data Erased Erased :: Q0Origin -> Erased NotErased :: QωOrigin -> Erased data ExpandedEllipsis ExpandedEllipsis :: Range -> Int -> ExpandedEllipsis [ellipsisRange] :: ExpandedEllipsis -> Range [ellipsisWithArgs] :: ExpandedEllipsis -> Int NoEllipsis :: ExpandedEllipsis -- | Expression kinds: Expressions or patterns. data ExprKind IsExpr :: ExprKind IsPattern :: DisplayLHS -> ExprKind data FileType AgdaFileType :: FileType MdFileType :: FileType RstFileType :: FileType TexFileType :: FileType OrgFileType :: FileType TypstFileType :: FileType TreeFileType :: FileType -- | Fixity of operators. data Fixity Fixity :: Range -> FixityLevel -> Associativity -> Fixity -- | Range of the whole fixity declaration. [fixityRange] :: Fixity -> Range [fixityLevel] :: Fixity -> FixityLevel [fixityAssoc] :: Fixity -> Associativity -- | The notation is handled as the fixity in the renamer. Hence, they are -- grouped together in this type. data Fixity' Fixity' :: Fixity -> Notation -> Range -> Fixity' [theFixity] :: Fixity' -> Fixity [theNotation] :: Fixity' -> Notation -- | Range of the name in the fixity declaration (used for correct -- highlighting, see issue #2140). [theNameRange] :: Fixity' -> Range data FixityLevel -- | No fixity declared. Unrelated :: FixityLevel -- | Fixity level declared as the number. Related :: PrecedenceLevel -> FixityLevel -- | Force record type to have eta equality? (Default is no). data ForceRecordEta YesForceRecordEta :: ForceRecordEta NoForceRecordEta :: ForceRecordEta data FreeVariables UnknownFVs :: FreeVariables KnownFVs :: VarSet -> FreeVariables -- | Pattern and copattern matching is allowed in the presence of eta. -- -- In the absence of eta, we have to choose whether we want to allow -- matching on the constructor or copattern matching with the -- projections. Having both leads to breakage of subject reduction (issue -- #4560). type HasEta = HasEta' PatternOrCopattern -- | Does a record come with eta-equality? data HasEta' a YesEta :: HasEta' a NoEta :: a -> HasEta' a type HasEta0 = HasEta' () class HasOverlapMode a lensOverlapMode :: HasOverlapMode a => Lens' a OverlapMode data Hiding Hidden :: Hiding Instance :: Overlappable -> Hiding NotHidden :: Hiding type HidingDirective' n m = [ImportedName' n m] -- | The things you are allowed to say when you shuffle names between name -- spaces (i.e. in import, namespace, or open -- declarations). data ImportDirective' n m ImportDirective :: Range -> Using' n m -> HidingDirective' n m -> RenamingDirective' n m -> Maybe KwRange -> ImportDirective' n m [importDirRange] :: ImportDirective' n m -> Range [using] :: ImportDirective' n m -> Using' n m [hiding] :: ImportDirective' n m -> HidingDirective' n m [impRenaming] :: ImportDirective' n m -> RenamingDirective' n m -- | Only for open. Exports the opened names from the current -- module. Range of the public keyword. [publicOpen] :: ImportDirective' n m -> Maybe KwRange -- | An imported name can be a module or a defined name. data ImportedName' n m -- | Imported module name of type m. ImportedModule :: m -> ImportedName' n m -- | Imported name of type n. ImportedName :: n -> ImportedName' n m newtype InteractionId InteractionId :: Nat -> InteractionId [interactionId] :: InteractionId -> Nat -- | Abstract or concrete. data IsAbstract AbstractDef :: IsAbstract ConcreteDef :: IsAbstract -- | Does a datatype have path constructors, i.e. is it a HIT? data IsHIT YesHIT :: IsHIT NotHIT :: IsHIT -- | Functions can be defined in both infix and prefix style. See -- LHS. data IsInfix InfixDef :: IsInfix PrefixDef :: IsInfix -- | Is this definition eligible for instance search? data IsInstance -- | Range of the instance keyword. InstanceDef :: KwRange -> IsInstance NotInstanceDef :: IsInstance class IsInstanceDef a isInstanceDef :: IsInstanceDef a => a -> Maybe KwRange -- | Is this a macro definition? data IsMacro MacroDef :: IsMacro NotMacroDef :: IsMacro data IsMain IsMain :: IsMain NotMain :: IsMain -- | Opaque or transparent. data IsOpaque -- | This definition is opaque, and it is guarded by the given opaque -- block. OpaqueDef :: OpaqueId -> IsOpaque TransparentDef :: IsOpaque -- | Monoid representing the combined opaque blocks of a Foldable -- containing possibly-opaque declarations. data JointOpacity -- | Every definition agrees on what opaque block they belong to. UniqueOpaque :: OpaqueId -> JointOpacity -- | More than one opaque block was found. DifferentOpaque :: HashSet OpaqueId -> JointOpacity -- | Nothing here is opaque. NoOpaque :: JointOpacity -- | Agda variants. -- -- Only some variants are tracked. data Language WithoutK :: Language WithK :: Language Cubical :: Cubical -> Language class LensAnnotation a getAnnotation :: LensAnnotation a => a -> Annotation ($dmgetAnnotation) :: (LensAnnotation a, LensArgInfo a) => a -> Annotation setAnnotation :: LensAnnotation a => Annotation -> a -> a ($dmsetAnnotation) :: (LensAnnotation a, LensArgInfo a) => Annotation -> a -> a mapAnnotation :: LensAnnotation a => (Annotation -> Annotation) -> a -> a class LensArgInfo a getArgInfo :: LensArgInfo a => a -> ArgInfo setArgInfo :: LensArgInfo a => ArgInfo -> a -> a mapArgInfo :: LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a -- | A lens to access the Cohesion attribute in data structures. -- Minimal implementation: getCohesion and mapCohesion -- or LensModality. class LensCohesion a getCohesion :: LensCohesion a => a -> Cohesion ($dmgetCohesion) :: (LensCohesion a, LensModality a) => a -> Cohesion setCohesion :: LensCohesion a => Cohesion -> a -> a mapCohesion :: LensCohesion a => (Cohesion -> Cohesion) -> a -> a ($dmmapCohesion) :: (LensCohesion a, LensModality a) => (Cohesion -> Cohesion) -> a -> a class LensFixity a lensFixity :: LensFixity a => Lens' a Fixity class LensFixity' a lensFixity' :: LensFixity' a => Lens' a Fixity' -- | A lens to access the FreeVariables attribute in data -- structures. Minimal implementation: getFreeVariables and -- mapFreeVariables or LensArgInfo. class LensFreeVariables a getFreeVariables :: LensFreeVariables a => a -> FreeVariables ($dmgetFreeVariables) :: (LensFreeVariables a, LensArgInfo a) => a -> FreeVariables setFreeVariables :: LensFreeVariables a => FreeVariables -> a -> a mapFreeVariables :: LensFreeVariables a => (FreeVariables -> FreeVariables) -> a -> a ($dmmapFreeVariables) :: (LensFreeVariables a, LensArgInfo a) => (FreeVariables -> FreeVariables) -> a -> a -- | A lens to access the Hiding attribute in data structures. -- Minimal implementation: getHiding and mapHiding or -- LensArgInfo. class LensHiding a getHiding :: LensHiding a => a -> Hiding ($dmgetHiding) :: (LensHiding a, LensArgInfo a) => a -> Hiding setHiding :: LensHiding a => Hiding -> a -> a mapHiding :: LensHiding a => (Hiding -> Hiding) -> a -> a ($dmmapHiding) :: (LensHiding a, LensArgInfo a) => (Hiding -> Hiding) -> a -> a class LensIsAbstract a lensIsAbstract :: LensIsAbstract a => Lens' a IsAbstract class LensIsOpaque a lensIsOpaque :: LensIsOpaque a => Lens' a IsOpaque class LensLock a getLock :: LensLock a => a -> Lock setLock :: LensLock a => Lock -> a -> a mapLock :: LensLock a => (Lock -> Lock) -> a -> a -- | A lens to access the PolarityModality attribute in data -- structures. Minimal implementation: getModalPolarity and -- mapModalPolarity or LensModality. class LensModalPolarity a getModalPolarity :: LensModalPolarity a => a -> PolarityModality ($dmgetModalPolarity) :: (LensModalPolarity a, LensModality a) => a -> PolarityModality setModalPolarity :: LensModalPolarity a => PolarityModality -> a -> a mapModalPolarity :: LensModalPolarity a => (PolarityModality -> PolarityModality) -> a -> a ($dmmapModalPolarity) :: (LensModalPolarity a, LensModality a) => (PolarityModality -> PolarityModality) -> a -> a class LensModality a getModality :: LensModality a => a -> Modality ($dmgetModality) :: (LensModality a, LensArgInfo a) => a -> Modality setModality :: LensModality a => Modality -> a -> a mapModality :: LensModality a => (Modality -> Modality) -> a -> a ($dmmapModality) :: (LensModality a, LensArgInfo a) => (Modality -> Modality) -> a -> a -- | Accessor/editor for the nameOf component. class LensNamed a where { -- | The type of the name type NameOf a; } lensNamed :: LensNamed a => Lens' a (Maybe (NameOf a)) ($dmlensNamed) :: forall (f :: Type -> Type) b. (LensNamed a, Decoration f, LensNamed b, NameOf b ~ NameOf a, f b ~ a) => Lens' a (Maybe (NameOf a)) -- | A lens to access the Origin attribute in data structures. -- Minimal implementation: getOrigin and mapOrigin or -- LensArgInfo. class LensOrigin a getOrigin :: LensOrigin a => a -> Origin ($dmgetOrigin) :: (LensOrigin a, LensArgInfo a) => a -> Origin setOrigin :: LensOrigin a => Origin -> a -> a mapOrigin :: LensOrigin a => (Origin -> Origin) -> a -> a ($dmmapOrigin) :: (LensOrigin a, LensArgInfo a) => (Origin -> Origin) -> a -> a class LensQuantity a getQuantity :: LensQuantity a => a -> Quantity ($dmgetQuantity) :: (LensQuantity a, LensModality a) => a -> Quantity setQuantity :: LensQuantity a => Quantity -> a -> a mapQuantity :: LensQuantity a => (Quantity -> Quantity) -> a -> a ($dmmapQuantity) :: (LensQuantity a, LensModality a) => (Quantity -> Quantity) -> a -> a -- | A lens to access the Relevance attribute in data structures. -- Minimal implementation: getRelevance and -- mapRelevance or LensModality. class LensRelevance a getRelevance :: LensRelevance a => a -> Relevance ($dmgetRelevance) :: (LensRelevance a, LensModality a) => a -> Relevance setRelevance :: LensRelevance a => Relevance -> a -> a mapRelevance :: LensRelevance a => (Relevance -> Relevance) -> a -> a ($dmmapRelevance) :: (LensRelevance a, LensModality a) => (Relevance -> Relevance) -> a -> a class LensRewriteAnn a getRewriteAnn :: LensRewriteAnn a => a -> RewriteAnn setRewriteAnn :: LensRewriteAnn a => RewriteAnn -> a -> a mapRewriteAnn :: LensRewriteAnn a => (RewriteAnn -> RewriteAnn) -> a -> a data Lock IsNotLock :: Lock -- | In the future there might be different kinds of them. For now we -- assume lock weakening. IsLock :: LockOrigin -> Lock data LockOrigin -- | The user wrote @lock. LockOLock :: LockOrigin -- | The user wrote @tick. LockOTick :: LockOrigin -- | Placeholders are used to represent the underscores in a section. data MaybePlaceholder e Placeholder :: PositionInName -> MaybePlaceholder e -- | The second argument is used only (but not always) for name parts other -- than underscores. NoPlaceholder :: Maybe PositionInName -> e -> MaybePlaceholder e -- | Meta-variable identifiers use the same structure as NameIds. data MetaId MetaId :: Word64 -> ModuleNameHash -> MetaId [metaId] :: MetaId -> Word64 [metaModule] :: MetaId -> ModuleNameHash -- | The different polarity options data ModalPolarity -- | argument will not be used. UnusedPolarity :: ModalPolarity -- | argument will only be used in strictly positive position. StrictlyPositive :: ModalPolarity -- | argument will only be used in positive position. Positive :: ModalPolarity -- | argument will only be used in negative position. Negative :: ModalPolarity -- | we don't know anything, argument can be used anywhere. MixedPolarity :: ModalPolarity -- | We have a tuple of modalities, which might not be fully orthogonal. -- For example, irrelevant stuff is also run-time irrelevant. data Modality Modality :: Relevance -> Quantity -> Cohesion -> PolarityModality -> Modality -- | Legacy irrelevance. See Pfenning, LiCS 2001; Abel, Vezzosi and -- Winterhalter, ICFP 2017. [modRelevance] :: Modality -> Relevance -- | Cardinality / runtime erasure. See Conor McBride, I got plenty o' -- nutting, Wadlerfest 2016. See Bob Atkey, Syntax and Semantics of -- Quantitative Type Theory, LiCS 2018. [modQuantity] :: Modality -> Quantity -- | Cohesion/what was in Agda-flat. see "Brouwer's fixed-point theorem in -- real-cohesive homotopy type theory" (arXiv:1509.07584) Currently only -- the comonad is implemented. [modCohesion] :: Modality -> Cohesion -- | Polarity annotations (strictly positive, ...) [modPolarity] :: Modality -> PolarityModality -- | The unique identifier of a name. Second argument is the top-level -- module identifier. data NameId NameId :: Word64 -> ModuleNameHash -> NameId -- | The type of the name type family NameOf a -- | Something potentially carrying a name. data Named name a Named :: Maybe name -> a -> Named name a [nameOf] :: Named name a -> Maybe name [namedThing] :: Named name a -> a -- | Only Hidden arguments can have names. type NamedArg a = Arg Named_ a -- | Standard argument names. type NamedName = WithOrigin Ranged ArgName -- | Standard naming. type Named_ = Named NamedName -- | Number >= 0. type Nat = Int -- | Number >= 1. type Nat1 = Nat -- | Notation as provided by the syntax declaration. type Notation = [NotationPart] -- | Notation parts. data NotationPart -- | An identifier part. For instance, for _+_ the only identifier -- part is +. IdPart :: RString -> NotationPart -- | A hole: a place where argument expressions can be written. For -- instance, for _+_ the two underscores are holes, and for -- syntax Σ A (λ x → B) = B , A , x the variables A and -- B are holes. The number is the position of the hole, counting -- from zero. For instance, the number for A is 0, and -- the number for B is 1. HolePart :: Range -> NamedArg (Ranged Int) -> NotationPart -- | A bound variable. -- -- The first range is the range of the variable in the right-hand side of -- the syntax declaration, and the second range is the range of the -- variable in the left-hand side. VarPart :: Range -> Ranged BoundVariablePosition -> NotationPart -- | A wildcard (an underscore in binding position). WildPart :: Ranged BoundVariablePosition -> NotationPart -- | The unique identifier of an opaque block. Second argument is the -- top-level module identifier. data OpaqueId OpaqueId :: Word64 -> ModuleNameHash -> OpaqueId -- | Origin of arguments. data Origin -- | From the source file / user input. (Preserve!) UserWritten :: Origin -- | E.g. inserted hidden arguments. Inserted :: Origin -- | Produced by the reflection machinery. Reflected :: Origin -- | Produced by an interactive case split. CaseSplit :: Origin -- | Named application produced to represent a substitution. E.g. "?0 (x = -- n)" instead of "?0 n" Substitution :: Origin -- | An expanded hidden argument pun. ExpandedPun :: Origin -- | Inserted by the generalization process Generalization :: Origin -- | Inserted by the conversion checker in an argument spine at the -- position where they differ. -- -- Indicates that the argument at this position should always be reified, -- even if the visibility/modality would be skipped with the current -- flags. ConversionFail :: Origin -- | Inserted to stand for the record "self" variable when checking a -- declaration inside a record module. RecordSelf :: Origin -- | Origin of Irrelevant. data OriginIrrelevant -- | User wrote nothing. OIrrInferred :: OriginIrrelevant -- | User wrote ".". OIrrDot :: Range -> OriginIrrelevant -- | User wrote "@irr". OIrrIrr :: Range -> OriginIrrelevant -- | User wrote "@irrelevant". OIrrIrrelevant :: Range -> OriginIrrelevant -- | Origin of Relevant. data OriginRelevant -- | User wrote nothing. ORelInferred :: OriginRelevant -- | User wrote "@relevant". ORelRelevant :: Range -> OriginRelevant -- | Origin of ShapeIrrelevant. data OriginShapeIrrelevant -- | User wrote nothing. OShIrrInferred :: OriginShapeIrrelevant -- | User wrote "..". OShIrrDotDot :: Range -> OriginShapeIrrelevant -- | User wrote "@shirr". OShIrrShIrr :: Range -> OriginShapeIrrelevant -- | User wrote "@shape-irrelevant". OShIrrShapeIrrelevant :: Range -> OriginShapeIrrelevant -- | The possible overlap modes for an instance, also used for instance -- candidates. data OverlapMode -- | User-written OVERLAPPABLE pragma: this candidate can *be removed* by a -- more specific candidate. Overlappable :: OverlapMode -- | User-written OVERLAPPING pragma: this candidate can *remove* a less -- specific candidate. Overlapping :: OverlapMode -- | User-written OVERLAPS pragma: both overlappable and overlapping. Overlaps :: OverlapMode -- | No user-written overlap pragma. This instance can be overlapped by an -- OVERLAPPING instance, and it can overlap OVERLAPPABLE instances. DefaultOverlap :: OverlapMode -- | User-written INCOHERENT pragma: both overlappable and overlapping; -- and, if there are multiple candidates after all overlap has been -- handled, make an arbitrary choice. Incoherent :: OverlapMode -- | Overlapping instances in record fields. FieldOverlap :: OverlapMode data Overlappable YesOverlap :: Overlappable NoOverlap :: Overlappable -- | Can we pattern match on the record constructor? class PatternMatchingAllowed a patternMatchingAllowed :: PatternMatchingAllowed a => a -> Bool -- | For a record without eta, which type of matching do we allow? data PatternOrCopattern -- | Can match on the record constructor. PatternMatching :: PatternOrCopattern -- | Can copattern match using the projections. (Default.) CopatternMatching :: PatternOrCopattern data PolarityModality PolarityModality :: ModalPolarity -> ModalPolarity -> ModalPolarity -> PolarityModality -- | The actual polarity of the variable [modPolarityAnn] :: PolarityModality -> ModalPolarity -- | The original polarity annotation by the user [modPolarityOrigin] :: PolarityModality -> ModalPolarity -- | The locks of the variable (= composition of all denominators the -- variable has been left divided by) [modPolarityLock] :: PolarityModality -> ModalPolarity -- | The position of a name part or underscore in a name. data PositionInName -- | The following underscore is at the beginning of the name: -- _foo. Beginning :: PositionInName -- | The following underscore is in the middle of the name: -- foo_bar. Middle :: PositionInName -- | The following underscore is at the end of the name: foo_. End :: PositionInName -- | Positivity check? (Default = True). data PositivityCheck YesPositivityCheck :: PositivityCheck NoPositivityCheck :: PositivityCheck -- | Precedence levels for operators. type PrecedenceLevel = Double -- | A "problem" consists of a set of constraints and the same constraint -- can be part of multiple problems. newtype ProblemId ProblemId :: Word64 -> ProblemId -- | Where does a projection come from? data ProjOrigin -- | User wrote a prefix projection. ProjPrefix :: ProjOrigin -- | User wrote a postfix projection. ProjPostfix :: ProjOrigin -- | Projection was generated by the system. ProjSystem :: ProjOrigin -- | Origin of Quantity0. data Q0Origin -- | User wrote nothing. Q0Inferred :: Q0Origin -- | User wrote "@0". Q0 :: Range -> Q0Origin -- | User wrote "@erased". Q0Erased :: Range -> Q0Origin -- | Origin of Quantity1. data Q1Origin -- | User wrote nothing. Q1Inferred :: Q1Origin -- | User wrote "@1". Q1 :: Range -> Q1Origin -- | User wrote "@linear". Q1Linear :: Range -> Q1Origin -- | Quantity for linearity. -- -- A quantity is a set of natural numbers, indicating possible semantic -- uses of a variable. A singleton set {n} requires that the -- corresponding variable is used exactly n times. data Quantity -- | Zero uses {0}, erased at runtime. Quantity0 :: Q0Origin -> Quantity -- | Linear use {1} (could be updated destructively). Mostly TODO -- (needs postponable constraints between quantities to compute uses). Quantity1 :: Q1Origin -> Quantity -- | Unrestricted use ℕ. Quantityω :: QωOrigin -> Quantity -- | Origin of Quantityω. data QωOrigin -- | User wrote nothing. QωInferred :: QωOrigin -- | User wrote "@ω". Qω :: Range -> QωOrigin -- | User wrote "@plenty". QωPlenty :: Range -> QωOrigin -- | String with range info. type RString = Ranged RawName -- | Thing with range info. data Ranged a Ranged :: Range -> a -> Ranged a [rangeOf] :: Ranged a -> Range [rangedThing] :: Ranged a -> a -- | A RawName is some sort of string. type RawName = String data RecordDirectives' a RecordDirectives :: Maybe (Ranged Induction) -> Maybe (Ranged HasEta0) -> Maybe Range -> a -> RecordDirectives' a [recInductive] :: RecordDirectives' a -> Maybe (Ranged Induction) [recHasEta] :: RecordDirectives' a -> Maybe (Ranged HasEta0) [recPattern] :: RecordDirectives' a -> Maybe Range [recConstructor] :: RecordDirectives' a -> a -- | A function argument can be relevant or irrelevant. See -- Agda.TypeChecking.Irrelevance. data Relevance -- | The argument is (possibly) relevant at compile-time. Relevant :: OriginRelevant -> Relevance -- | Like Quantity0, the argument may never flow into evaluation -- position. So it is irrelevant at run-time, yet treated relevantly -- during equality checking. -- -- Unlike Quantity0, it is used to type Irrelevant -- arguments in functions: If you enable -- --experimental-irrelevance, then the type of an irrelevant -- function is forced to be shape-irrelevant. See: - -- https://doi.org/10.2168/LMCS-8(1:29)2012 example 2.8 (Not -- enforcing shape-irrelevant codomains can break subject reduction!) - -- https://dl.acm.org/doi/10.1145/3110277 - -- https://doi.org/10.1145/3209108.3209119 ShapeIrrelevant :: OriginShapeIrrelevant -> Relevance -- | The argument is irrelevant at compile- and runtime. Irrelevant :: OriginIrrelevant -> Relevance data Renaming' n m Renaming :: ImportedName' n m -> ImportedName' n m -> Maybe Fixity -> Range -> Renaming' n m -- | Rename from this name. [renFrom] :: Renaming' n m -> ImportedName' n m -- | To this one. Must be same kind as renFrom. [renTo] :: Renaming' n m -> ImportedName' n m -- | New fixity of renTo (optional). [renFixity] :: Renaming' n m -> Maybe Fixity -- | The range of the "to" keyword. Retained for highlighting purposes. [renToRange] :: Renaming' n m -> Range type RenamingDirective' n m = [Renaming' n m] data RewriteAnn IsNotRewrite :: RewriteAnn IsRewrite :: Range -> RewriteAnn -- | RewriteEqn' qn p e represents the rewrite and -- irrefutable with clauses of the LHS. qn stands for -- the QName of the auxiliary function generated to implement the feature -- nm is the type of names for pattern variables p is -- the type of patterns e is the type of expressions data RewriteEqn' qn nm p e -- |
--   rewrite e
--   
Rewrite :: List1 (qn, e) -> RewriteEqn' qn nm p e -- |
--   with p <- e in eq
--   
Invert :: qn -> List1 (Named nm (p, e)) -> RewriteEqn' qn nm p e -- |
--   using p <- e
--   
LeftLet :: List1 (p, e) -> RewriteEqn' qn nm p e -- | Termination check? (Default = TerminationCheck). data TerminationCheck m -- | Run the termination checker. TerminationCheck :: TerminationCheck m -- | Skip termination checking (unsafe). NoTerminationCheck :: TerminationCheck m -- | Treat as non-terminating. NonTerminating :: TerminationCheck m -- | Treat as terminating (unsafe). Same effect as -- NoTerminationCheck. Terminating :: TerminationCheck m -- | Skip termination checking but use measure instead. TerminationMeasure :: Range -> m -> TerminationCheck m -- | Type wrapper to indicate additive monoid/semigroup context. newtype UnderAddition t UnderAddition :: t -> UnderAddition t -- | Type wrapper to indicate composition or multiplicative -- monoid/semigroup context. newtype UnderComposition t UnderComposition :: t -> UnderComposition t class Eq a => Underscore a underscore :: Underscore a => a isUnderscore :: Underscore a => a -> Bool -- | Universe check? (Default is yes). data UniverseCheck YesUniverseCheck :: UniverseCheck NoUniverseCheck :: UniverseCheck -- | The using clause of import directive. data Using' n m -- | No using clause given. UseEverything :: Using' n m -- | using the specified names. Using :: [ImportedName' n m] -> Using' n m -- | Decorating something with Hiding information. data WithHiding a WithHiding :: Hiding -> a -> WithHiding a [whHiding] :: WithHiding a -> Hiding [whThing] :: WithHiding a -> a -- | Decorating something with Origin information. data WithOrigin a WithOrigin :: Origin -> a -> WithOrigin a [woOrigin] :: WithOrigin a -> Origin [woThing] :: WithOrigin a -> a data Induction Inductive :: Induction CoInductive :: Induction instance Agda.Syntax.Common.AllAreOpaque Agda.Syntax.Common.IsOpaque instance Agda.Syntax.Common.AllAreOpaque a => Agda.Syntax.Common.AllAreOpaque [a] instance Agda.Syntax.Common.AllAreOpaque a => Agda.Syntax.Common.AllAreOpaque (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Common.AnyIsAbstract Agda.Syntax.Common.IsAbstract instance Agda.Syntax.Common.AnyIsAbstract a => Agda.Syntax.Common.AnyIsAbstract [a] instance Agda.Syntax.Common.AnyIsAbstract a => Agda.Syntax.Common.AnyIsAbstract (GHC.Internal.Maybe.Maybe a) instance GHC.Internal.Base.Applicative Agda.Syntax.Common.UnderAddition instance GHC.Internal.Base.Applicative Agda.Syntax.Common.UnderComposition instance GHC.Internal.Base.Applicative Agda.Syntax.Common.WithHiding instance Agda.Utils.Boolean.Boolean Agda.Syntax.Common.DataOrRecord_ instance Agda.Utils.Boolean.Boolean Agda.Syntax.Common.DisplayLHS instance Agda.Utils.Boolean.Boolean Agda.Syntax.Common.IsAbstract instance Agda.Utils.Boolean.Boolean Agda.Syntax.Common.IsHIT instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.Cohesion instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.ConOrigin instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.ConstructorOrPatternSynonym instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.DisplayLHS instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.LockOrigin instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.ModalPolarity instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.Origin instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.OverlapMode instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.PatternOrCopattern instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.PolarityModality instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.ProjOrigin instance GHC.Internal.Enum.Bounded Agda.Syntax.Common.UniverseCheck instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.Syntax.Common.DataOrRecord instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.Syntax.Common.HasEta instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.Syntax.Common.PatternOrCopattern instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.Arg instance Agda.Utils.Functor.Decoration (Agda.Syntax.Common.Named name) instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.Ranged instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.WithHiding instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.WithOrigin instance GHC.Internal.Enum.Enum Agda.Syntax.Common.Cohesion instance GHC.Internal.Enum.Enum Agda.Syntax.Common.ConOrigin instance GHC.Internal.Enum.Enum Agda.Syntax.Common.ConstructorOrPatternSynonym instance GHC.Internal.Enum.Enum Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Enum.Enum Agda.Syntax.Common.DisplayLHS instance GHC.Internal.Enum.Enum Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Enum.Enum Agda.Syntax.Common.InteractionId instance GHC.Internal.Enum.Enum Agda.Syntax.Common.LockOrigin instance GHC.Internal.Enum.Enum Agda.Syntax.Common.MetaId instance GHC.Internal.Enum.Enum Agda.Syntax.Common.ModalPolarity instance GHC.Internal.Enum.Enum Agda.Syntax.Common.NameId instance GHC.Internal.Enum.Enum Agda.Syntax.Common.OpaqueId instance GHC.Internal.Enum.Enum Agda.Syntax.Common.Origin instance GHC.Internal.Enum.Enum Agda.Syntax.Common.OverlapMode instance GHC.Internal.Enum.Enum Agda.Syntax.Common.PatternOrCopattern instance GHC.Internal.Enum.Enum Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Enum.Enum Agda.Syntax.Common.ProblemId instance GHC.Internal.Enum.Enum Agda.Syntax.Common.ProjOrigin instance GHC.Internal.Enum.Enum Agda.Syntax.Common.UniverseCheck instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Access instance GHC.Internal.Classes.Eq Agda.Syntax.Common.AllowedErasedMatches instance GHC.Internal.Classes.Eq Agda.Syntax.Common.AllowedErasedMatchesIndexed instance GHC.Internal.Classes.Eq Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Annotation instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Common.Arg e) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ArgInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Associativity instance GHC.Internal.Classes.Eq Agda.Syntax.Common.BinderNameOrigin instance GHC.Internal.Classes.Eq Agda.Syntax.Common.BoundVariablePosition instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Catchall instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Cohesion instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ConOrigin instance GHC.Internal.Classes.Eq Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Cubical instance GHC.Internal.Classes.Eq p => GHC.Internal.Classes.Eq (Agda.Syntax.Common.DataOrRecord' p) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.DisplayLHS instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Erased instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ExpandedEllipsis instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ExprKind instance GHC.Internal.Classes.Eq Agda.Syntax.Common.FileType instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Fixity instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Fixity' instance GHC.Internal.Classes.Eq Agda.Syntax.Common.FixityLevel instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Classes.Eq Agda.Syntax.Common.FreeVariables instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Common.HasEta' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Hiding instance (GHC.Internal.Classes.Eq m, GHC.Internal.Classes.Eq n) => GHC.Internal.Classes.Eq (Agda.Syntax.Common.ImportDirective' n m) instance (GHC.Internal.Classes.Eq m, GHC.Internal.Classes.Eq n) => GHC.Internal.Classes.Eq (Agda.Syntax.Common.ImportedName' n m) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.InteractionId instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsAbstract instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsHIT instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsInfix instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsInstance instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsMacro instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsMain instance GHC.Internal.Classes.Eq Agda.Syntax.Common.IsOpaque instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Language instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Lock instance GHC.Internal.Classes.Eq Agda.Syntax.Common.LockOrigin instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Common.MaybePlaceholder e) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.MetaId instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ModalPolarity instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Modality instance GHC.Internal.Classes.Eq Agda.Syntax.Common.NameId instance (GHC.Internal.Classes.Eq name, GHC.Internal.Classes.Eq a) => GHC.Internal.Classes.Eq (Agda.Syntax.Common.Named name a) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.NotationPart instance GHC.Internal.Classes.Eq Agda.Syntax.Common.OpaqueId instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Origin instance GHC.Internal.Classes.Eq Agda.Syntax.Common.OverlapMode instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Overlappable instance GHC.Internal.Classes.Eq Agda.Syntax.Common.PatternOrCopattern instance GHC.Internal.Classes.Eq Agda.Syntax.Common.PolarityModality instance GHC.Internal.Classes.Eq Agda.Syntax.Common.PositionInName instance GHC.Internal.Classes.Eq Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ProblemId instance GHC.Internal.Classes.Eq Agda.Syntax.Common.ProjOrigin instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Q0Origin instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Q1Origin instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Quantity instance GHC.Internal.Classes.Eq Agda.Syntax.Common.QωOrigin instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Common.Ranged a) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Common.RecordDirectives' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.Relevance instance (GHC.Internal.Classes.Eq m, GHC.Internal.Classes.Eq n) => GHC.Internal.Classes.Eq (Agda.Syntax.Common.Renaming' n m) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.RewriteAnn instance (GHC.Internal.Classes.Eq qn, GHC.Internal.Classes.Eq nm, GHC.Internal.Classes.Eq p, GHC.Internal.Classes.Eq e) => GHC.Internal.Classes.Eq (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance GHC.Internal.Classes.Eq m => GHC.Internal.Classes.Eq (Agda.Syntax.Common.TerminationCheck m) instance GHC.Internal.Classes.Eq t => GHC.Internal.Classes.Eq (Agda.Syntax.Common.UnderAddition t) instance GHC.Internal.Classes.Eq t => GHC.Internal.Classes.Eq (Agda.Syntax.Common.UnderComposition t) instance GHC.Internal.Classes.Eq Agda.Syntax.Common.UniverseCheck instance (GHC.Internal.Classes.Eq m, GHC.Internal.Classes.Eq n) => GHC.Internal.Classes.Eq (Agda.Syntax.Common.Using' n m) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Common.WithHiding a) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Common.WithOrigin a) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.Arg instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.HasEta' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.MaybePlaceholder instance GHC.Internal.Data.Foldable.Foldable (Agda.Syntax.Common.Named name) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.Ranged instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.RecordDirectives' instance GHC.Internal.Data.Foldable.Foldable (Agda.Syntax.Common.RewriteEqn' qn nm p) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.WithHiding instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Common.WithOrigin instance GHC.Internal.Base.Functor Agda.Syntax.Common.Arg instance GHC.Internal.Base.Functor Agda.Syntax.Common.HasEta' instance GHC.Internal.Base.Functor Agda.Syntax.Common.MaybePlaceholder instance GHC.Internal.Base.Functor (Agda.Syntax.Common.Named name) instance GHC.Internal.Base.Functor Agda.Syntax.Common.Ranged instance GHC.Internal.Base.Functor Agda.Syntax.Common.RecordDirectives' instance GHC.Internal.Base.Functor (Agda.Syntax.Common.RewriteEqn' qn nm p) instance GHC.Internal.Base.Functor Agda.Syntax.Common.TerminationCheck instance GHC.Internal.Base.Functor Agda.Syntax.Common.UnderAddition instance GHC.Internal.Base.Functor Agda.Syntax.Common.UnderComposition instance GHC.Internal.Base.Functor Agda.Syntax.Common.WithHiding instance GHC.Internal.Base.Functor Agda.Syntax.Common.WithOrigin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.AllowedErasedMatches instance GHC.Internal.Generics.Generic Agda.Syntax.Common.AllowedErasedMatchesIndexed instance GHC.Internal.Generics.Generic Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Annotation instance GHC.Internal.Generics.Generic Agda.Syntax.Common.BinderNameOrigin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Catchall instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Cohesion instance GHC.Internal.Generics.Generic Agda.Syntax.Common.ConOrigin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.ConstructorOrPatternSynonym instance GHC.Internal.Generics.Generic Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Cubical instance GHC.Internal.Generics.Generic (Agda.Syntax.Common.DataOrRecord' p) instance GHC.Internal.Generics.Generic Agda.Syntax.Common.DisplayLHS instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Erased instance GHC.Internal.Generics.Generic Agda.Syntax.Common.FileType instance GHC.Internal.Generics.Generic Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Generics.Generic Agda.Syntax.Common.IsAbstract instance GHC.Internal.Generics.Generic Agda.Syntax.Common.IsHIT instance GHC.Internal.Generics.Generic Agda.Syntax.Common.IsMacro instance GHC.Internal.Generics.Generic Agda.Syntax.Common.IsOpaque instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Language instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Lock instance GHC.Internal.Generics.Generic Agda.Syntax.Common.LockOrigin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.MetaId instance GHC.Internal.Generics.Generic Agda.Syntax.Common.ModalPolarity instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Modality instance GHC.Internal.Generics.Generic Agda.Syntax.Common.NameId instance GHC.Internal.Generics.Generic Agda.Syntax.Common.OpaqueId instance GHC.Internal.Generics.Generic Agda.Syntax.Common.OriginIrrelevant instance GHC.Internal.Generics.Generic Agda.Syntax.Common.OriginRelevant instance GHC.Internal.Generics.Generic Agda.Syntax.Common.OriginShapeIrrelevant instance GHC.Internal.Generics.Generic Agda.Syntax.Common.PolarityModality instance GHC.Internal.Generics.Generic Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Generics.Generic Agda.Syntax.Common.ProjOrigin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Q0Origin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Q1Origin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Quantity instance GHC.Internal.Generics.Generic Agda.Syntax.Common.QωOrigin instance GHC.Internal.Generics.Generic Agda.Syntax.Common.Relevance instance GHC.Internal.Generics.Generic Agda.Syntax.Common.RewriteAnn instance GHC.Internal.Generics.Generic Agda.Syntax.Common.UniverseCheck instance Agda.Syntax.Common.HasOverlapMode Agda.Syntax.Common.OverlapMode instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Access instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Annotation instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Cohesion instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Erased instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Fixity instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Fixity' instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.HasEta' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Hiding instance Agda.Syntax.Position.HasRange (Agda.Syntax.Common.ImportDirective' a b) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.ImportedName' a b) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Aspect.Induction instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.IsInstance instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.IsMacro instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.MaybePlaceholder a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Modality instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.NotationPart instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Origin instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.OriginIrrelevant instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.OriginRelevant instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.OriginShapeIrrelevant instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.PolarityModality instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.RecordDirectives' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Relevance instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Renaming' a b) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.RewriteAnn instance (Agda.Syntax.Position.HasRange qn, Agda.Syntax.Position.HasRange p, Agda.Syntax.Position.HasRange e) => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Using' a b) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.WithOrigin a) instance Data.Hashable.Class.Hashable Agda.Syntax.Common.MetaId instance Data.Hashable.Class.Hashable Agda.Syntax.Common.NameId instance Data.Hashable.Class.Hashable Agda.Syntax.Common.OpaqueId instance GHC.Internal.Real.Integral Agda.Syntax.Common.InteractionId instance GHC.Internal.Real.Integral Agda.Syntax.Common.ProblemId instance Agda.Utils.Boolean.IsBool Agda.Syntax.Common.DataOrRecord_ instance Agda.Utils.Boolean.IsBool Agda.Syntax.Common.DisplayLHS instance Agda.Utils.Boolean.IsBool Agda.Syntax.Common.IsAbstract instance Agda.Utils.Boolean.IsBool Agda.Syntax.Common.IsHIT instance Agda.Syntax.Common.IsInstanceDef Agda.Syntax.Common.IsInstance instance GHC.Internal.Ix.Ix Agda.Syntax.Common.Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Access instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Annotation instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.BinderNameOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Catchall instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Cohesion instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ConOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.CoverageCheck instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.DataOrRecord' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Erased instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ExpandedEllipsis instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Fixity instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Fixity' instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ForceRecordEta instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.FreeVariables instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.HasEta' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Hiding instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.ImportDirective' a b) instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.ImportedName' a b) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Aspect.Induction instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.InteractionId instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsAbstract instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsHIT instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsInstance instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsMacro instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsOpaque instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Language instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.MaybePlaceholder a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Modality instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.NameId instance (Agda.Syntax.Position.KillRange name, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.NotationPart instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.OpaqueId instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.OriginIrrelevant instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.OriginRelevant instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.OriginShapeIrrelevant instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.OverlapMode instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.PolarityModality instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.PositivityCheck instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ProjOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.RecordDirectives' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Relevance instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Renaming' a b) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.RewriteAnn instance (Agda.Syntax.Position.KillRange qn, Agda.Syntax.Position.KillRange nm, Agda.Syntax.Position.KillRange e, Agda.Syntax.Position.KillRange p) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance Agda.Syntax.Position.KillRange m => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.TerminationCheck m) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.UniverseCheck instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Using' a b) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.WithOrigin a) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.PolarityModality) instance Agda.Syntax.Common.LensAnnotation Agda.Syntax.Common.Annotation instance Agda.Syntax.Common.LensAnnotation (Agda.Syntax.Common.Arg t) instance Agda.Syntax.Common.LensAnnotation Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensArgInfo (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Common.LensArgInfo Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensCohesion (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensCohesion Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensCohesion Agda.Syntax.Common.Cohesion instance Agda.Syntax.Common.LensCohesion Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensFixity' Agda.Syntax.Common.Fixity' instance Agda.Syntax.Common.LensFixity Agda.Syntax.Common.Fixity instance Agda.Syntax.Common.LensFixity Agda.Syntax.Common.Fixity' instance Agda.Syntax.Common.LensFreeVariables (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensFreeVariables Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensFreeVariables Agda.Syntax.Common.FreeVariables instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensHiding Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensHiding Agda.Syntax.Common.Hiding instance Agda.Syntax.Common.LensHiding a => Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.Named nm a) instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Common.LensIsAbstract Agda.Syntax.Common.IsAbstract instance Agda.Syntax.Common.LensIsOpaque Agda.Syntax.Common.IsOpaque instance Agda.Syntax.Common.LensLock (Agda.Syntax.Common.Arg t) instance Agda.Syntax.Common.LensLock Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensLock Agda.Syntax.Common.Lock instance Agda.Syntax.Common.LensModalPolarity (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensModalPolarity Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensModalPolarity Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensModalPolarity Agda.Syntax.Common.PolarityModality instance Agda.Syntax.Common.LensModality (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensModality Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensModality Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensNamed a => Agda.Syntax.Common.LensNamed (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Common.LensNamed (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Common.LensNamed (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensOrigin Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensOrigin Agda.Syntax.Common.Origin instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Common.WithOrigin a) instance Agda.Syntax.Common.LensQuantity (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensQuantity Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensQuantity Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensQuantity Agda.Syntax.Common.Quantity instance Agda.Syntax.Common.LensRelevance (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Common.Relevance instance Agda.Syntax.Common.LensRewriteAnn (Agda.Syntax.Common.Arg t) instance Agda.Syntax.Common.LensRewriteAnn Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensRewriteAnn Agda.Syntax.Common.RewriteAnn instance GHC.Internal.Base.Monoid Agda.Syntax.Common.AllowedErasedMatches instance GHC.Internal.Base.Monoid Agda.Syntax.Common.AllowedErasedMatchesIndexed instance GHC.Internal.Base.Monoid Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Catchall instance GHC.Internal.Base.Monoid Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Base.Monoid Agda.Syntax.Common.ExpandedEllipsis instance GHC.Internal.Base.Monoid Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Base.Monoid Agda.Syntax.Common.FreeVariables instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Hiding instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.ImportDirective' n m) instance GHC.Internal.Base.Monoid Agda.Syntax.Common.IsAbstract instance GHC.Internal.Base.Monoid Agda.Syntax.Common.IsMain instance GHC.Internal.Base.Monoid Agda.Syntax.Common.JointOpacity instance GHC.Internal.Base.Monoid Agda.Syntax.Common.OriginIrrelevant instance GHC.Internal.Base.Monoid Agda.Syntax.Common.OriginRelevant instance GHC.Internal.Base.Monoid Agda.Syntax.Common.OriginShapeIrrelevant instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Overlappable instance GHC.Internal.Base.Monoid Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Q0Origin instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Q1Origin instance GHC.Internal.Base.Monoid Agda.Syntax.Common.QωOrigin instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.PolarityModality) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.PolarityModality) instance GHC.Internal.Base.Monoid Agda.Syntax.Common.UniverseCheck instance GHC.Internal.Base.Monoid (Agda.Syntax.Common.Using' n m) instance Control.DeepSeq.NFData Agda.Syntax.Common.Access instance Control.DeepSeq.NFData Agda.Syntax.Common.AllowedErasedMatches instance Control.DeepSeq.NFData Agda.Syntax.Common.AllowedErasedMatchesIndexed instance Control.DeepSeq.NFData Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance Control.DeepSeq.NFData Agda.Syntax.Common.Annotation instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Common.Arg e) instance Control.DeepSeq.NFData Agda.Syntax.Common.ArgInfo instance Control.DeepSeq.NFData Agda.Syntax.Common.BinderNameOrigin instance Control.DeepSeq.NFData Agda.Syntax.Common.BoundVariablePosition instance Control.DeepSeq.NFData Agda.Syntax.Common.Catchall instance Control.DeepSeq.NFData Agda.Syntax.Common.Cohesion instance Control.DeepSeq.NFData Agda.Syntax.Common.ConOrigin instance Control.DeepSeq.NFData Agda.Syntax.Common.ConstructorOrPatternSynonym instance Control.DeepSeq.NFData Agda.Syntax.Common.CoverageCheck instance Control.DeepSeq.NFData Agda.Syntax.Common.Cubical instance Control.DeepSeq.NFData Agda.Syntax.Common.Erased instance Control.DeepSeq.NFData Agda.Syntax.Common.ExpandedEllipsis instance Control.DeepSeq.NFData Agda.Syntax.Common.FileType instance Control.DeepSeq.NFData Agda.Syntax.Common.Fixity instance Control.DeepSeq.NFData Agda.Syntax.Common.Fixity' instance Control.DeepSeq.NFData Agda.Syntax.Common.FixityLevel instance Control.DeepSeq.NFData Agda.Syntax.Common.ForceRecordEta instance Control.DeepSeq.NFData Agda.Syntax.Common.FreeVariables instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.HasEta' a) instance Control.DeepSeq.NFData Agda.Syntax.Common.Hiding instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.ImportDirective' a b) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.ImportedName' a b) instance Control.DeepSeq.NFData Agda.Syntax.Common.InteractionId instance Control.DeepSeq.NFData Agda.Syntax.Common.IsAbstract instance Control.DeepSeq.NFData Agda.Syntax.Common.IsHIT instance Control.DeepSeq.NFData Agda.Syntax.Common.IsInstance instance Control.DeepSeq.NFData Agda.Syntax.Common.IsMacro instance Control.DeepSeq.NFData Agda.Syntax.Common.IsOpaque instance Control.DeepSeq.NFData Agda.Syntax.Common.Language instance Control.DeepSeq.NFData Agda.Syntax.Common.Lock instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.MaybePlaceholder a) instance Control.DeepSeq.NFData Agda.Syntax.Common.MetaId instance Control.DeepSeq.NFData Agda.Syntax.Common.Modality instance Control.DeepSeq.NFData Agda.Syntax.Common.NameId instance (Control.DeepSeq.NFData name, Control.DeepSeq.NFData a) => Control.DeepSeq.NFData (Agda.Syntax.Common.Named name a) instance Control.DeepSeq.NFData Agda.Syntax.Common.NotationPart instance Control.DeepSeq.NFData Agda.Syntax.Common.OpaqueId instance Control.DeepSeq.NFData Agda.Syntax.Common.Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.OriginIrrelevant instance Control.DeepSeq.NFData Agda.Syntax.Common.OriginRelevant instance Control.DeepSeq.NFData Agda.Syntax.Common.OriginShapeIrrelevant instance Control.DeepSeq.NFData Agda.Syntax.Common.OverlapMode instance Control.DeepSeq.NFData Agda.Syntax.Common.Overlappable instance Control.DeepSeq.NFData Agda.Syntax.Common.PatternOrCopattern instance Control.DeepSeq.NFData Agda.Syntax.Common.PolarityModality instance Control.DeepSeq.NFData Agda.Syntax.Common.PositivityCheck instance Control.DeepSeq.NFData Agda.Syntax.Common.ProblemId instance Control.DeepSeq.NFData Agda.Syntax.Common.ProjOrigin instance Control.DeepSeq.NFData Agda.Syntax.Common.Q0Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.Q1Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.Quantity instance Control.DeepSeq.NFData Agda.Syntax.Common.QωOrigin instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.Ranged a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.RecordDirectives' a) instance Control.DeepSeq.NFData Agda.Syntax.Common.Relevance instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.Renaming' a b) instance Control.DeepSeq.NFData Agda.Syntax.Common.RewriteAnn instance (Control.DeepSeq.NFData qn, Control.DeepSeq.NFData nm, Control.DeepSeq.NFData p, Control.DeepSeq.NFData e) => Control.DeepSeq.NFData (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.TerminationCheck a) instance Control.DeepSeq.NFData Agda.Syntax.Common.UniverseCheck instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.Using' a b) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.WithHiding a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.WithOrigin a) instance Agda.Utils.Null.Null Agda.Syntax.Common.Annotation instance Agda.Utils.Null.Null Agda.Syntax.Common.ArgInfo instance Agda.Utils.Null.Null Agda.Syntax.Common.Catchall instance Agda.Utils.Null.Null Agda.Syntax.Common.Cohesion instance Agda.Utils.Null.Null Agda.Syntax.Common.ExpandedEllipsis instance Agda.Utils.Null.Null Agda.Syntax.Common.Fixity instance Agda.Utils.Null.Null Agda.Syntax.Common.Fixity' instance Agda.Utils.Null.Null Agda.Syntax.Common.FixityLevel instance Agda.Utils.Null.Null Agda.Syntax.Common.ForceRecordEta instance Agda.Utils.Null.Null Agda.Syntax.Common.Hiding instance Agda.Utils.Null.Null (Agda.Syntax.Common.ImportDirective' n m) instance Agda.Utils.Null.Null Agda.Syntax.Common.IsInstance instance Agda.Utils.Null.Null Agda.Syntax.Common.Lock instance Agda.Utils.Null.Null Agda.Syntax.Common.Modality instance Agda.Utils.Null.Null Agda.Syntax.Common.NameId instance Agda.Utils.Null.Null Agda.Syntax.Common.OriginIrrelevant instance Agda.Utils.Null.Null Agda.Syntax.Common.OriginRelevant instance Agda.Utils.Null.Null Agda.Syntax.Common.OriginShapeIrrelevant instance Agda.Utils.Null.Null Agda.Syntax.Common.PolarityModality instance Agda.Utils.Null.Null Agda.Syntax.Common.PositivityCheck instance Agda.Utils.Null.Null Agda.Syntax.Common.Q0Origin instance Agda.Utils.Null.Null Agda.Syntax.Common.Q1Origin instance Agda.Utils.Null.Null Agda.Syntax.Common.Quantity instance Agda.Utils.Null.Null Agda.Syntax.Common.QωOrigin instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (Agda.Syntax.Common.RecordDirectives' a) instance Agda.Utils.Null.Null Agda.Syntax.Common.Relevance instance Agda.Utils.Null.Null Agda.Syntax.Common.RewriteAnn instance Agda.Utils.Null.Null Agda.Syntax.Common.UniverseCheck instance Agda.Utils.Null.Null (Agda.Syntax.Common.Using' n m) instance GHC.Internal.Num.Num Agda.Syntax.Common.InteractionId instance GHC.Internal.Num.Num Agda.Syntax.Common.ProblemId instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Access instance GHC.Internal.Classes.Ord Agda.Syntax.Common.AllowedErasedMatches instance GHC.Internal.Classes.Ord Agda.Syntax.Common.AllowedErasedMatchesIndexed instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Annotation instance GHC.Internal.Classes.Ord e => GHC.Internal.Classes.Ord (Agda.Syntax.Common.Arg e) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.ArgInfo instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Associativity instance GHC.Internal.Classes.Ord Agda.Syntax.Common.BoundVariablePosition instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Cohesion instance GHC.Internal.Classes.Ord Agda.Syntax.Common.ConOrigin instance GHC.Internal.Classes.Ord Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Erased instance GHC.Internal.Classes.Ord Agda.Syntax.Common.FileType instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Fixity instance GHC.Internal.Classes.Ord Agda.Syntax.Common.FixityLevel instance GHC.Internal.Classes.Ord Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Classes.Ord Agda.Syntax.Common.FreeVariables instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Common.HasEta' a) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Hiding instance (GHC.Internal.Classes.Ord m, GHC.Internal.Classes.Ord n) => GHC.Internal.Classes.Ord (Agda.Syntax.Common.ImportedName' n m) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.InteractionId instance GHC.Internal.Classes.Ord Agda.Syntax.Common.IsAbstract instance GHC.Internal.Classes.Ord Agda.Syntax.Common.IsHIT instance GHC.Internal.Classes.Ord Agda.Syntax.Common.IsInfix instance GHC.Internal.Classes.Ord Agda.Syntax.Common.IsInstance instance GHC.Internal.Classes.Ord Agda.Syntax.Common.IsMacro instance GHC.Internal.Classes.Ord Agda.Syntax.Common.IsOpaque instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Lock instance GHC.Internal.Classes.Ord Agda.Syntax.Common.LockOrigin instance GHC.Internal.Classes.Ord e => GHC.Internal.Classes.Ord (Agda.Syntax.Common.MaybePlaceholder e) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.MetaId instance GHC.Internal.Classes.Ord Agda.Syntax.Common.ModalPolarity instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Modality instance GHC.Internal.Classes.Ord Agda.Syntax.Common.NameId instance (GHC.Internal.Classes.Ord name, GHC.Internal.Classes.Ord a) => GHC.Internal.Classes.Ord (Agda.Syntax.Common.Named name a) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.NotationPart instance GHC.Internal.Classes.Ord Agda.Syntax.Common.OpaqueId instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Origin instance GHC.Internal.Classes.Ord Agda.Syntax.Common.OverlapMode instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Overlappable instance GHC.Internal.Classes.Ord Agda.Syntax.Common.PatternOrCopattern instance GHC.Internal.Classes.Ord Agda.Syntax.Common.PolarityModality instance GHC.Internal.Classes.Ord Agda.Syntax.Common.PositionInName instance GHC.Internal.Classes.Ord Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Classes.Ord Agda.Syntax.Common.ProblemId instance GHC.Internal.Classes.Ord Agda.Syntax.Common.ProjOrigin instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Q0Origin instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Q1Origin instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Quantity instance GHC.Internal.Classes.Ord Agda.Syntax.Common.QωOrigin instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Common.Ranged a) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.Relevance instance GHC.Internal.Classes.Ord Agda.Syntax.Common.RewriteAnn instance GHC.Internal.Classes.Ord t => GHC.Internal.Classes.Ord (Agda.Syntax.Common.UnderAddition t) instance GHC.Internal.Classes.Ord t => GHC.Internal.Classes.Ord (Agda.Syntax.Common.UnderComposition t) instance GHC.Internal.Classes.Ord Agda.Syntax.Common.UniverseCheck instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Common.WithHiding a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Common.WithOrigin a) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.PolarityModality) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.PolarityModality) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.PolarityModality) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.PolarityModality) instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Cohesion instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.ModalPolarity instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Modality instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.PolarityModality instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Quantity instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Relevance instance Agda.Utils.PartialOrd.PartialOrd t => Agda.Utils.PartialOrd.PartialOrd (Agda.Syntax.Common.UnderAddition t) instance Agda.Utils.PartialOrd.PartialOrd t => Agda.Utils.PartialOrd.PartialOrd (Agda.Syntax.Common.UnderComposition t) instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.DataOrRecord instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.HasEta instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.Aspect.Induction instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Access instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Associativity instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Cohesion instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.ConstructorOrPatternSynonym instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Erased instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.FileType instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Fixity instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Fixity' instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.FixityLevel instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Hiding instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.ImportDirective' a b) instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.ImportedName' a b) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Aspect.Induction instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.InteractionId instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Lock instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.MetaId instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.ModalPolarity instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Modality instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.NameId instance Agda.Syntax.Common.Pretty.Pretty e => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.Named_ e) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.NotationPart instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.OpaqueId instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.OriginIrrelevant instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.OriginRelevant instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.OriginShapeIrrelevant instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.OverlapMode instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.PolarityModality instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.ProblemId instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Quantity instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.Relevance instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.Renaming' a b) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Common.RewriteAnn instance (Agda.Syntax.Common.Pretty.Pretty nm, Agda.Syntax.Common.Pretty.Pretty p, Agda.Syntax.Common.Pretty.Pretty e) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.Using' a b) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.WithOrigin a) instance GHC.Internal.Real.Real Agda.Syntax.Common.InteractionId instance GHC.Internal.Real.Real Agda.Syntax.Common.ProblemId instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.AllowedErasedMatches instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.AllowedErasedMatchesIndexed instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Catchall instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.ExpandedEllipsis instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.FreeVariables instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Hiding instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.ImportDirective' n m) instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.IsAbstract instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.IsMain instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.JointOpacity instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.OriginIrrelevant instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.OriginRelevant instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.OriginShapeIrrelevant instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Overlappable instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Q0Origin instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Q1Origin instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.QωOrigin instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.PolarityModality) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Erased) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.PolarityModality) instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.UniverseCheck instance GHC.Internal.Base.Semigroup (Agda.Syntax.Common.Using' n m) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Cohesion instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.NotationPart instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.OriginIrrelevant instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.OriginRelevant instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.OriginShapeIrrelevant instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.PolarityModality instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Relevance instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.RewriteAnn instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.WithOrigin a) instance GHC.Internal.Show.Show Agda.Syntax.Common.Access instance GHC.Internal.Show.Show Agda.Syntax.Common.AllowedErasedMatches instance GHC.Internal.Show.Show Agda.Syntax.Common.AllowedErasedMatchesIndexed instance GHC.Internal.Show.Show Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance GHC.Internal.Show.Show Agda.Syntax.Common.Annotation instance GHC.Internal.Show.Show e => GHC.Internal.Show.Show (Agda.Syntax.Common.Arg e) instance GHC.Internal.Show.Show Agda.Syntax.Common.ArgInfo instance GHC.Internal.Show.Show Agda.Syntax.Common.Associativity instance GHC.Internal.Show.Show Agda.Syntax.Common.BinderNameOrigin instance GHC.Internal.Show.Show Agda.Syntax.Common.BoundVariablePosition instance GHC.Internal.Show.Show Agda.Syntax.Common.Catchall instance GHC.Internal.Show.Show Agda.Syntax.Common.Cohesion instance GHC.Internal.Show.Show Agda.Syntax.Common.ConOrigin instance GHC.Internal.Show.Show Agda.Syntax.Common.ConstructorOrPatternSynonym instance GHC.Internal.Show.Show Agda.Syntax.Common.CoverageCheck instance GHC.Internal.Show.Show Agda.Syntax.Common.Cubical instance GHC.Internal.Show.Show p => GHC.Internal.Show.Show (Agda.Syntax.Common.DataOrRecord' p) instance GHC.Internal.Show.Show Agda.Syntax.Common.DisplayLHS instance GHC.Internal.Show.Show Agda.Syntax.Common.Erased instance GHC.Internal.Show.Show Agda.Syntax.Common.ExpandedEllipsis instance GHC.Internal.Show.Show Agda.Syntax.Common.ExprKind instance GHC.Internal.Show.Show Agda.Syntax.Common.FileType instance GHC.Internal.Show.Show Agda.Syntax.Common.Fixity instance GHC.Internal.Show.Show Agda.Syntax.Common.Fixity' instance GHC.Internal.Show.Show Agda.Syntax.Common.FixityLevel instance GHC.Internal.Show.Show Agda.Syntax.Common.ForceRecordEta instance GHC.Internal.Show.Show Agda.Syntax.Common.FreeVariables instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Common.HasEta' a) instance GHC.Internal.Show.Show Agda.Syntax.Common.Hiding instance (GHC.Internal.Show.Show m, GHC.Internal.Show.Show n) => GHC.Internal.Show.Show (Agda.Syntax.Common.ImportDirective' n m) instance (GHC.Internal.Show.Show m, GHC.Internal.Show.Show n) => GHC.Internal.Show.Show (Agda.Syntax.Common.ImportedName' n m) instance GHC.Internal.Show.Show Agda.Syntax.Common.InteractionId instance GHC.Internal.Show.Show Agda.Syntax.Common.IsAbstract instance GHC.Internal.Show.Show Agda.Syntax.Common.IsHIT instance GHC.Internal.Show.Show Agda.Syntax.Common.IsInfix instance GHC.Internal.Show.Show Agda.Syntax.Common.IsInstance instance GHC.Internal.Show.Show Agda.Syntax.Common.IsMacro instance GHC.Internal.Show.Show Agda.Syntax.Common.IsMain instance GHC.Internal.Show.Show Agda.Syntax.Common.IsOpaque instance GHC.Internal.Show.Show Agda.Syntax.Common.Language instance GHC.Internal.Show.Show Agda.Syntax.Common.Lock instance GHC.Internal.Show.Show Agda.Syntax.Common.LockOrigin instance GHC.Internal.Show.Show e => GHC.Internal.Show.Show (Agda.Syntax.Common.MaybePlaceholder e) instance GHC.Internal.Show.Show Agda.Syntax.Common.MetaId instance GHC.Internal.Show.Show Agda.Syntax.Common.ModalPolarity instance GHC.Internal.Show.Show Agda.Syntax.Common.Modality instance GHC.Internal.Show.Show Agda.Syntax.Common.NameId instance (GHC.Internal.Show.Show name, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Agda.Syntax.Common.Named name a) instance GHC.Internal.Show.Show Agda.Syntax.Common.NotationPart instance GHC.Internal.Show.Show Agda.Syntax.Common.OpaqueId instance GHC.Internal.Show.Show Agda.Syntax.Common.Origin instance GHC.Internal.Show.Show Agda.Syntax.Common.OriginIrrelevant instance GHC.Internal.Show.Show Agda.Syntax.Common.OriginRelevant instance GHC.Internal.Show.Show Agda.Syntax.Common.OriginShapeIrrelevant instance GHC.Internal.Show.Show Agda.Syntax.Common.OverlapMode instance GHC.Internal.Show.Show Agda.Syntax.Common.Overlappable instance GHC.Internal.Show.Show Agda.Syntax.Common.PatternOrCopattern instance GHC.Internal.Show.Show Agda.Syntax.Common.PolarityModality instance GHC.Internal.Show.Show Agda.Syntax.Common.PositionInName instance GHC.Internal.Show.Show Agda.Syntax.Common.PositivityCheck instance GHC.Internal.Show.Show Agda.Syntax.Common.ProblemId instance GHC.Internal.Show.Show Agda.Syntax.Common.ProjOrigin instance GHC.Internal.Show.Show Agda.Syntax.Common.Q0Origin instance GHC.Internal.Show.Show Agda.Syntax.Common.Q1Origin instance GHC.Internal.Show.Show Agda.Syntax.Common.Quantity instance GHC.Internal.Show.Show Agda.Syntax.Common.QωOrigin instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Common.Ranged a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Common.RecordDirectives' a) instance GHC.Internal.Show.Show Agda.Syntax.Common.Relevance instance (GHC.Internal.Show.Show m, GHC.Internal.Show.Show n) => GHC.Internal.Show.Show (Agda.Syntax.Common.Renaming' n m) instance GHC.Internal.Show.Show Agda.Syntax.Common.RewriteAnn instance (GHC.Internal.Show.Show qn, GHC.Internal.Show.Show nm, GHC.Internal.Show.Show p, GHC.Internal.Show.Show e) => GHC.Internal.Show.Show (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance GHC.Internal.Show.Show m => GHC.Internal.Show.Show (Agda.Syntax.Common.TerminationCheck m) instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Common.UnderAddition t) instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Common.UnderComposition t) instance GHC.Internal.Show.Show Agda.Syntax.Common.UniverseCheck instance (GHC.Internal.Show.Show m, GHC.Internal.Show.Show n) => GHC.Internal.Show.Show (Agda.Syntax.Common.Using' n m) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Common.WithHiding a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Common.WithOrigin a) instance Agda.Utils.SmallSet.SmallSetElement Agda.Syntax.Common.Origin instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.Arg instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.HasEta' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.MaybePlaceholder instance GHC.Internal.Data.Traversable.Traversable (Agda.Syntax.Common.Named name) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.Ranged instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.RecordDirectives' instance GHC.Internal.Data.Traversable.Traversable (Agda.Syntax.Common.RewriteEqn' qn nm p) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.WithHiding instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Common.WithOrigin instance Agda.Syntax.Common.Underscore Data.ByteString.Internal.Type.ByteString instance Agda.Syntax.Common.Underscore Agda.Syntax.Common.Pretty.Doc instance Agda.Syntax.Common.Underscore GHC.Internal.Base.String -- | Preprocessors for literate code formats. module Agda.Syntax.Parser.Literate -- | List of valid extensions for literate Agda files, and their -- corresponding preprocessors. -- -- If you add new extensions, remember to update test/Utils.hs so that -- test cases ending in the new extensions are found. -- -- The Bool parameter controls whether only ```agda -- blocks are treated as Agda code in Markdown/Typst files. When -- True, only blocks marked ```agda are considered -- code. When False, both ``` and ```agda -- blocks are code (default). literateProcessors :: Bool -> [(String, (Processor, FileType))] -- | List of valid literate file extensions. literateExts :: [String] -- | Preprocessor for literate TeX. literateTeX :: Processor -- | Preprocessor for reStructuredText. literateRsT :: Processor -- | Preprocessor for Markdown. -- -- The Bool parameter controls whether only ```agda -- blocks are treated as Agda code. When True, only blocks -- explicitly marked ```agda are considered code. When -- False, both unmarked ``` and ```agda blocks -- are code (default). literateMd :: Bool -> Processor -- | Preprocessor for Org mode documents. literateOrg :: Processor -- | Blanks the non-code parts of a given file, preserving positions of -- characters corresponding to code. This way, there is a direct -- correspondence between source positions and positions in the processed -- result. illiterate :: [Layer] -> String atomizeLayers :: Layers -> [(LayerRole, Char)] -- | Type of a literate preprocessor: Invariants: -- --
--   f : Processor
--   
-- -- proposition> f pos s /= [] -- -- proposition> f pos s >>= layerContent == s type Processor = PositionWithoutFile -> String -> [Layer] -- | A list of contiguous layers. type Layers = [Layer] -- | A sequence of characters in a file playing the same role. data Layer Layer :: LayerRole -> IntervalWithoutFile -> String -> Layer [layerRole] :: Layer -> LayerRole [interval] :: Layer -> IntervalWithoutFile [layerContent] :: Layer -> String -- | Role of a character in the file. data LayerRole Markup :: LayerRole Comment :: LayerRole Code :: LayerRole -- | Returns True if the role corresponds to Agda code. isCode :: LayerRole -> Bool -- | Returns True if the layer contains Agda code. isCodeLayer :: Layer -> Bool instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Literate.LayerRole instance Agda.Syntax.Position.HasRangeWithoutFile Agda.Syntax.Parser.Literate.Layer instance GHC.Internal.Show.Show Agda.Syntax.Parser.Literate.Layer instance GHC.Internal.Show.Show Agda.Syntax.Parser.Literate.LayerRole -- | Definitions for fixity, precedence levels, and declared syntax. module Agda.Syntax.Fixity -- | Decorating something with Fixity'. data ThingWithFixity x ThingWithFixity :: x -> Fixity' -> ThingWithFixity x -- | Do we prefer parens around arguments like λ x → x or not? See -- lamBrackets. data ParenPreference PreferParen :: ParenPreference PreferParenless :: ParenPreference preferParen :: ParenPreference -> Bool preferParenless :: ParenPreference -> Bool -- | Precedence is associated with a context. data Precedence TopCtx :: Precedence FunctionSpaceDomainCtx :: Precedence LeftOperandCtx :: Fixity -> Precedence RightOperandCtx :: Fixity -> ParenPreference -> Precedence FunctionCtx :: Precedence ArgumentCtx :: ParenPreference -> Precedence InsideOperandCtx :: Precedence WithFunCtx :: Precedence WithArgCtx :: Precedence DotPatternCtx :: Precedence -- | When printing we keep track of a stack of precedences in order to be -- able to decide whether it's safe to leave out parens around lambdas. -- An empty stack is equivalent to TopCtx. Invariant: `notElem -- TopCtx`. type PrecedenceStack = [Precedence] pushPrecedence :: Precedence -> PrecedenceStack -> PrecedenceStack headPrecedence :: PrecedenceStack -> Precedence -- | Argument context preferring parens. argumentCtx_ :: Precedence -- | Do we need to bracket an operator application of the given fixity in a -- context with the given precedence. opBrackets :: Fixity -> PrecedenceStack -> Bool -- | Do we need to bracket an operator application of the given fixity in a -- context with the given precedence. opBrackets' :: Bool -> Fixity -> PrecedenceStack -> Bool -- | Does a lambda-like thing (lambda, let or pi) need brackets in the -- given context? A peculiar thing with lambdas is that they don't need -- brackets in certain right operand contexts. To decide we need to look -- at the stack of precedences and not just the current precedence. -- Example: m₁ >>= (λ x → x) >>= m₂ (for -- _>>=_ left associative). lamBrackets :: PrecedenceStack -> Bool -- | Does a function application need brackets? appBrackets :: PrecedenceStack -> Bool -- | Does a function application need brackets? appBrackets' :: Bool -> PrecedenceStack -> Bool -- | Does a with application need brackets? withAppBrackets :: PrecedenceStack -> Bool -- | Does a function space need brackets? piBrackets :: PrecedenceStack -> Bool roundFixBrackets :: PrecedenceStack -> Bool instance GHC.Internal.Classes.Eq Agda.Syntax.Fixity.ParenPreference instance GHC.Internal.Classes.Eq Agda.Syntax.Fixity.Precedence instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Fixity.ThingWithFixity instance GHC.Internal.Base.Functor Agda.Syntax.Fixity.ThingWithFixity instance GHC.Internal.Generics.Generic Agda.Syntax.Fixity.ParenPreference instance GHC.Internal.Generics.Generic Agda.Syntax.Fixity.Precedence instance Agda.Syntax.Position.KillRange x => Agda.Syntax.Position.KillRange (Agda.Syntax.Fixity.ThingWithFixity x) instance Agda.Syntax.Common.LensFixity' (Agda.Syntax.Fixity.ThingWithFixity a) instance Agda.Syntax.Common.LensFixity (Agda.Syntax.Fixity.ThingWithFixity a) instance Control.DeepSeq.NFData Agda.Syntax.Fixity.ParenPreference instance Control.DeepSeq.NFData Agda.Syntax.Fixity.Precedence instance GHC.Internal.Classes.Ord Agda.Syntax.Fixity.ParenPreference instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Fixity.Precedence instance GHC.Internal.Show.Show Agda.Syntax.Fixity.ParenPreference instance GHC.Internal.Show.Show Agda.Syntax.Fixity.Precedence instance GHC.Internal.Show.Show x => GHC.Internal.Show.Show (Agda.Syntax.Fixity.ThingWithFixity x) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Fixity.ThingWithFixity -- | The parser monad used by the operator parser module Agda.Syntax.Concrete.Operators.Parser.Monad -- | Memoisation keys. data MemoKey NodeK :: PrecedenceKey -> MemoKey PostLeftsK :: PrecedenceKey -> MemoKey PreRightsK :: PrecedenceKey -> MemoKey TopK :: MemoKey AppK :: MemoKey NonfixK :: MemoKey data PrecedenceKey -- | The parser monad. type Parser tok a = ParserWithGrammar MemoKey tok MaybePlaceholder tok a -- | Runs the parser. parse :: Parser tok a -> [MaybePlaceholder tok] -> [a] -- | Parses a token satisfying the given predicate. The computed value is -- returned. sat' :: (MaybePlaceholder tok -> Maybe a) -> Parser tok a -- | Parses a token satisfying the given predicate. sat :: (MaybePlaceholder tok -> Bool) -> Parser tok (MaybePlaceholder tok) -- | Uses the given document as the printed representation of the given -- parser. The document's precedence is taken to be atomP. doc :: Doc -> Parser tok a -> Parser tok a -- | Memoises the given parser. -- -- Every memoised parser must be annotated with a unique key. -- (Parametrised parsers must use distinct keys for distinct inputs.) memoise :: MemoKey -> Parser tok tok -> Parser tok tok -- | Memoises the given parser, but only if printing, not if parsing. -- -- Every memoised parser must be annotated with a unique key. -- (Parametrised parsers must use distinct keys for distinct inputs.) memoiseIfPrinting :: MemoKey -> Parser tok tok -> Parser tok tok -- | Tries to print the parser, or returns empty, depending on the -- implementation. This function might not terminate. grammar :: Parser tok a -> Doc pattern LeftPK :: PrecedenceLevel -> PrecedenceKey pattern RightPK :: PrecedenceLevel -> PrecedenceKey instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Operators.Parser.Monad.PrecedenceKey instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance Data.Hashable.Class.Hashable Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance Data.Hashable.Class.Hashable Agda.Syntax.Concrete.Operators.Parser.Monad.PrecedenceKey instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Operators.Parser.Monad.PrecedenceKey -- | Names in the concrete syntax are just strings (or lists of strings for -- qualified names). module Agda.Syntax.Concrete.Name -- | A name is a non-empty list of alternating Ids and Holes. -- A normal name is represented by a singleton list, and operators are -- represented by a list with Holes where the arguments should go. -- For instance: [Hole,Id "+",Hole] is infix addition. -- -- Equality and ordering on Names are defined to ignore range so -- same names in different locations are equal. data Name -- | A (mixfix) identifier. Name :: Range -> NameInScope -> NameParts -> Name [nameRange] :: Name -> Range [nameInScope] :: Name -> NameInScope [nameNameParts] :: Name -> NameParts -- | _. NoName :: Range -> NameId -> Name [nameRange] :: Name -> Range [nameId] :: Name -> NameId type NameParts = List1 NamePart -- | An open mixfix identifier is either prefix, infix, or suffix. That is -- to say: at least one of its extremities is a Hole isPrePostOrInfixOperator :: Name -> Bool -- | Mixfix identifiers are composed of words and holes, e.g. _+_ -- or if_then_else_ or [_/_]. data NamePart -- | _ part. Hole :: NamePart -- | Identifier part. Id :: RawName -> NamePart -- | QName is a list of namespaces and the name of the constant. -- For the moment assumes namespaces are just Names and not -- explicitly applied modules. Also assumes namespaces are generative by -- just using derived equality. We will have to define an equality -- instance to non-generative namespaces (as well as having some sort of -- lookup table for namespace names). data QName -- | A.rest. Qual :: Name -> QName -> QName -- | x. QName :: Name -> QName -- | Create an ordinary InScope name. simpleName :: RawName -> Name -- | Create a binary operator name in scope. simpleBinaryOperator :: RawName -> Name -- | Create an ordinary InScope name containing a single -- Hole. simpleHole :: Name -- | Check whether a name is a simple identifier without holes. isSimpleName :: Name -> Maybe RawName -- | Don't use on 'NoName{}'. lensNameParts :: Lens' Name NameParts nameToRawName :: Name -> RawName nameParts :: Name -> NameParts nameStringParts :: Name -> [RawName] -- | Parse a string to parts of a concrete name. -- -- Note: stringNameParts "_" == [Id "_"] == nameParts NoName{} stringNameParts :: String -> NameParts -- | Number of holes in a Name (i.e., arity of a mixfix-operator). class NumHoles a numHoles :: NumHoles a => a -> Int -- | Is the name an operator? Needs at least 2 NameParts. isOperator :: Name -> Bool isHole :: NamePart -> Bool isPrefix :: Name -> Bool isPostfix :: Name -> Bool isInfix :: Name -> Bool isNonfix :: Name -> Bool data NameInScope InScope :: NameInScope NotInScope :: NameInScope class LensInScope a lensInScope :: LensInScope a => Lens' a NameInScope isInScope :: LensInScope a => a -> NameInScope mapInScope :: LensInScope a => (NameInScope -> NameInScope) -> a -> a setInScope :: LensInScope a => a -> a setNotInScope :: LensInScope a => a -> a -- | Method by which to generate fresh unshadowed names. data FreshNameMode -- | Append an integer Unicode subscript: x, x₁, x₂, … UnicodeSubscript :: FreshNameMode -- | Append an integer ASCII counter: x, x1, x2, … AsciiCounter :: FreshNameMode nextRawName :: FreshNameMode -> RawName -> RawName -- | Get the next version of the concrete name. For instance, nextName -- "x" = "x₁". The name must not be a NoName. nextName :: FreshNameMode -> Name -> Name -- | Zoom on the last non-hole in a name. lastIdPart :: Lens' NameParts RawName -- | Get the first version of the concrete name that does not satisfy the -- given predicate. firstNonTakenName :: FreshNameMode -> (Name -> Bool) -> Name -> Name -- | Lens for accessing and modifying the suffix of a name. The suffix of a -- NoName is always Nothing, and should not be changed. nameSuffix :: Lens' Name (Maybe Suffix) -- | Split a name into a base name plus a suffix. nameSuffixView :: Name -> (Maybe Suffix, Name) -- | Replaces the suffix of a name. Unless the suffix is Nothing, -- the name should not be NoName. setNameSuffix :: Maybe Suffix -> Name -> Name -- | Get a raw version of the name with all suffixes removed. For instance, -- nameRoot "x₁₂₃" = "x". nameRoot :: Name -> RawName sameRoot :: Name -> Name -> Bool -- | Lens for the unqualified part of a QName lensQNameName :: Lens' QName Name -- |
--   qualify A.B x == A.B.x
--   
qualify :: QName -> Name -> QName -- |
--   unqualify A.B.x == x
--   
-- -- The range is preserved. unqualify :: QName -> Name -- |
--   qnameParts A.B.x = [A, B, x]
--   
qnameParts :: QName -> List1 Name -- | Is the name (un)qualified? isQualified :: QName -> Bool isUnqualified :: QName -> Maybe Name -- |
--   noName_ = noName noRange
--   
noName_ :: Name noName :: Range -> Name -- | Check whether a name is the empty name "_". class IsNoName a isNoName :: IsNoName a => a -> Bool ($dmisNoName) :: forall (t :: Type -> Type) b. (IsNoName a, Foldable t, IsNoName b, t b ~ a) => a -> Bool instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Name.Name instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Name.NameInScope instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Name.NamePart instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Name.QName instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Name.NamePart instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Name.IsNoName Data.ByteString.Internal.Type.ByteString instance Agda.Syntax.Concrete.Name.IsNoName GHC.Internal.Base.String instance Agda.Syntax.Concrete.Name.IsNoName Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Name.IsNoName Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Name.IsNoName a => Agda.Syntax.Concrete.Name.IsNoName (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Concrete.Name.IsNoName a => Agda.Syntax.Concrete.Name.IsNoName (Agda.Syntax.Common.WithOrigin a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Concrete.Name.NameInScope instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Concrete.Name.QName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.Name instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.NameInScope instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.NamePart instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.QName instance Agda.Utils.Null.Null Agda.Syntax.Concrete.Name.Name instance Agda.Utils.Null.Null Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.NameParts instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.QName instance GHC.Internal.Classes.Ord Agda.Syntax.Concrete.Name.Name instance GHC.Internal.Classes.Ord Agda.Syntax.Concrete.Name.NamePart instance GHC.Internal.Classes.Ord Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Name.NamePart instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Name.QName instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Name.Name instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Name.NameInScope instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Name.NamePart instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Common.Underscore Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Common.Underscore Agda.Syntax.Concrete.Name.QName -- | Provide names for the errors Agda throws.Options/Er module Agda.Interaction.Options.Errors -- | Extra information for error CannotQuoteTerm. data CannotQuoteTerm CannotQuoteTermHidden :: CannotQuoteTerm CannotQuoteTermNothing :: CannotQuoteTerm -- | What kind of declaration? -- -- See also DataRecOrFun. data DataRecOrFun_ -- | Name of a data type. DataName_ :: DataRecOrFun_ -- | Name of a record type. RecName_ :: DataRecOrFun_ -- | Name of a function. FunName_ :: DataRecOrFun_ -- | The reason for an ErasedDatatype error. data ErasedDatatypeReason -- | There are several constructors. SeveralConstructors :: ErasedDatatypeReason -- | Erased matches are disabled for empty types. ErasedMatchesDisabledEmpty :: ErasedDatatypeReason -- | Erased matches are disabled for non-indexed, single-constructor types. ErasedMatchesDisabledNonDependent :: ErasedDatatypeReason -- | Erased matches are disabled for indexed, single-constructor types. ErasedMatchesDisabledDependent :: ErasedDatatypeReason -- | Things not allowed in dot patterns. data NotAllowedInDotPatterns LetExpressions :: NotAllowedInDotPatterns PatternLambdas :: NotAllowedInDotPatterns -- | Reasons for error NotAValidLetBinding. data NotAValidLetBinding MissingRHS :: NotAValidLetBinding NotAValidLetPattern :: NotAValidLetBinding WhereClausesNotAllowed :: NotAValidLetBinding CopatternsNotAllowed :: NotAValidLetBinding -- | Reasons for error NotAValidLetExpression. data NotAValidLetExpression MissingBody :: NotAValidLetExpression -- | Symbolic name of an Agda error. data ErrorName ExecError_ :: ExecError_ -> ErrorName GHCBackendError_ :: GHCBackendError_ -> ErrorName ImpossibleConstructor_ :: NegativeUnification_ -> ErrorName InteractionError_ :: InteractionError_ -> ErrorName JSBackendError_ :: JSBackendError_ -> ErrorName NicifierError_ :: DeclarationException_ -> ErrorName SplitError_ :: SplitError_ -> ErrorName UnquoteError_ :: UnquoteError_ -> ErrorName CompilationError_ :: ErrorName CustomBackendError_ :: ErrorName InternalError_ :: ErrorName LibraryError_ :: ErrorName NonFatalErrors_ :: ErrorName NotImplemented_ :: ErrorName NotSupported_ :: ErrorName OptionError_ :: ErrorName SyntaxError_ :: ErrorName UserError_ :: ErrorName AbsentRHSRequiresAbsurdPattern_ :: ErrorName AbstractConstructorNotInScope_ :: ErrorName AmbiguousConstructor_ :: ErrorName AmbiguousField_ :: ErrorName AmbiguousModule_ :: ErrorName AmbiguousName_ :: ErrorName AmbiguousOverloadedProjection_ :: ErrorName AmbiguousParseForApplication_ :: ErrorName AmbiguousParseForLHS_ :: ErrorName AmbiguousProjection_ :: ErrorName AmbiguousTopLevelModuleName_ :: ErrorName AsPatternInPatternSynonym_ :: ErrorName AttributeKindNotEnabled_ :: ErrorName BackendDoesNotSupportOnlyScopeChecking_ :: ErrorName BadArgumentsToPatternSynonym_ :: ErrorName BothWithAndRHS_ :: ErrorName BuiltinInParameterisedModule_ :: ErrorName BuiltinMustBeConstructor_ :: ErrorName BuiltinMustBeData_ :: ErrorName BuiltinMustBeDef_ :: ErrorName BuiltinMustBeFunction_ :: ErrorName BuiltinMustBePostulate_ :: ErrorName CannotApply_ :: ErrorName CannotEliminateWithPattern_ :: ErrorName CannotEliminateWithProjection_ :: ErrorName CannotGeneralizeEtaExpandable_ :: ErrorName CannotGenerateHCompClause_ :: ErrorName CannotGenerateTransportClause_ :: ErrorName CannotGenerateTransportLocalRewrite_ :: ErrorName CannotQuote_ :: CannotQuote_ -> ErrorName CannotQuoteTerm_ :: CannotQuoteTerm -> ErrorName CannotResolveAmbiguousPatternSynonym_ :: ErrorName CannotRewriteByNonEquation_ :: ErrorName CannotSolveSizeConstraints_ :: ErrorName CantResolveOverloadedConstructorsTargetingSameDatatype_ :: ErrorName ClashingDefinition_ :: ErrorName ClashingModule_ :: ErrorName ComatchingDisabledForRecord_ :: ErrorName ConstructorDoesNotTargetGivenType_ :: ErrorName ConstructorPatternInWrongDatatype_ :: ErrorName ContradictorySizeConstraint_ :: ErrorName CopatternHeadNotProjection_ :: ErrorName CubicalCompilationNotSupported_ :: ErrorName CubicalNotErasure_ :: ErrorName CubicalPrimitiveNotFullyApplied_ :: ErrorName CyclicModuleDependency_ :: ErrorName DatatypeIndexPolarity_ :: ErrorName DeBruijnIndexOutOfScope_ :: ErrorName DeclarationsAfterTopLevelModule_ :: ErrorName DefinitionInDifferentModule_ :: ErrorName DefinitionIsErased_ :: ErrorName DefinitionIsIrrelevant_ :: ErrorName DoNotationError_ :: ErrorName DoesNotMentionTicks_ :: ErrorName DotPatternInPatternSynonym_ :: ErrorName DuplicateBuiltinBinding_ :: ErrorName DuplicateConstructors_ :: ErrorName DuplicateFields_ :: ErrorName DuplicateImports_ :: ErrorName DuplicateOverlapPragma_ :: ErrorName DuplicatePrimitiveBinding_ :: ErrorName EmptyTypeOfSizes_ :: ErrorName EtaPragmaVsNoEtaEquality_ :: ErrorName ExpectedBindingForParameter_ :: ErrorName ExpectedIntervalLiteral_ :: ErrorName FieldOutsideRecord_ :: ErrorName FaceConstraintDisjunction_ :: ErrorName FaceConstraintUnsatisfiable_ :: ErrorName FileNotFound_ :: ErrorName ForcedConstructorNotInstantiated_ :: ErrorName FunctionTypeInSizeUniv_ :: ErrorName GeneralizationFailed_ :: ErrorName GeneralizationPrepruneErrorRefinedContext_ :: ErrorName GeneralizationPrepruneErrorCyclicDependencies_ :: ErrorName GeneralizationPrepruneErrorFailedToInstantiate_ :: ErrorName GeneralizeCyclicDependency_ :: ErrorName GeneralizeNotSupportedHere_ :: ErrorName GeneralizedVarInLetOpenedModule_ :: ErrorName ModuleNameHashCollision_ :: ErrorName HidingMismatch_ :: ErrorName IdiomBracketError_ :: ErrorName InvalidBuiltin_ :: ErrorName InvalidDottedExpression_ :: ErrorName IllTypedPatternAfterWithAbstraction_ :: ErrorName IlltypedRewriteRule_ :: ErrorName IllegalDeclarationBeforeTopLevelModule_ :: ErrorName IllegalHidingInPostfixProjection_ :: ErrorName IllegalInstanceVariableInPatternSynonym_ :: ErrorName IllegalLetInTelescope_ :: ErrorName IllegalPatternInTelescope_ :: ErrorName IllformedProjectionPatternAbstract_ :: ErrorName IllformedProjectionPatternConcrete_ :: ErrorName IncorrectTypeForRewriteRelation_ :: ErrorName InstanceNoCandidate_ :: ErrorName InstanceSearchDepthExhausted_ :: ErrorName InvalidFileName_ :: ErrorName InvalidModalTelescopeUse_ :: ErrorName InvalidPattern_ :: ErrorName InvalidProjectionParameter_ :: ErrorName InvalidPun_ :: ConstructorOrPatternSynonym -> ErrorName InvalidTypeSort_ :: ErrorName LambdaIsErased_ :: ErrorName LibTooFarDown_ :: ErrorName LiteralTooBig_ :: ErrorName MacroResultTypeMismatch_ :: ErrorName MetaCannotDependOn_ :: ErrorName MetaErasedSolution_ :: ErrorName MetaIrrelevantSolution_ :: ErrorName MismatchedProjectionsError_ :: ErrorName MissingBindingsForTelescopeVariables_ :: ErrorName MissingTypeSignature_ :: DataRecOrFun_ -> ErrorName ModuleArityMismatch_ :: ErrorName ModuleDefinedInOtherFile_ :: ErrorName ModuleNameDoesntMatchFileName_ :: ErrorName ModuleNameUnexpected_ :: ErrorName MultipleFixityDecls_ :: ErrorName MultiplePolarityPragmas_ :: ErrorName ExplicitPolarityVsPragma_ :: ErrorName ConstructorNameOfNonRecord_ :: ErrorName NamedWhereModuleInRefinedContext_ :: ErrorName NamedWhereModuleUnderWith_ :: ErrorName NeedOptionAllowExec_ :: ErrorName NeedOptionCopatterns_ :: ErrorName NeedOptionCubical_ :: ErrorName NeedOptionPatternMatching_ :: ErrorName NeedOptionIrrelevance_ :: ErrorName NeedOptionProp_ :: ErrorName NeedOptionRewriting_ :: ErrorName NeedOptionSizedTypes_ :: ErrorName NeedOptionTwoLevel_ :: ErrorName NeedOptionUniversePolymorphism_ :: ErrorName NegativeLiteralInPattern_ :: ErrorName NoBindingForBuiltin_ :: ErrorName NoBindingForPrimitive_ :: ErrorName NoKnownRecordWithSuchFields_ :: ErrorName NoParameterOfName_ :: ErrorName NoParseForApplication_ :: ErrorName NoParseForLHS_ :: ErrorName NoSuchBuiltinName_ :: ErrorName NoSuchModule_ :: ErrorName NoSuchPrimitiveFunction_ :: ErrorName NotAValidLetBinding_ :: Maybe NotAValidLetBinding -> ErrorName NotAValidLetExpression_ :: NotAValidLetExpression -> ErrorName NotAllowedInDotPatterns_ :: NotAllowedInDotPatterns -> ErrorName NotAnExpression_ :: ErrorName NotInScope_ :: ErrorName NotLeqSort_ :: ErrorName NotValidBeforeField_ :: ErrorName OverlappingProjects_ :: ErrorName PathAbstractionFailed_ :: ErrorName PatternInPathLambda_ :: ErrorName PatternInSystem_ :: ErrorName PatternSynonymArgumentShadows_ :: ConstructorOrPatternSynonym -> ErrorName PostulatedSizeInModule_ :: ErrorName PrivateRecordField_ :: ErrorName ProjectionIsIrrelevant_ :: ErrorName QualifiedLocalModule_ :: ErrorName QuantityMismatch_ :: ErrorName RecordIsErased_ :: ErrorName ReferencesFutureVariables_ :: ErrorName RelevanceMismatch_ :: ErrorName RepeatedNamesInImportDirective_ :: ErrorName RepeatedVariablesInPattern_ :: ErrorName ShadowedModule_ :: ErrorName ShouldBeASort_ :: ErrorName ShouldBeEmpty_ :: ErrorName ShouldBePath_ :: ErrorName ShouldBePi_ :: ErrorName ShouldBeRecordPattern_ :: ErrorName ShouldBeRecordType_ :: ErrorName ShouldEndInApplicationOfTheDatatype_ :: ErrorName SolvedButOpenHoles_ :: ErrorName SortCannotDependOnItsIndex_ :: ErrorName SortDoesNotAdmitDataDefinitions_ :: ErrorName SortOfSplitVarError_ :: ErrorName SplitInProp_ :: ErrorName SplitOnAbstract_ :: ErrorName SplitOnCoinductive_ :: ErrorName SplitOnIrrelevant_ :: ErrorName SplitOnNonEtaRecord_ :: ErrorName SplitOnNonVariable_ :: ErrorName SplitOnPartial_ :: ErrorName SplitOnUnchecked_ :: ErrorName SplitOnUnusableCohesion_ :: ErrorName SplitOnUnusablePolarity_ :: ErrorName TacticAttributeNotAllowed_ :: ErrorName TooFewArgumentsToPatternSynonym_ :: ErrorName TooFewPatternsInWithClause_ :: ErrorName TooManyFields_ :: ErrorName TooManyPatternsInWithClause_ :: ErrorName TriedToCopyConstrainedPrim_ :: ErrorName TrustedBuiltin_ :: ErrorName TrustedPrimitive_ :: ErrorName InvalidInstanceHeadType_ :: ErrorName UnboundVariablesInPatternSynonym_ :: ErrorName UnequalTerms_ :: ErrorName UnequalTypes_ :: ErrorName UnexpectedModalityAnnotationInParameter_ :: ErrorName UnexpectedParameter_ :: ErrorName UnexpectedTypeSignatureForParameter_ :: ErrorName UnexpectedWithPatterns_ :: ErrorName UnguardedEtaRecord_ :: ErrorName UnknownBackend_ :: ErrorName UnusableAtModality_ :: ErrorName UnusedVariableInPatternSynonym_ :: ErrorName VariableIsErased_ :: ErrorName VariableIsIrrelevant_ :: ErrorName VariableIsOfUnusableCohesion_ :: ErrorName VariableIsOfUnusablePolarity_ :: ErrorName WithClausePatternMismatch_ :: ErrorName WithOnFreeVariable_ :: ErrorName WrongAnnotationInLambda_ :: ErrorName WrongArgInfoForPrimitive_ :: ErrorName WrongCohesionInLambda_ :: ErrorName WrongPolarityInLambda_ :: ErrorName WrongHidingInApplication_ :: ErrorName WrongHidingInLHS_ :: ErrorName WrongHidingInLambda_ :: ErrorName WrongHidingInProjection_ :: ErrorName WrongIrrelevanceInLambda_ :: ErrorName WrongNamedArgument_ :: ErrorName WrongNumberOfConstructorArguments_ :: ErrorName WrongQuantityInLambda_ :: ErrorName WrongSharpArity_ :: ErrorName -- | Nicifier errors. data DeclarationException_ AmbiguousConstructorN_ :: DeclarationException_ AmbiguousFunClauses_ :: DeclarationException_ BadMacroDef_ :: DeclarationException_ DisallowedInterleavedMutual_ :: DeclarationException_ DuplicateAnonDeclaration_ :: DeclarationException_ DuplicateDefinition_ :: DeclarationException_ InvalidMeasureMutual_ :: DeclarationException_ MissingWithClauses_ :: DeclarationException_ MultipleEllipses_ :: DeclarationException_ OpaqueInMutual_ :: DeclarationException_ UnfoldingOutsideOpaque_ :: DeclarationException_ UnquoteDefRequiresSignature_ :: DeclarationException_ WrongContentBlock_ :: DeclarationException_ WrongDefinition_ :: DeclarationException_ data GHCBackendError_ ConstructorCountMismatch_ :: GHCBackendError_ NotAHaskellType_ :: NotAHaskellType_ -> GHCBackendError_ WrongTypeOfMain_ :: GHCBackendError_ data JSBackendError_ BadCompilePragma_ :: JSBackendError_ data InteractionError_ CannotGive_ :: InteractionError_ CannotRefine_ :: InteractionError_ CaseSplitError_ :: InteractionError_ ExpectedIdentifier_ :: InteractionError_ ExpectedApplication_ :: InteractionError_ NoActionForInteractionPoint_ :: InteractionError_ NoSuchInteractionPoint_ :: InteractionError_ UnexpectedWhere_ :: InteractionError_ data NegativeUnification_ UnifyConflict_ :: NegativeUnification_ UnifyCycle_ :: NegativeUnification_ data NotAHaskellType_ BadDontCare_ :: NotAHaskellType_ BadLambda_ :: NotAHaskellType_ BadMeta_ :: NotAHaskellType_ NoPragmaFor_ :: NotAHaskellType_ NotCompiled_ :: NotAHaskellType_ WrongPragmaFor_ :: NotAHaskellType_ data SplitError_ ErasedDatatype_ :: ErasedDatatypeReason -> SplitError_ GenericSplitError_ :: SplitError_ BlockedType_ :: SplitError_ CannotCreateMissingClause_ :: SplitError_ CoinductiveDatatype_ :: SplitError_ CosplitNoRecordType_ :: SplitError_ CosplitNoTarget_ :: SplitError_ NotADatatype_ :: SplitError_ UnificationStuck_ :: SplitError_ data CannotQuote_ CannotQuoteAmbiguous_ :: CannotQuote_ CannotQuoteExpression_ :: CannotQuote_ CannotQuoteHidden_ :: CannotQuote_ CannotQuoteNothing_ :: CannotQuote_ CannotQuotePattern_ :: CannotQuote_ data ExecError_ ExeNotTrusted_ :: ExecError_ ExeNotFound_ :: ExecError_ ExeNotExecutable_ :: ExecError_ data UnquoteError_ BlockedOnMeta_ :: UnquoteError_ CannotDeclareHiddenFunction_ :: UnquoteError_ CommitAfterDef_ :: UnquoteError_ ConInsteadOfDef_ :: UnquoteError_ DefineDataNotData_ :: UnquoteError_ DefInsteadOfCon_ :: UnquoteError_ EscapingVariable_ :: UnquoteError_ MissingDeclaration_ :: UnquoteError_ MissingDefinition_ :: UnquoteError_ NakedUnquote_ :: UnquoteError_ NonCanonical_ :: UnquoteError_ PatLamWithoutClauses_ :: UnquoteError_ StaleMeta_ :: UnquoteError_ TooManyParameters_ :: UnquoteError_ UnboundName_ :: UnquoteError_ defaultErrorNameString :: Show a => a -> String erasedDatatypeReasonString :: ErasedDatatypeReason -> String errorNameString :: ErrorName -> String constructorOrPatternSynonymNameString :: ConstructorOrPatternSynonym -> String dataRecOrFunString :: DataRecOrFun_ -> String declarationExceptionNameString :: DeclarationException_ -> String ghcBackendErrorNameString :: GHCBackendError_ -> String jsBackendErrorNameString :: JSBackendError_ -> String interactionErrorNameString :: InteractionError_ -> String negativeUnificationErrorNameString :: NegativeUnification_ -> String notAHaskellTypeErrorNameString :: NotAHaskellType_ -> String notAValidLetBindingString :: NotAValidLetBinding -> String notAValidLetExpressionString :: NotAValidLetExpression -> String notAllowedInDotPatternsString :: NotAllowedInDotPatterns -> String splitErrorNameString :: SplitError_ -> String cannotQuoteNameString :: CannotQuote_ -> String cannotQuoteTermNameString :: CannotQuoteTerm -> String execErrorNameString :: ExecError_ -> String unquoteErrorNameString :: UnquoteError_ -> String -- | Print list of errors. helpErrors :: String verbalizeNotAValidLetBinding :: NotAValidLetBinding -> String verbalizeNotAValidLetExpression :: NotAValidLetExpression -> String instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.CannotQuoteTerm instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.CannotQuote_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.DataRecOrFun_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.DeclarationException_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.ErasedDatatypeReason instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.ErrorName instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.ExecError_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.GHCBackendError_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.InteractionError_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.JSBackendError_ instance GHC.Internal.Enum.Bounded a => GHC.Internal.Enum.Bounded (GHC.Internal.Maybe.Maybe a) instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.NegativeUnification_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.NotAHaskellType_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.NotAValidLetBinding instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.NotAValidLetExpression instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.NotAllowedInDotPatterns instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.SplitError_ instance GHC.Internal.Enum.Bounded Agda.Interaction.Options.Errors.UnquoteError_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.CannotQuoteTerm instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.CannotQuote_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.DataRecOrFun_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.DeclarationException_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.ErasedDatatypeReason instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.ErrorName instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.ExecError_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.GHCBackendError_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.InteractionError_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.JSBackendError_ instance (GHC.Internal.Enum.Bounded a, GHC.Internal.Enum.Enum a) => GHC.Internal.Enum.Enum (GHC.Internal.Maybe.Maybe a) instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.NegativeUnification_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.NotAHaskellType_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.NotAValidLetBinding instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.NotAValidLetExpression instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.NotAllowedInDotPatterns instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.SplitError_ instance GHC.Internal.Enum.Enum Agda.Interaction.Options.Errors.UnquoteError_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.CannotQuoteTerm instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.CannotQuote_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.DataRecOrFun_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.DeclarationException_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.ErasedDatatypeReason instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.ErrorName instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.ExecError_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.GHCBackendError_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.InteractionError_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.JSBackendError_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.NegativeUnification_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.NotAHaskellType_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.NotAValidLetBinding instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.NotAValidLetExpression instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.NotAllowedInDotPatterns instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.SplitError_ instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Errors.UnquoteError_ instance Control.DeepSeq.NFData Agda.Interaction.Options.Errors.CannotQuoteTerm instance Control.DeepSeq.NFData Agda.Interaction.Options.Errors.ErasedDatatypeReason instance Control.DeepSeq.NFData Agda.Interaction.Options.Errors.NotAValidLetBinding instance Control.DeepSeq.NFData Agda.Interaction.Options.Errors.NotAValidLetExpression instance Control.DeepSeq.NFData Agda.Interaction.Options.Errors.NotAllowedInDotPatterns instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.CannotQuoteTerm instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.CannotQuote_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.DataRecOrFun_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.DeclarationException_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.ErasedDatatypeReason instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.ErrorName instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.ExecError_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.GHCBackendError_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.InteractionError_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.JSBackendError_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.NegativeUnification_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.NotAHaskellType_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.NotAValidLetBinding instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.NotAValidLetExpression instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.NotAllowedInDotPatterns instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.SplitError_ instance GHC.Internal.Show.Show Agda.Interaction.Options.Errors.UnquoteError_ module Agda.Compiler.JS.Syntax data Exp Self :: Exp Local :: LocalId -> Exp Global :: GlobalId -> Exp Undefined :: Exp Null :: Exp String :: Text -> Exp Char :: Char -> Exp Integer :: Integer -> Exp Double :: Double -> Exp Lambda :: Nat -> Exp -> Exp Object :: Map MemberId Exp -> Exp Array :: [Exp] -> Exp MemberIdInString :: MemberId -> Exp Ternary :: Exp -> Exp -> Exp -> Exp Apply :: Exp -> [Exp] -> Exp Lookup :: Exp -> MemberId -> Exp If :: Exp -> Exp -> Exp -> Exp BinOp :: Exp -> String -> Exp -> Exp PreOp :: String -> Exp -> Exp -- | Arbitrary JS code. PlainJS :: String -> Exp newtype LocalId LocalId :: Nat -> LocalId newtype GlobalId GlobalId :: [String] -> GlobalId data MemberId MemberId :: String -> MemberId MemberIndex :: Int -> MemberId data Export Export :: JSQName -> Exp -> Export [expName] :: Export -> JSQName [defn] :: Export -> Exp type JSQName = List1 MemberId data Module Module :: GlobalId -> [GlobalId] -> [Export] -> Maybe Exp -> Module [modName] :: Module -> GlobalId [imports] :: Module -> [GlobalId] [exports] :: Module -> [Export] [callMain] :: Module -> Maybe Exp class Uses a uses :: Uses a => a -> Set JSQName ($dmuses) :: forall (t :: Type -> Type) b. (Uses a, a ~ t b, Foldable t, Uses b) => a -> Set JSQName class Globals a globals :: Globals a => a -> Set GlobalId ($dmglobals) :: forall (t :: Type -> Type) b. (Globals a, a ~ t b, Foldable t, Globals b) => a -> Set GlobalId instance GHC.Internal.Classes.Eq Agda.Compiler.JS.Syntax.Exp instance GHC.Internal.Classes.Eq Agda.Compiler.JS.Syntax.GlobalId instance GHC.Internal.Classes.Eq Agda.Compiler.JS.Syntax.LocalId instance GHC.Internal.Classes.Eq Agda.Compiler.JS.Syntax.MemberId instance Agda.Compiler.JS.Syntax.Globals Agda.Compiler.JS.Syntax.Exp instance Agda.Compiler.JS.Syntax.Globals Agda.Compiler.JS.Syntax.Export instance Agda.Compiler.JS.Syntax.Globals a => Agda.Compiler.JS.Syntax.Globals [a] instance Agda.Compiler.JS.Syntax.Globals a => Agda.Compiler.JS.Syntax.Globals (Data.Map.Internal.Map k a) instance Agda.Compiler.JS.Syntax.Globals a => Agda.Compiler.JS.Syntax.Globals (GHC.Internal.Maybe.Maybe a) instance Agda.Compiler.JS.Syntax.Globals Agda.Compiler.JS.Syntax.Module instance (Agda.Compiler.JS.Syntax.Globals a, Agda.Compiler.JS.Syntax.Globals b) => Agda.Compiler.JS.Syntax.Globals (a, b) instance (Agda.Compiler.JS.Syntax.Globals a, Agda.Compiler.JS.Syntax.Globals b, Agda.Compiler.JS.Syntax.Globals c) => Agda.Compiler.JS.Syntax.Globals (a, b, c) instance GHC.Internal.Classes.Ord Agda.Compiler.JS.Syntax.GlobalId instance GHC.Internal.Classes.Ord Agda.Compiler.JS.Syntax.LocalId instance GHC.Internal.Classes.Ord Agda.Compiler.JS.Syntax.MemberId instance GHC.Internal.Show.Show Agda.Compiler.JS.Syntax.Exp instance GHC.Internal.Show.Show Agda.Compiler.JS.Syntax.Export instance GHC.Internal.Show.Show Agda.Compiler.JS.Syntax.GlobalId instance GHC.Internal.Show.Show Agda.Compiler.JS.Syntax.LocalId instance GHC.Internal.Show.Show Agda.Compiler.JS.Syntax.MemberId instance GHC.Internal.Show.Show Agda.Compiler.JS.Syntax.Module instance Agda.Compiler.JS.Syntax.Uses Agda.Compiler.JS.Syntax.Exp instance Agda.Compiler.JS.Syntax.Uses Agda.Compiler.JS.Syntax.Export instance Agda.Compiler.JS.Syntax.Uses a => Agda.Compiler.JS.Syntax.Uses [a] instance Agda.Compiler.JS.Syntax.Uses a => Agda.Compiler.JS.Syntax.Uses (Data.Map.Internal.Map k a) instance (Agda.Compiler.JS.Syntax.Uses a, Agda.Compiler.JS.Syntax.Uses b) => Agda.Compiler.JS.Syntax.Uses (a, b) instance (Agda.Compiler.JS.Syntax.Uses a, Agda.Compiler.JS.Syntax.Uses b, Agda.Compiler.JS.Syntax.Uses c) => Agda.Compiler.JS.Syntax.Uses (a, b, c) module Agda.Compiler.JS.Substitution map :: Nat -> (Nat -> LocalId -> Exp) -> Exp -> Exp shift :: Nat -> Exp -> Exp shiftFrom :: Nat -> Nat -> Exp -> Exp shifter :: Nat -> Nat -> LocalId -> Exp subst :: Nat -> [Exp] -> Exp -> Exp substituter :: Nat -> [Exp] -> Nat -> LocalId -> Exp substShift :: Nat -> Nat -> [Exp] -> Exp -> Exp map' :: Nat -> (Nat -> LocalId -> Exp) -> Exp -> Exp subst' :: Nat -> [Exp] -> Exp -> Exp apply :: Exp -> [Exp] -> Exp lookup :: Exp -> MemberId -> Exp self :: Exp -> Exp -> Exp fix :: Exp -> Exp curriedApply :: Exp -> [Exp] -> Exp curriedApply' :: Exp -> [Exp] -> Exp curriedLambda :: Nat -> Exp -> Exp emp :: Exp module Agda.Compiler.JS.Pretty data JSModuleStyle JSES6 :: JSModuleStyle JSCJS :: JSModuleStyle JSAMD :: JSModuleStyle data Doc Doc :: String -> Doc Indent :: Int -> Doc -> Doc Group :: Doc -> Doc Beside :: Doc -> Doc -> Doc Above :: Doc -> Doc -> Doc Enclose :: Doc -> Doc -> Doc -> Doc Space :: Doc Empty :: Doc minifiedCodeLinesLength :: Int render :: Bool -> Doc -> String ($+$) :: Doc -> Doc -> Doc infixr 5 $+$ -- | Separate by blank line. ($++$) :: Doc -> Doc -> Doc infixr 5 $++$ -- | Separate by space that will be removed by minify. -- -- For non-removable space, use d <> " " <> d'. (<+>) :: Doc -> Doc -> Doc infixr 6 <+> text :: String -> Doc group :: Doc -> Doc indentBy :: Int -> Doc -> Doc enclose :: Doc -> Doc -> Doc -> Doc space :: Doc indent :: Doc -> Doc hcat :: [Doc] -> Doc vcat :: [Doc] -> Doc -- | Concatenate vertically, separated by blank lines. vsep :: [Doc] -> Doc punctuate :: Doc -> [Doc] -> Doc parens :: Doc -> Doc brackets :: Doc -> Doc braces :: Doc -> Doc -- | Apply parens to Doc if boolean is true. mparens :: Bool -> Doc -> Doc unescape :: Char -> String unescapes :: String -> Doc class Pretty a pretty :: Pretty a => (Nat, Bool, JSModuleStyle) -> a -> Doc prettyPrec :: Pretty a => Int -> (Nat, Bool, JSModuleStyle) -> a -> Doc prettyShow :: Pretty a => Bool -> JSModuleStyle -> a -> String class Pretties a pretties :: Pretties a => (Nat, Bool, JSModuleStyle) -> a -> [Doc] block :: (Nat, Bool, JSModuleStyle) -> Exp -> Doc modname :: GlobalId -> Doc exports :: (Nat, Bool, JSModuleStyle) -> Set JSQName -> [Export] -> Doc variableName :: String -> String -- | Check if a string is a valid JS identifier. The check ignores keywords -- as we prepend z_ to our identifiers. The check is conservative and may -- not admit all valid JS identifiers. isValidJSIdent :: String -> Bool instance GHC.Internal.Generics.Generic Agda.Compiler.JS.Pretty.JSModuleStyle instance GHC.Internal.Data.String.IsString Agda.Compiler.JS.Pretty.Doc instance GHC.Internal.Base.Monoid Agda.Compiler.JS.Pretty.Doc instance Agda.Compiler.JS.Pretty.Pretty a => Agda.Compiler.JS.Pretty.Pretties [a] instance (Agda.Compiler.JS.Pretty.Pretty a, Agda.Compiler.JS.Pretty.Pretty b) => Agda.Compiler.JS.Pretty.Pretties (Data.Map.Internal.Map a b) instance Agda.Compiler.JS.Pretty.Pretty a => Agda.Compiler.JS.Pretty.Pretties (Agda.Utils.List1.List1 a) instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.Exp instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.GlobalId instance Agda.Compiler.JS.Pretty.Pretty [(Agda.Compiler.JS.Syntax.GlobalId, Agda.Compiler.JS.Syntax.Export)] instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.LocalId instance Agda.Compiler.JS.Pretty.Pretty a => Agda.Compiler.JS.Pretty.Pretty (GHC.Internal.Maybe.Maybe a) instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.MemberId instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.Module instance (Agda.Compiler.JS.Pretty.Pretty a, Agda.Compiler.JS.Pretty.Pretty b) => Agda.Compiler.JS.Pretty.Pretty (a, b) instance GHC.Internal.Base.Semigroup Agda.Compiler.JS.Pretty.Doc -- | This module defines the names of all builtin and primitives used in -- Agda. -- -- See Agda.TypeChecking.Monad.Builtin module Agda.Syntax.Builtin -- | Either a BuiltinId or PrimitiveId, used for some -- lookups. data SomeBuiltin BuiltinName :: BuiltinId -> SomeBuiltin PrimitiveName :: PrimitiveId -> SomeBuiltin -- | The class of types which can be converted to SomeBuiltin. class IsBuiltin a -- | Convert this value to a builtin. someBuiltin :: IsBuiltin a => a -> SomeBuiltin -- | Get the identifier for this builtin, generally used for error -- messages. getBuiltinId :: IsBuiltin a => a -> String -- | A builtin name, defined by the BUILTIN pragma. data BuiltinId BuiltinNat :: BuiltinId BuiltinSuc :: BuiltinId BuiltinZero :: BuiltinId BuiltinNatPlus :: BuiltinId BuiltinNatMinus :: BuiltinId BuiltinNatTimes :: BuiltinId BuiltinNatDivSucAux :: BuiltinId BuiltinNatModSucAux :: BuiltinId BuiltinNatEquals :: BuiltinId BuiltinNatLess :: BuiltinId BuiltinWord64 :: BuiltinId BuiltinInteger :: BuiltinId BuiltinIntegerPos :: BuiltinId BuiltinIntegerNegSuc :: BuiltinId BuiltinFloat :: BuiltinId BuiltinChar :: BuiltinId BuiltinString :: BuiltinId BuiltinUnit :: BuiltinId BuiltinUnitUnit :: BuiltinId BuiltinSigma :: BuiltinId BuiltinSigmaCon :: BuiltinId BuiltinBool :: BuiltinId BuiltinTrue :: BuiltinId BuiltinFalse :: BuiltinId BuiltinList :: BuiltinId BuiltinNil :: BuiltinId BuiltinCons :: BuiltinId BuiltinMaybe :: BuiltinId BuiltinNothing :: BuiltinId BuiltinJust :: BuiltinId BuiltinIO :: BuiltinId BuiltinPath :: BuiltinId BuiltinPathP :: BuiltinId BuiltinIntervalUniv :: BuiltinId BuiltinInterval :: BuiltinId BuiltinIZero :: BuiltinId BuiltinIOne :: BuiltinId BuiltinPartial :: BuiltinId BuiltinPartialP :: BuiltinId BuiltinIsOne :: BuiltinId BuiltinItIsOne :: BuiltinId BuiltinEquiv :: BuiltinId BuiltinEquivFun :: BuiltinId BuiltinEquivProof :: BuiltinId BuiltinTranspProof :: BuiltinId BuiltinIsOne1 :: BuiltinId BuiltinIsOne2 :: BuiltinId BuiltinIsOneEmpty :: BuiltinId BuiltinSub :: BuiltinId BuiltinSubIn :: BuiltinId BuiltinSizeUniv :: BuiltinId BuiltinSize :: BuiltinId BuiltinSizeLt :: BuiltinId BuiltinSizeSuc :: BuiltinId BuiltinSizeInf :: BuiltinId BuiltinSizeMax :: BuiltinId BuiltinInf :: BuiltinId BuiltinSharp :: BuiltinId BuiltinFlat :: BuiltinId BuiltinEquality :: BuiltinId BuiltinRefl :: BuiltinId BuiltinRewrite :: BuiltinId BuiltinLevelMax :: BuiltinId BuiltinLevel :: BuiltinId BuiltinLevelZero :: BuiltinId BuiltinLevelSuc :: BuiltinId BuiltinProp :: BuiltinId BuiltinSet :: BuiltinId BuiltinStrictSet :: BuiltinId BuiltinPropOmega :: BuiltinId BuiltinSetOmega :: BuiltinId BuiltinSSetOmega :: BuiltinId BuiltinLevelUniv :: BuiltinId BuiltinFromNat :: BuiltinId BuiltinFromNeg :: BuiltinId BuiltinFromString :: BuiltinId BuiltinQuotientConstructor :: BuiltinId BuiltinQName :: BuiltinId BuiltinAgdaSort :: BuiltinId BuiltinAgdaSortSet :: BuiltinId BuiltinAgdaSortLit :: BuiltinId BuiltinAgdaSortProp :: BuiltinId BuiltinAgdaSortPropLit :: BuiltinId BuiltinAgdaSortInf :: BuiltinId BuiltinAgdaSortUnsupported :: BuiltinId BuiltinHiding :: BuiltinId BuiltinHidden :: BuiltinId BuiltinInstance :: BuiltinId BuiltinVisible :: BuiltinId BuiltinRelevance :: BuiltinId BuiltinRelevant :: BuiltinId BuiltinIrrelevant :: BuiltinId BuiltinQuantity :: BuiltinId BuiltinQuantity0 :: BuiltinId BuiltinQuantityω :: BuiltinId BuiltinModality :: BuiltinId BuiltinModalityConstructor :: BuiltinId BuiltinAssoc :: BuiltinId BuiltinAssocLeft :: BuiltinId BuiltinAssocRight :: BuiltinId BuiltinAssocNon :: BuiltinId BuiltinPrecedence :: BuiltinId BuiltinPrecRelated :: BuiltinId BuiltinPrecUnrelated :: BuiltinId BuiltinFixity :: BuiltinId BuiltinFixityFixity :: BuiltinId BuiltinArg :: BuiltinId BuiltinArgInfo :: BuiltinId BuiltinArgArgInfo :: BuiltinId BuiltinArgArg :: BuiltinId BuiltinAbs :: BuiltinId BuiltinAbsAbs :: BuiltinId BuiltinAgdaTerm :: BuiltinId BuiltinAgdaTermVar :: BuiltinId BuiltinAgdaTermLam :: BuiltinId BuiltinAgdaTermExtLam :: BuiltinId BuiltinAgdaTermDef :: BuiltinId BuiltinAgdaTermCon :: BuiltinId BuiltinAgdaTermPi :: BuiltinId BuiltinAgdaTermSort :: BuiltinId BuiltinAgdaTermLit :: BuiltinId BuiltinAgdaTermUnsupported :: BuiltinId BuiltinAgdaTermMeta :: BuiltinId BuiltinAgdaErrorPart :: BuiltinId BuiltinAgdaErrorPartString :: BuiltinId BuiltinAgdaErrorPartTerm :: BuiltinId BuiltinAgdaErrorPartPatt :: BuiltinId BuiltinAgdaErrorPartName :: BuiltinId BuiltinAgdaLiteral :: BuiltinId BuiltinAgdaLitNat :: BuiltinId BuiltinAgdaLitWord64 :: BuiltinId BuiltinAgdaLitFloat :: BuiltinId BuiltinAgdaLitChar :: BuiltinId BuiltinAgdaLitString :: BuiltinId BuiltinAgdaLitQName :: BuiltinId BuiltinAgdaLitMeta :: BuiltinId BuiltinAgdaClause :: BuiltinId BuiltinAgdaClauseClause :: BuiltinId BuiltinAgdaClauseAbsurd :: BuiltinId BuiltinAgdaPattern :: BuiltinId BuiltinAgdaPatVar :: BuiltinId BuiltinAgdaPatCon :: BuiltinId BuiltinAgdaPatDot :: BuiltinId BuiltinAgdaPatLit :: BuiltinId BuiltinAgdaPatProj :: BuiltinId BuiltinAgdaPatAbsurd :: BuiltinId BuiltinAgdaDefinitionFunDef :: BuiltinId BuiltinAgdaDefinitionDataDef :: BuiltinId BuiltinAgdaDefinitionRecordDef :: BuiltinId BuiltinAgdaDefinitionDataConstructor :: BuiltinId BuiltinAgdaDefinitionPostulate :: BuiltinId BuiltinAgdaDefinitionPrimitive :: BuiltinId BuiltinAgdaDefinition :: BuiltinId BuiltinAgdaMeta :: BuiltinId BuiltinAgdaTCM :: BuiltinId BuiltinAgdaTCMReturn :: BuiltinId BuiltinAgdaTCMBind :: BuiltinId BuiltinAgdaTCMUnify :: BuiltinId BuiltinAgdaTCMTypeError :: BuiltinId BuiltinAgdaTCMInferType :: BuiltinId BuiltinAgdaTCMCheckType :: BuiltinId BuiltinAgdaTCMNormalise :: BuiltinId BuiltinAgdaTCMReduce :: BuiltinId BuiltinAgdaTCMCatchError :: BuiltinId BuiltinAgdaTCMGetContext :: BuiltinId BuiltinAgdaTCMExtendContext :: BuiltinId BuiltinAgdaTCMInContext :: BuiltinId BuiltinAgdaTCMFreshName :: BuiltinId BuiltinAgdaTCMDeclareDef :: BuiltinId BuiltinAgdaTCMDeclarePostulate :: BuiltinId BuiltinAgdaTCMDeclareData :: BuiltinId BuiltinAgdaTCMDefineData :: BuiltinId BuiltinAgdaTCMDefineFun :: BuiltinId BuiltinAgdaTCMGetType :: BuiltinId BuiltinAgdaTCMGetDefinition :: BuiltinId BuiltinAgdaTCMBlock :: BuiltinId BuiltinAgdaTCMCommit :: BuiltinId BuiltinAgdaTCMQuoteTerm :: BuiltinId BuiltinAgdaTCMUnquoteTerm :: BuiltinId BuiltinAgdaTCMQuoteOmegaTerm :: BuiltinId BuiltinAgdaTCMIsMacro :: BuiltinId BuiltinAgdaTCMWithNormalisation :: BuiltinId BuiltinAgdaTCMWithReconstructed :: BuiltinId BuiltinAgdaTCMWithExpandLast :: BuiltinId BuiltinAgdaTCMWithReduceDefs :: BuiltinId BuiltinAgdaTCMAskNormalisation :: BuiltinId BuiltinAgdaTCMAskReconstructed :: BuiltinId BuiltinAgdaTCMAskExpandLast :: BuiltinId BuiltinAgdaTCMAskReduceDefs :: BuiltinId BuiltinAgdaTCMFormatErrorParts :: BuiltinId BuiltinAgdaTCMDebugPrint :: BuiltinId BuiltinAgdaTCMNoConstraints :: BuiltinId BuiltinAgdaTCMWorkOnTypes :: BuiltinId BuiltinAgdaTCMRunSpeculative :: BuiltinId BuiltinAgdaTCMExec :: BuiltinId BuiltinAgdaTCMCheckFromString :: BuiltinId BuiltinAgdaTCMGetInstances :: BuiltinId BuiltinAgdaTCMSolveInstances :: BuiltinId BuiltinAgdaTCMPragmaForeign :: BuiltinId BuiltinAgdaTCMPragmaCompile :: BuiltinId BuiltinAgdaBlocker :: BuiltinId BuiltinAgdaBlockerAny :: BuiltinId BuiltinAgdaBlockerAll :: BuiltinId BuiltinAgdaBlockerMeta :: BuiltinId -- | Builtins that come without a definition in Agda syntax. These are -- giving names to Agda internal concepts which cannot be assigned an -- Agda type. -- -- An example would be a user-defined name for Set. -- -- {-# BUILTIN TYPE Type #-} -- -- The type of Type would be Type : Level → Setω which -- is not valid Agda. isBuiltinNoDef :: BuiltinId -> Bool builtinsNoDef :: [BuiltinId] sizeBuiltins :: [BuiltinId] builtinNat :: BuiltinId builtinSuc :: BuiltinId builtinZero :: BuiltinId builtinNatPlus :: BuiltinId builtinNatMinus :: BuiltinId builtinNatTimes :: BuiltinId builtinNatDivSucAux :: BuiltinId builtinNatModSucAux :: BuiltinId builtinNatEquals :: BuiltinId builtinNatLess :: BuiltinId builtinWord64 :: BuiltinId builtinInteger :: BuiltinId builtinIntegerPos :: BuiltinId builtinIntegerNegSuc :: BuiltinId builtinFloat :: BuiltinId builtinChar :: BuiltinId builtinString :: BuiltinId builtinUnit :: BuiltinId builtinUnitUnit :: BuiltinId builtinSigma :: BuiltinId builtinBool :: BuiltinId builtinTrue :: BuiltinId builtinFalse :: BuiltinId builtinList :: BuiltinId builtinNil :: BuiltinId builtinCons :: BuiltinId builtinMaybe :: BuiltinId builtinNothing :: BuiltinId builtinJust :: BuiltinId builtinIO :: BuiltinId builtinPath :: BuiltinId builtinPathP :: BuiltinId builtinIntervalUniv :: BuiltinId builtinInterval :: BuiltinId builtinIZero :: BuiltinId builtinIOne :: BuiltinId builtinPartial :: BuiltinId builtinPartialP :: BuiltinId builtinIsOne :: BuiltinId builtinItIsOne :: BuiltinId builtinEquiv :: BuiltinId builtinEquivFun :: BuiltinId builtinEquivProof :: BuiltinId builtinTranspProof :: BuiltinId builtinIsOne1 :: BuiltinId builtinIsOne2 :: BuiltinId builtinIsOneEmpty :: BuiltinId builtinSub :: BuiltinId builtinSubIn :: BuiltinId builtinSizeUniv :: BuiltinId builtinSize :: BuiltinId builtinSizeLt :: BuiltinId builtinSizeSuc :: BuiltinId builtinSizeInf :: BuiltinId builtinSizeMax :: BuiltinId builtinInf :: BuiltinId builtinSharp :: BuiltinId builtinFlat :: BuiltinId builtinEquality :: BuiltinId builtinRefl :: BuiltinId builtinRewrite :: BuiltinId builtinLevelMax :: BuiltinId builtinLevel :: BuiltinId builtinLevelZero :: BuiltinId builtinLevelSuc :: BuiltinId builtinProp :: BuiltinId builtinSet :: BuiltinId builtinStrictSet :: BuiltinId builtinPropOmega :: BuiltinId builtinSetOmega :: BuiltinId builtinSSetOmega :: BuiltinId builtinLevelUniv :: BuiltinId builtinFromNat :: BuiltinId builtinFromNeg :: BuiltinId builtinFromString :: BuiltinId builtinQuotientConstructor :: BuiltinId builtinQName :: BuiltinId builtinAgdaSort :: BuiltinId builtinAgdaSortSet :: BuiltinId builtinAgdaSortLit :: BuiltinId builtinAgdaSortProp :: BuiltinId builtinAgdaSortPropLit :: BuiltinId builtinAgdaSortInf :: BuiltinId builtinAgdaSortUnsupported :: BuiltinId builtinHiding :: BuiltinId builtinHidden :: BuiltinId builtinInstance :: BuiltinId builtinVisible :: BuiltinId builtinRelevance :: BuiltinId builtinRelevant :: BuiltinId builtinIrrelevant :: BuiltinId builtinQuantity :: BuiltinId builtinQuantity0 :: BuiltinId builtinQuantityω :: BuiltinId builtinModality :: BuiltinId builtinModalityConstructor :: BuiltinId builtinAssoc :: BuiltinId builtinAssocLeft :: BuiltinId builtinAssocRight :: BuiltinId builtinAssocNon :: BuiltinId builtinPrecedence :: BuiltinId builtinPrecRelated :: BuiltinId builtinPrecUnrelated :: BuiltinId builtinFixity :: BuiltinId builtinFixityFixity :: BuiltinId builtinArg :: BuiltinId builtinArgInfo :: BuiltinId builtinArgArgInfo :: BuiltinId builtinArgArg :: BuiltinId builtinAbs :: BuiltinId builtinAbsAbs :: BuiltinId builtinAgdaTerm :: BuiltinId builtinAgdaTermVar :: BuiltinId builtinAgdaTermLam :: BuiltinId builtinAgdaTermExtLam :: BuiltinId builtinAgdaTermDef :: BuiltinId builtinAgdaTermCon :: BuiltinId builtinAgdaTermPi :: BuiltinId builtinAgdaTermSort :: BuiltinId builtinAgdaTermLit :: BuiltinId builtinAgdaTermUnsupported :: BuiltinId builtinAgdaTermMeta :: BuiltinId builtinAgdaErrorPart :: BuiltinId builtinAgdaErrorPartString :: BuiltinId builtinAgdaErrorPartTerm :: BuiltinId builtinAgdaErrorPartPatt :: BuiltinId builtinAgdaErrorPartName :: BuiltinId builtinAgdaLiteral :: BuiltinId builtinAgdaLitNat :: BuiltinId builtinAgdaLitWord64 :: BuiltinId builtinAgdaLitFloat :: BuiltinId builtinAgdaLitChar :: BuiltinId builtinAgdaLitString :: BuiltinId builtinAgdaLitQName :: BuiltinId builtinAgdaLitMeta :: BuiltinId builtinAgdaClause :: BuiltinId builtinAgdaClauseClause :: BuiltinId builtinAgdaClauseAbsurd :: BuiltinId builtinAgdaPattern :: BuiltinId builtinAgdaPatVar :: BuiltinId builtinAgdaPatCon :: BuiltinId builtinAgdaPatDot :: BuiltinId builtinAgdaPatLit :: BuiltinId builtinAgdaPatProj :: BuiltinId builtinAgdaPatAbsurd :: BuiltinId builtinAgdaDefinitionFunDef :: BuiltinId builtinAgdaDefinitionDataDef :: BuiltinId builtinAgdaDefinitionRecordDef :: BuiltinId builtinAgdaDefinitionDataConstructor :: BuiltinId builtinAgdaDefinitionPostulate :: BuiltinId builtinAgdaDefinitionPrimitive :: BuiltinId builtinAgdaDefinition :: BuiltinId builtinAgdaMeta :: BuiltinId builtinAgdaTCM :: BuiltinId builtinAgdaTCMReturn :: BuiltinId builtinAgdaTCMBind :: BuiltinId builtinAgdaTCMUnify :: BuiltinId builtinAgdaTCMTypeError :: BuiltinId builtinAgdaTCMInferType :: BuiltinId builtinAgdaTCMCheckType :: BuiltinId builtinAgdaTCMNormalise :: BuiltinId builtinAgdaTCMReduce :: BuiltinId builtinAgdaTCMCatchError :: BuiltinId builtinAgdaTCMGetContext :: BuiltinId builtinAgdaTCMExtendContext :: BuiltinId builtinAgdaTCMInContext :: BuiltinId builtinAgdaTCMFreshName :: BuiltinId builtinAgdaTCMDeclareDef :: BuiltinId builtinAgdaTCMDeclarePostulate :: BuiltinId builtinAgdaTCMDeclareData :: BuiltinId builtinAgdaTCMDefineData :: BuiltinId builtinAgdaTCMDefineFun :: BuiltinId builtinAgdaTCMGetType :: BuiltinId builtinAgdaTCMGetDefinition :: BuiltinId builtinAgdaTCMBlock :: BuiltinId builtinAgdaTCMCommit :: BuiltinId builtinAgdaTCMQuoteTerm :: BuiltinId builtinAgdaTCMUnquoteTerm :: BuiltinId builtinAgdaTCMQuoteOmegaTerm :: BuiltinId builtinAgdaTCMIsMacro :: BuiltinId builtinAgdaTCMWithNormalisation :: BuiltinId builtinAgdaTCMWithReconstructed :: BuiltinId builtinAgdaTCMWithExpandLast :: BuiltinId builtinAgdaTCMWithReduceDefs :: BuiltinId builtinAgdaTCMAskNormalisation :: BuiltinId builtinAgdaTCMAskReconstructed :: BuiltinId builtinAgdaTCMAskExpandLast :: BuiltinId builtinAgdaTCMAskReduceDefs :: BuiltinId builtinAgdaTCMFormatErrorParts :: BuiltinId builtinAgdaTCMDebugPrint :: BuiltinId builtinAgdaTCMNoConstraints :: BuiltinId builtinAgdaTCMWorkOnTypes :: BuiltinId builtinAgdaTCMRunSpeculative :: BuiltinId builtinAgdaTCMExec :: BuiltinId builtinAgdaTCMCheckFromString :: BuiltinId builtinAgdaTCMGetInstances :: BuiltinId builtinAgdaTCMSolveInstances :: BuiltinId builtinAgdaTCMPragmaForeign :: BuiltinId builtinAgdaTCMPragmaCompile :: BuiltinId builtinAgdaBlocker :: BuiltinId builtinAgdaBlockerAny :: BuiltinId builtinAgdaBlockerAll :: BuiltinId builtinAgdaBlockerMeta :: BuiltinId -- | Lookup a builtin by the string used in the BUILTIN pragma. builtinById :: String -> Maybe BuiltinId -- | A primitive name, defined by the primitive block. data PrimitiveId PrimIMin :: PrimitiveId PrimIMax :: PrimitiveId PrimINeg :: PrimitiveId PrimPartial :: PrimitiveId PrimPartialP :: PrimitiveId PrimSubOut :: PrimitiveId PrimGlue :: PrimitiveId Prim_glue :: PrimitiveId Prim_unglue :: PrimitiveId Prim_glueU :: PrimitiveId Prim_unglueU :: PrimitiveId PrimFaceForall :: PrimitiveId PrimComp :: PrimitiveId PrimPOr :: PrimitiveId PrimTrans :: PrimitiveId PrimHComp :: PrimitiveId PrimShowInteger :: PrimitiveId PrimNatPlus :: PrimitiveId PrimNatMinus :: PrimitiveId PrimNatTimes :: PrimitiveId PrimNatDivSucAux :: PrimitiveId PrimNatModSucAux :: PrimitiveId PrimNatEquality :: PrimitiveId PrimNatLess :: PrimitiveId PrimShowNat :: PrimitiveId PrimWord64FromNat :: PrimitiveId PrimWord64ToNat :: PrimitiveId PrimWord64ToNatInjective :: PrimitiveId PrimLevelZero :: PrimitiveId PrimLevelSuc :: PrimitiveId PrimLevelMax :: PrimitiveId PrimFloatEquality :: PrimitiveId PrimFloatInequality :: PrimitiveId PrimFloatLess :: PrimitiveId PrimFloatIsInfinite :: PrimitiveId PrimFloatIsNaN :: PrimitiveId PrimFloatIsNegativeZero :: PrimitiveId PrimFloatIsSafeInteger :: PrimitiveId PrimFloatToWord64 :: PrimitiveId PrimFloatToWord64Injective :: PrimitiveId PrimNatToFloat :: PrimitiveId PrimIntToFloat :: PrimitiveId PrimFloatRound :: PrimitiveId PrimFloatFloor :: PrimitiveId PrimFloatCeiling :: PrimitiveId PrimFloatToRatio :: PrimitiveId PrimRatioToFloat :: PrimitiveId PrimFloatDecode :: PrimitiveId PrimFloatEncode :: PrimitiveId PrimShowFloat :: PrimitiveId PrimFloatPlus :: PrimitiveId PrimFloatMinus :: PrimitiveId PrimFloatTimes :: PrimitiveId PrimFloatNegate :: PrimitiveId PrimFloatDiv :: PrimitiveId PrimFloatPow :: PrimitiveId PrimFloatSqrt :: PrimitiveId PrimFloatExp :: PrimitiveId PrimFloatLog :: PrimitiveId PrimFloatSin :: PrimitiveId PrimFloatCos :: PrimitiveId PrimFloatTan :: PrimitiveId PrimFloatASin :: PrimitiveId PrimFloatACos :: PrimitiveId PrimFloatATan :: PrimitiveId PrimFloatATan2 :: PrimitiveId PrimFloatSinh :: PrimitiveId PrimFloatCosh :: PrimitiveId PrimFloatTanh :: PrimitiveId PrimFloatASinh :: PrimitiveId PrimFloatACosh :: PrimitiveId PrimFloatATanh :: PrimitiveId PrimCharEquality :: PrimitiveId PrimIsLower :: PrimitiveId PrimIsDigit :: PrimitiveId PrimIsAlpha :: PrimitiveId PrimIsSpace :: PrimitiveId PrimIsAscii :: PrimitiveId PrimIsLatin1 :: PrimitiveId PrimIsPrint :: PrimitiveId PrimIsHexDigit :: PrimitiveId PrimToUpper :: PrimitiveId PrimToLower :: PrimitiveId PrimCharToNat :: PrimitiveId PrimCharToNatInjective :: PrimitiveId PrimNatToChar :: PrimitiveId PrimShowChar :: PrimitiveId PrimStringToList :: PrimitiveId PrimStringToListInjective :: PrimitiveId PrimStringFromList :: PrimitiveId PrimStringFromListInjective :: PrimitiveId PrimStringAppend :: PrimitiveId PrimStringEquality :: PrimitiveId PrimShowString :: PrimitiveId PrimStringUncons :: PrimitiveId PrimQrec :: PrimitiveId PrimErase :: PrimitiveId PrimEraseEquality :: PrimitiveId PrimForce :: PrimitiveId PrimForceLemma :: PrimitiveId PrimQNameEquality :: PrimitiveId PrimQNameLess :: PrimitiveId PrimShowQName :: PrimitiveId PrimQNameFixity :: PrimitiveId PrimQNameToWord64s :: PrimitiveId PrimQNameToWord64sInjective :: PrimitiveId PrimMetaEquality :: PrimitiveId PrimMetaLess :: PrimitiveId PrimShowMeta :: PrimitiveId PrimMetaToNat :: PrimitiveId PrimMetaToNatInjective :: PrimitiveId PrimLockUniv :: PrimitiveId PrimRewriteNoMatch :: PrimitiveId builtinIMin :: PrimitiveId builtinIMax :: PrimitiveId builtinINeg :: PrimitiveId builtinSubOut :: PrimitiveId builtinGlue :: PrimitiveId builtin_glue :: PrimitiveId builtin_unglue :: PrimitiveId builtin_glueU :: PrimitiveId builtin_unglueU :: PrimitiveId builtinFaceForall :: PrimitiveId builtinComp :: PrimitiveId builtinPOr :: PrimitiveId builtinTrans :: PrimitiveId builtinHComp :: PrimitiveId builtinLockUniv :: PrimitiveId builtinRewriteNoMatch :: PrimitiveId -- | Lookup a primitive by its identifier. primitiveById :: String -> Maybe PrimitiveId instance GHC.Internal.Enum.Bounded Agda.Syntax.Builtin.BuiltinId instance GHC.Internal.Enum.Bounded Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Enum.Enum Agda.Syntax.Builtin.BuiltinId instance GHC.Internal.Enum.Enum Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Classes.Eq Agda.Syntax.Builtin.BuiltinId instance GHC.Internal.Classes.Eq Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Classes.Eq Agda.Syntax.Builtin.SomeBuiltin instance GHC.Internal.Generics.Generic Agda.Syntax.Builtin.BuiltinId instance GHC.Internal.Generics.Generic Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Generics.Generic Agda.Syntax.Builtin.SomeBuiltin instance Data.Hashable.Class.Hashable Agda.Syntax.Builtin.BuiltinId instance Data.Hashable.Class.Hashable Agda.Syntax.Builtin.PrimitiveId instance Data.Hashable.Class.Hashable Agda.Syntax.Builtin.SomeBuiltin instance Agda.Syntax.Builtin.IsBuiltin Agda.Syntax.Builtin.BuiltinId instance Agda.Syntax.Builtin.IsBuiltin Agda.Syntax.Builtin.PrimitiveId instance Agda.Syntax.Builtin.IsBuiltin Agda.Syntax.Builtin.SomeBuiltin instance Agda.Syntax.Position.KillRange Agda.Syntax.Builtin.BuiltinId instance Agda.Syntax.Position.KillRange Agda.Syntax.Builtin.PrimitiveId instance Control.DeepSeq.NFData Agda.Syntax.Builtin.BuiltinId instance Control.DeepSeq.NFData Agda.Syntax.Builtin.PrimitiveId instance Control.DeepSeq.NFData Agda.Syntax.Builtin.SomeBuiltin instance GHC.Internal.Classes.Ord Agda.Syntax.Builtin.BuiltinId instance GHC.Internal.Classes.Ord Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Classes.Ord Agda.Syntax.Builtin.SomeBuiltin instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Builtin.BuiltinId instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Show.Show Agda.Syntax.Builtin.BuiltinId instance GHC.Internal.Show.Show Agda.Syntax.Builtin.PrimitiveId instance GHC.Internal.Show.Show Agda.Syntax.Builtin.SomeBuiltin -- | Abstract names carry unique identifiers and stuff. module Agda.Syntax.Abstract.Name ambAbstractNames :: AmbiguousQName -> [AbstractName] ambigName :: List1 AbstractName -> AmbiguousQName ambiguous :: List1 QName -> AmbiguousQName commonParentModule :: ModuleName -> ModuleName -> ModuleName -- | Drop anonymous modules at the end of the module name dropAnonymousModules :: ModuleName -> ModuleName fromAmbQName :: AmbQNameEntry -> QName generalizedVarsMetadata :: Map QName Name -> NameMetadata getAmbiguous :: AmbiguousQName -> List1 QName -- | Get the name if unambiguous. getUnambiguous :: AmbiguousQName -> Maybe QName -- | Get the first of the ambiguous names. headAmbQ :: AmbiguousQName -> QName instanceMetadata :: IsInstance -> NameMetadata -- | Is a name ambiguous. isAmbiguous :: AmbiguousQName -> Bool -- | A module is anonymous if the qualification path ends in an underscore. isAnonymousModuleName :: ModuleName -> Bool isInModule :: QName -> ModuleName -> Bool -- | Is the first module a weak child of the second? isLeChildModuleOf :: ModuleName -> ModuleName -> Bool -- | Is the first module a weak parent of the second? isLeParentModuleOf :: ModuleName -> ModuleName -> Bool -- | Is the first module a proper child of the second? isLtChildModuleOf :: ModuleName -> ModuleName -> Bool -- | Is the first module a proper parent of the second? isLtParentModuleOf :: ModuleName -> ModuleName -> Bool -- | Is the name an operator? isOperator :: QName -> Bool -- | Van Laarhoven lens on amodName. lensAmodName :: Lens' AbstractModule ModuleName -- | Van Laarhoven lens on anameName. lensAnameName :: Lens' AbstractName QName lensQNameName :: Lens' QName Name makeName :: NameId -> Name -> Range -> Fixity' -> Bool -> Name -- | Preserve lineage information from both maps, left-biased. mergeAmbQ :: AmbiguousQName -> AmbiguousQName -> AmbiguousQName mnameFromList :: [Name] -> ModuleName mnameFromList1 :: List1 Name -> ModuleName mnameToConcrete :: ModuleName -> QName mnameToList1 :: ModuleName -> List1 Name mnameToQName :: ModuleName -> QName nameToArgName :: Name -> ArgName namedArgName :: NamedArg Name -> ArgName -- | Get the next version of the concrete name. For instance, nextName -- "x" = "x₁". The name must not be a NoName. nextName :: FreshNameMode -> Name -> Name noMetadata :: NameMetadata noModuleName :: ModuleName qnameFromList :: List1 Name -> QName -- | Turn a qualified name into a concrete name. This should only be used -- as a fallback when looking up the right concrete name in the scope -- fails. qnameToConcrete :: QName -> QName qnameToList :: QName -> List1 Name qnameToList0 :: QName -> [Name] qnameToMName :: QName -> ModuleName qualify :: ModuleName -> Name -> QName qualifyM :: ModuleName -> ModuleName -> ModuleName qualifyQ :: ModuleName -> QName -> QName -- | Convert a Name to a QName (add no module name). qualify_ :: Name -> QName -- | Ignoring the suffix. sameRoot :: Name -> Name -> Bool showQNameId :: QName -> String -- | Useful for debugging scoping problems uglyShowName :: Name -> String unambigName :: AbstractName -> AmbiguousQName -- | A singleton "ambiguous" name. unambiguous :: QName -> AmbiguousQName -- | Sets the ranges of the individual names in the module name to match -- those of the corresponding concrete names. If the concrete names are -- fewer than the number of module name name parts, then the initial name -- parts get the range noRange. -- -- C.D.E `withRangesOf` [A, B] returns C.D.E but with -- ranges set as follows: -- -- -- -- Precondition: The number of module name name parts has to be at least -- as large as the length of the list. withRangesOf :: ModuleName -> List1 Name -> ModuleName -- | Like withRangesOf, but uses the name parts (qualifier + name) -- of the qualified name as the list of concrete names. withRangesOfQ :: ModuleName -> QName -> ModuleName -- | A decoration of abstract syntax module names. data AbstractModule AbsModule :: ModuleName -> WhyInScope -> AbstractModule -- | The resolved module name. [amodName] :: AbstractModule -> ModuleName -- | Explanation where this name came from. [amodLineage] :: AbstractModule -> WhyInScope -- | A decoration of QName. data AbstractName AbsName :: QName -> KindOfName -> WhyInScope -> NameMetadata -> AbstractName -- | The resolved qualified name. [anameName] :: AbstractName -> QName -- | The kind (definition, constructor, record field etc.). [anameKind] :: AbstractName -> KindOfName -- | Explanation where this name came from. [anameLineage] :: AbstractName -> WhyInScope -- | Additional information needed during scope checking. Currently used -- for generalized data/record params. [anameMetadata] :: AbstractName -> NameMetadata -- | Alternative in AmbiguousQName. data AmbQNameEntry -- | QName without lineage information. AmbQName :: QName -> AmbQNameEntry -- | QName with lineage information, for error reporting. AmbAbstractName :: AbstractName -> AmbQNameEntry -- | Ambiguous qualified names. Used for overloaded constructors. -- -- A QName in this collection might be equipped with lineage -- information in form of an associated AbstractName (which must -- contain the same QName). -- -- Invariant: All the names in the map must have the same concrete, -- unqualified name. (This implies that they all have the same -- Range). -- -- Don't use the constructor AmbQ directly, use the smart -- constructors below! newtype AmbiguousQName AmbQ :: Map1 NameId AmbQNameEntry -> AmbiguousQName [unAmbQ] :: AmbiguousQName -> Map1 NameId AmbQNameEntry class HasNameBindingSite a nameBindingSite :: HasNameBindingSite a => a -> Range class HasNameId a nameId :: HasNameId a => a -> NameId -- | Check whether we are a projection pattern. class IsProjP a isProjP :: IsProjP a => a -> Maybe (ProjOrigin, AmbiguousQName) -- | For the sake of parsing left-hand sides, we distinguish constructor -- and record field names from defined names. data KindOfName -- | Constructor name (Inductive or don't know). ConName :: KindOfName -- | Constructor name (definitely CoInductive). CoConName :: KindOfName -- | Record field name. FldName :: KindOfName -- | Name of a pattern synonym. PatternSynName :: KindOfName -- | Name to be generalized GeneralizeName :: KindOfName -- | Generalizable variable from a let open DisallowedGeneralizeName :: KindOfName -- | Name of a macro MacroName :: KindOfName -- | A name that can only be quoted. Previous category DefName: -- (Refined in a flat manner as Enum and Bounded are not hereditary.) QuotableName :: KindOfName -- | Name of a data. DataName :: KindOfName -- | Name of a record. RecName :: KindOfName -- | Name of a defined function. FunName :: KindOfName -- | Name of a postulate. AxiomName :: KindOfName -- | Name of a primitive. PrimName :: KindOfName -- | A DefName, but either other kind or don't know which kind. -- End DefName. Keep these together in sequence, for sake of -- isDefName! OtherDefName :: KindOfName -- | Make a Name from some kind of string. class MkName a -- | The Range sets the definition site of the name, not the -- use site. mkName :: MkName a => Range -> NameId -> a -> Name mkName_ :: MkName a => NameId -> a -> Name -- | A module name is just a qualified name. -- -- The SetRange instance for module names sets all individual -- ranges to the given one. newtype ModuleName MName :: [Name] -> ModuleName [mnameToList] :: ModuleName -> [Name] -- | A name is a unique identifier and a suggestion for a concrete name. -- The concrete name contains the source location (if any) of the name. -- The source location of the binding site is also recorded. data Name Name :: NameId -> Name -> Name -> Range -> Fixity' -> Bool -> Name [_nameId] :: Name -> NameId -- | The concrete name used for this instance [nameConcrete] :: Name -> Name -- | The concrete name in the original definition (needed by primShowQName, -- see #4735) [nameCanonical] :: Name -> Name -- | Range of the name in its defining occurrence. [_nameBindingSite] :: Name -> Range [nameFixity] :: Name -> Fixity' -- | Is this the name of the invisible record variable self? -- Should not be printed or displayed in the context, see issue #3584. [nameIsRecordName] :: Name -> Bool data NameMetadata NameMetadata :: Map QName Name -> IsInstance -> NameMetadata [nameDataGeneralizedVars] :: NameMetadata -> Map QName Name [nameDataIsInstance] :: NameMetadata -> IsInstance -- | Qualified names are non-empty lists of names. Equality on qualified -- names are just equality on the last name, i.e. the module part is just -- for show. -- -- The SetRange instance for qualified names sets all individual -- ranges (including those of the module prefix) to the given one. data QName QName :: ModuleName -> Name -> QName [qnameModule] :: QName -> ModuleName [qnameName] :: QName -> Name -- | Something preceeded by a qualified name. data QNamed a QNamed :: QName -> a -> QNamed a [qname] :: QNamed a -> QName [qnamed] :: QNamed a -> a -- | A name suffix. data Suffix NoSuffix :: Suffix Suffix :: Integer -> Suffix -- | Where does a name come from? -- -- This information is solely for reporting to the user, see -- whyInScope. data WhyInScope -- | Defined in this module. Defined :: WhyInScope -- | Imported from another module. Opened :: QName -> WhyInScope -> WhyInScope -- | Imported by a module application. Applied :: QName -> WhyInScope -> WhyInScope -- | Check whether a name is the empty name "_". class IsNoName a isNoName :: IsNoName a => a -> Bool ($dmisNoName) :: forall (t :: Type -> Type) b. (IsNoName a, Foldable t, IsNoName b, t b ~ a) => a -> Bool -- | Method by which to generate fresh unshadowed names. data FreshNameMode -- | Append an integer Unicode subscript: x, x₁, x₂, … UnicodeSubscript :: FreshNameMode -- | Append an integer ASCII counter: x, x1, x2, … AsciiCounter :: FreshNameMode instance GHC.Internal.Enum.Bounded Agda.Syntax.Abstract.Name.KindOfName instance GHC.Internal.Enum.Enum Agda.Syntax.Abstract.Name.KindOfName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.AbstractModule instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.AbstractName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.AmbQNameEntry instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.AmbiguousQName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.KindOfName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.ModuleName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.Name instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Name.Suffix instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Abstract.Name.QNamed instance GHC.Internal.Base.Functor Agda.Syntax.Abstract.Name.QNamed instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.AbstractModule instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.AbstractName instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.AmbQNameEntry instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.KindOfName instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.NameMetadata instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Name.WhyInScope instance Agda.Syntax.Abstract.Name.HasNameBindingSite Agda.Syntax.Abstract.Name.AbstractModule instance Agda.Syntax.Abstract.Name.HasNameBindingSite Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Abstract.Name.HasNameBindingSite Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.Name.HasNameBindingSite Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Abstract.Name.HasNameBindingSite Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Abstract.Name.HasNameId Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Abstract.Name.HasNameId Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Abstract.Name.HasNameId Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Name.AmbQNameEntry instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Name.QName instance Data.Hashable.Class.Hashable Agda.Syntax.Abstract.Name.AbstractName instance Data.Hashable.Class.Hashable Agda.Syntax.Abstract.Name.ModuleName instance Data.Hashable.Class.Hashable Agda.Syntax.Abstract.Name.Name instance Data.Hashable.Class.Hashable Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Common.IsInstanceDef Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Common.IsInstanceDef Agda.Syntax.Abstract.Name.NameMetadata instance Agda.Syntax.Concrete.Name.IsNoName Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Concrete.Name.IsNoName Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Abstract.Name.IsProjP a => Agda.Syntax.Abstract.Name.IsProjP (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.Name.IsProjP a => Agda.Syntax.Abstract.Name.IsProjP (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Abstract.Name.IsProjP GHC.Internal.Base.Void instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.AmbQNameEntry instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.KindOfName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.NameMetadata instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.WhyInScope instance Agda.Syntax.Common.LensFixity' Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Common.LensFixity' Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Common.LensFixity Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Common.LensFixity Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Common.LensFixity Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Abstract.Name.MkName GHC.Internal.Base.String instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.AbstractModule instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.AbstractName instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.AmbQNameEntry instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.AmbiguousQName instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.KindOfName instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.ModuleName instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.Name instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.NameMetadata instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.QName instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.Suffix instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Name.WhyInScope instance Agda.Utils.Null.Null Agda.Syntax.Abstract.Name.ModuleName instance Agda.Utils.Null.Null Agda.Syntax.Abstract.Name.Name instance Agda.Utils.Null.Null Agda.Syntax.Abstract.Name.NameMetadata instance Agda.Utils.Null.Null Agda.Syntax.Abstract.Name.QName instance Agda.Utils.Null.Null Agda.Syntax.Abstract.Name.Suffix instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.AbstractModule instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.AbstractName instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.AmbQNameEntry instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.AmbiguousQName instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.KindOfName instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.ModuleName instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.Name instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.Name.Suffix instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.AbstractModule instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Abstract.Name.QNamed a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.Name.Suffix instance GHC.Internal.Base.Semigroup Agda.Syntax.Abstract.Name.AmbQNameEntry instance Agda.Syntax.Position.SetRange Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Position.SetRange Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Position.SetRange Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Position.SetRange Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.AbstractModule instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.AbstractName instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.AmbQNameEntry instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.AmbiguousQName instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.KindOfName instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.ModuleName instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.Name instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.NameMetadata instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Abstract.Name.QNamed a) instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.Suffix instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Name.WhyInScope instance Agda.Utils.Size.Sized Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Utils.Size.Sized Agda.Syntax.Abstract.Name.ModuleName instance Agda.Utils.Size.Sized Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Abstract.Name.QNamed -- | Occurrences. module Agda.TypeChecking.Positivity.Occurrence -- | List of polarities stemming from POLARITY pragma. type PragmaPolarities = List1 Ranged Occurrence -- | Subterm occurrences for positivity checking. The constructors are -- listed in increasing information they provide: Mixed <= JustPos -- <= StrictPos <= GuardPos <= Unused Mixed <= -- JustNeg <= Unused. data Occurrence -- | Arbitrary occurrence (positive and negative). Mixed :: Occurrence -- | Negative occurrence. JustNeg :: Occurrence -- | Positive occurrence, but not strictly positive. JustPos :: Occurrence -- | Strictly positive occurrence. StrictPos :: Occurrence -- | Guarded strictly positive occurrence (i.e., under ∞). For checking -- recursive records. GuardPos :: Occurrence -- | No occurrence. Unused :: Occurrence modalPolarityToOccurrence :: ModalPolarity -> Occurrence data OccursPath Root :: OccursPath LeftOfArrow :: OccursPath -> OccursPath -- | in the nth argument of a defined constant DefArg :: OccursPath -> QName -> Nat -> OccursPath -- | in the nth argument of a def in the current mutual block. (def given -- by Int index in the block) MutDefArg :: OccursPath -> QName -> Nat -> OccursPath -- | in the principal argument of built-in ∞ UnderInf :: OccursPath -> OccursPath -- | as an argument to a bound variable with given polarity. The polarity -- is only used for warning printing. VarArg :: OccursPath -> Nat -> Occurrence -> OccursPath -- | as an argument of a metavariable MetaArg :: OccursPath -> OccursPath -- | in the type of a constructor ConArgType :: OccursPath -> QName -> OccursPath -- | in a datatype index of a constructor IndArgType :: OccursPath -> QName -> OccursPath -- | in an endpoint of a higher constructor ConEndpoint :: OccursPath -> QName -> OccursPath -- | in the nth clause of a defined function InClause :: OccursPath -> Nat -> OccursPath -- | matched against in a clause of a defined function Matched :: OccursPath -> OccursPath -- | is an index of an inductive family InIndex :: OccursPath -> OccursPath -- | in a sort, e.g. in the level of a universe InSort :: OccursPath -> OccursPath -- | in the definition of a constant InDefOf :: OccursPath -> QName -> OccursPath data OccursWhere OccursWhere :: Range -> OccursPath -> OccursWhere data Node -- | Definition site of a mutual definition DefNode :: QName -> Node -- | Occurrence of the nth definition argument inside the definition. ArgNode :: QName -> Int -> Node data Edge a Edge :: Occurrence -> a -> Edge a mergeEdges :: Edge a -> Edge a -> Edge a instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Enum.Enum Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Positivity.Occurrence.Edge a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.Node instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.OccursPath instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance GHC.Internal.Base.Functor Agda.TypeChecking.Positivity.Occurrence.Edge instance Data.Hashable.Class.Hashable Agda.TypeChecking.Positivity.Occurrence.Node instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Occurrence.OccursPath instance Agda.Utils.Null.Null Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.TypeChecking.Positivity.Occurrence.Edge a) instance GHC.Internal.Classes.Ord Agda.TypeChecking.Positivity.Occurrence.Node instance GHC.Internal.Classes.Ord Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.Node instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.OccursPath instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance GHC.Internal.Base.Monoid a => Agda.Utils.SemiRing.SemiRing (Agda.TypeChecking.Positivity.Occurrence.Edge a) instance Agda.Utils.SemiRing.SemiRing Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Positivity.Occurrence.Edge a) instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.Occurrence.Node instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.Occurrence.OccursPath instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance Agda.Utils.SemiRing.StarSemiRing Agda.TypeChecking.Positivity.Occurrence.Occurrence -- | Types related to warnings raised by Agda. module Agda.TypeChecking.Monad.Base.Warning data RecordFieldWarning -- | Each redundant field comes with a range of associated dead code. DuplicateFields :: List1 (Name, Range) -> RecordFieldWarning -- | Record type, fields not supplied by user, non-fields but supplied. The -- redundant fields come with a range of associated dead code. TooManyFields :: QName -> [Name] -> List1 (Name, Range) -> RecordFieldWarning data UselessPublicReason UselessPublicPreamble :: UselessPublicReason UselessPublicLet :: UselessPublicReason UselessPublicNoOpen :: UselessPublicReason UselessPublicAnonymousModule :: UselessPublicReason instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.Warning.UselessPublicReason instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.Warning.UselessPublicReason instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Warning.RecordFieldWarning instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Warning.UselessPublicReason instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Warning.UselessPublicReason instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Warning.RecordFieldWarning instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Warning.UselessPublicReason module Agda.Syntax.Literal type RLiteral = Ranged Literal data Literal LitNat :: Integer -> Literal LitWord64 :: Word64 -> Literal LitFloat :: Double -> Literal LitString :: Text -> Literal LitChar :: Char -> Literal LitQName :: QName -> Literal LitMeta :: TopLevelModuleName' Range -> MetaId -> Literal showText :: Text -> ShowS showChar' :: Char -> ShowS instance GHC.Internal.Classes.Eq Agda.Syntax.Literal.Literal instance Agda.Syntax.Position.KillRange Agda.Syntax.Literal.Literal instance Control.DeepSeq.NFData Agda.Syntax.Literal.Literal instance GHC.Internal.Classes.Ord Agda.Syntax.Literal.Literal instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Literal.Literal instance GHC.Internal.Show.Show Agda.Syntax.Literal.Literal module Agda.Syntax.Parser.Tokens data Token TokKeyword :: Keyword -> Interval -> Token TokId :: (Interval, String) -> Token TokQId :: [(Interval, String)] -> Token TokQual_ :: QualifiedToken -> Token TokLiteral :: RLiteral -> Token TokSymbol :: Symbol -> Interval -> Token -- | Arbitrary string (not enclosed in double quotes), used in pragmas. TokString :: (Interval, String) -> Token TokTeX :: (Interval, String) -> Token TokMarkup :: (Interval, String) -> Token TokComment :: (Interval, String) -> Token TokDummy :: Token TokEOF :: Interval -> Token pattern TokQual :: QualifiableToken -> [(Interval, String)] -> Interval -> Token -- | Tokens which may appear qualified. data QualifiableToken -- | qualified do QualDo :: QualifiableToken -- | qualified (|) or ⦇⦈ QualEmptyIdiom :: QualifiableToken -- | qualified (| or ⦇, True if unicode QualOpenIdiom :: Bool -> QualifiableToken -- | A "qualified token", i.e. a sequence of (module) names followed by one -- of the allowed (QualifiableToken) keywords/symbols. data QualifiedToken QualifiedToken :: QualifiableToken -> [(Interval, String)] -> Interval -> QualifiedToken data Keyword KwLet :: Keyword KwIn :: Keyword KwWhere :: Keyword KwData :: Keyword KwCoData :: Keyword KwDo :: Keyword KwPostulate :: Keyword KwAbstract :: Keyword KwPrivate :: Keyword KwInstance :: Keyword KwInterleaved :: Keyword KwMutual :: Keyword KwOverlap :: Keyword KwOpen :: Keyword KwImport :: Keyword KwModule :: Keyword KwPrimitive :: Keyword KwMacro :: Keyword KwInfix :: Keyword KwInfixL :: Keyword KwInfixR :: Keyword KwWith :: Keyword KwRewrite :: Keyword KwForall :: Keyword KwRecord :: Keyword KwConstructor :: Keyword KwField :: Keyword KwInductive :: Keyword KwCoInductive :: Keyword KwEta :: Keyword KwNoEta :: Keyword KwHiding :: Keyword KwUsing :: Keyword KwRenaming :: Keyword KwTo :: Keyword KwPublic :: Keyword KwOpaque :: Keyword KwUnfolding :: Keyword KwOPTIONS :: Keyword KwBUILTIN :: Keyword KwLINE :: Keyword KwFOREIGN :: Keyword KwCOMPILE :: Keyword KwIMPOSSIBLE :: Keyword KwSTATIC :: Keyword KwINJECTIVE :: Keyword KwINJECTIVE_FOR_INFERENCE :: Keyword KwINLINE :: Keyword KwNOINLINE :: Keyword KwETA :: Keyword KwETA_EQUALITY :: Keyword KwNO_TERMINATION_CHECK :: Keyword KwTERMINATING :: Keyword KwNON_TERMINATING :: Keyword KwNOT_PROJECTION_LIKE :: Keyword KwNON_COVERING :: Keyword KwWARNING_ON_USAGE :: Keyword KwWARNING_ON_IMPORT :: Keyword KwMEASURE :: Keyword KwDISPLAY :: Keyword KwREWRITE :: Keyword KwOVERLAPPABLE :: Keyword KwOVERLAPPING :: Keyword KwOVERLAPS :: Keyword KwINCOHERENT :: Keyword KwQuote :: Keyword KwQuoteTerm :: Keyword KwUnquote :: Keyword KwUnquoteDecl :: Keyword KwUnquoteDef :: Keyword KwSyntax :: Keyword KwPatternSyn :: Keyword KwTactic :: Keyword KwCATCHALL :: Keyword KwVariable :: Keyword KwNO_POSITIVITY_CHECK :: Keyword KwPOLARITY :: Keyword KwNO_UNIVERSE_CHECK :: Keyword -- | Unconditional layout keywords. -- -- Some keywords introduce layout only in certain circumstances, these -- are not included here. layoutKeywords :: [Keyword] data Symbol -- |
--   .
--   
SymDot :: Symbol -- |
--   ;
--   
SymSemi :: Symbol -- | layout-implied ; SymVirtualSemi :: Symbol -- |
--   |
--   
SymBar :: Symbol -- |
--   :
--   
SymColon :: Symbol -- | -> or → SymArrow :: Symbol -- |
--   =
--   
SymEqual :: Symbol -- | @ or λ@ SymLambda :: Symbol -- |
--   _
--   
SymUnderscore :: Symbol -- |
--   ?
--   
SymQuestionMark :: Symbol -- | @@@ SymAs :: Symbol -- |
--   (
--   
SymOpenParen :: Symbol -- |
--   )
--   
SymCloseParen :: Symbol -- | (|) or ⦇⦈ SymEmptyIdiomBracket :: Symbol -- | (| or ⦇, True if unicode SymOpenIdiomBracket :: Bool -> Symbol -- | |) or ⦈, True if unicode SymCloseIdiomBracket :: Bool -> Symbol -- | {{ or ⦃, True if unicode SymDoubleOpenBrace :: Bool -> Symbol -- | {{ or ⦄, True if unicode SymDoubleCloseBrace :: Bool -> Symbol -- |
--   {
--   
SymOpenBrace :: Symbol -- |
--   }
--   
SymCloseBrace :: Symbol -- | layout-implied { SymOpenVirtualBrace :: Symbol -- | layout-implied } SymCloseVirtualBrace :: Symbol -- |
--   {-#
--   
SymOpenPragma :: Symbol -- |
--   #-}
--   
SymClosePragma :: Symbol -- | ... or … SymEllipsis :: Symbol -- |
--   ..
--   
SymDotDot :: Symbol -- | A misplaced end-comment "-}". SymEndComment :: Symbol instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Tokens.Keyword instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Tokens.QualifiableToken instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Tokens.QualifiedToken instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Tokens.Symbol instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Tokens.Token instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Tokens.QualifiedToken instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Tokens.Token instance Agda.Syntax.Position.HasRangeWithoutFile Agda.Syntax.Parser.Tokens.Token instance GHC.Internal.Show.Show Agda.Syntax.Parser.Tokens.Keyword instance GHC.Internal.Show.Show Agda.Syntax.Parser.Tokens.QualifiableToken instance GHC.Internal.Show.Show Agda.Syntax.Parser.Tokens.QualifiedToken instance GHC.Internal.Show.Show Agda.Syntax.Parser.Tokens.Symbol instance GHC.Internal.Show.Show Agda.Syntax.Parser.Tokens.Token module Agda.Syntax.Internal.Elim -- | Eliminations, subsuming applications and projections. data Elim' a -- | Application. Apply :: Arg a -> Elim' a -- | Projection. QName is name of a record projection. Proj :: ProjOrigin -> QName -> Elim' a -- | IApply x y r, x and y are the endpoints IApply :: a -> a -> a -> Elim' a -- | Drop Apply constructor. (Safe) isApplyElim :: Elim' a -> Maybe (Arg a) -- | Drop Apply constructor, fails with IMPOSSIBLE -- on a projection. mustApplyElim :: Elim' a -> Arg a isApplyElim' :: Empty -> Elim' a -> Arg a -- | Only Apply variant. isProperApplyElim :: Elim' a -> Bool -- | Drop Apply constructors. (Safe) allApplyElims :: [Elim' a] -> Maybe [Arg a] -- | Drop Apply constructors, fails with IMPOSSIBLE -- if there's a non-Apply entry. mustAllApplyElims :: [Elim' a] -> [Arg a] -- | Split at first non-Apply splitApplyElims :: [Elim' a] -> ([Arg a], [Elim' a]) class IsProjElim e isProjElim :: IsProjElim e => e -> Maybe (ProjOrigin, QName) -- | Discards Proj f entries. argsFromElims :: [Elim' t] -> [Arg t] -- | Drop Proj constructors. (Safe) allProjElims :: [Elim' t] -> Maybe [(ProjOrigin, QName)] instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.Elim.Elim' instance GHC.Internal.Base.Functor Agda.Syntax.Internal.Elim.Elim' instance Agda.Syntax.Internal.Elim.IsProjElim (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Internal.Elim.Elim' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Common.Pretty.Pretty tm => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Elim.Elim' tm) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Internal.Elim.Elim' a) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.Elim.Elim' module Agda.Syntax.Internal.Blockers -- | Even if we are not stuck on a meta during reduction we can fail to -- reduce a definition by pattern matching for another reason. data NotBlocked' t -- | The Elim is neutral and blocks a pattern match. StuckOn :: Elim' t -> NotBlocked' t -- | Not enough arguments were supplied to complete the matching. Underapplied :: NotBlocked' t -- | We matched an absurd clause, results in a neutral Def. AbsurdMatch :: NotBlocked' t -- | We ran out of clauses for QName, all considered clauses -- produced an actual mismatch. This can happen when try to reduce a -- function application but we are still missing some function clauses. -- See Agda.TypeChecking.Patterns.Match. MissingClauses :: QName -> NotBlocked' t -- | Reduction was not blocked, we reached a whnf which can be anything but -- a stuck Def. ReallyNotBlocked :: NotBlocked' t -- | What is causing the blocking? Or in other words which metas or -- problems need to be solved to unblock the blocked -- computation/constraint. data Blocker UnblockOnAll :: Set Blocker -> Blocker UnblockOnAny :: Set Blocker -> Blocker -- | Unblock if meta is instantiated UnblockOnMeta :: MetaId -> Blocker UnblockOnProblem :: ProblemId -> Blocker -- | Unblock when function is defined UnblockOnDef :: QName -> Blocker alwaysUnblock :: Blocker neverUnblock :: Blocker unblockOnAll :: Set Blocker -> Blocker unblockOnAny :: Set Blocker -> Blocker unblockOnEither :: Blocker -> Blocker -> Blocker unblockOnBoth :: Blocker -> Blocker -> Blocker unblockOnMeta :: MetaId -> Blocker unblockOnProblem :: ProblemId -> Blocker unblockOnDef :: QName -> Blocker unblockOnAllMetas :: Set MetaId -> Blocker unblockOnAnyMeta :: Set MetaId -> Blocker onBlockingMetasM :: Monad m => (MetaId -> m Blocker) -> Blocker -> m Blocker allBlockingMetas :: Blocker -> Set MetaId allBlockingProblems :: Blocker -> Set ProblemId allBlockingDefs :: Blocker -> Set QName -- | Something where a meta variable may block reduction. Notably a -- top-level meta is considered blocking. This did not use to be the case -- (pre Aug 2020). data Blocked' t a Blocked :: Blocker -> a -> Blocked' t a [theBlocker] :: Blocked' t a -> Blocker [ignoreBlocking] :: Blocked' t a -> a NotBlocked :: NotBlocked' t -> a -> Blocked' t a [blockingStatus] :: Blocked' t a -> NotBlocked' t [ignoreBlocking] :: Blocked' t a -> a -- | When trying to reduce f es, on match failed on one -- elimination e ∈ es that came with info r :: -- NotBlocked. stuckOn e r produces the new -- NotBlocked info. -- -- MissingClauses must be propagated, as this is blockage that can -- be lifted in the future (as more clauses are added). -- -- StuckOn e0 is also propagated, since it provides more -- precise information as StuckOn e (as e0 is the -- original reason why reduction got stuck and usually a subterm of -- e). An information like StuckOn (Apply (Arg info (Var i -- []))) (stuck on a variable) could be used by the lhs/coverage -- checker to trigger a split on that (pattern) variable. -- -- In the remaining cases for r, we are terminally stuck due to -- StuckOn e. Propagating AbsurdMatch does not -- seem useful. -- -- Underapplied must not be propagated, as this would mean that -- f es is underapplied, which is not the case (it is stuck). -- Note that Underapplied can only arise when projection patterns -- were missing to complete the original match (in e). (Missing -- ordinary pattern would mean the e is of function type, but we -- cannot match against something of function type.) stuckOn :: Elim' t -> NotBlocked' t -> NotBlocked' t blockedOn :: Blocker -> a -> Blocked' t a blocked :: MetaId -> a -> Blocked' t a notBlocked :: a -> Blocked' t a blocked_ :: MetaId -> Blocked' t () notBlocked_ :: Blocked' t () getBlocker :: Blocked' t a -> Blocker -- | Should a constraint wake up or not? If not, we might refine the -- unblocker. data WakeUp WakeUp :: WakeUp DontWakeUp :: Maybe Blocker -> WakeUp wakeUpWhen :: (constr -> Bool) -> (constr -> WakeUp) -> constr -> WakeUp wakeUpWhen_ :: (constr -> Bool) -> constr -> WakeUp wakeIfBlockedOnProblem :: ProblemId -> Blocker -> WakeUp wakeIfBlockedOnMeta :: MetaId -> Blocker -> WakeUp wakeIfBlockedOnDef :: QName -> Blocker -> WakeUp unblockMeta :: MetaId -> Blocker -> Blocker unblockProblem :: ProblemId -> Blocker -> Blocker unblockDef :: QName -> Blocker -> Blocker instance GHC.Internal.Base.Applicative (Agda.Syntax.Internal.Blockers.Blocked' t) instance Agda.Utils.Functor.Decoration (Agda.Syntax.Internal.Blockers.Blocked' t) instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Blockers.Blocker instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Blockers.WakeUp instance GHC.Internal.Data.Foldable.Foldable (Agda.Syntax.Internal.Blockers.Blocked' t) instance GHC.Internal.Base.Functor (Agda.Syntax.Internal.Blockers.Blocked' t) instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.Blockers.Blocked' t a) instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.Blockers.Blocker instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.Blockers.NotBlocked' t) instance GHC.Internal.Base.Monoid a => GHC.Internal.Base.Monoid (Agda.Syntax.Internal.Blockers.Blocked' t a) instance GHC.Internal.Base.Monoid (Agda.Syntax.Internal.Blockers.NotBlocked' t) instance (Control.DeepSeq.NFData t, Control.DeepSeq.NFData a) => Control.DeepSeq.NFData (Agda.Syntax.Internal.Blockers.Blocked' t a) instance Control.DeepSeq.NFData Agda.Syntax.Internal.Blockers.Blocker instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Agda.Syntax.Internal.Blockers.NotBlocked' t) instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Blockers.Blocker instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.Blockers.Blocker instance Agda.Syntax.Common.Pretty.Pretty t => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Blockers.NotBlocked' t) instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Agda.Syntax.Internal.Blockers.Blocked' t a) instance GHC.Internal.Base.Semigroup (Agda.Syntax.Internal.Blockers.NotBlocked' t) instance (GHC.Internal.Show.Show t, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Agda.Syntax.Internal.Blockers.Blocked' t a) instance GHC.Internal.Show.Show Agda.Syntax.Internal.Blockers.Blocker instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.Blockers.NotBlocked' t) instance GHC.Internal.Show.Show Agda.Syntax.Internal.Blockers.WakeUp instance GHC.Internal.Data.Traversable.Traversable (Agda.Syntax.Internal.Blockers.Blocked' t) module Agda.Syntax.Internal -- | Constant level n pattern ClosedLevel :: Integer -> Level pattern Dom :: ArgInfo -> Maybe NamedName -> Bool -> Maybe t -> Maybe (RewDom' t) -> e -> Dom' t e pattern EqualityType :: Range -> Sort -> QName -> Args -> Arg Term -> Arg Term -> Arg Term -> EqualityView pattern PProp :: NLPat -> NLPSort pattern PSSet :: NLPat -> NLPSort pattern PType :: NLPat -> NLPSort pattern Prop :: Level' t -> Sort' t pattern SSet :: Level' t -> Sort' t pattern Type :: Level' t -> Sort' t pattern Var :: Int -> Elims -> Term __DUMMY_DOM__ :: HasCallStack => Dom Type __DUMMY_LEVEL__ :: HasCallStack => Level __DUMMY_SORT__ :: HasCallStack => Sort __DUMMY_TERM_WITH__ :: HasCallStack => String -> Term __DUMMY_TERM__ :: HasCallStack => Term __DUMMY_TYPE__ :: HasCallStack => Type -- | Absurd lambdas are internally represented as identity with variable -- name "()". absurdBody :: Abs Term -- | Make an absurd pattern with the given de Bruijn index. absurdP :: Int -> DeBruijnPattern absurdPatternName :: PatVarName applySpineHead :: SpineHead -> Elims -> Term argFromDom :: Dom' t a -> Arg a -- | Doesn't do any reduction. arity :: Type -> Nat atomicLevel :: t -> Level' t clausePats :: Clause -> [Arg DeBruijnPattern] couldBeRecursive :: ClauseRecursive -> Bool dInfo :: forall t e f. Functor f => (ArgInfo -> f ArgInfo) -> Dom' t e -> f (Dom' t e) dIsFinite :: forall t e f. Functor f => (Bool -> f Bool) -> Dom' t e -> f (Dom' t e) dName :: forall t e f. Functor f => (Maybe NamedName -> f (Maybe NamedName)) -> Dom' t e -> f (Dom' t e) dRew :: forall t e f. Functor f => (Maybe (RewDom' t) -> f (Maybe (RewDom' t))) -> Dom' t e -> f (Dom' t e) dTactic :: forall t e f. Functor f => (Maybe t -> f (Maybe t)) -> Dom' t e -> f (Dom' t e) decideRecursive :: Bool -> ClauseRecursive defaultArgDom :: ArgInfo -> a -> Dom a defaultArgDomRew :: ArgInfo -> Maybe RewDom -> a -> Dom a defaultDom :: a -> Dom a defaultNamedArgDom :: ArgInfo -> String -> a -> Dom a defaultPatternInfo :: PatternInfo domEq :: Dom' t e -> Maybe (LocalEquation' t) domFromArg :: Arg a -> Dom a domFromArgRew :: Maybe RewDom -> Arg a -> Dom a domFromNamedArg :: NamedArg a -> Dom a domInfo :: Dom' t e -> ArgInfo domIsFinite :: Dom' t e -> Bool domName :: Dom' t e -> Maybe NamedName domTactic :: Dom' t e -> Maybe t -- | Add DontCare is it is not already a DontCare. dontCare :: Term -> Term dotP :: Term -> Pattern' a -- | Context entries without a type have this dummy type. Note: use macro -- DUMMY_DOM ! dummyDom :: CallStack -> Dom Type -- | A dummy level to constitute a level/sort created at location. Note: -- use macro DUMMY_LEVEL ! dummyLevel :: CallStack -> Level -- | Construct a string representing the call-site that created the dummy -- thing. dummyLocName :: CallStack -> String -- | A dummy sort created at location. Note: use macro DUMMY_SORT ! dummySort :: CallStack -> Sort -- | A dummy term created at location. Note: use macro DUMMY_TERM ! dummyTerm :: CallStack -> Term -- | Aux: A dummy term to constitute a dummy termlevelsort/type. dummyTermWith :: String -> CallStack -> Term -- | A dummy type created at location. Note: use macro DUMMY_TYPE ! dummyType :: CallStack -> Type eqtLhs :: EqualityView -> Arg Term eqtName :: EqualityView -> QName eqtParams :: EqualityView -> Args eqtRange :: EqualityView -> Range eqtRhs :: EqualityView -> Arg Term eqtSort :: EqualityView -> Sort eqtType :: EqualityView -> Arg Term -- | Build ConInfo from ConPatternInfo. fromConPatternInfo :: ConPatternInfo -> ConInfo -- | A view distinguishing the neutrals Var, Def, and -- MetaV which can be projected. hasElims :: Term -> Maybe (Elims -> Term, Elims) hasProj :: Elims -> Bool headToPat :: Nat -> RewriteHead -> PElims -> NLPat headToTerm :: Nat -> RewriteHead -> Elims -> Term impossibleTerm :: CallStack -> Term -- | Is this Dom annotated as a local rewrite rule and if so, has the -- rewrite been invalidated due to a substitution? invalidRew :: Dom' t e -> Bool isAbsurdBody :: Abs Term -> Bool isAbsurdPatternName :: PatVarName -> Bool isAlwaysSing :: DefSing -> Bool isEqualityType :: EqualityView -> Bool isIOne :: IntervalView -> Bool isPathType :: PathView -> Bool -- | Is this a Prop universe? Answers are yes (True) or maybe -- (False). isProp :: Sort' t -> Bool isSort :: Term -> Maybe Sort -- | Is this a strict universe inhabitable by data types? isStrictDataSort :: Sort' t -> Bool -- | Given a constant m and level l, compute m + -- l levelPlus :: Integer -> Level -> Level levelSuc :: Level -> Level -- | Lens to edit a Telescope as a list. listTel :: Lens' Telescope ListTel litP :: Literal -> Pattern' a lrewHasProjectionPattern :: RewriteRule -> Bool mapAbsNames :: (ArgName -> ArgName) -> Tele a -> Tele a -- | A traversal for the names in a telescope. mapAbsNamesM :: Applicative m => (ArgName -> m ArgName) -> Tele a -> m (Tele a) maxDefSing :: DefSing -> DefSing -> DefSing minDefSing :: DefSing -> DefSing -> DefSing mkProp :: Integer -> Sort mkSSet :: Integer -> Sort mkType :: Integer -> Sort nameToPatVarName :: Name -> PatVarName namedArgFromDom :: Dom' t a -> NamedArg a namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern namedVarP :: PatVarName -> Named_ Pattern noConPatternInfo :: ConPatternInfo pDom :: LensHiding a => a -> Doc -> Doc patVarNameToString :: PatVarName -> String -- | Retrieve the PatternInfo from a pattern patternInfo :: Pattern' x -> Maybe PatternInfo -- | Retrieve the origin of a pattern patternOrigin :: Pattern' x -> Maybe PatOrigin prettyPrecLevelSucs :: Int -> Integer -> (Int -> Doc) -> Doc -- | Turn a known UProp sort into a UType sort, leave others -- unchanged. propToType :: Sort' t -> Sort' t relToDefSing :: Relevance -> DefSing rewDom :: Dom' t e -> Maybe (RewDom' t) -- | Get the flavor of the universe. Nothing could also mean "don't -- know". sortUniv :: Sort' t -> Maybe Univ -- | Removing a topmost DontCare constructor. stripDontCare :: Term -> Term suggests :: [Suggestion] -> String -- | Convert a list telescope to a telescope. telFromList :: ListTel -> Telescope telFromList' :: (a -> ArgName) -> ListTel' a -> Telescope -- | Convert a telescope to its list form. telToList :: Tele (Dom t) -> [Dom (ArgName, t)] tmSSort :: Term -> Sort tmSort :: Term -> Sort -- | Build partial ConPatternInfo from ConInfo toConPatternInfo :: ConInfo -> ConPatternInfo -- | Convert top-level postfix projections into prefix projections. unSpine :: Term -> Term -- | Convert Proj projection eliminations according to their -- ProjOrigin into Def projection applications. unSpine' :: (ProjOrigin -> QName -> Bool) -> Term -> Term unSpineLoop :: SpineHead -> Elims -> Elims -> Term -- | An unapplied variable. var :: Nat -> Term varP :: a -> Pattern' a varSort :: Int -> Sort varTable :: Array Term varTableSize :: Int -- | Binder. -- -- Abs: The bound variable might appear in the body. NoAbs -- is pseudo-binder, it does not introduce a fresh variable, similar to -- the const of Haskell. data Abs a -- | The body has (at least) one free variable. Danger: unAbs -- doesn't shift variables properly Abs :: ArgName -> a -> Abs a [absName] :: Abs a -> ArgName [unAbs] :: Abs a -> a NoAbs :: ArgName -> a -> Abs a [absName] :: Abs a -> ArgName [unAbs] :: Abs a -> a -- | Type of argument lists. type Args = [Arg Term] type Args1 = List1 Arg Term type Blocked = Blocked' Term -- | 'Blocked a without the a. type Blocked_ = Blocked () -- | Newtypes for terms that produce a dummy, rather than crash, when -- applied to incompatible eliminations. newtype BraveTerm BraveTerm :: Term -> BraveTerm [unBrave] :: BraveTerm -> Term -- | A clause is a list of patterns and the clause body. -- -- The telescope contains the types of the pattern variables and the de -- Bruijn indices say how to get from the order the variables occur in -- the patterns to the order they occur in the telescope. The body binds -- the variables in the order they appear in the telescope. -- --
--   clauseTel ~ permute clausePerm (patternVars namedClausePats)
--   
-- -- Terms in dot patterns are valid in the clause telescope. -- -- For the purpose of the permutation and the body dot patterns count as -- variables. TODO: Change this! data Clause Clause :: Range -> Range -> Telescope -> NAPs -> Maybe Term -> Maybe (Arg Type) -> Catchall -> ClauseRecursive -> Maybe Bool -> ExpandedEllipsis -> Maybe ModuleName -> Clause [clauseLHSRange] :: Clause -> Range [clauseFullRange] :: Clause -> Range -- | Δ: The types of the pattern variables in dependency order. [clauseTel] :: Clause -> Telescope -- | Δ ⊢ ps. The de Bruijn indices refer to Δ. [namedClausePats] :: Clause -> NAPs -- | Just v with Δ ⊢ v for a regular clause, or -- Nothing for an absurd one. [clauseBody] :: Clause -> Maybe Term -- | Δ ⊢ t. The type of the rhs under clauseTel. Used, -- e.g., by TermCheck. Can be Irrelevant if we -- encountered an irrelevant projection pattern on the lhs. [clauseType] :: Clause -> Maybe (Arg Type) -- | Clause has been labelled as CATCHALL. [clauseCatchall] :: Clause -> Catchall -- | clauseBody contains recursive calls? Computed by termination -- checker. [clauseRecursive] :: Clause -> ClauseRecursive -- | Clause has been labelled as unreachable by the coverage checker. -- Nothing means coverage checker has not run yet (clause may be -- unreachable). Just False means clause is not unreachable. -- Just True means clause is unreachable. [clauseUnreachable] :: Clause -> Maybe Bool -- | Was this clause created by expansion of an ellipsis? [clauseEllipsis] :: Clause -> ExpandedEllipsis -- | Keeps track of the module name associate with the clause's where -- clause. [clauseWhereModule] :: Clause -> Maybe ModuleName -- | Does the clause body contain calls to any of the mutually recursive -- functions? data ClauseRecursive -- | Definitely a call to a mutually recursive function. YesRecursive :: ClauseRecursive -- | Definitely no call to a mutually recursive function. NotRecursive :: ClauseRecursive -- | Don't know because the analysis has not run yet. MaybeRecursive :: ClauseRecursive -- | Store the names of the record fields in the constructor. This allows -- reduction of projection redexes outside of TCM. For instance, during -- substitution and application. data ConHead ConHead :: QName -> DataOrRecord -> Induction -> IsHIT -> [Arg QName] -> ConHead -- | The name of the constructor. [conName] :: ConHead -> QName -- | Data or record constructor? [conDataRecord] :: ConHead -> DataOrRecord -- | Record constructors can be coinductive. [conInductive] :: ConHead -> Induction -- | Is the datatype of this constructor a HIT? [conIsHIT] :: ConHead -> IsHIT -- | The name of the record fields. Arg is stored since the info in -- the constructor args might not be accurate because of subtyping (issue -- #2170). [conFields] :: ConHead -> [Arg QName] type ConInfo = ConOrigin -- | The ConPatternInfo states whether the constructor belongs to -- a record type (True) or data type (False). In the -- former case, the PatOrigin of the conPInfo says -- whether the record pattern orginates from the expansion of an implicit -- pattern. The Type is the type of the whole record pattern. -- The scope used for the type is given by any outer scope plus the -- clause's telescope (clauseTel). data ConPatternInfo ConPatternInfo :: PatternInfo -> Bool -> Bool -> Maybe (Arg Type) -> Bool -> MatchPrio -> ConPatternInfo -- | Information on the origin of the pattern. [conPInfo] :: ConPatternInfo -> PatternInfo -- | False if data constructor. True if record -- constructor. [conPRecord] :: ConPatternInfo -> Bool -- | Should the match block on non-canonical terms or can it proceed to the -- catch-all clause? [conPFallThrough] :: ConPatternInfo -> Bool -- | The type of the whole constructor pattern. Should be present -- (Just) if constructor pattern is is generated ordinarily by -- type-checking. Could be absent (Nothing) if pattern comes -- from some plugin (like Agsy). Needed e.g. for with-clause stripping. [conPType] :: ConPatternInfo -> Maybe (Arg Type) -- | Lazy patterns are generated by the forcing translation in the unifier -- (unifyStep) and are dropped by the clause compiler (TODO: not -- yet) (compileClauses) when the variables they bind are unused. -- The GHC backend compiles lazy matches to lazy patterns in Haskell -- (TODO: not yet). [conPLazy] :: ConPatternInfo -> Bool -- | Time when this pattern was constructed during LHS checking. This field -- is used during pattern matching with the non-compiled clauses. [conPPrio] :: ConPatternInfo -> MatchPrio -- | Type used when numbering pattern variables. data DBPatVar DBPatVar :: PatVarName -> Int -> DBPatVar [dbPatVarName] :: DBPatVar -> PatVarName [dbPatVarIndex] :: DBPatVar -> Int type DeBruijnPattern = Pattern' DBPatVar -- | NLPat might become definitionally singular (after a substitution) data DefSing -- | Never definitionally singular NeverSing :: DefSing -- | Might become definitionally singular after a substitution MaybeSing :: DefSing -- | Always definitionally singular (e.g. irrelevant or in |Prop|) AlwaysSing :: DefSing type Dom = Dom' Term -- | Similar to Arg, but we need to distinguish an irrelevance -- annotation in a function domain (the domain itself is not irrelevant!) -- from an irrelevant argument. -- -- Dom is used in Pi of internal syntax, in -- Context and Telescope. Arg is used for actual -- arguments (Var, Con, Def etc.) and in -- Abstract syntax and other situations. -- -- data Dom' t e Dom' :: DomInfo t -> e -> Dom' t e [domDomInfo] :: Dom' t e -> DomInfo t [unDom] :: Dom' t e -> e data DomInfo t DomInfo :: ArgInfo -> Maybe NamedName -> Bool -> Maybe t -> Maybe (RewDom' t) -> DomInfo t [domInfoArgInfo] :: DomInfo t -> ArgInfo -- | e.g. x in {x = y : A} -> B. [domInfoName] :: DomInfo t -> Maybe NamedName -- | Is this a Π-type (False), or a partial type (True)? [domInfoIsFinite] :: DomInfo t -> Bool -- | "@tactic e". [domInfoTactic] :: DomInfo t -> Maybe t -- | Elaborated "@rewrite" equation -- -- Will only be present if domain annotated with "rewrite" -- (annRewrite is IsRewrite@) AND the type successfully -- elaborated into a rewrite rule. [domInfoRew] :: DomInfo t -> Maybe (RewDom' t) -- | Terms used for internal purposes data DummyTermKind -- | Generic dummy term, the String generally describes where the -- term was generated (as well as giving a disambiguator). -- -- Should not be used to convey actual information. DummyNamed :: String -> DummyTermKind -- | Collects applications to a BraveTerm. DummyBrave :: Term -> DummyTermKind type Elim = Elim' Term type Elims = [Elim] data EqualityTypeData EqualityTypeData :: Range -> Sort -> QName -> Args -> Arg Term -> Arg Term -> Arg Term -> EqualityTypeData -- | Range of the rewrite expression, if any. [_eqtRange] :: EqualityTypeData -> Range -- | Sort of this type. [_eqtSort] :: EqualityTypeData -> Sort -- | Builtin EQUALITY. [_eqtName] :: EqualityTypeData -> QName -- | Hidden. Empty or Level. [_eqtParams] :: EqualityTypeData -> Args -- | Hidden. [_eqtType] :: EqualityTypeData -> Arg Term -- | NotHidden. [_eqtLhs] :: EqualityTypeData -> Arg Term -- | NotHidden. [_eqtRhs] :: EqualityTypeData -> Arg Term -- | View type as equality type. data EqualityView -- | A type of the form u ≡ v decomposed into its parts. Used as -- type for the rewrite expression. EqualityViewType :: EqualityTypeData -> EqualityView -- | A reduced type used as type for a with expression. OtherType :: Type -> EqualityView -- | A reduced type used as type for the with inspect idiom. IdiomType :: Type -> EqualityView data IntervalView IZero :: IntervalView IOne :: IntervalView IMin :: Arg Term -> Arg Term -> IntervalView IMax :: Arg Term -> Arg Term -> IntervalView INeg :: Arg Term -> IntervalView OTerm :: Term -> IntervalView class LensConName a getConName :: LensConName a => a -> QName setConName :: LensConName a => QName -> a -> a mapConName :: LensConName a => (QName -> QName) -> a -> a class LensLocalEquation a getLocalEq :: LensLocalEquation a => a -> Maybe LocalEquation class LensSort a lensSort :: LensSort a => Lens' a Sort getSort :: LensSort a => a -> Sort type Level = Level' Term -- | A level is a maximum expression of a closed level and 0..n -- PlusLevel expressions each of which is an atom plus a number. data Level' t Max :: Integer -> [PlusLevel' t] -> Level' t type LevelAtom = Term type ListTel = ListTel' ArgName -- | Telescope as list. type ListTel' a = [Dom (a, Type)] -- | Extra information attached to a LitP. data LitPatternInfo LitPatternInfo :: PatternInfo -> MatchPrio -> LitPatternInfo -- | Information on the origin of the pattern. [litPInfo] :: LitPatternInfo -> PatternInfo -- | Time when this pattern was constructed during LHS checking. This field -- is used during pattern matching with the non-compiled clauses. [litPPrio] :: LitPatternInfo -> MatchPrio type LocalEquation = LocalEquation' Term -- | Undirected equational constraint ("the LHS and RHS must be convertible -- in the calling context"). Admits arbitrary substitution. data LocalEquation' t LocalEquation :: Tele (Dom' t (Type'' t t)) -> t -> t -> Type'' t t -> LocalEquation' t [lEqContext] :: LocalEquation' t -> Tele (Dom' t (Type'' t t)) [lEqLHS] :: LocalEquation' t -> t [lEqRHS] :: LocalEquation' t -> t [lEqType] :: LocalEquation' t -> Type'' t t -- | For the sake of reducing clauses before they have compiled, we keep a -- match priority in the constructors (and literals) of patterns that is -- computed during lhs checking and decides whether a mismatch should be -- treated as a hard No. Matches that get available earlier have -- a lower priority. Lower priority wins, meaning that if we combine a -- DontKnow with a No we take the one with the lower -- priority. newtype MatchPrio MatchPrio :: Int -> MatchPrio [theMatchPrio] :: MatchPrio -> Int -- | Named pattern arguments. type NAPs = [NamedArg DeBruijnPattern] data NLPSort PUniv :: Univ -> NLPat -> NLPSort PInf :: Univ -> Integer -> NLPSort PSizeUniv :: NLPSort PLockUniv :: NLPSort PLevelUniv :: NLPSort PIntervalUniv :: NLPSort data NLPType NLPType :: NLPSort -> NLPat -> NLPType [nlpTypeSort] :: NLPType -> NLPSort [nlpTypeUnEl] :: NLPType -> NLPat -- | Non-linear (non-constructor) first-order pattern. data NLPat -- | Matches anything (modulo non-linearity) that only contains bound -- variables that occur in the given arguments. Tracks the definitional -- singularity of the surrounding pattern (not the type of the variable -- itself) PVar :: DefSing -> Int -> [Arg Int] -> NLPat -- | Matches f es PDef :: QName -> PElims -> NLPat -- | Matches λ x → t PLam :: ArgInfo -> Abs NLPat -> NLPat -- | Matches (x : A) → B PPi :: Dom NLPType -> Abs NLPType -> NLPat -- | Matches a sort of the given shape. PSort :: NLPSort -> NLPat -- | Matches x es where x is a lambda-bound variable PBoundVar :: Int -> PElims -> NLPat -- | Matches the term modulo β (ideally βη). PTerm :: Term -> NLPat type NamedArgs = [NamedArg Term] type NamedArgs1 = List1 NamedArg Term -- | Wrapper for types that do not contain variables (so applying a -- substitution is the identity). Useful if you have a structure of types -- that support substitution mixed with types that don't and need to -- apply a substitution to the full structure. newtype NoSubst t a NoSubst :: a -> NoSubst t a [unNoSubst] :: NoSubst t a -> a type NotBlocked = NotBlocked' Term type PElims = [Elim' NLPat] -- | Origin of the pattern: what did the user write in this position? data PatOrigin -- | Pattern inserted by the system PatOSystem :: PatOrigin -- | Pattern generated by case split PatOSplit :: PatOrigin -- | Argument to pattern generated by case split PatOSplitArg :: ArgName -> PatOrigin -- | User wrote a variable pattern PatOVar :: Name -> PatOrigin -- | User wrote a dot pattern PatODot :: PatOrigin -- | User wrote a wildcard pattern PatOWild :: PatOrigin -- | User wrote a constructor pattern PatOCon :: PatOrigin -- | User wrote a record pattern PatORec :: PatOrigin -- | User wrote a literal pattern PatOLit :: PatOrigin -- | User wrote an absurd pattern PatOAbsurd :: PatOrigin -- | Pattern variables. type PatVarName = ArgName -- | View type as path type. data PathView PathType :: Sort -> QName -> Arg Term -> Arg Term -> Arg Term -> Arg Term -> PathView -- | Sort of this type. [pathSort] :: PathView -> Sort -- | Builtin PATH. [pathName] :: PathView -> QName -- | Hidden [pathLevel] :: PathView -> Arg Term -- | Hidden [pathType] :: PathView -> Arg Term -- | NotHidden [pathLhs] :: PathView -> Arg Term -- | NotHidden [pathRhs] :: PathView -> Arg Term -- | reduced OType :: Type -> PathView type Pattern = Pattern' PatVarName -- | Patterns are variables, constructors, or wildcards. QName is -- used in ConP rather than Name since a constructor -- might come from a particular namespace. This also meshes well with the -- fact that values (i.e. the arguments we are matching with) use -- QName. data Pattern' x -- |
--   x
--   
VarP :: PatternInfo -> x -> Pattern' x -- |
--   .t
--   
DotP :: PatternInfo -> Term -> Pattern' x -- | c ps The subpatterns do not contain any projection -- copatterns. ConP :: ConHead -> ConPatternInfo -> [NamedArg (Pattern' x)] -> Pattern' x -- | E.g. 5, "hello". LitP :: LitPatternInfo -> Literal -> Pattern' x -- | Projection copattern. Can only appear by itself. ProjP :: ProjOrigin -> QName -> Pattern' x -- | Path elimination pattern, like VarP but keeps track of -- endpoints. IApplyP :: PatternInfo -> Term -> Term -> x -> Pattern' x -- | Used for HITs, the QName should be the one from primHComp. DefP :: PatternInfo -> QName -> [NamedArg (Pattern' x)] -> Pattern' x data PatternInfo PatternInfo :: PatOrigin -> [Name] -> PatternInfo [patOrigin] :: PatternInfo -> PatOrigin [patAsNames] :: PatternInfo -> [Name] type PatternSubstitution = Substitution' DeBruijnPattern type family PatternVarOut a -- | Extract pattern variables in left-to-right order. A DotP is -- also treated as variable (see docu for Clause). class PatternVars a where { type PatternVarOut a; } patternVars :: PatternVars a => a -> [Arg (Either (PatternVarOut a) Term)] type PlusLevel = PlusLevel' Term data PlusLevel' t Plus :: Integer -> t -> PlusLevel' t type Renaming = Substitution' Nat type RewDom = RewDom' Term data RewDom' t RewDom :: LocalEquation' t -> Maybe RewriteRule -> RewDom' t -- | Elaborated "@rewrite" equation [rewDomEq] :: RewDom' t -> LocalEquation' t -- | "@rewrite" equation transformed into a directed rewrite rule. -- -- Nothing iff invalidated by a substitution. If we are checking -- against an "rewrite" domain, this is fine, but if we are inside an -- "rewrite" context, this is probably an internal error. [rewDomRew] :: RewDom' t -> Maybe RewriteRule data RewriteHead RewDefHead :: QName -> RewriteHead -- | de Bruijn index of head symbol (excluding rewContext variables) RewVarHead :: Nat -> RewriteHead -- | Directed rewrite rules generic over the type of head symbol. Generally -- unstable under substitution. data RewriteRule RewriteRule :: Telescope -> RewriteHead -> PElims -> Term -> Type -> RewriteRule [rewContext] :: RewriteRule -> Telescope [rewHead] :: RewriteRule -> RewriteHead [rewPats] :: RewriteRule -> PElims [rewRHS] :: RewriteRule -> Term [rewType] :: RewriteRule -> Type -- | Constructing a singleton telescope. class SgTel a sgTel :: SgTel a => a -> Telescope type Sort = Sort' Term -- | Sorts. data Sort' t -- | Prop ℓ, Set ℓ, SSet ℓ. Univ :: Univ -> Level' t -> Sort' t -- | Propωᵢ, (S)Setωᵢ. Inf :: Univ -> Integer -> Sort' t -- | SizeUniv, a sort inhabited by type Size. SizeUniv :: Sort' t -- | LockUniv, a sort for locks. LockUniv :: Sort' t -- | LevelUniv, a sort inhabited by type Level. When -- --level-universe isn't on, this universe reduces to Set 0 LevelUniv :: Sort' t -- | IntervalUniv, a sort inhabited by the cubical interval. IntervalUniv :: Sort' t -- | Sort of the pi type (x : A) → B. The components are the -- domain A (as a bare term), the sort s1 of -- A, and the sort s2 of B in the context -- extended by x : A. -- -- The sort denoted by PiSort A s1 s2 only depends on -- s1 and s2. The domain A is kept around so -- that we can rebuild the type El s1 A needed to extend -- the context when we have to work under the binder of s2; see -- e.g. reduceB' for sorts or piSortEquals. PiSort :: Dom' t t -> Sort' t -> Abs (Sort' t) -> Sort' t -- | Sort of a (non-dependent) function type. FunSort :: Sort' t -> Sort' t -> Sort' t -- | Sort of another sort ("successor sort"). UnivSort :: Sort' t -> Sort' t -- | Sort metavariable. MetaS :: MetaId -> [Elim' t] -> Sort' t -- | A postulated sort. DefS :: QName -> [Elim' t] -> Sort' t -- | A (part of a) term or type which is only used for internal purposes. -- Replaces the abuse of Prop for a dummy sort. The -- String typically describes the location where we create this -- dummy, but can contain other information as well. DummyS :: String -> Sort' t data SpineHead SpineHead :: SpineHead' -> SpineHead data SpineHead' SHVar :: Int -> SpineHead' SHDef :: QName -> SpineHead' SHMetaV :: MetaId -> SpineHead' type Substitution = Substitution' Term -- | Substitutions. data Substitution' a -- | Identity substitution. Γ ⊢ IdS : Γ IdS :: Substitution' a -- | Empty substitution, lifts from the empty context. First argument is -- IMPOSSIBLE. Apply this to closed terms you want to use -- in a non-empty context. Γ ⊢ EmptyS : () EmptyS :: Impossible -> Substitution' a -- | Substitution extension, `cons'. Γ ⊢ u : Aρ Γ ⊢ ρ : Δ -- ---------------------- Γ ⊢ u :# ρ : Δ, A (:#) :: a -> Substitution' a -> Substitution' a -- | Strengthening substitution. First argument is -- IMPOSSIBLE. In 'Strengthen err n ρ the number -- n must be non-negative. This substitution should only be -- applied to values t for which none of the variables -- 0 up to n - 1 are free in t[ρ], and in that -- case n is subtracted from all free de Bruijn indices in -- t[ρ]. Γ ⊢ ρ : Δ |Θ| = n --------------------------- Γ ⊢ -- Strengthen n ρ : Δ, Θ @ Strengthen :: Impossible -> Int -> Substitution' a -> Substitution' a -- | Weakening substitution, lifts to an extended context. Γ ⊢ ρ : Δ -- ------------------- Γ, Ψ ⊢ Wk |Ψ| ρ : Δ Wk :: Int -> Substitution' a -> Substitution' a -- | Lifting substitution. Use this to go under a binder. Lift 1 ρ == -- var 0 :# Wk 1 ρ. Γ ⊢ ρ : Δ ------------------------- Γ, Ψρ ⊢ -- Lift |Ψ| ρ : Δ, Ψ Lift :: Int -> Substitution' a -> Substitution' a infixr 4 :# -- | Suggest a name if available (i.e. name is not "_") class Suggest a suggestName :: Suggest a => a -> Maybe String data Suggestion Suggestion :: a -> Suggestion -- | Drop the types from a telescope. class TelToArgs a telToArgs :: TelToArgs a => a -> [Arg ArgName] -- | Sequence of types. An argument of the first type is bound in later -- types and so on. data Tele a EmptyTel :: Tele a -- | Abs is never NoAbs. ExtendTel :: a -> Abs (Tele a) -> Tele a type Telescope = Tele Dom Type -- | Raw values. -- -- Def is used for both defined and undefined constants. Assume -- there is a type declaration and a definition for every constant, even -- if the definition is an empty list of clauses. data Term -- | x es neutral Var' :: Int -> Elims -> Term -- | Terms are beta normal. Relevance is ignored Lam :: ArgInfo -> Abs Term -> Term Lit :: Literal -> Term -- | f es, possibly a delta/iota-redex Def :: QName -> Elims -> Term -- | c es or record { fs = es } es allows only -- Apply and IApply eliminations, and IApply only for data constructors. Con :: ConHead -> ConInfo -> Elims -> Term -- | dependent or non-dependent function space Pi :: Dom Type -> Abs Type -> Term Sort :: Sort -> Term Level :: Level -> Term MetaV :: MetaId -> Elims -> Term -- | Irrelevant stuff in relevant position, but created in an irrelevant -- context. Basically, an internal version of the irrelevance axiom -- .irrAx : .A -> A. DontCare :: Term -> Term -- | A (part of a) term or type which is only used for internal purposes. -- -- The DummyTermKind describes why this dummy was created; -- typically, it is a string describing the source location that created -- it, but dummy terms are also used when *leaving* the type checker -- (through reification) to convey out-of-band information. -- -- The second field accumulates eliminations in case we apply a dummy -- term to more of them. Dummy terms should never be used in places where -- they can affect type checking, so syntactic checks are free to ignore -- the eliminators, which are only there to ease debugging when a dummy -- term incorrectly leaks into a relevant position. Dummy :: DummyTermKind -> Elims -> Term -- | The size of a term is roughly the number of nodes in its syntax tree. -- This number need not be precise for logical correctness of Agda, it is -- only used for reporting (and maybe decisions regarding performance). -- -- Not counting towards the term size are: -- -- class TermSize a termSize :: TermSize a => a -> Int tsize :: TermSize a => a -> Sum Int type Type = Type' Term type Type' a = Type'' Term a -- | Types are terms with a sort annotation. data Type'' t a El :: Sort' t -> a -> Type'' t a [_getSort] :: Type'' t a -> Sort' t [unEl] :: Type'' t a -> a type family TypeOf a data UnivSize -- | PropSetSSet ℓ. USmall :: UnivSize -- | (PropSetSSet)ωᵢ. ULarge :: UnivSize -- | Meta-variable identifiers use the same structure as NameIds. data MetaId MetaId :: Word64 -> ModuleNameHash -> MetaId [metaId] :: MetaId -> Word64 [metaModule] :: MetaId -> ModuleNameHash -- | A "problem" consists of a set of constraints and the same constraint -- can be part of multiple problems. newtype ProblemId ProblemId :: Word64 -> ProblemId instance GHC.Internal.Enum.Bounded Agda.Syntax.Internal.ClauseRecursive instance GHC.Internal.Enum.Bounded Agda.Syntax.Internal.DefSing instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.Syntax.Internal.ConHead instance Agda.Utils.Functor.Decoration Agda.Syntax.Internal.Abs instance Agda.Utils.Functor.Decoration (Agda.Syntax.Internal.Dom' t) instance Agda.Utils.Functor.Decoration (Agda.Syntax.Internal.Type'' t) instance GHC.Internal.Enum.Enum Agda.Syntax.Internal.ClauseRecursive instance GHC.Internal.Enum.Enum Agda.Syntax.Internal.DefSing instance GHC.Internal.Enum.Enum Agda.Syntax.Internal.MatchPrio instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.ClauseRecursive instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.ConHead instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.DBPatVar instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Dom' t a) instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.LitPatternInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.MatchPrio instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.PatOrigin instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.PatternInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.RewriteHead instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.UnivSize instance Agda.Utils.ExpandCase.ExpandCase (Agda.Syntax.Internal.Tele a) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.Abs instance GHC.Internal.Data.Foldable.Foldable (Agda.Syntax.Internal.Dom' t) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.Level' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.Pattern' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.PlusLevel' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.Substitution' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Internal.Tele instance GHC.Internal.Data.Foldable.Foldable (Agda.Syntax.Internal.Type'' t) instance GHC.Internal.Base.Functor Agda.Syntax.Internal.Abs instance GHC.Internal.Base.Functor (Agda.Syntax.Internal.Dom' t) instance GHC.Internal.Base.Functor Agda.Syntax.Internal.Level' instance GHC.Internal.Base.Functor (Agda.Syntax.Internal.NoSubst t) instance GHC.Internal.Base.Functor Agda.Syntax.Internal.Pattern' instance GHC.Internal.Base.Functor Agda.Syntax.Internal.PlusLevel' instance GHC.Internal.Base.Functor Agda.Syntax.Internal.Substitution' instance GHC.Internal.Base.Functor Agda.Syntax.Internal.Tele instance GHC.Internal.Base.Functor (Agda.Syntax.Internal.Type'' t) instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.Abs a) instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.Clause instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.ClauseRecursive instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.ConHead instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.ConPatternInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.DBPatVar instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.DefSing instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.LitPatternInfo instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.LocalEquation' t) instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.NLPSort instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.NLPType instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.NLPat instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.NoSubst t a) instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.PatOrigin instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.Pattern' x) instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.PatternInfo instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.RewDom' t) instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.RewriteHead instance GHC.Internal.Generics.Generic Agda.Syntax.Internal.RewriteRule instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.Substitution' a) instance GHC.Internal.Generics.Generic (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Internal.Clause instance Agda.Syntax.Position.HasRange Agda.Syntax.Internal.ConHead instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Internal.Dom' t a) instance Agda.Syntax.Abstract.Name.IsProjP (Agda.Syntax.Internal.Pattern' a) instance GHC.Internal.Data.String.IsString Agda.Syntax.Internal.DummyTermKind instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Blocked a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Clause instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.ClauseRecursive instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.ConHead instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.ConPatternInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.DBPatVar instance (Agda.Syntax.Position.KillRange t, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Dom' t a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Level' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.LitPatternInfo instance Agda.Syntax.Position.KillRange t => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.LocalEquation' t) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.MatchPrio instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.NLPSort instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.NLPType instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.NLPat instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PatOrigin instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Pattern' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PatternInfo instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.PlusLevel' a) instance Agda.Syntax.Position.KillRange t => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.RewDom' t) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.RewriteHead instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.RewriteRule instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Sort' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Substitution instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Term instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Type'' a b) instance Agda.Syntax.Common.LensAnnotation (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensArgInfo (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensCohesion (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Internal.LensConName Agda.Syntax.Internal.ConHead instance Agda.Syntax.Common.LensFreeVariables (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Internal.LensLocalEquation (Agda.Syntax.Internal.Dom e) instance Agda.Syntax.Common.LensLock (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensModalPolarity (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensModality (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensNamed (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensQuantity (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensRelevance (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensRewriteAnn (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Internal.LensSort a => Agda.Syntax.Internal.LensSort (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.LensSort a => Agda.Syntax.Internal.LensSort (Agda.Syntax.Internal.Dom a) instance Agda.Syntax.Internal.LensSort Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.LensSort (Agda.Syntax.Internal.Type' a) instance GHC.Internal.Base.Monoid Agda.Syntax.Internal.MatchPrio instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Abs a) instance Control.DeepSeq.NFData Agda.Syntax.Internal.Clause instance Control.DeepSeq.NFData Agda.Syntax.Internal.ClauseRecursive instance Control.DeepSeq.NFData Agda.Syntax.Internal.ConHead instance Control.DeepSeq.NFData Agda.Syntax.Internal.ConPatternInfo instance Control.DeepSeq.NFData Agda.Syntax.Internal.DBPatVar instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.DataOrRecord' a) instance Control.DeepSeq.NFData Agda.Syntax.Internal.DefSing instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Internal.Dom e) instance Control.DeepSeq.NFData Agda.Syntax.Internal.Univ.IsFibrant instance Control.DeepSeq.NFData Agda.Syntax.Internal.Level instance Control.DeepSeq.NFData Agda.Syntax.Internal.LitPatternInfo instance Control.DeepSeq.NFData Agda.Syntax.Internal.LocalEquation instance Control.DeepSeq.NFData Agda.Syntax.Internal.MatchPrio instance Control.DeepSeq.NFData Agda.Syntax.Internal.NLPSort instance Control.DeepSeq.NFData Agda.Syntax.Internal.NLPType instance Control.DeepSeq.NFData Agda.Syntax.Internal.NLPat instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.NoSubst t a) instance Control.DeepSeq.NFData Agda.Syntax.Internal.PatOrigin instance Control.DeepSeq.NFData x => Control.DeepSeq.NFData (Agda.Syntax.Internal.Pattern' x) instance Control.DeepSeq.NFData Agda.Syntax.Internal.PatternInfo instance Control.DeepSeq.NFData Agda.Syntax.Internal.PlusLevel instance Control.DeepSeq.NFData Agda.Syntax.Internal.RewDom instance Control.DeepSeq.NFData Agda.Syntax.Internal.RewriteHead instance Control.DeepSeq.NFData Agda.Syntax.Internal.RewriteRule instance Control.DeepSeq.NFData Agda.Syntax.Internal.Sort instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Substitution' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Tele a) instance Control.DeepSeq.NFData Agda.Syntax.Internal.Term instance Control.DeepSeq.NFData Agda.Syntax.Internal.Type instance Agda.Utils.Null.Null Agda.Syntax.Internal.Clause instance Agda.Utils.Null.Null Agda.Syntax.Internal.ClauseRecursive instance Agda.Utils.Null.Null Agda.Syntax.Internal.LitPatternInfo instance Agda.Utils.Null.Null Agda.Syntax.Internal.MatchPrio instance Agda.Utils.Null.Null Agda.Syntax.Internal.PatternInfo instance Agda.Utils.Null.Null (Agda.Syntax.Internal.Substitution' a) instance Agda.Utils.Null.Null (Agda.Syntax.Internal.Tele a) instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.ConHead instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.MatchPrio instance Agda.Syntax.Internal.PatternVars (Agda.Syntax.Common.Arg (Agda.Syntax.Internal.Pattern' a)) instance Agda.Syntax.Internal.PatternVars (Agda.Syntax.Common.NamedArg (Agda.Syntax.Internal.Pattern' a)) instance Agda.Syntax.Internal.PatternVars a => Agda.Syntax.Internal.PatternVars [a] instance Agda.Syntax.Common.Pretty.Pretty t => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Abs t) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Blocked a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.Clause instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.ClauseRecursive instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.ConHead instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.DBPatVar instance (Agda.Syntax.Common.Pretty.Pretty t, Agda.Syntax.Common.Pretty.Pretty e) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.Level instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.NoSubst t a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Pattern' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.Sort instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Substitution' a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Internal.Tele (Agda.Syntax.Internal.Dom a)) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.Term instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Internal.Type instance GHC.Internal.Base.Semigroup Agda.Syntax.Internal.MatchPrio instance Agda.Syntax.Position.SetRange Agda.Syntax.Internal.ConHead instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Internal.Dom (Agda.Syntax.Common.ArgName, Agda.Syntax.Internal.Type)) instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Common.ArgName, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Internal.Abs a) instance GHC.Internal.Show.Show Agda.Syntax.Internal.BraveTerm instance GHC.Internal.Show.Show Agda.Syntax.Internal.Clause instance GHC.Internal.Show.Show Agda.Syntax.Internal.ClauseRecursive instance GHC.Internal.Show.Show Agda.Syntax.Internal.ConHead instance GHC.Internal.Show.Show Agda.Syntax.Internal.ConPatternInfo instance GHC.Internal.Show.Show Agda.Syntax.Internal.DBPatVar instance GHC.Internal.Show.Show Agda.Syntax.Internal.DefSing instance (GHC.Internal.Show.Show t, GHC.Internal.Show.Show e) => GHC.Internal.Show.Show (Agda.Syntax.Internal.Dom' t e) instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.DomInfo t) instance GHC.Internal.Show.Show Agda.Syntax.Internal.DummyTermKind instance GHC.Internal.Show.Show Agda.Syntax.Internal.IntervalView instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.Level' t) instance GHC.Internal.Show.Show Agda.Syntax.Internal.LitPatternInfo instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.LocalEquation' t) instance GHC.Internal.Show.Show Agda.Syntax.Internal.MatchPrio instance GHC.Internal.Show.Show Agda.Syntax.Internal.NLPSort instance GHC.Internal.Show.Show Agda.Syntax.Internal.NLPType instance GHC.Internal.Show.Show Agda.Syntax.Internal.NLPat instance GHC.Internal.Show.Show Agda.Syntax.Internal.PatOrigin instance GHC.Internal.Show.Show x => GHC.Internal.Show.Show (Agda.Syntax.Internal.Pattern' x) instance GHC.Internal.Show.Show Agda.Syntax.Internal.PatternInfo instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.PlusLevel' t) instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.RewDom' t) instance GHC.Internal.Show.Show Agda.Syntax.Internal.RewriteHead instance GHC.Internal.Show.Show Agda.Syntax.Internal.RewriteRule instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Internal.Sort' t) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Internal.Substitution' a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Internal.Tele a) instance GHC.Internal.Show.Show Agda.Syntax.Internal.Term instance (GHC.Internal.Show.Show t, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Agda.Syntax.Internal.Type'' t a) instance GHC.Internal.Show.Show Agda.Syntax.Internal.UnivSize instance Agda.Utils.Size.Sized a => Agda.Utils.Size.Sized (Agda.Syntax.Internal.Abs a) instance Agda.Utils.Size.Sized (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Internal.Suggest (Agda.Syntax.Internal.Abs b) instance Agda.Syntax.Internal.Suggest GHC.Internal.Base.String instance Agda.Syntax.Internal.Suggest Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Internal.Suggest Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.TelToArgs Agda.Syntax.Internal.ListTel instance Agda.Syntax.Internal.TelToArgs Agda.Syntax.Internal.Telescope instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.TermSize a => Agda.Syntax.Internal.TermSize (Agda.Syntax.Internal.Substitution' a) instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.Term instance (GHC.Internal.Data.Foldable.Foldable t, Agda.Syntax.Internal.TermSize a) => Agda.Syntax.Internal.TermSize (t a) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.Abs instance GHC.Internal.Data.Traversable.Traversable (Agda.Syntax.Internal.Dom' t) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.Level' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.Pattern' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.PlusLevel' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.Substitution' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Internal.Tele instance GHC.Internal.Data.Traversable.Traversable (Agda.Syntax.Internal.Type'' t) module Agda.TypeChecking.Substitute.DeBruijn -- | Things we can substitute for a variable. Needs to be able to represent -- variables, e.g. for substituting under binders. class DeBruijn a -- | Produce a variable without name suggestion. deBruijnVar :: DeBruijn a => Int -> a -- | Produce a variable with name suggestion. deBruijnNamedVar :: DeBruijn a => String -> Int -> a -- | Are we dealing with a variable? If yes, what is its index? deBruijnView :: DeBruijn a => a -> Maybe Int instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Common.Nat instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.Level instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn a => Agda.TypeChecking.Substitute.DeBruijn.DeBruijn (Agda.Syntax.Common.Named_ a) instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.Term module Agda.TypeChecking.Positivity.Warnings -- | Description of an occurrence. data OccursWhere -- | The elements of the sequences, read from left to right, explain how to -- get to the occurrence. The second sequence includes the main -- information, and if the first sequence is non-empty, then it includes -- information about the context of the second sequence. OccursWhere :: Range -> Seq Where -> Seq Where -> OccursWhere -- | One part of the description of an occurrence. data Where LeftOfArrow :: Where -- | in the nth argument of a define constant DefArg :: QName -> Nat -> Where -- | in the principal argument of built-in ∞ UnderInf :: Where -- | as an argument to a bound variable. VarArg :: Occurrence -> Nat -> Where -- | as an argument of a metavariable MetaArg :: Where -- | in the type of a constructor ConArgType :: QName -> Where -- | in a datatype index of a constructor IndArgType :: QName -> Where -- | in an endpoint of a higher constructor ConEndpoint :: QName -> Where -- | in the nth clause of a defined function InClause :: Nat -> Where -- | matched against in a clause of a defined function Matched :: Where -- | is an index of an inductive family InIndex :: Where -- | in a sort, e.g. in the level of a universe InSort :: Where -- | in the definition of a constant InDefOf :: QName -> Where -- | The map contains bindings of the form bound |-> ess, -- satisfying the following property: for every non-empty list -- w, foldr1 otimes w <= bound -- iff or [ all every w && any -- some w | (every, some) <- ess ]. boundToEverySome :: Map Occurrence [(Occurrence -> Bool, Occurrence -> Bool)] -- | productOfEdgesInBoundedWalk occ g u v bound returns a value -- distinct from Nothing iff there is a walk c (a list of -- edges) in g, from u to v, for which the -- product foldr1 otimes (map occ c) -- <= bound. In this case the returned value is -- Just (foldr1 otimes c) for one such walk -- c. -- -- Preconditions: u and v must belong to g, -- and bound must belong to the domain of -- boundToEverySome. -- -- There is a property for this function in -- Internal.Utils.Graph.AdjacencyMap.Unidirectional. productOfEdgesInBoundedWalk :: (SemiRing e, Ord n) => (e -> Occurrence) -> Graph n e -> n -> n -> Occurrence -> Maybe e instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.Warnings.OccursWhere instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.Warnings.Where instance GHC.Internal.Generics.Generic Agda.TypeChecking.Positivity.Warnings.OccursWhere instance GHC.Internal.Generics.Generic Agda.TypeChecking.Positivity.Warnings.Where instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Warnings.OccursWhere instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Warnings.Where instance Agda.Utils.Null.Null Agda.TypeChecking.Positivity.Warnings.OccursWhere instance GHC.Internal.Classes.Ord Agda.TypeChecking.Positivity.Warnings.OccursWhere instance GHC.Internal.Classes.Ord Agda.TypeChecking.Positivity.Warnings.Where instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Positivity.Warnings.OccursWhere instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Positivity.Warnings.Where instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.Warnings.OccursWhere instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.Warnings.Where -- | Precompute free variables in a term (and store in ArgInfo). module Agda.TypeChecking.Free.Precompute class PrecomputeFreeVars a precomputeFreeVars :: PrecomputeFreeVars a => a -> FV a precomputedFreeVars :: PrecomputeFreeVars a => a -> VarSet precomputeFreeVars_ :: PrecomputeFreeVars a => a -> a instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Level instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars [a] instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a, Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars b) => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (a, b) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Type module Agda.TypeChecking.Free.Base -- | A set of meta variables. Forms a monoid under union. newtype MetaSet MetaSet :: HashSet MetaId -> MetaSet [theMetaSet] :: MetaSet -> HashSet MetaId insertMetaSet :: MetaId -> MetaSet -> MetaSet foldrMetaSet :: (MetaId -> a -> a) -> a -> MetaSet -> a metaSetToBlocker :: MetaSet -> Blocker -- | Depending on the surrounding context of a variable, it's occurrence -- can be classified as flexible or rigid, with finer distinctions. -- -- The constructors are listed in increasing order (wrt. information -- content). data FlexRig' a -- | In arguments of metas. The set of metas is used by -- 'NonLinMatch' to generate the right blocking information. The -- semantics is that the status of a variable occurrence may change if -- one of the metas in the set gets solved. We may say the occurrence is -- tainted by the meta variables in the set. Flexible :: a -> FlexRig' a -- | In arguments to variables and definitions. WeaklyRigid :: FlexRig' a -- | In top position, or only under inductive record constructors (unit). Unguarded :: FlexRig' a -- | Under at least one and only inductive constructors. StronglyRigid :: FlexRig' a type FlexRig = FlexRig' MetaSet class LensFlexRig o a | o -> a lensFlexRig :: LensFlexRig o a => Lens' o (FlexRig' a) isFlexible :: LensFlexRig o a => o -> Bool isUnguarded :: LensFlexRig o a => o -> Bool isWeaklyRigid :: LensFlexRig o a => o -> Bool isStronglyRigid :: LensFlexRig o a => o -> Bool -- | FlexRig aggregation (additive operation of the semiring). For -- combining occurrences of the same variable in subterms. This is a -- refinement of the max operation for FlexRig which would -- work if Flexible did not have the MetaSet as an -- argument. Now, to aggregate two Flexible occurrences, we union -- the involved MetaSets. addFlexRig :: Semigroup a => FlexRig' a -> FlexRig' a -> FlexRig' a -- | Unit for addFlexRig. zeroFlexRig :: Monoid a => FlexRig' a -- | Absorptive for addFlexRig. omegaFlexRig :: FlexRig' a -- | FlexRig composition (multiplicative operation of the semiring). -- For accumulating the context of a variable. -- -- Flexible is dominant. Once we are under a meta, we are flexible -- regardless what else comes. We taint all variable occurrences under a -- meta by this meta. -- -- WeaklyRigid is next in strength. Destroys strong rigidity. -- -- StronglyRigid is still dominant over Unguarded. -- -- Unguarded is the unit. It is the top (identity) context. composeFlexRig :: Semigroup a => FlexRig' a -> FlexRig' a -> FlexRig' a -- | Unit for composeFlexRig. oneFlexRig :: FlexRig' a -- | Extract a blocker from an occurrence flexRigToBlocker :: FlexRig -> Blocker -- | Occurrence of free variables is classified by several dimensions. -- Currently, we have FlexRig and Modality. data VarOcc' a VarOcc :: FlexRig' a -> Modality -> VarOcc' a [varFlexRig] :: VarOcc' a -> FlexRig' a [varModality] :: VarOcc' a -> Modality type VarOcc = VarOcc' MetaSet -- | The absorptive element of variable occurrence under aggregation: -- strongly rigid, relevant. topVarOcc :: VarOcc' a -- | First argument is the outer occurrence (context) and second is the -- inner. This multiplicative operation is to modify an occurrence under -- a context. composeVarOcc :: Semigroup a => VarOcc' a -> VarOcc' a -> VarOcc' a oneVarOcc :: VarOcc' a -- | What's the rigidity of a constructor? constructorFlexRig :: ConHead -> Elims -> FlexRig' a -- | Representation of a variable set as map from de Bruijn indices to -- VarOcc. type TheVarMap' a = IntMap VarOcc' a newtype VarMap' a VarMap :: TheVarMap' a -> VarMap' a [theVarMap] :: VarMap' a -> TheVarMap' a type TheVarMap = TheVarMap' MetaSet type VarMap = VarMap' MetaSet mapVarMap :: (TheVarMap' a -> TheVarMap' b) -> VarMap' a -> VarMap' b lookupVarMap :: Variable -> VarMap' a -> Maybe (VarOcc' a) newtype VarCounts VarCounts :: IntMap Int -> VarCounts [varCounts] :: VarCounts -> IntMap Int -- | Where should we skip sorts in free variable analysis? data IgnoreSorts -- | Do not skip. IgnoreNot :: IgnoreSorts -- | Skip when annotation to a type. IgnoreInAnnotations :: IgnoreSorts -- | Skip unconditionally. IgnoreAll :: IgnoreSorts type Variable = Int instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Free.Base.FlexRig' a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Free.Base.IgnoreSorts instance GHC.Internal.Classes.Eq Agda.TypeChecking.Free.Base.MetaSet instance GHC.Internal.Classes.Eq Agda.TypeChecking.Free.Base.VarCounts instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Free.Base.VarMap' a) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Free.Base.VarOcc' a) instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Free.Base.FlexRig' instance GHC.Internal.Base.Functor Agda.TypeChecking.Free.Base.FlexRig' instance Agda.TypeChecking.Free.Base.LensFlexRig (Agda.TypeChecking.Free.Base.FlexRig' a) a instance Agda.TypeChecking.Free.Base.LensFlexRig (Agda.TypeChecking.Free.Base.VarOcc' a) a instance Agda.Syntax.Common.LensModality (Agda.TypeChecking.Free.Base.VarOcc' a) instance Agda.Syntax.Common.LensQuantity (Agda.TypeChecking.Free.Base.VarOcc' a) instance Agda.Syntax.Common.LensRelevance (Agda.TypeChecking.Free.Base.VarOcc' a) instance GHC.Internal.Base.Monoid Agda.TypeChecking.Free.Base.MetaSet instance GHC.Internal.Base.Monoid Agda.TypeChecking.Free.Base.VarCounts instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Monoid (Agda.TypeChecking.Free.Base.VarMap' a) instance GHC.Internal.Base.Monoid a => GHC.Internal.Base.Monoid (Agda.TypeChecking.Free.Base.VarOcc' a) instance Agda.Utils.Null.Null Agda.TypeChecking.Free.Base.MetaSet instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Free.Base.FlexRig' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Free.Base.MetaSet instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Free.Base.VarOcc' a) instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Free.Base.MetaSet instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Free.Base.VarCounts instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Agda.TypeChecking.Free.Base.VarMap' a) instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Agda.TypeChecking.Free.Base.VarOcc' a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Free.Base.FlexRig' a) instance GHC.Internal.Show.Show Agda.TypeChecking.Free.Base.IgnoreSorts instance GHC.Internal.Show.Show Agda.TypeChecking.Free.Base.MetaSet instance GHC.Internal.Show.Show Agda.TypeChecking.Free.Base.VarCounts instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Free.Base.VarMap' a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Free.Base.VarOcc' a) instance Agda.Utils.Singleton.Singleton Agda.TypeChecking.Free.Base.Variable (Agda.TypeChecking.Free.Base.VarMap' a) instance Agda.Utils.Singleton.Singleton Agda.Syntax.Common.MetaId Agda.TypeChecking.Free.Base.MetaSet -- | Computing free variables of a term generically. Different queries can -- be specialized to the appropriate short-circuiting behavior and to -- only pass around the necessary data. A query can be written as an -- instance to the ComputeFree class which bundles all parameters -- of the generic traversal. The traversal itself is defined in the -- instance of the Free class. See Agda.TypeChecking.Free for -- examples of queries. -- -- Background notes: -- -- The distinction between rigid and strongly rigid occurrences comes -- from: Jason C. Reed, PhD thesis, 2009, page 96 (see also his LFMTP -- 2009 paper) -- -- The main idea is that x = t(x) is unsolvable if x occurs strongly -- rigidly in t. It might have a solution if the occurrence is not -- strongly rigid, e.g. -- -- x = f -> suc (f (x ( y -> k))) has x = f -> suc (f (suc k)) -- -- -- -- Under coinductive constructors, occurrences are never strongly rigid. -- Also, function types and lambdas do not establish strong rigidity. -- Only inductive constructors do so. (See issue 1271). -- -- For further reading on semirings and semimodules for variable -- occurrence, see e.g. Conor McBrides "I got plenty of nuttin'" -- (Wadlerfest 2016). There, he treats the "quantity" dimension of -- variable occurrences. -- -- The semiring has an additive operation for combining occurrences of -- subterms, and a multiplicative operation of representing function -- composition. E.g. if variable x appears o in term -- u, but u appears in context q in term -- t then occurrence of variable x coming from -- u is accounted for as q o in t. -- -- Consider the example (λ{ x → (x,x)}) y: -- -- -- -- If , is a record constructor, then we stay unguarded. -- -- -- -- It is not a given that the context can be described in the same way as -- the variable occurrence. However, for the purpose of quantity it is -- the case and we obtain a semiring of occurrences with 0, 1, and even -- ω, which is an absorptive element for addition. module Agda.TypeChecking.Free.Generic -- | Instances of ComputeFree are inputs to the generic traveral -- implemented by Free instances. The r type parameter -- denotes the Reader environment of the traversal. class (ExpandCase Collect r, Monoid Collect r) => ComputeFree r where { -- | The result type of the traversal. Most commonly, this is either a -- newtype wrapper on Bool or some instantiation of -- StrictEndo from StrictEndo. The latter is used to -- efficiently accummulate sets or maps. type Collect r; } -- | Update the environment when going under some number of binders. underBinders' :: ComputeFree r => Int -> r -> r -- | Update the environment when descending into the spine of a -- constructor. underConstructor' :: ComputeFree r => ConHead -> Elims -> r -> r -- | Update the environment when going under a modality. Nothing has -- the identity action. underModality' :: ComputeFree r => Maybe (Modality -> r -> r) -- | Update the environment when the rigidity of the current position -- changes, e.g. we switch to flexible mode when going into the spine of -- an unsolved metavariable. See the Free instances for details. -- Nothing has the identity action. NOTE: since Modality -- contains FlexRig information, if you implement a non-trivial -- FlexRig update, you must also implement a non-trivial modality -- update, in order to handle the FlexRig-s there! underFlexRig' :: ComputeFree r => Maybe (FlexRig -> r -> r) -- | Update the environment with relevance information. Nothing has -- the identity action. NOTE: since Modality contains relevances, -- if you implement non-trivial Relevance update, you must also -- implement a non-trivial modality update, to handle the relevances -- there! underRelevance' :: ComputeFree r => Maybe (Relevance -> r -> r) -- | Evaluating a single variable. NOTE: you have to disambiguate bound and -- free variables yourself! For example, when we collect all free -- variables in a set, we need to store an Int in the reader -- environment to keep track of the size of the local scope, which allows -- us to distinguish bound and free vars. variable' :: ComputeFree r => Int -> r -> Collect r -- | Do we want to skip over sorts of types? ignoreSorts' :: ComputeFree r => IgnoreSorts underBinders :: ComputeFree r => Int -> Reader r (Collect r) -> Reader r (Collect r) underBinder :: ComputeFree r => Reader r (Collect r) -> Reader r (Collect r) underConstructor :: ComputeFree r => ConHead -> Elims -> Reader r (Collect r) -> Reader r (Collect r) underModality :: ComputeFree r => Modality -> Reader r (Collect r) -> Reader r (Collect r) underRelevance :: ComputeFree r => Relevance -> Reader r (Collect r) -> Reader r (Collect r) underFlexRig :: ComputeFree r => FlexRig -> Reader r (Collect r) -> Reader r (Collect r) variable :: ComputeFree r => Int -> Reader r (Collect r) class Free t freeVars :: (Free t, ComputeFree r) => t -> Reader r (Collect r) defaultUnderConstructor :: (Semigroup a, LensFlexRig r a) => ConHead -> Elims -> r -> r defaultUnderFlexRig :: (Semigroup a, LensFlexRig r a) => Maybe (FlexRig' a -> r -> r) defaultUnderModality :: LensModality r => Maybe (Modality -> r -> r) defaultUnderRelevance :: LensRelevance r => Maybe (Relevance -> r -> r) instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Internal.Abs t) instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.Level instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free [t] instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Utils.List1.List1 t) instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Internal.PlusLevel' t) instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.RewriteHead instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.RewriteRule instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Internal.Tele t) instance Agda.TypeChecking.Free.Generic.Free Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Free.Generic.Free a, Agda.TypeChecking.Free.Generic.Free b) => Agda.TypeChecking.Free.Generic.Free (a, b) instance (Agda.TypeChecking.Free.Generic.Free a, Agda.TypeChecking.Free.Generic.Free b, Agda.TypeChecking.Free.Generic.Free c) => Agda.TypeChecking.Free.Generic.Free (a, b, c) instance (Agda.TypeChecking.Free.Generic.Free a, Agda.TypeChecking.Free.Generic.Free b, Agda.TypeChecking.Free.Generic.Free c, Agda.TypeChecking.Free.Generic.Free d) => Agda.TypeChecking.Free.Generic.Free (a, b, c, d) instance (Agda.TypeChecking.Free.Generic.Free a, Agda.TypeChecking.Free.Generic.Free b, Agda.TypeChecking.Free.Generic.Free c, Agda.TypeChecking.Free.Generic.Free d, Agda.TypeChecking.Free.Generic.Free e) => Agda.TypeChecking.Free.Generic.Free (a, b, c, d, e) instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.Syntax.Internal.Type' t) -- | Computing the free variables of a term. -- -- The distinction between rigid and strongly rigid occurrences comes -- from: Jason C. Reed, PhD thesis, 2009, page 96 (see also his LFMTP -- 2009 paper) -- -- The main idea is that x = t(x) is unsolvable if x occurs strongly -- rigidly in t. It might have a solution if the occurrence is not -- strongly rigid, e.g. -- -- x = f -> suc (f (x ( y -> k))) has x = f -> suc (f (suc k)) -- -- -- -- The most general function here is freeVarMap, which returns -- returns occurrence information about every free variable. It is also a -- legacy function in the sense that it used to be the only function for -- computing free occurrences, and it came with various functions for -- taking views of the resulting VarMap. You can find these under -- the "Legacy API" here. -- -- There are also also a bunch of specialized and optimized -- implementations of traversals here. -- -- If you want to write a new function for computing free occurrence -- information, your task is essentially to write a ComputeFree -- instance and invoke freeVars. These together implement a -- generic traversal which has a good chance of being converted to decent -- code by GHC. You can look at examples here and also look at the -- comments at ComputeFree. module Agda.TypeChecking.Free type FlexRig = FlexRig' MetaSet -- | Depending on the surrounding context of a variable, it's occurrence -- can be classified as flexible or rigid, with finer distinctions. -- -- The constructors are listed in increasing order (wrt. information -- content). data FlexRig' a -- | In arguments of metas. The set of metas is used by -- 'NonLinMatch' to generate the right blocking information. The -- semantics is that the status of a variable occurrence may change if -- one of the metas in the set gets solved. We may say the occurrence is -- tainted by the meta variables in the set. Flexible :: a -> FlexRig' a -- | In arguments to variables and definitions. WeaklyRigid :: FlexRig' a -- | In top position, or only under inductive record constructors (unit). Unguarded :: FlexRig' a -- | Under at least one and only inductive constructors. StronglyRigid :: FlexRig' a class Free t freeVars :: (Free t, ComputeFree r) => t -> Reader r (Collect r) -- | Where should we skip sorts in free variable analysis? data IgnoreSorts -- | Do not skip. IgnoreNot :: IgnoreSorts -- | Skip when annotation to a type. IgnoreInAnnotations :: IgnoreSorts -- | Skip unconditionally. IgnoreAll :: IgnoreSorts class LensFlexRig o a | o -> a lensFlexRig :: LensFlexRig o a => Lens' o (FlexRig' a) newtype VarCounts VarCounts :: IntMap Int -> VarCounts [varCounts] :: VarCounts -> IntMap Int type VarMap = VarMap' MetaSet newtype VarMap' a VarMap :: TheVarMap' a -> VarMap' a [theVarMap] :: VarMap' a -> TheVarMap' a type VarOcc = VarOcc' MetaSet -- | Occurrence of free variables is classified by several dimensions. -- Currently, we have FlexRig and Modality. data VarOcc' a VarOcc :: FlexRig' a -> Modality -> VarOcc' a [varFlexRig] :: VarOcc' a -> FlexRig' a [varModality] :: VarOcc' a -> Modality -- | FlexRig composition (multiplicative operation of the semiring). -- For accumulating the context of a variable. -- -- Flexible is dominant. Once we are under a meta, we are flexible -- regardless what else comes. We taint all variable occurrences under a -- meta by this meta. -- -- WeaklyRigid is next in strength. Destroys strong rigidity. -- -- StronglyRigid is still dominant over Unguarded. -- -- Unguarded is the unit. It is the top (identity) context. composeFlexRig :: Semigroup a => FlexRig' a -> FlexRig' a -> FlexRig' a lookupVarMap :: Variable -> VarMap' a -> Maybe (VarOcc' a) mapVarMap :: (TheVarMap' a -> TheVarMap' b) -> VarMap' a -> VarMap' b allVars :: VarMap -> VarSet filterVarMap :: (VarOcc -> Bool) -> VarMap -> VarSet filterVarMapToList :: (VarOcc -> Bool) -> VarMap -> [Int] -- | Variables occuring in arguments of metas. These are only potentially -- free, depending how the meta variable is instantiated. The set -- contains the id's of the meta variables that this variable is an -- argument to. flexibleVars :: VarMap -> IntMap MetaSet -- | Return information about every free variable. freeVarMap :: Free t => t -> VarMap isFlexible :: LensFlexRig o a => o -> Bool isStronglyRigid :: LensFlexRig o a => o -> Bool isUnguarded :: LensFlexRig o a => o -> Bool isWeaklyRigid :: LensFlexRig o a => o -> Bool -- | Rigid variables: either strongly rigid, unguarded, or weakly rigid. rigidVars :: VarMap -> VarSet -- | Variables under only and at least one inductive constructor(s). stronglyRigidVars :: VarMap -> VarSet -- | Variables at top or only under inductive record constructors λs and -- Πs. The purpose of recording these separately is that they can still -- become strongly rigid if put under a constructor whereas weakly rigid -- ones stay weakly rigid. unguardedVars :: VarMap -> VarSet -- | A set of meta variables. Forms a monoid under union. newtype MetaSet MetaSet :: HashSet MetaId -> MetaSet [theMetaSet] :: MetaSet -> HashSet MetaId foldrMetaSet :: (MetaId -> a -> a) -> a -> MetaSet -> a insertMetaSet :: MetaId -> MetaSet -> MetaSet metaSetToBlocker :: MetaSet -> Blocker -- | Compute the conjunction of a predicate on free variables. allFreeVar :: Free t => (Int -> Bool) -> t -> Bool -- | Same as allFreeVar except occurrences in sorts of types are -- ignored. allFreeVarIgnoreAll :: Free t => (Int -> Bool) -> t -> Bool -- | Compute the disjunction of a predicate on free variables. anyFreeVar :: Free t => (Int -> Bool) -> t -> Bool -- | Same as anyFreeVar except occurrences in sorts of types are -- ignored. anyFreeVarIgnoreAll :: (Int -> Bool) -> Term -> Bool -- | Is a term closed? closed :: Free t => t -> Bool -- | Compute VarOcc for a single variable. varOccurrenceIn :: Free a => Nat -> a -> Maybe VarOcc -- | Check if single variable occurs freely. freeIn :: Free t => Nat -> t -> Bool -- | Check if a single variable occurs freely outside of sorts of types. freeInIgnoringSorts :: Free a => Nat -> a -> Bool -- | Return how many times each free variable occurs. freeVarCounts :: Free t => t -> VarCounts -- | Compute a (possibly non-unique) list of free variables, in preorder -- traversal order. freeVarList :: Free t => t -> [Int] -- | Return information about every free variable, but ignore occurrences -- in sorts of types. freeVarMapIgnoreAnn :: Free t => t -> VarMap -- | Compute the set of free variables. freeVarSet :: Free t => t -> VarSet -- | Is the variable bound by the abstraction actually used? isBinderUsed :: Free a => Abs a -> Bool -- | Does a variable occur relevantly and outside of sorts of types? relevantInIgnoringSortAnn :: Free t => Nat -> t -> Bool -- | Test for a set of variables whether each variable occurs relevantly -- and outside of sort annotations. Return the set of variables that -- don't occur. setRelInIgnoring :: Free t => VarSet -> t -> VarSet -- | Extract a blocker from an occurrence flexRigToBlocker :: FlexRig -> Blocker -- | Returns all variables that occur in local rewrite rules. inRewVars :: Telescope -> VarSet -- | Returns the variables that correspond to local rewrite rules. theRewVars :: Telescope -> VarSet instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.AnyFreeVar instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.AnyFreeVarIgnoreAll instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.Closed instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeIn instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeInIgnoringSorts instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeVarCounts instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeVarList instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeVarMap instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeVarMapIgnoreAnn instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.FreeVarSet instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.RelevantInIgnoringSortAnn instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.SetRelInIgnoring instance Agda.TypeChecking.Free.Generic.ComputeFree Agda.TypeChecking.Free.SingleVarOcc instance Agda.Utils.ExpandCase.ExpandCase Agda.TypeChecking.Free.CollectSFII instance Agda.TypeChecking.Free.Base.LensFlexRig Agda.TypeChecking.Free.FreeVarMapIgnoreAnn Agda.TypeChecking.Free.Base.MetaSet instance Agda.TypeChecking.Free.Base.LensFlexRig Agda.TypeChecking.Free.FreeVarMap Agda.TypeChecking.Free.Base.MetaSet instance Agda.TypeChecking.Free.Base.LensFlexRig Agda.TypeChecking.Free.SingleVarOcc Agda.TypeChecking.Free.Base.MetaSet instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Free.FreeVarMap instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Free.FreeVarMapIgnoreAnn instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Free.SingleVarOcc instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Free.FreeVarMap instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Free.FreeVarMapIgnoreAnn instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Free.RelevantInIgnoringSortAnn instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Free.SetRelInIgnoring instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Free.SingleVarOcc instance GHC.Internal.Base.Monoid Agda.TypeChecking.Free.CollectSFII instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Free.CollectSFII instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Free.CollectSingleVarOcc module Agda.TypeChecking.Substitute.Class -- | Apply something to a bunch of arguments. Preserves blocking tags -- (application can never resolve blocking). class Apply t apply :: Apply t => t -> Args -> t applyE :: Apply t => t -> Elims -> t -- | Apply to some default arguments. applys :: Apply t => t -> [Term] -> t -- | Apply to a single default argument. apply1 :: Apply t => t -> Term -> t -- | Apply to two default arguments. apply2 :: Apply t => t -> Term -> Term -> t -- | (abstract args v) apply args --> v[args]. class Abstract t abstract :: Abstract t => Telescope -> t -> t -- | Apply a substitution. class DeBruijn SubstArg a => Subst a where { type SubstArg a; } applySubst :: Subst a => Substitution' (SubstArg a) -> a -> a ($dmapplySubst) :: forall (f :: Type -> Type) b. (Subst a, a ~ f b, Functor f, Subst b, SubstArg a ~ SubstArg b) => Substitution' (SubstArg a) -> a -> a -- | Simple constraint alias for a Subst instance a with -- arg type t. type SubstWith t a = (Subst a, SubstArg a ~ t) -- | Subst instance whose argument type is itself type EndoSubst a = SubstWith a a -- | Subst instance whose argument type is Term type TermSubst a = SubstWith Term a -- | Subst instance whose argument type is Nat (i.e. for -- things that can be weakened, but do not admit arbitrary substitution) type WeakSubst a = SubstWith Nat a -- | Raise de Bruijn index, i.e. weakening raise :: Subst a => Nat -> a -> a raiseFrom :: Subst a => Nat -> Nat -> a -> a -- | Replace de Bruijn index i by a Term in something. subst :: Subst a => Int -> SubstArg a -> a -> a strengthen :: Subst a => Impossible -> a -> a -- | Replace what is now de Bruijn index 0, but go under n binders. -- substUnder n u == subst n (raise n u). substUnder :: Subst a => Nat -> SubstArg a -> a -> a -- | Checks whether the variable bound by the abstraction is actually used, -- and, if not, returns the term within, strengthened to -- live in the context outside the abstraction. See also -- isBinderUsed. isNoAbs :: (Free a, Subst a) => Abs a -> Maybe a idS :: Substitution' a wkS :: Int -> Substitution' a -> Substitution' a raiseS :: Int -> Substitution' a consS :: DeBruijn a => a -> Substitution' a -> Substitution' a -- | To replace index n by term u, do applySubst -- (singletonS n u). Γ, Δ ⊢ u : A -- --------------------------------- Γ, Δ ⊢ singletonS |Δ| u : Γ, A, Δ -- singletonS :: DeBruijn a => Int -> a -> Substitution' a -- | Single substitution without disturbing any deBruijn indices. Γ, -- A, Δ ⊢ u : A --------------------------------- Γ, A, Δ ⊢ inplace |Δ| u -- : Γ, A, Δ inplaceS :: EndoSubst a => Int -> a -> Substitution' a -- | Lift a substitution under k binders. liftS :: Int -> Substitution' a -> Substitution' a -- |
--      Γ ⊢ ρ : Δ, Ψ
--   -------------------
--   Γ ⊢ dropS |Ψ| ρ : Δ
--   
--   
dropS :: Int -> Substitution' a -> Substitution' a -- |
--   applySubst (ρ composeS σ) v == applySubst ρ (applySubst σ v)
--   
composeS :: EndoSubst a => Substitution' a -> Substitution' a -> Substitution' a splitS :: Int -> Substitution' a -> (Substitution' a, Substitution' a) (++#) :: DeBruijn a => [a] -> Substitution' a -> Substitution' a infixr 4 ++# -- |
--   Γ ⊢ ρ : Δ  Γ ⊢ reverse vs : Θ
--   ----------------------------- (treating Nothing as having any type)
--     Γ ⊢ prependS vs ρ : Δ, Θ
--   
--   
prependS :: DeBruijn a => Impossible -> [Maybe a] -> Substitution' a -> Substitution' a -- |
--     Γ ⊢ reverse vs : Δ
--   -----------------------------
--     Γ ⊢ parallelS vs ρ : Γ, Δ
--   
--   
-- -- Note the Γ in Γ, Δ. parallelS :: DeBruijn a => [a] -> Substitution' a -- | Γ ⊢ (strengthenS ⊥ |Δ|) : Γ,Δ strengthenS :: Impossible -> Int -> Substitution' a -- | A "smart" variant of Strengthen. If strengthenS is -- applied to a substitution with an outermost Strengthen -- constructor, then the "error message" of that constructor is discarded -- in favour of the Impossible argument of this function. strengthenS' :: Impossible -> Int -> Substitution' a -> Substitution' a lookupS :: EndoSubst a => Substitution' a -> Nat -> a lookupS' :: EndoSubst a => Nat -> Substitution' a -> Nat -> a -- | lookupS (listS [(x0,t0)..(xn,tn)]) xi = ti, assuming x0 < .. < -- xn. listS :: EndoSubst a => [(Int, a)] -> Substitution' a -- |
--   Γ, Ξ, Δ ⊢ raiseFromS |Δ| |Ξ| : Γ, Δ
--   
raiseFromS :: Nat -> Nat -> Substitution' a -- | Instantiate an abstraction. Strict in the term. absApp :: Subst a => Abs a -> SubstArg a -> a -- | Instantiate an abstraction. Lazy in the term, which allow it to be -- IMPOSSIBLE in the case where the variable shouldn't be used but -- we cannot use noabsApp. Used in Apply. lazyAbsApp :: Subst a => Abs a -> SubstArg a -> a -- | Instantiate an abstraction that doesn't use its argument. noabsApp :: Subst a => Impossible -> Abs a -> a absBody :: Subst a => Abs a -> a mkAbs :: (Subst a, Free a) => ArgName -> a -> Abs a reAbs :: (Subst a, Free a) => Abs a -> Abs a instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn t => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.NoSubst t a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Abstract.Name.QName module Agda.TypeChecking.DiscrimTree.Types data Key -- | Rigid symbols (constructors, data types, record types, postulates) -- identified by a QName. RigidK :: QName -> Int -> Key -- | Local variables. LocalK :: Int -> Int -> Key -- | Dependent function types. The domain will be represented accurately, -- for the case of a genuine dependent function type, the codomain will -- be a dummy. PiK :: Hiding -> Key -- | Constant lambdas. ConstK :: Key -- | Universes. SortK :: Key -- | Anything else. FlexK :: Key -- | A Term-indexed associative data structure supporting -- approximate (conservative) lookup. Rather than using a -- Trie keyed by Key directly, a DiscrimTree is -- instead represented more like a case tree. -- -- This allows us to exploit the fact that instance selection often -- focuses on a small part of the term: Only that critical chain is -- represented in the tree. As an example, level parameters are unlikely -- to contribute to narrowing a search problem, so it would be wasteful -- to have an indirection in the tree for every FlexK standing for -- a level parameter. data DiscrimTree a -- | The empty discrimination tree. EmptyDT :: DiscrimTree a -- | Succeed with a given set of values. DoneDT :: Set a -> DiscrimTree a -- | Do case analysis on a term. CaseDT is scoped in the same way as -- fast case trees for the abstract machine: When matching actually -- succeeds, the variable that was matched gets replaced by its arguments -- directly in the context. CaseDT :: Int -> Map Key (DiscrimTree a) -> DiscrimTree a -> DiscrimTree a -- | Merge a pair of discrimination trees. This function tries to build the -- minimal discrimination tree that yields the union of the inputs' -- results, though it does so slightly naïvely, without considerable -- optimisations (e.g. it does not turn single-alternative CaseDTs -- into DoneDTs). mergeDT :: Ord a => DiscrimTree a -> DiscrimTree a -> DiscrimTree a -- | Construct the case tree corresponding to only performing proper -- matches on the given key. In this context, a "proper match" is any -- Key that is not FlexK. singletonDT :: [Key] -> a -> DiscrimTree a instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.DiscrimTree.Types.Key instance GHC.Internal.Generics.Generic (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.DiscrimTree.Types.Key instance (Agda.Syntax.Position.KillRange a, GHC.Internal.Classes.Ord a) => Agda.Syntax.Position.KillRange (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Base.Monoid (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance Control.DeepSeq.NFData Agda.TypeChecking.DiscrimTree.Types.Key instance Agda.Utils.Null.Null (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance GHC.Internal.Classes.Ord Agda.TypeChecking.DiscrimTree.Types.Key instance GHC.Internal.Classes.Ord a => GHC.Internal.Base.Semigroup (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance GHC.Internal.Show.Show Agda.TypeChecking.DiscrimTree.Types.Key -- | The treeless syntax is intended to be used as input for the compiler -- backends. It is more low-level than Internal syntax and is not used -- for type checking. -- -- Some of the features of treeless syntax are: - case expressions -- instead of case trees - no instantiated datatypes / constructors module Agda.Syntax.Treeless pattern TPFn :: TPrim -> TTerm -> TTerm pattern TPOp :: TPrim -> TTerm -> TTerm -> TTerm -- | Expose the format coerce f args. -- -- We fuse coercions, even if interleaving with applications. We assume -- that coercion is powerful enough to satisfy coerce (coerce f a) b -- = coerce f a b coerceAppView :: TTerm -> ((Bool, TTerm), [TTerm]) -- | Strip leading coercions and indicate whether there were some. coerceView :: TTerm -> (Bool, TTerm) -- | The default strictness for constructors of the given kind. defaultConstructorStrictness :: EvaluationStrategy -> Induction -> Strictness -- | The default strictness. defaultStrictness :: EvaluationStrategy -> Strictness -- | filterUsed used args drops those args which are -- labelled ArgUnused in list used. -- -- Specification: -- --
--   filterUsed used args = [ a | (a, ArgUsed) <- zip args $ used ++ repeat ArgUsed ]
--   
-- -- Examples: -- --
--   filterUsed []                 == id
--   filterUsed (repeat ArgUsed)   == id
--   filterUsed (repeat ArgUnused) == const []
--   
filterUsed :: [ArgUsage] -> [a] -> [a] intView :: TTerm -> Maybe Integer isPrimEq :: TPrim -> Bool -- | Introduces a new binding mkLet :: Strictness -> TTerm -> TTerm -> TTerm mkTApp :: TTerm -> Args -> TTerm mkTLam :: Int -> TTerm -> TTerm negPlusKView :: TTerm -> Maybe (Integer, TTerm) plusKView :: TTerm -> Maybe (Integer, TTerm) tAppView :: TTerm -> (TTerm, [TTerm]) tIfThenElse :: TTerm -> TTerm -> TTerm -> TTerm tInt :: Integer -> TTerm tLamView :: TTerm -> (Int, TTerm) tLetView :: TTerm -> ([(Strictness, TTerm)], TTerm) tNegPlusK :: Integer -> TTerm -> TTerm tOp :: TPrim -> TTerm -> TTerm -> TTerm tPlusK :: Integer -> TTerm -> TTerm tUnreachable :: TTerm word64View :: TTerm -> Maybe Word64 -- | Usage status of function arguments in treeless code. data ArgUsage ArgUsed :: ArgUsage ArgUnused :: ArgUsage type Args = [TTerm] data CaseInfo CaseInfo :: Bool -> Induction -> Erased -> CaseType -> CaseInfo [caseLazy] :: CaseInfo -> Bool -- | Is the matched type inductive (or non-recursive), or is it -- coinductive? [caseInduction] :: CaseInfo -> Induction -- | Is this a match on an erased argument? [caseErased] :: CaseInfo -> Erased [caseType] :: CaseInfo -> CaseType data CaseType CTData :: QName -> CaseType CTNat :: CaseType CTInt :: CaseType CTChar :: CaseType CTString :: CaseType CTFloat :: CaseType CTQName :: CaseType data Compiled Compiled :: TTerm -> Maybe [ArgUsage] -> Compiled [cTreeless] :: Compiled -> TTerm -- | Nothing if treeless usage analysis has not run yet. [cArgUsage] :: Compiled -> Maybe [ArgUsage] -- | The treeless compiler can behave differently depending on the target -- language evaluation strategy. For instance, more aggressive erasure -- for lazy targets. data EvaluationStrategy -- | Lazy evaluation. If the argument is Strict, then applications -- of inductive (or non-recursive) constructors are strict. LazyEvaluation :: Strictness -> EvaluationStrategy -- | Strict evaluation. EagerEvaluation :: EvaluationStrategy -- | Strictness. data Strictness NonStrict :: Strictness Strict :: Strictness data TAlt -- | Matches on the given constructor. If the match succeeds, the pattern -- variables are prepended to the current environment (pushes all -- existing variables aArity steps further away) TACon :: QName -> Int -> TTerm -> TAlt [aCon] :: TAlt -> QName [aArity] :: TAlt -> Int [aBody] :: TAlt -> TTerm -- | Binds no variables -- -- The guard must only use the variable that the case expression matches -- on. TAGuard :: TTerm -> TTerm -> TAlt [aGuard] :: TAlt -> TTerm [aBody] :: TAlt -> TTerm TALit :: Literal -> TTerm -> TAlt [aLit] :: TAlt -> Literal [aBody] :: TAlt -> TTerm data TError -- | Code which is unreachable. E.g. absurd branches or missing case -- defaults. Runtime behaviour of unreachable code is undefined, but -- preferably the program will exit with an error message. The compiler -- is free to assume that this code is unreachable and to remove it. TUnreachable :: TError -- | Code which could not be obtained because of a hole in the program. -- This should throw a runtime error. The string gives some information -- about the meta variable that got compiled. TMeta :: String -> TError -- | Compiler-related primitives. This are NOT the same thing as primitives -- in Agda's surface or internal syntax! Some of the primitives have a -- suffix indicating which type of arguments they take, using the -- following naming convention: Char | Type C | Character F | Float I | -- Integer Q | QName S | String data TPrim PAdd :: TPrim PAdd64 :: TPrim PSub :: TPrim PSub64 :: TPrim PMul :: TPrim PMul64 :: TPrim PQuot :: TPrim PQuot64 :: TPrim PRem :: TPrim PRem64 :: TPrim PGeq :: TPrim PLt :: TPrim PLt64 :: TPrim PEqI :: TPrim PEq64 :: TPrim PEqF :: TPrim PEqS :: TPrim PEqC :: TPrim PEqQ :: TPrim PIf :: TPrim PSeq :: TPrim PITo64 :: TPrim P64ToI :: TPrim -- | Treeless Term. All local variables are using de Bruijn indices. data TTerm TVar :: Int -> TTerm TPrim :: TPrim -> TTerm TDef :: QName -> TTerm TApp :: TTerm -> Args -> TTerm TLam :: TTerm -> TTerm TLit :: Literal -> TTerm TCon :: QName -> TTerm -- | Introduces a new (non-recursive) local binding. It can be strict or -- non-strict. Non-strict bindings should not be made more strict, this -- could lead to crashes. Sharing may happen, but is optional. It is also -- perfectly valid to just inline the bound term in the body. TLet :: Strictness -> TTerm -> TTerm -> TTerm -- | Case scrutinee (always variable), case type, default value, -- alternatives First, all TACon alternatives are tried; then all TAGuard -- alternatives in top to bottom order. TACon alternatives must not -- overlap. TCase :: Int -> CaseInfo -> TTerm -> [TAlt] -> TTerm TUnit :: TTerm TSort :: TTerm TErased :: TTerm -- | Used by the GHC backend TCoerce :: TTerm -> TTerm -- | A runtime error, something bad has happened. TError :: TError -> TTerm class Unreachable a -- | Checks if the given expression is unreachable or not. isUnreachable :: Unreachable a => a -> Bool instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.ArgUsage instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.CaseInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.CaseType instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.Compiled instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.EvaluationStrategy instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.Strictness instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.TAlt instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.TError instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.TPrim instance GHC.Internal.Classes.Eq Agda.Syntax.Treeless.TTerm instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.ArgUsage instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.CaseInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.CaseType instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.Compiled instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.EvaluationStrategy instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.Strictness instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.TAlt instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.TError instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.TPrim instance GHC.Internal.Generics.Generic Agda.Syntax.Treeless.TTerm instance Agda.Syntax.Position.KillRange Agda.Syntax.Treeless.Compiled instance Control.DeepSeq.NFData Agda.Syntax.Treeless.ArgUsage instance Control.DeepSeq.NFData Agda.Syntax.Treeless.CaseInfo instance Control.DeepSeq.NFData Agda.Syntax.Treeless.CaseType instance Control.DeepSeq.NFData Agda.Syntax.Treeless.Compiled instance Control.DeepSeq.NFData Agda.Syntax.Treeless.EvaluationStrategy instance Control.DeepSeq.NFData Agda.Syntax.Treeless.Strictness instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TAlt instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TError instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TPrim instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TTerm instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.ArgUsage instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.CaseInfo instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.CaseType instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.Compiled instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.EvaluationStrategy instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.Strictness instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.TAlt instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.TError instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.TPrim instance GHC.Internal.Classes.Ord Agda.Syntax.Treeless.TTerm instance GHC.Internal.Show.Show Agda.Syntax.Treeless.ArgUsage instance GHC.Internal.Show.Show Agda.Syntax.Treeless.CaseInfo instance GHC.Internal.Show.Show Agda.Syntax.Treeless.CaseType instance GHC.Internal.Show.Show Agda.Syntax.Treeless.Compiled instance GHC.Internal.Show.Show Agda.Syntax.Treeless.EvaluationStrategy instance GHC.Internal.Show.Show Agda.Syntax.Treeless.Strictness instance GHC.Internal.Show.Show Agda.Syntax.Treeless.TAlt instance GHC.Internal.Show.Show Agda.Syntax.Treeless.TError instance GHC.Internal.Show.Show Agda.Syntax.Treeless.TPrim instance GHC.Internal.Show.Show Agda.Syntax.Treeless.TTerm instance Agda.Syntax.Internal.TermSize Agda.Syntax.Treeless.TAlt instance Agda.Syntax.Internal.TermSize Agda.Syntax.Treeless.TTerm instance Agda.Syntax.Treeless.Unreachable Agda.Syntax.Treeless.TAlt instance Agda.Syntax.Treeless.Unreachable Agda.Syntax.Treeless.TTerm -- | Translates guard alternatives to if-then-else cascades. -- -- The builtin translation must be run before this transformation. module Agda.Compiler.Treeless.GuardsToPrims convertGuards :: TTerm -> TTerm module Agda.Compiler.Treeless.AsPatterns -- | We lose track of @-patterns in the internal syntax. This pass puts -- them back. recoverAsPatterns :: Monad m => TTerm -> m TTerm instance GHC.Internal.Show.Show Agda.Compiler.Treeless.AsPatterns.AsPat module Agda.Syntax.Reflected type Args = [Arg Term] data Elim' a Apply :: Arg a -> Elim' a type Elim = Elim' Term type Elims = [Elim] argsToElims :: Args -> Elims data Abs a Abs :: String -> a -> Abs a data Term Var :: Int -> Elims -> Term Con :: QName -> Elims -> Term Def :: QName -> Elims -> Term Meta :: MetaId -> Elims -> Term Lam :: Hiding -> Abs Term -> Term ExtLam :: List1 Clause -> Elims -> Term Pi :: Dom Type -> Abs Type -> Term Sort :: Sort -> Term Lit :: Literal -> Term Unknown :: Term type Type = Term data Sort SetS :: Term -> Sort LitS :: Integer -> Sort PropS :: Term -> Sort PropLitS :: Integer -> Sort InfS :: Integer -> Sort UnknownS :: Sort data Pattern ConP :: QName -> [Arg Pattern] -> Pattern DotP :: Term -> Pattern VarP :: Int -> Pattern LitP :: Literal -> Pattern AbsurdP :: Int -> Pattern ProjP :: QName -> Pattern data Clause Clause :: [(Text, Arg Type)] -> [Arg Pattern] -> Term -> Clause [clauseTel] :: Clause -> [(Text, Arg Type)] [clausePats] :: Clause -> [Arg Pattern] [clauseRHS] :: Clause -> Term AbsurdClause :: [(Text, Arg Type)] -> [Arg Pattern] -> Clause [clauseTel] :: Clause -> [(Text, Arg Type)] [clausePats] :: Clause -> [Arg Pattern] data Definition FunDef :: Type -> [Clause] -> Definition DataDef :: Definition RecordDef :: Definition DataConstructor :: Definition Axiom :: Definition Primitive :: Definition instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Reflected.Abs a) instance GHC.Internal.Show.Show Agda.Syntax.Reflected.Clause instance GHC.Internal.Show.Show Agda.Syntax.Reflected.Definition instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Reflected.Elim' a) instance GHC.Internal.Show.Show Agda.Syntax.Reflected.Pattern instance GHC.Internal.Show.Show Agda.Syntax.Reflected.Sort instance GHC.Internal.Show.Show Agda.Syntax.Reflected.Term module Agda.Syntax.Internal.Pattern -- | Translate the clause patterns to terms with free variables bound by -- the clause telescope. -- -- Precondition: no projection patterns. clauseArgs :: Clause -> Args -- | Translate the clause patterns to an elimination spine with free -- variables bound by the clause telescope. clauseElims :: Clause -> Elims -- | Arity of a function, computed from clauses. class FunArity a funArity :: FunArity a => a -> Int -- | Label the pattern variables from left to right using one label for -- each variable pattern and one for each dot pattern. class LabelPatVars a b where { type PatVarLabel b; } labelPatVars :: LabelPatVars a b => a -> State [PatVarLabel b] b ($dmlabelPatVars) :: forall (f :: Type -> Type) a' b'. (LabelPatVars a b, Traversable f, LabelPatVars a' b', PatVarLabel b ~ PatVarLabel b', f a' ~ a, f b' ~ b) => a -> State [PatVarLabel b] b -- | Intended, but unpractical due to the absence of type-level lambda, is: -- labelPatVars :: f (Pattern' x) -> State [i] (f (Pattern' -- (i,x))) unlabelPatVars :: LabelPatVars a b => b -> a ($dmunlabelPatVars) :: forall (f :: Type -> Type) a' b'. (LabelPatVars a b, Traversable f, LabelPatVars a' b', f a' ~ a, f b' ~ b) => b -> a -- | Augment pattern variables with their de Bruijn index. numberPatVars :: (LabelPatVars a b, PatVarLabel b ~ Int) => Int -> Permutation -> a -> b unnumberPatVars :: LabelPatVars a b => b -> a dbPatPerm :: [NamedArg DeBruijnPattern] -> Maybe Permutation -- | Computes the permutation from the clause telescope to the pattern -- variables. -- -- Use as fromMaybe IMPOSSIBLE . dbPatPerm to crash in a -- controlled way if a de Bruijn index is out of scope here. -- -- The first argument controls whether dot patterns counts as variables -- or not. dbPatPerm' :: Bool -> [NamedArg DeBruijnPattern] -> Maybe Permutation -- | Computes the permutation from the clause telescope to the pattern -- variables. -- -- Use as fromMaybe IMPOSSIBLE . clausePerm to crash in a -- controlled way if a de Bruijn index is out of scope here. clausePerm :: Clause -> Maybe Permutation -- | Turn a pattern into a term. Projection patterns are turned into -- projection eliminations, other patterns into apply elimination. patternToElim :: Arg DeBruijnPattern -> Elim patternsToElims :: [NamedArg DeBruijnPattern] -> [Elim] patternToTerm :: DeBruijnPattern -> Term class MapNamedArgPattern a p mapNamedArgPattern :: MapNamedArgPattern a p => (NamedArg (Pattern' a) -> NamedArg (Pattern' a)) -> p -> p ($dmmapNamedArgPattern) :: forall (f :: Type -> Type) p'. (MapNamedArgPattern a p, Functor f, MapNamedArgPattern a p', p ~ f p') => (NamedArg (Pattern' a) -> NamedArg (Pattern' a)) -> p -> p -- | Generic pattern traversal. -- -- Pre-applies a pattern modification, recurses, and post-applies another -- one. class PatternLike a b -- | Fold pattern. foldrPattern :: (PatternLike a b, Monoid m) => (Pattern' a -> m -> m) -> b -> m ($dmfoldrPattern) :: forall m (f :: Type -> Type) p. (PatternLike a b, Monoid m, Foldable f, PatternLike a p, f p ~ b) => (Pattern' a -> m -> m) -> b -> m -- | Traverse pattern. traversePatternM :: (PatternLike a b, Monad m) => (Pattern' a -> m (Pattern' a)) -> (Pattern' a -> m (Pattern' a)) -> b -> m b ($dmtraversePatternM) :: forall (f :: Type -> Type) p m. (PatternLike a b, Traversable f, PatternLike a p, f p ~ b, Monad m) => (Pattern' a -> m (Pattern' a)) -> (Pattern' a -> m (Pattern' a)) -> b -> m b -- | Compute from each subpattern a value and collect them all in a monoid. foldPattern :: (PatternLike a b, Monoid m) => (Pattern' a -> m) -> b -> m -- | Traverse pattern(s) with a modification before the recursive descent. preTraversePatternM :: (PatternLike a b, Monad m) => (Pattern' a -> m (Pattern' a)) -> b -> m b -- | Traverse pattern(s) with a modification after the recursive descent. postTraversePatternM :: (PatternLike a b, Monad m) => (Pattern' a -> m (Pattern' a)) -> b -> m b class CountPatternVars a countPatternVars :: CountPatternVars a => a -> Int ($dmcountPatternVars) :: forall (f :: Type -> Type) b. (CountPatternVars a, Foldable f, CountPatternVars b, f b ~ a) => a -> Int class PatternVarModalities p where { type PatVar p; } -- | Get the list of pattern variables annotated with modalities. patternVarModalities :: PatternVarModalities p => p -> [(PatVar p, Modality)] hasDefP :: [NamedArg DeBruijnPattern] -> Bool instance Agda.Syntax.Internal.Pattern.CountPatternVars a => Agda.Syntax.Internal.Pattern.CountPatternVars (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Pattern.CountPatternVars a => Agda.Syntax.Internal.Pattern.CountPatternVars [a] instance Agda.Syntax.Internal.Pattern.CountPatternVars a => Agda.Syntax.Internal.Pattern.CountPatternVars (Agda.Syntax.Common.Named x a) instance Agda.Syntax.Internal.Pattern.CountPatternVars (Agda.Syntax.Internal.Pattern' x) instance Agda.Syntax.Internal.Pattern.FunArity Agda.Syntax.Internal.Clause instance Agda.Syntax.Abstract.Name.IsProjP p => Agda.Syntax.Internal.Pattern.FunArity [p] instance Agda.Syntax.Internal.Pattern.FunArity [Agda.Syntax.Internal.Clause] instance Agda.Syntax.Internal.Pattern.LabelPatVars a b => Agda.Syntax.Internal.Pattern.LabelPatVars (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.Syntax.Internal.Pattern.LabelPatVars a b => Agda.Syntax.Internal.Pattern.LabelPatVars [a] [b] instance Agda.Syntax.Internal.Pattern.LabelPatVars a b => Agda.Syntax.Internal.Pattern.LabelPatVars (Agda.Syntax.Common.Named x a) (Agda.Syntax.Common.Named x b) instance Agda.Syntax.Internal.Pattern.LabelPatVars Agda.Syntax.Internal.Pattern Agda.Syntax.Internal.DeBruijnPattern instance Agda.Syntax.Internal.Pattern.MapNamedArgPattern a (Agda.Syntax.Common.NamedArg (Agda.Syntax.Internal.Pattern' a)) instance Agda.Syntax.Internal.Pattern.MapNamedArgPattern a p => Agda.Syntax.Internal.Pattern.MapNamedArgPattern a [p] instance Agda.Syntax.Internal.Pattern.PatternLike a b => Agda.Syntax.Internal.Pattern.PatternLike a (Agda.Syntax.Common.Arg b) instance Agda.Syntax.Internal.Pattern.PatternLike a b => Agda.Syntax.Internal.Pattern.PatternLike a [b] instance Agda.Syntax.Internal.Pattern.PatternLike a b => Agda.Syntax.Internal.Pattern.PatternLike a (Agda.Syntax.Common.Named x b) instance Agda.Syntax.Internal.Pattern.PatternLike a (Agda.Syntax.Internal.Pattern' a) instance Agda.Syntax.Internal.Pattern.PatternVarModalities a => Agda.Syntax.Internal.Pattern.PatternVarModalities (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Pattern.PatternVarModalities a => Agda.Syntax.Internal.Pattern.PatternVarModalities [a] instance Agda.Syntax.Internal.Pattern.PatternVarModalities a => Agda.Syntax.Internal.Pattern.PatternVarModalities (Agda.Syntax.Common.Named s a) instance Agda.Syntax.Internal.Pattern.PatternVarModalities (Agda.Syntax.Internal.Pattern' x) -- | Tree traversal for internal syntax. module Agda.Syntax.Internal.Generic -- | Generic term traversal. -- -- Note: ignores sorts in terms! (Does not traverse into or collect from -- them.) class TermLike a -- | Generic traversal with post-traversal action. Ignores sorts. traverseTermM :: (TermLike a, Monad m) => (Term -> m Term) -> a -> m a ($dmtraverseTermM) :: forall m (f :: Type -> Type) b. (TermLike a, Monad m, Traversable f, TermLike b, f b ~ a) => (Term -> m Term) -> a -> m a -- | Generic fold, ignoring sorts. foldTerm :: (TermLike a, Monoid m) => (Term -> m) -> a -> m ($dmfoldTerm) :: forall m (f :: Type -> Type) b. (TermLike a, Monoid m, Foldable f, TermLike b, f b ~ a) => (Term -> m) -> a -> m -- | Put it in a monad to make it possible to do strictly. copyTerm :: (TermLike a, Monad m) => a -> m a instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Blocked a) instance Agda.Syntax.Internal.Generic.TermLike GHC.Internal.Types.Bool instance Agda.Syntax.Internal.Generic.TermLike GHC.Internal.Types.Char instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.Generic.TermLike b) => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Dom' a b) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.EqualityView instance Agda.Syntax.Internal.Generic.TermLike GHC.Internal.Types.Int instance Agda.Syntax.Internal.Generic.TermLike GHC.Internal.Bignum.Integer.Integer instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike [a] instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Utils.List1.List1 a) instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Term instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.Generic.TermLike b) => Agda.Syntax.Internal.Generic.TermLike (a, b) instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.Generic.TermLike b, Agda.Syntax.Internal.Generic.TermLike c) => Agda.Syntax.Internal.Generic.TermLike (a, b, c) instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.Generic.TermLike b, Agda.Syntax.Internal.Generic.TermLike c, Agda.Syntax.Internal.Generic.TermLike d) => Agda.Syntax.Internal.Generic.TermLike (a, b, c, d) instance Agda.Syntax.Internal.Generic.TermLike b => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Type'' a b) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Common.WithHiding a) -- | Case trees. -- -- After coverage checking, pattern matching is translated to case trees, -- i.e., a tree of successive case splits on one variable at a time. module Agda.TypeChecking.CompiledClause -- | The number of a Clause (starting with 0) in the clause list of -- a FunctionData. type ClauseNumber = Int data WithArity c WithArity :: Int -> c -> WithArity c [arity] :: WithArity c -> Int [content] :: WithArity c -> c -- | Branches in a case tree. data Case c Branches :: Bool -> Map QName (WithArity c) -> Maybe (ConHead, WithArity c) -> Map Literal c -> Maybe c -> Maybe Bool -> Bool -> Case c -- | We are constructing a record here (copatterns). conBranches -- lists projections. [projPatterns] :: Case c -> Bool -- | Map from constructor (or projection) names to their arity and the case -- subtree. (Projections have arity 0.) [conBranches] :: Case c -> Map QName (WithArity c) -- | Eta-expand with the given (eta record) constructor. If this is -- present, there should not be any conBranches or litBranches. [etaBranch] :: Case c -> Maybe (ConHead, WithArity c) -- | Map from literal to case subtree. [litBranches] :: Case c -> Map Literal c -- | (Possibly additional) catch-all clause. [catchallBranch] :: Case c -> Maybe c -- | (if True) In case of non-canonical argument use catchallBranch. [fallThrough] :: Case c -> Maybe Bool -- | Lazy pattern match. Requires single (non-copattern) branch with no lit -- branches and no catch-all. [lazyMatch] :: Case c -> Bool type CompiledClauses = CompiledClauses' Term -- | Case tree with bodies. data CompiledClauses' a -- | Case n bs stands for a match on the n-th argument -- (counting from zero) with bs as the case branches. If the -- n-th argument is a projection, we have only -- conBranches with arity 0. Case :: Arg Int -> Case (CompiledClauses' a) -> CompiledClauses' a Done_ :: CCDone a -> CompiledClauses' a -- | Absurd case. Add the free variables here as well so we can build -- correct number of lambdas for strict backends. (#4280) Fail :: [Arg ArgName] -> CompiledClauses' a -- | Data stored in Done nodes of the case tree. CCDone no mr xs -- b stands for the body b where the xs contains -- hiding and name suggestions for the free variables. This is needed to -- build lambdas on the right hand side for partial applications which -- can still reduce. The no is the number of the original -- Clause this case tree leaf comes from. mr tells -- whether this body contains calls to the mutually recursive functions. data CCDone a CCDone :: ClauseNumber -> ClauseRecursive -> [Arg ArgName] -> a -> CCDone a [ccClauseNumber] :: CCDone a -> ClauseNumber [ccClauseRecursive] :: CCDone a -> ClauseRecursive [ccBoundVars] :: CCDone a -> [Arg ArgName] [ccBody] :: CCDone a -> a pattern Done :: ClauseNumber -> ClauseRecursive -> [Arg ArgName] -> a -> CompiledClauses' a litCase :: Literal -> c -> Case c conCase :: QName -> Bool -> WithArity c -> Case c etaCase :: ConHead -> WithArity c -> Case c projCase :: QName -> c -> Case c catchall :: c -> Case c -- | Check that the requirements on lazy matching (single inductive case) -- are met, and set lazy to False otherwise. checkLazyMatch :: Case c -> Case c -- | Check whether a case tree has a catch-all clause. hasCatchall :: CompiledClauses -> Bool -- | Check whether a case tree has any projection patterns hasProjectionPatterns :: CompiledClauses -> Bool class MapDone (f :: Type -> Type) mapDone :: MapDone f => (CCDone a -> CCDone b) -> f a -> f b prettyMap_ :: (Pretty k, Pretty v) => Map k v -> [Doc] instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.CCDone instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.Case instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.CompiledClauses' instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.WithArity instance GHC.Internal.Base.Functor Agda.TypeChecking.CompiledClause.CCDone instance GHC.Internal.Base.Functor Agda.TypeChecking.CompiledClause.Case instance GHC.Internal.Base.Functor Agda.TypeChecking.CompiledClause.CompiledClauses' instance GHC.Internal.Base.Functor Agda.TypeChecking.CompiledClause.WithArity instance GHC.Internal.Generics.Generic (Agda.TypeChecking.CompiledClause.CCDone a) instance GHC.Internal.Generics.Generic (Agda.TypeChecking.CompiledClause.Case c) instance GHC.Internal.Generics.Generic (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance GHC.Internal.Generics.Generic (Agda.TypeChecking.CompiledClause.WithArity c) instance Agda.Syntax.Position.KillRange c => Agda.Syntax.Position.KillRange (Agda.TypeChecking.CompiledClause.Case c) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.Syntax.Position.KillRange c => Agda.Syntax.Position.KillRange (Agda.TypeChecking.CompiledClause.WithArity c) instance Agda.TypeChecking.CompiledClause.MapDone Agda.TypeChecking.CompiledClause.CompiledClauses' instance GHC.Internal.Base.Monoid m => GHC.Internal.Base.Monoid (Agda.TypeChecking.CompiledClause.Case m) instance GHC.Internal.Base.Monoid c => GHC.Internal.Base.Monoid (Agda.TypeChecking.CompiledClause.WithArity c) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.CCDone a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.Case a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance Control.DeepSeq.NFData c => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.WithArity c) instance Agda.Utils.Null.Null (Agda.TypeChecking.CompiledClause.Case m) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.CompiledClause.CCDone a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.CompiledClause.Case a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.CompiledClause.WithArity a) instance GHC.Internal.Base.Semigroup m => GHC.Internal.Base.Semigroup (Agda.TypeChecking.CompiledClause.Case m) instance GHC.Internal.Base.Semigroup c => GHC.Internal.Base.Semigroup (Agda.TypeChecking.CompiledClause.WithArity c) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.CompiledClause.CCDone a) instance GHC.Internal.Show.Show c => GHC.Internal.Show.Show (Agda.TypeChecking.CompiledClause.Case c) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance GHC.Internal.Show.Show c => GHC.Internal.Show.Show (Agda.TypeChecking.CompiledClause.WithArity c) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.CCDone a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.Case a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.WithArity a) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.CCDone instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.Case instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.CompiledClauses' instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.WithArity module Agda.Syntax.Internal.MetaVars -- | Returns every meta-variable occurrence in the given type, except for -- those in sort annotations on types. class AllMetas t allMetas :: (AllMetas t, Monoid m) => (MetaId -> m) -> t -> m ($dmallMetas) :: (AllMetas t, TermLike t, Monoid m) => (MetaId -> m) -> t -> m allMetas' :: (TermLike a, Monoid m) => (MetaId -> m) -> a -> m -- | Returns allMetas in a list. allMetasList = allMetas -- (:[]). -- -- Note: this resulting list is computed via difference lists. Thus, use -- this function if you actually need the whole list of metas. Otherwise, -- use allMetas with a suitable monoid. allMetasList :: AllMetas a => a -> [MetaId] -- | True if thing contains no metas. noMetas = null . -- allMetasList. noMetas :: AllMetas a => a -> Bool -- | Returns the first meta it find in the thing, if any. firstMeta == -- listToMaybe . allMetasList. firstMeta :: AllMetas a => a -> Maybe MetaId -- | A blocker that unblocks if any of the metas in a term are solved. unblockOnAnyMetaIn :: AllMetas t => t -> Blocker -- | A blocker that unblocks if any of the metas in a term are solved. unblockOnAllMetasIn :: AllMetas t => t -> Blocker instance Agda.Syntax.Internal.MetaVars.AllMetas a => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Common.Arg a) instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.MetaVars.AllMetas a, Agda.Syntax.Internal.MetaVars.AllMetas b) => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.Dom' a b) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.MetaVars.AllMetas GHC.Internal.Base.String instance Agda.Syntax.Internal.MetaVars.AllMetas a => Agda.Syntax.Internal.MetaVars.AllMetas [a] instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.MetaVars.AllMetas a) => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.LocalEquation' a) instance Agda.Syntax.Internal.MetaVars.AllMetas a => Agda.Syntax.Internal.MetaVars.AllMetas (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.PlusLevel instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.MetaVars.AllMetas a) => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.RewDom' a) instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.RewriteRule instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.Term instance (Agda.Syntax.Internal.MetaVars.AllMetas a, Agda.Syntax.Internal.MetaVars.AllMetas b) => Agda.Syntax.Internal.MetaVars.AllMetas (a, b) instance (Agda.Syntax.Internal.MetaVars.AllMetas a, Agda.Syntax.Internal.MetaVars.AllMetas b, Agda.Syntax.Internal.MetaVars.AllMetas c) => Agda.Syntax.Internal.MetaVars.AllMetas (a, b, c) instance (Agda.Syntax.Internal.MetaVars.AllMetas a, Agda.Syntax.Internal.MetaVars.AllMetas b, Agda.Syntax.Internal.MetaVars.AllMetas c, Agda.Syntax.Internal.MetaVars.AllMetas d) => Agda.Syntax.Internal.MetaVars.AllMetas (a, b, c, d) instance (Agda.Syntax.Internal.Generic.TermLike a, Agda.Syntax.Internal.Generic.TermLike b) => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.Type'' a b) -- | Extract used definitions from terms. module Agda.Syntax.Internal.Defs -- | Get list of definitions, throw an error if any metavariable is -- encountered. getDefListNoMetas :: Term -> [QName] -- | Getting the used definitions. -- -- Note: in contrast to foldTerm getDefs also collects -- from sorts in terms. Thus, this is not an instance of -- foldTerm. class GetDefs a -- | getDefs lookup emb a extracts all used definitions -- (functions, data/record types) from a, embedded into a monoid -- via emb. Instantiations of meta variables are obtained via -- lookup. -- -- Typical monoid instances would be Endo [QName] or Set -- QName. Do not use [QName] because of obvious quadratic -- slowdown. Note that emb can also choose to discard a used -- definition by mapping to the unit of the monoid. getDefs :: (GetDefs a, Monoid m, ExpandCase m) => (MetaId -> Maybe Term) -> (QName -> m) -> a -> m instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Clause instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (Agda.Syntax.Internal.Dom a) instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs [a] instance Agda.Syntax.Internal.Defs.GetDefs GHC.Internal.Base.String instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Common.MetaId instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Telescope instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Term instance (Agda.Syntax.Internal.Defs.GetDefs a, Agda.Syntax.Internal.Defs.GetDefs b) => Agda.Syntax.Internal.Defs.GetDefs (a, b) instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Type -- | The concrete syntax is a raw representation of the program text -- without any desugaring at all. This is what the parser produces. The -- idea is that if we figure out how to keep the concrete syntax around, -- it can be printed exactly as the user wrote it. module Agda.Syntax.Concrete -- | Concrete expressions. Should represent exactly what the user wrote. data Expr -- | ex: x Ident :: QName -> Expr -- | ex: 1 or "foo" Lit :: Range -> Literal -> Expr -- | ex: ? or {! ... !} QuestionMark :: Range -> Maybe Nat -> Expr -- | ex: _ or _A_5 Underscore :: Range -> Maybe String -> Expr -- | before parsing operators RawApp :: Range -> List2 Expr -> Expr -- | ex: e e, e {e}, or e {x = e} App :: Range -> Expr -> NamedArg Expr -> Expr -- | ex: e + e The QName is possibly ambiguous, but it must -- correspond to one of the names in the set. OpApp :: Range -> QName -> Set1 Name -> OpAppArgs -> Expr -- | ex: e | e1 | .. | en WithApp :: Range -> Expr -> List1 Expr -> Expr -- | ex: {e} or {x=e} HiddenArg :: Range -> Named_ Expr -> Expr -- | ex: {{e}} or {{x=e}} InstanceArg :: Range -> Named_ Expr -> Expr -- | ex: \x {y} -> e or \(x:A){y:B} -> e Lam :: Range -> List1 LamBinding -> Expr -> Expr -- | ex: \ () AbsurdLam :: Range -> Hiding -> Expr -- | ex: \ { p11 .. p1a -> e1 ; .. ; pn1 .. pnz -> en } ExtendedLam :: Range -> Erased -> List1 LamClause -> Expr -- | ex: e -> e or .e -> e (NYI: {e} -> -- e) Fun :: Range -> Arg Expr -> Expr -> Expr -- | ex: (xs:e) -> e or {xs:e} -> e Pi :: Telescope1 -> Expr -> Expr -- | ex: record {x = a; y = b}, or record { x = a; M1; M2 -- } The KwRange is for the record keyword. Rec :: KwRange -> Range -> RecordAssignments -> Expr -- | ex: record e {x = a; y = b} The KwRange is for the -- record keyword. RecUpdate :: KwRange -> Range -> Expr -> [FieldAssignment] -> Expr -- | ex: let Ds in e, missing body when parsing do-notation let Let :: Range -> List1 Declaration -> Maybe Expr -> Expr -- | ex: (e) Paren :: Range -> Expr -> Expr -- | ex: (| e1 | e2 | .. | en |) or (|) IdiomBrackets :: Range -> Maybe QName -> [Expr] -> Expr -- | ex: do x <- m1; m2 The KwRange is for the -- do keyword. DoBlock :: KwRange -> Maybe QName -> List1 DoStmt -> Expr -- | ex: () or {}, only in patterns Absurd :: Range -> Expr -- | ex: x@p, only in patterns As :: Range -> Name -> Expr -> Expr -- | ex: .p, only in patterns Dot :: KwRange -> Expr -> Expr -- | ex: ..A, used for parsing ..A -> B DoubleDot :: KwRange -> Expr -> Expr -- | ex: quote, should be applied to a name Quote :: Range -> Expr -- | ex: quoteTerm, should be applied to a term QuoteTerm :: Range -> Expr -- | ex: @(tactic t), used to declare tactic arguments Tactic :: Range -> Expr -> Expr -- | ex: unquote, should be applied to a term of type -- Term Unquote :: Range -> Expr -- | to print irrelevant things DontCare :: Expr -> Expr -- | ex: a = b, used internally in the parser Equal :: Range -> Expr -> Expr -> Expr -- | ..., used internally to parse patterns. Ellipsis :: Range -> Expr -- | An identifier coming from abstract syntax, for which we know a precise -- syntactic highlighting class (used in printing). KnownIdent :: Aspects -> QName -> Expr -- | An operator application coming from abstract syntax, for which we know -- a precise syntactic highlighting class (used in printing). KnownOpApp :: Aspects -> Range -> QName -> Set1 Name -> OpAppArgs -> Expr -- | An arbitrary expression bundled with highlighting information from -- abstract (or internal) syntax Highlighted :: Aspects -> Expr -> Expr Generalized :: Expr -> Expr data OpApp e -- | An abstraction inside a special syntax declaration (see Issue 358 why -- we introduce this). SyntaxBindingLambda :: Range -> List1 LamBinding -> e -> OpApp e Ordinary :: e -> OpApp e fromOrdinary :: e -> OpApp e -> e type OpAppArgs = OpAppArgs' Expr type OpAppArgs' e = List1 NamedArg MaybePlaceholder OpApp e type OpAppArgs0 e = [NamedArg MaybePlaceholder OpApp e] -- | The Expr is not an application. data AppView AppView :: Expr -> [NamedArg Expr] -> AppView appView :: Expr -> AppView unAppView :: AppView -> Expr -- | Parse outermost hiding information. toNamedArg :: Expr -> NamedArg Expr -- | Unparse hiding information. unNamedArg :: NamedArg Expr -> Expr rawApp :: List1 Expr -> Expr rawAppP :: List1 Pattern -> Pattern isSingleIdentifierP :: Pattern -> Maybe Name removeParenP :: Pattern -> Pattern -- | Turn an expression into a pattern. Fails if the expression is not a -- valid pattern. isPattern :: Expr -> Maybe Pattern isAbsurdP :: Pattern -> Maybe (Range, Hiding) isBinderP :: Pattern -> Maybe Binder -- | Can a dot pattern be interpreted as projection pattern? data PossiblyProjectionPattern -- | Yes. CouldBeProjectionPattern :: PossiblyProjectionPattern -- | No. CannotBeProjectionPattern :: PossiblyProjectionPattern -- | Observe the hiding status of an expression observeHiding :: Expr -> WithHiding Expr -- | Observe the relevance status of an expression observeRelevance :: Expr -> (Relevance, Expr) -- | Observe various modifiers applied to an expression observeModifiers :: Expr -> Arg Expr -- | Turn an expression into a pattern, turning non-pattern subexpressions -- into WildP. exprToPatternWithHoles :: Expr -> Pattern returnExpr :: Expr -> Maybe Expr -- | A Binder x@p, the pattern is optional data Binder' a Binder :: Maybe Pattern -> BinderNameOrigin -> a -> Binder' a [binderPattern] :: Binder' a -> Maybe Pattern [binderNameOrigin] :: Binder' a -> BinderNameOrigin [binderName] :: Binder' a -> a type Binder = Binder' BoundName mkBinder_ :: Name -> Binder mkBinder :: a -> Binder' a -- | A lambda binding is either untyped (domain free) or typed -- (TypedBinding). type LamBinding = LamBinding' TypedBinding data LamBinding' a -- | . x or {x} or .x or .{x} or -- {.x} or x@p or (p) DomainFree :: NamedArg Binder -> LamBinding' a -- | . (xs : e) or {xs : e} DomainFull :: a -> LamBinding' a -- | Parameters supplied to data and record definitions (as opposed to -- their signatures) are stripped of their type information. They also -- cannot contain let or pattern bindings or tactic attributes. type DefParameters = [WithHiding Named_ Name] -- | Drop type annotations and modalities from bindings. Also drop let, -- patterns, fixity, and tactics, but those should not be present in the -- first place when using this function, because all such cannot occur in -- data and record parameters. parametersToDefParameters :: Parameters -> DefParameters defParametersToParameters :: DefParameters -> Parameters -- | A typed binding. type TypedBinding = TypedBinding' Expr data TypedBinding' e -- | Binding (x1@p1 ... xn@pn : A). TBind :: Range -> List1 (NamedArg Binder) -> e -> TypedBinding' e -- | Let binding (let Ds) or (open M args). TLet :: Range -> List1 Declaration -> TypedBinding' e type RecordAssignment = Either FieldAssignment ModuleAssignment type RecordAssignments = [RecordAssignment] type FieldAssignment = FieldAssignment' Expr data FieldAssignment' a FieldAssignment :: Name -> a -> FieldAssignment' a [_nameFieldA] :: FieldAssignment' a -> Name [_exprFieldA] :: FieldAssignment' a -> a nameFieldA :: forall a f. Functor f => (Name -> f Name) -> FieldAssignment' a -> f (FieldAssignment' a) exprFieldA :: forall a f. Functor f => (a -> f a) -> FieldAssignment' a -> f (FieldAssignment' a) data ModuleAssignment ModuleAssignment :: QName -> [Expr] -> ImportDirective -> ModuleAssignment [_qnameModA] :: ModuleAssignment -> QName [_exprModA] :: ModuleAssignment -> [Expr] [_importDirModA] :: ModuleAssignment -> ImportDirective data BoundName BName :: Name -> Fixity' -> TacticAttribute -> Bool -> BoundName [boundName] :: BoundName -> Name [bnameFixity] :: BoundName -> Fixity' -- | From @tactic attribute. [bnameTactic] :: BoundName -> TacticAttribute -- | The @finite cannot be parsed, it comes from the builtin -- Partial only. [bnameIsFinite] :: BoundName -> Bool mkBoundName_ :: Name -> BoundName mkBoundName :: Name -> Fixity' -> BoundName type TacticAttribute = TacticAttribute' Expr newtype TacticAttribute' a TacticAttribute :: Maybe (Ranged a) -> TacticAttribute' a [theTacticAttribute] :: TacticAttribute' a -> Maybe (Ranged a) type Telescope = [TypedBinding] -- | A telescope is a sequence of typed bindings. Bound variables are in -- scope in later types. type Telescope1 = List1 TypedBinding -- | Parameters are sequences of typed or untyped bindings. type Parameters = [LamBinding] -- | We can get a Telescope from Parameters. If we have a -- type annotation already, we're happy. Otherwise we manufacture a -- binder with an underscore for the type. parametersToTelescope :: Range -> Parameters -> Telescope -- | Smart constructor for Pi: check whether the -- Telescope is empty makePi :: Telescope -> Expr -> Expr -- | Smart constructor for Lam: check for non-zero bindings. mkLam :: Range -> [LamBinding] -> Expr -> Expr -- | Smart constructor for Let: check for non-zero let bindings. mkLet :: Range -> [Declaration] -> Expr -> Expr -- | Smart constructor for TLet: check for non-zero let bindings. mkTLet :: Range -> [Declaration] -> Maybe (TypedBinding' e) -- | The representation type of a declaration. The comments indicate which -- type in the intended family the constructor targets. data Declaration -- | Axioms and functions can be irrelevant. (Hiding should be -- NotHidden) TacticAttribute makes only sense in -- Generalize blocks. TypeSig :: ArgInfo -> TacticAttribute -> Name -> Expr -> Declaration FieldSig :: IsInstance -> TacticAttribute -> Name -> Arg Expr -> Declaration -- | Variables to be generalized, can be hidden and/or irrelevant. Generalize :: KwRange -> [TypeSignature] -> Declaration Field :: KwRange -> [FieldSignature] -> Declaration -- | Only Modality is used in ArgInfo. FunClause :: ArgInfo -> LHS -> RHS -> WhereClause -> Catchall -> Declaration -- | lone data signature in mutual block DataSig :: Range -> Erased -> Name -> Parameters -> Expr -> Declaration Data :: Range -> Erased -> Name -> Parameters -> Expr -> [TypeSignatureOrInstanceBlock] -> Declaration DataDef :: Range -> Name -> Parameters -> [TypeSignatureOrInstanceBlock] -> Declaration -- | lone record signature in mutual block RecordSig :: Range -> Erased -> Name -> Parameters -> Expr -> Declaration RecordDef :: Range -> Name -> [RecordDirective] -> Parameters -> [Declaration] -> Declaration Record :: Range -> Erased -> Name -> [RecordDirective] -> Parameters -> Expr -> [Declaration] -> Declaration Infix :: Fixity -> List1 Name -> Declaration -- | notation declaration for a name Syntax :: Name -> Notation -> Declaration PatternSyn :: Range -> Name -> [WithHiding Name] -> Pattern -> Declaration Mutual :: KwRange -> [Declaration] -> Declaration InterleavedMutual :: KwRange -> [Declaration] -> Declaration Abstract :: KwRange -> [Declaration] -> Declaration -- | In Agda.Syntax.Concrete.Definitions we generate private blocks -- temporarily, which should be treated different that user-declared -- private blocks. Thus the Origin. Private :: KwRange -> Origin -> [Declaration] -> Declaration -- | The KwRange here only refers to the range of the -- instance keyword. The range of the whole block InstanceB -- r ds is fuseRange r ds. InstanceB :: KwRange -> [Declaration] -> Declaration LoneConstructor :: KwRange -> [Declaration] -> Declaration Macro :: KwRange -> [Declaration] -> Declaration Postulate :: KwRange -> [TypeSignatureOrInstanceBlock] -> Declaration Primitive :: KwRange -> [TypeSignature] -> Declaration Open :: KwRange -> QName -> ImportDirective -> Declaration Import :: OpenShortHand -> KwRange -> QName -> Either AsName RawOpenArgs -> ImportDirective -> Declaration ModuleMacro :: Range -> Erased -> Name -> ModuleApplication -> OpenShortHand -> ImportDirective -> Declaration Module :: Range -> Erased -> QName -> Telescope -> [Declaration] -> Declaration -- |
--   unquoteDecl xs = e
--   
UnquoteDecl :: Range -> [Name] -> Expr -> Declaration -- |
--   unquoteDef xs = e
--   
UnquoteDef :: Range -> [Name] -> Expr -> Declaration -- |
--   unquoteDecl data d constructor xs = e
--   
UnquoteData :: Range -> Name -> [Name] -> Expr -> Declaration Pragma :: Pragma -> Declaration -- |
--   opaque ...
--   
Opaque :: KwRange -> [Declaration] -> Declaration -- |
--   unfolding ...
--   
Unfolding :: KwRange -> [QName] -> Declaration -- | Return Pragma if Declaration is Pragma. isPragma :: CMaybe Pragma m => Declaration -> m -- | Isolated record directives parsed as Declarations data RecordDirective -- | Range of keyword [co]inductive. Induction :: Ranged Induction -> RecordDirective Constructor :: Name -> IsInstance -> RecordDirective -- | Range of [no-]eta-equality keyword. Eta :: Ranged HasEta0 -> RecordDirective -- | If declaration pattern is present, give its range. PatternOrCopattern :: Range -> RecordDirective type RecordDirectives = RecordDirectives' Maybe (Name, IsInstance) data ModuleApplication -- | tel M exprs where M exprs is a RawApp just -- after parsing. SectionApp :: Range -> Telescope -> QName -> [Expr] -> ModuleApplication -- |
--   M {{...}}
--   
RecordModuleInstance :: Range -> QName -> ModuleApplication -- | Just type signatures. type TypeSignature = Declaration -- | Just type signatures or instance blocks. type TypeSignatureOrInstanceBlock = Declaration -- | The things you are allowed to say when you shuffle names between name -- spaces (i.e. in import, namespace, or open -- declarations). type ImportDirective = ImportDirective' Name Name type Using = Using' Name Name -- | An imported name can be a module or a defined name. type ImportedName = ImportedName' Name Name type Renaming = Renaming' Name Name type RenamingDirective = RenamingDirective' Name Name type HidingDirective = HidingDirective' Name Name -- | The content of the as-clause of the import statement. data AsName' a AsName :: a -> Range -> AsName' a -- | The "as" name. [asName] :: AsName' a -> a -- | The range of the "as" keyword. Retained for highlighting purposes. [asRange] :: AsName' a -> Range -- | From the parser, we get an expression for the as-Name, -- which we have to parse into a Name. type AsName = AsName' Name -- | Expressions usually instantiating module parameters as in open -- import Monoid Carrier _==_ that might also code an as -- clause e.g. in open import File as M The parser does not -- distinguish these so we do it in the nicifier. type RawOpenArgs = [Expr] data OpenShortHand -- | Range of the open keyword. DoOpen :: KwRange -> OpenShortHand DontOpen :: OpenShortHand type RewriteEqn = RewriteEqn' () Name Pattern Expr type WithExpr = Named Name Arg Expr -- | Left hand sides can be written in infix style. For example: -- --
--   n + suc m = suc (n + m)
--   (f ∘ g) x = f (g x)
--   
-- -- We use fixity information to see which name is actually defined. data LHS -- | Original pattern (including with-patterns), rewrite equations and -- with-expressions. LHS :: Pattern -> [RewriteEqn] -> [WithExpr] -> LHS -- | e.g. f ps | wps [lhsOriginalPattern] :: LHS -> Pattern -- | (rewrite e | with p <- e in eq) (many) [lhsRewriteEqn] :: LHS -> [RewriteEqn] -- | with e1 in eq | {e2} | ... (many) [lhsWithExpr] :: LHS -> [WithExpr] -- | Concrete patterns. No literals in patterns at the moment. data Pattern -- | c or x -- -- If the boolean is False, then the QName must not refer -- to a constructor or a pattern synonym. The value False is used -- when a hidden argument pun is expanded. IdentP :: Bool -> QName -> Pattern -- |
--   quote
--   
QuoteP :: Range -> Pattern -- | p p' or p {x = p'} AppP :: Pattern -> NamedArg Pattern -> Pattern -- | p1..pn before parsing operators RawAppP :: Range -> List2 Pattern -> Pattern -- | eg: p => p' for operator _=>_ The QName -- is possibly ambiguous, but it must correspond to one of the names in -- the set. OpAppP :: Range -> QName -> Set1 Name -> List1 (NamedArg Pattern) -> Pattern -- | {p} or {x = p} HiddenP :: Range -> Named_ Pattern -> Pattern -- | {{p}} or {{x = p}} InstanceP :: Range -> Named_ Pattern -> Pattern -- |
--   (p)
--   
ParenP :: Range -> Pattern -> Pattern -- |
--   _
--   
WildP :: Range -> Pattern -- |
--   ()
--   
AbsurdP :: Range -> Pattern -- |
--   x@p
--   
AsP :: Range -> Name -> Pattern -> Pattern -- | .e, the KwRange is for the dot, the Range for -- the whole thing (including the dot). If the dot pattern came from -- parsing e.g. .{e} it cannot be a projection pattern. DotP :: KwRange -> Range -> PossiblyProjectionPattern -> Expr -> Pattern -- | 0, 1, etc. LitP :: Range -> Literal -> Pattern -- | record {x = p; y = q}. The KwRange is for the -- record keyword. RecP :: KwRange -> Range -> [FieldAssignment' Pattern] -> Pattern -- | i = i1 i.e. cubical face lattice generator EqualP :: Range -> List1 (Expr, Expr) -> Pattern -- | ..., only as left-most pattern. Second arg is -- Nothing before expansion, and Just p after expanding -- ellipsis to p. EllipsisP :: Range -> Maybe Pattern -> Pattern -- | | p, for with-patterns. WithP :: Range -> Pattern -> Pattern -- | Processed (operator-parsed) intermediate form of the core f -- ps of LHS. Corresponds to lhsOriginalPattern. data LHSCore LHSHead :: QName -> [NamedArg Pattern] -> LHSCore -- |
--   f
--   
[lhsDefName] :: LHSCore -> QName -- |
--   ps
--   
[lhsPats] :: LHSCore -> [NamedArg Pattern] LHSProj :: QName -> [NamedArg Pattern] -> NamedArg LHSCore -> [NamedArg Pattern] -> LHSCore -- | Record projection. [lhsDestructor] :: LHSCore -> QName -- | Patterns for record indices (currently none). [lhsPatsLeft] :: LHSCore -> [NamedArg Pattern] -- | Main argument. [lhsFocus] :: LHSCore -> NamedArg LHSCore -- |
--   ps
--   
[lhsPats] :: LHSCore -> [NamedArg Pattern] LHSWith :: LHSCore -> List1 Pattern -> [NamedArg Pattern] -> LHSCore [lhsHead] :: LHSCore -> LHSCore -- | At least one (| p). [lhsWithPatterns] :: LHSCore -> List1 Pattern -- |
--   ps
--   
[lhsPats] :: LHSCore -> [NamedArg Pattern] LHSEllipsis :: Range -> LHSCore -> LHSCore [lhsEllipsisRange] :: LHSCore -> Range -- | Pattern that was expanded from an ellipsis .... [lhsEllipsisPat] :: LHSCore -> LHSCore data LamClause LamClause :: [Pattern] -> RHS -> Catchall -> LamClause -- | Possibly empty sequence. [lamLHS] :: LamClause -> [Pattern] [lamRHS] :: LamClause -> RHS [lamCatchall] :: LamClause -> Catchall type RHS = RHS' Expr data RHS' e -- | No right hand side because of absurd match. AbsurdRHS :: RHS' e RHS :: e -> RHS' e -- | where block following a clause. type WhereClause = WhereClause' [Declaration] -- | The generalization WhereClause' is for the sake of -- Agda.Concrete.Generic. data WhereClause' decls -- | No where clauses. NoWhere :: WhereClause' decls -- | Ordinary where. Range of the where keyword. -- List of declarations can be empty. AnyWhere :: Range -> decls -> WhereClause' decls -- | Named where: module M where ds. Range of the keywords -- module and where. The Access flag applies to -- the Name (not the module contents!) and is propagated from the -- parent function. List of declarations can be empty. SomeWhere :: Range -> Erased -> Name -> Access -> decls -> WhereClause' decls -- | Type of where block following a clause. data WhereClause_ -- | No where clauses. NoWhere_ :: WhereClause_ -- | Ordinary where. AnyWhere_ :: WhereClause_ -- | Named where: module M where .... SomeWhere_ :: WhereClause_ -- | An expression followed by a where clause. Currently only used to give -- better a better error message in interaction. data ExprWhere ExprWhere :: Expr -> WhereClause -> ExprWhere whereClause_ :: WhereClause' a -> WhereClause_ data DoStmt -- |
--   p ← e where cs
--   
DoBind :: Range -> Pattern -> Expr -> [LamClause] -> DoStmt DoThen :: Expr -> DoStmt DoLet :: Range -> List1 Declaration -> DoStmt data Pragma OptionsPragma :: Range -> [String] -> Pragma BuiltinPragma :: Range -> RString -> QName -> Pragma -- | Second Range is for REWRITE keyword. RewritePragma :: Range -> Range -> [QName] -> Pragma ForeignPragma :: Range -> Ranged BackendName -> String -> Pragma CompilePragma :: Range -> Ranged BackendName -> QName -> String -> Pragma StaticPragma :: Range -> QName -> Pragma -- | INLINE or NOINLINE InlinePragma :: Range -> Bool -> QName -> Pragma -- | Throws an internal error in the scope checker. The Strings are -- words to be displayed with the error. ImpossiblePragma :: Range -> [String] -> Pragma -- | Removed, replaced by EtaEqualityPragma. EtaPragma :: Range -> QName -> Pragma -- | Applies to the named function WarningOnUsage :: Range -> QName -> Text -> Pragma -- | Applies to the current module WarningOnImport :: Range -> Text -> Pragma -- | Mark a definition as injective for the pattern matching unifier. InjectivePragma :: Range -> QName -> Pragma -- | Mark a definition as injective for the conversion checker InjectiveForInferencePragma :: Range -> QName -> Pragma -- | Display lhs as rhs (modifies the printer). DisplayPragma :: Range -> Pattern -> Expr -> Pragma -- | Applies to the following function clause. CatchallPragma :: Range -> Pragma -- | Applies to the following record type. Force eta-equality for -- the attached record type for unguarded and -- coinductive records. EtaEqualityPragma :: Range -> Pragma -- | Applies to the following function (and all that are mutually recursive -- with it) or to the functions in the following mutual block. TerminationCheckPragma :: Range -> TerminationCheck Name -> Pragma -- | Applies to the following function (and all that are mutually recursive -- with it) or to the functions in the following mutual block. NoCoverageCheckPragma :: Range -> Pragma -- | Applies to the following data/record type or mutual block. NoPositivityCheckPragma :: Range -> Pragma PolarityPragma :: Range -> Name -> [Ranged Occurrence] -> Pragma -- | Applies to the following data/record type. NoUniverseCheckPragma :: Range -> Pragma -- | Applies to the stated function NotProjectionLikePragma :: Range -> QName -> Pragma -- | Applies to the given name(s), which must be instance names (checked by -- the type checker). OverlapPragma :: Range -> [QName] -> OverlapMode -> Pragma -- | Modules: Top-level pragmas plus other top-level declarations. data Module Mod :: QName -> [Pragma] -> [Declaration] -> Module -- | The module name as inferred by the parser. Could be _ if the -- parser inserted a top-level module declaration. [modName] :: Module -> QName -- | The top-level OPTIONS pragmas. [modPragmas] :: Module -> [Pragma] -- | All the other declarations, including the top-level module. [modDecls] :: Module -> [Declaration] -- | Decorating something with Fixity'. data ThingWithFixity x ThingWithFixity :: x -> Fixity' -> ThingWithFixity x type HoleContent = HoleContent' () Name Pattern Expr -- | Extended content of an interaction hole. data HoleContent' qn nm p e -- |
--   e
--   
HoleContentExpr :: e -> HoleContent' qn nm p e -- |
--   (rewrite | invert) e0 | ... | en
--   
HoleContentRewrite :: [RewriteEqn' qn nm p e] -> HoleContent' qn nm p e -- | Splits off allowed (= import) declarations before the first -- non-allowed declaration. After successful parsing, the first -- non-allowed declaration should be a module declaration. spanAllowedBeforeModule :: [Declaration] -> ([Declaration], [Declaration]) ungatherRecordDirectives :: RecordDirectives -> [RecordDirective] instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.AsName' a) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.Binder' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.BoundName instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Declaration instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.DoStmt instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Expr instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.FieldAssignment' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.LHS instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.LHSCore instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.LamBinding' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.LamClause instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.ModuleApplication instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.ModuleAssignment instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.OpApp e) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.OpenShortHand instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Pattern instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.PossiblyProjectionPattern instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Pragma instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.RHS' e) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.RecordDirective instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.TacticAttribute' a) instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.TypedBinding' e) instance GHC.Internal.Classes.Eq decls => GHC.Internal.Classes.Eq (Agda.Syntax.Concrete.WhereClause' decls) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.WhereClause_ instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.AsName' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.Binder' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.FieldAssignment' instance GHC.Internal.Data.Foldable.Foldable (Agda.Syntax.Concrete.HoleContent' qn nm p) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.LamBinding' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.OpApp instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.RHS' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.TacticAttribute' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.TypedBinding' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Concrete.WhereClause' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.AsName' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.Binder' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.FieldAssignment' instance GHC.Internal.Base.Functor (Agda.Syntax.Concrete.HoleContent' qn nm p) instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.LamBinding' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.OpApp instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.RHS' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.TacticAttribute' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.TypedBinding' instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.WhereClause' instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.OpenShortHand instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.WhereClause_ instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.AsName instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Binder instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.BoundName instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.DoStmt instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Expr instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LHSCore instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Position.HasRange e => Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.OpApp e) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.OpenShortHand instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Pragma instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.RHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.RecordDirective instance Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.TacticAttribute' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.WhereClause instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.AsName instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Binder instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.BoundName instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.DoStmt instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Expr instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.LHS instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Position.KillRange e => Agda.Syntax.Position.KillRange (Agda.Syntax.Concrete.OpApp e) instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.OpenShortHand instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Pragma instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.RHS instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.RecordDirective instance Agda.Syntax.Position.KillRange (Agda.Syntax.Concrete.TacticAttribute' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.WhereClause instance Agda.Syntax.Common.LensHiding Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Common.LensHiding Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Concrete.TypedBinding instance Control.DeepSeq.NFData Agda.Syntax.Concrete.AsName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Binder instance Control.DeepSeq.NFData Agda.Syntax.Concrete.BoundName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Declaration instance Control.DeepSeq.NFData Agda.Syntax.Concrete.DoStmt instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Expr instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.FieldAssignment' a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.LHS instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.LamBinding' a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.LamClause instance Control.DeepSeq.NFData Agda.Syntax.Concrete.ModuleApplication instance Control.DeepSeq.NFData Agda.Syntax.Concrete.ModuleAssignment instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.OpApp a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.OpenShortHand instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Pattern instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Pragma instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.RHS' a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.RecordDirective instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.TacticAttribute' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.TypedBinding' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.WhereClause' a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.WhereClause_ instance Agda.Utils.Null.Null Agda.Syntax.Concrete.OpenShortHand instance Agda.Utils.Null.Null (Agda.Syntax.Concrete.TacticAttribute' a) instance Agda.Utils.Null.Null (Agda.Syntax.Concrete.WhereClause' a) instance Agda.Utils.Null.Null Agda.Syntax.Concrete.WhereClause_ instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.TypedBinding instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Concrete.AsName' a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Concrete.FieldAssignment' a) instance GHC.Internal.Show.Show Agda.Syntax.Concrete.OpenShortHand instance GHC.Internal.Show.Show Agda.Syntax.Concrete.PossiblyProjectionPattern instance GHC.Internal.Show.Show Agda.Syntax.Concrete.RecordDirective instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Concrete.TacticAttribute' a) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.AsName' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.Binder' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.FieldAssignment' instance GHC.Internal.Data.Traversable.Traversable (Agda.Syntax.Concrete.HoleContent' qn nm p) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.LamBinding' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.OpApp instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.RHS' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.TacticAttribute' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.TypedBinding' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Concrete.WhereClause' module Agda.Syntax.TopLevelModuleName -- | Hashes a raw top-level module name. hashRawTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash -- | A lens focusing on the moduleNameParts. lensTopLevelModuleNameParts :: Lens' TopLevelModuleName TopLevelModuleNameParts -- | Turns a top-level module name into a file name with the given suffix. moduleNameToFileName :: TopLevelModuleName -> String -> FilePath -- | Finds the current project's "root" directory, given a project file and -- the corresponding top-level module name. -- -- Example: If the module "A.B.C" is located in the file -- "fooABC.agda", then the root is "foo". -- -- Precondition: The module name must be well-formed. projectRoot :: AbsolutePath -> TopLevelModuleName -> AbsolutePath -- | Converts a top-level module name to a raw top-level module name. rawTopLevelModuleName :: TopLevelModuleName -> RawTopLevelModuleName -- | Retrieves the top-level module name. rawTopLevelModuleNameForModule :: Module -> RawTopLevelModuleName -- | Computes the RawTopLevelModuleName corresponding to the given -- module name, which is assumed to represent a top-level module name. -- -- Precondition: The module name must be well-formed. rawTopLevelModuleNameForModuleName :: ModuleName -> RawTopLevelModuleName -- | Turns a qualified name into a RawTopLevelModuleName. The -- qualified name is assumed to represent a top-level module name. rawTopLevelModuleNameForQName :: QName -> RawTopLevelModuleName -- | Turns a raw top-level module name into a string. rawTopLevelModuleNameToString :: RawTopLevelModuleName -> String -- | A corresponding QName. The range of each Name part is -- the whole range of the TopLevelModuleName. topLevelModuleNameToQName :: TopLevelModuleName -> QName -- | Converts a raw top-level module name and a hash to a top-level module -- name. -- -- This function does not ensure that there are no hash collisions, that -- is taken care of by topLevelModuleName. unsafeTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash -> TopLevelModuleName -- | Raw top-level module names (with linear-time comparisons). data RawTopLevelModuleName RawTopLevelModuleName :: Range -> TopLevelModuleNameParts -> Bool -> RawTopLevelModuleName [rawModuleNameRange] :: RawTopLevelModuleName -> Range [rawModuleNameParts] :: RawTopLevelModuleName -> TopLevelModuleNameParts -- | Was this module name constructed from a file name rather than declared -- in the file? [rawModuleNameInferred] :: RawTopLevelModuleName -> Bool -- | Top-level module names (with constant-time comparisons). type TopLevelModuleName = TopLevelModuleName' Range instance GHC.Internal.Classes.Eq Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance GHC.Internal.Generics.Generic Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Position.HasRange Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Concrete.Name.IsNoName Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Position.KillRange Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Control.DeepSeq.NFData Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance GHC.Internal.Classes.Ord Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Syntax.Position.SetRange Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance GHC.Internal.Show.Show Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Utils.Size.Sized Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Utils.Size.Sized Agda.Syntax.TopLevelModuleName.TopLevelModuleName -- | Tools for patterns in concrete syntax. module Agda.Syntax.Concrete.Pattern -- | Check for ellipsis .... class IsEllipsis a isEllipsis :: IsEllipsis a => a -> Bool -- | Has the lhs an occurrence of the ellipsis ...? class HasEllipsis a hasEllipsis :: HasEllipsis a => a -> Bool -- | Check for with-pattern | p. class IsWithP p isWithP :: IsWithP p => p -> Maybe p ($dmisWithP) :: forall q (f :: Type -> Type). (IsWithP p, IsWithP q, Decoration f, f q ~ p) => p -> Maybe p -- | The next patterns are ... -- -- (This view discards PatInfo.) data LHSPatternView -- | Application patterns (non-empty list). LHSAppP :: List1 (NamedArg Pattern) -> LHSPatternView -- | With patterns (non-empty list). These patterns are not prefixed with -- WithP. LHSWithP :: List1 Pattern -> LHSPatternView -- | Construct the LHSPatternView of the given list (if not empty). -- -- Return the view and the remaining patterns. lhsPatternView :: [NamedArg Pattern] -> Maybe (LHSPatternView, [NamedArg Pattern]) -- | Add applicative patterns (non-projection / non-with patterns) to the -- right. lhsCoreApp :: LHSCore -> List1 (NamedArg Pattern) -> LHSCore -- | Add with-patterns to the right. lhsCoreWith :: LHSCore -> List1 Pattern -> LHSCore -- | Append patterns to LHSCore, separating with patterns from the -- rest. lhsCoreAddSpine :: LHSCore -> [NamedArg Pattern] -> LHSCore -- | Modify the Pattern component in LHS. mapLhsOriginalPattern :: (Pattern -> Pattern) -> LHS -> LHS -- | Effectfully modify the Pattern component in LHS. mapLhsOriginalPatternM :: Functor m => (Pattern -> m Pattern) -> LHS -> m LHS -- | Does the LHS contain projection patterns? hasCopatterns :: LHSCore -> Bool -- | Generic pattern traversal. -- -- See APatternLike. class CPatternLike p -- | Fold pattern. foldrCPattern :: (CPatternLike p, Monoid m) => (Pattern -> m -> m) -> p -> m ($dmfoldrCPattern) :: forall m (f :: Type -> Type) q. (CPatternLike p, Monoid m, Foldable f, CPatternLike q, f q ~ p) => (Pattern -> m -> m) -> p -> m -- | Traverse pattern with option of post-traversal modification. traverseCPatternA :: (CPatternLike p, Applicative m) => (Pattern -> m Pattern -> m Pattern) -> p -> m p ($dmtraverseCPatternA) :: forall (f :: Type -> Type) q m. (CPatternLike p, Traversable f, CPatternLike q, f q ~ p, Applicative m) => (Pattern -> m Pattern -> m Pattern) -> p -> m p -- | Traverse pattern. traverseCPatternM :: (CPatternLike p, Monad m) => (Pattern -> m Pattern) -> (Pattern -> m Pattern) -> p -> m p ($dmtraverseCPatternM) :: forall (f :: Type -> Type) q m. (CPatternLike p, Traversable f, CPatternLike q, f q ~ p, Monad m) => (Pattern -> m Pattern) -> (Pattern -> m Pattern) -> p -> m p -- | Compute a value from each subpattern and collect all values in a -- monoid. foldCPattern :: (CPatternLike p, Monoid m) => (Pattern -> m) -> p -> m -- | Traverse pattern(s) with a modification before the recursive descent. preTraverseCPatternM :: (CPatternLike p, Monad m) => (Pattern -> m Pattern) -> p -> m p -- | Traverse pattern(s) with a modification after the recursive descent. postTraverseCPatternM :: (CPatternLike p, Monad m) => (Pattern -> m Pattern) -> p -> m p -- | Map pattern(s) with a modification after the recursive descent. mapCPattern :: CPatternLike p => (Pattern -> Pattern) -> p -> p -- | Get all the identifiers in a pattern in left-to-right order. -- -- Implemented using difference lists. patternQNames :: CPatternLike p => p -> [QName] -- | Get all the identifiers in a pattern in left-to-right order. patternNames :: Pattern -> [Name] -- | Does the pattern contain a with-pattern? (Shortcutting.) hasWithPatterns :: CPatternLike p => p -> Bool -- | Is WithP? isWithPattern :: Pattern -> Bool -- | Count the number of with-subpatterns in a pattern? numberOfWithPatterns :: CPatternLike p => p -> Int -- | Compute the context in which the ellipsis occurs, if at all. If there -- are several occurrences, this is an error. This only counts ellipsis -- that haven't already been expanded. hasEllipsis' :: CPatternLike p => p -> AffineHole Pattern p -- | Reconstruct the ellipsis, used in printing (AbstractToConcrete). reintroduceEllipsis :: ExpandedEllipsis -> Pattern -> Pattern splitEllipsis :: IsWithP p => Int -> [p] -> ([p], [p]) -- | View a pattern p as a list p0 .. pn where -- p0 is the identifier (in most cases a constructor). -- -- Pattern needs to be parsed already (operators resolved). patternAppView :: Pattern -> List1 (NamedArg Pattern) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Syntax.Common.Arg p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Syntax.Concrete.FieldAssignment' p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike [p] instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Utils.List2.List2 p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (GHC.Internal.Maybe.Maybe p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Syntax.Common.Named n p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Utils.List1.List1 p) instance Agda.Syntax.Concrete.Pattern.CPatternLike Agda.Syntax.Concrete.Pattern instance (Agda.Syntax.Concrete.Pattern.CPatternLike a, Agda.Syntax.Concrete.Pattern.CPatternLike b) => Agda.Syntax.Concrete.Pattern.CPatternLike (a, b) instance Agda.Syntax.Concrete.Pattern.HasEllipsis Agda.Syntax.Concrete.LHS instance Agda.Syntax.Concrete.Pattern.HasEllipsis Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Concrete.Pattern.IsEllipsis Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Concrete.Pattern.IsWithP p => Agda.Syntax.Concrete.Pattern.IsWithP (Agda.Syntax.Common.Arg p) instance Agda.Syntax.Concrete.Pattern.IsWithP p => Agda.Syntax.Concrete.Pattern.IsWithP (Agda.Syntax.Common.Named n p) instance Agda.Syntax.Concrete.Pattern.IsWithP Agda.Syntax.Concrete.Pattern -- | Generic traversal and reduce for concrete syntax, in the style of -- Agda.Syntax.Internal.Generic. -- -- However, here we use the terminology of Traversable. module Agda.Syntax.Concrete.Generic -- | Generic traversals for concrete expressions. -- -- Note: does not go into patterns! class ExprLike a -- | This corresponds to map. mapExpr :: ExprLike a => (Expr -> Expr) -> a -> a ($dmmapExpr) :: forall (t :: Type -> Type) b. (ExprLike a, Functor t, ExprLike b, t b ~ a) => (Expr -> Expr) -> a -> a -- | This corresponds to foldMap. foldExpr :: (ExprLike a, Monoid m) => (Expr -> m) -> a -> m ($dmfoldExpr) :: forall m (t :: Type -> Type) b. (ExprLike a, Monoid m, Foldable t, ExprLike b, t b ~ a) => (Expr -> m) -> a -> m -- | This corresponds to mapM. traverseExpr :: (ExprLike a, Monad m) => (Expr -> m Expr) -> a -> m a ($dmtraverseExpr) :: forall m (t :: Type -> Type) b. (ExprLike a, Monad m, Traversable t, ExprLike b, t b ~ a) => (Expr -> m Expr) -> a -> m a class FoldDecl a -- | Collect declarations and subdeclarations, transitively. Prefix-order -- tree traversal. foldDecl :: (FoldDecl a, Monoid m) => (Declaration -> m) -> a -> m ($dmfoldDecl) :: forall m (t :: Type -> Type) b. (FoldDecl a, Monoid m, Foldable t, FoldDecl b, t b ~ a) => (Declaration -> m) -> a -> m class TraverseDecl a -- | Update declarations and their subdeclarations. Prefix-order traversal: -- traverses subdeclarations of updated declaration. preTraverseDecl :: (TraverseDecl a, Monad m) => (Declaration -> m Declaration) -> a -> m a ($dmpreTraverseDecl) :: forall m (t :: Type -> Type) b. (TraverseDecl a, Monad m, Traversable t, TraverseDecl b, t b ~ a) => (Declaration -> m Declaration) -> a -> m a instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Concrete.Generic.ExprLike GHC.Internal.Types.Bool instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.DoStmt instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b) => Agda.Syntax.Concrete.Generic.ExprLike (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Expr instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.FieldAssignment instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.LHS instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike [a] instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Utils.List2.List2 a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.MaybePlaceholder a) instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Utils.List1.List1 a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.OpApp a) instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.RHS' a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.Ranged a) instance (Agda.Syntax.Concrete.Generic.ExprLike qn, Agda.Syntax.Concrete.Generic.ExprLike e) => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.TacticAttribute' a) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b) => Agda.Syntax.Concrete.Generic.ExprLike (a, b) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b, Agda.Syntax.Concrete.Generic.ExprLike c) => Agda.Syntax.Concrete.Generic.ExprLike (a, b, c) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b, Agda.Syntax.Concrete.Generic.ExprLike c, Agda.Syntax.Concrete.Generic.ExprLike d) => Agda.Syntax.Concrete.Generic.ExprLike (a, b, c, d) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.TypedBinding' a) instance Agda.Syntax.Concrete.Generic.ExprLike () instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.WhereClause' a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Concrete.Generic.FoldDecl Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Concrete.Generic.FoldDecl a => Agda.Syntax.Concrete.Generic.FoldDecl [a] instance Agda.Syntax.Concrete.Generic.FoldDecl a => Agda.Syntax.Concrete.Generic.FoldDecl (Agda.Utils.List2.List2 a) instance Agda.Syntax.Concrete.Generic.FoldDecl Agda.Syntax.Concrete.Module instance Agda.Syntax.Concrete.Generic.FoldDecl a => Agda.Syntax.Concrete.Generic.FoldDecl (Agda.Utils.List1.List1 a) instance Agda.Syntax.Concrete.Generic.FoldDecl a => Agda.Syntax.Concrete.Generic.FoldDecl (Agda.Syntax.Concrete.WhereClause' a) instance Agda.Syntax.Concrete.Generic.TraverseDecl Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Concrete.Generic.TraverseDecl a => Agda.Syntax.Concrete.Generic.TraverseDecl [a] instance Agda.Syntax.Concrete.Generic.TraverseDecl a => Agda.Syntax.Concrete.Generic.TraverseDecl (Agda.Utils.List2.List2 a) instance Agda.Syntax.Concrete.Generic.TraverseDecl a => Agda.Syntax.Concrete.Generic.TraverseDecl (Agda.Utils.List1.List1 a) instance Agda.Syntax.Concrete.Generic.TraverseDecl a => Agda.Syntax.Concrete.Generic.TraverseDecl (Agda.Syntax.Concrete.WhereClause' a) -- | Types used for precise syntax highlighting. module Agda.Interaction.Highlighting.Precise data Aspect Comment :: Aspect Keyword :: Aspect String :: Aspect Number :: Aspect Hole :: Aspect -- | Symbols like forall, =, ->, etc. Symbol :: Aspect -- | Things like Set and Prop. PrimitiveType :: Aspect -- | Bool: Is the name an operator part? Name :: Maybe NameKind -> Bool -> Aspect -- | Text occurring in pragmas that does not have a more specific aspect. Pragma :: Aspect -- | Non-code contents in literate Agda. Background :: Aspect -- | Delimiters used to separate the Agda code blocks from the other -- contents in literate Agda. Markup :: Aspect -- | Uniform Resource Locator aka clickable link. URL :: Text -> Aspect -- | NameKinds are figured out during scope checking. data NameKind -- | Bound variable. Bound :: NameKind -- | Generalizable variable. (This includes generalizable variables that -- have been generalized). Generalizable :: NameKind -- | Inductive or coinductive constructor. Constructor :: Induction -> NameKind Datatype :: NameKind -- | Record field. Field :: NameKind Function :: NameKind -- | Module name. Module :: NameKind Postulate :: NameKind -- | Primitive. Primitive :: NameKind -- | Record type. Record :: NameKind -- | Named argument, like x in {x = v} Argument :: NameKind -- | Macro. Macro :: NameKind -- | Other aspects, generated by type checking. (These can overlap with -- each other and with Aspects.) data OtherAspect Error :: OtherAspect -- | A warning that is considered fatal in the end. ErrorWarning :: OtherAspect DottedPattern :: OtherAspect UnsolvedMeta :: OtherAspect -- | Unsolved constraint not connected to meta-variable. This could for -- instance be an emptyness constraint. UnsolvedConstraint :: OtherAspect TerminationProblem :: OtherAspect PositivityProblem :: OtherAspect -- | Used for highlighting unreachable clauses, unreachable RHS (because of -- an absurd pattern), etc. Deadcode :: OtherAspect -- | Used for shadowed repeated variable names in telescopes. ShadowingInTelescope :: OtherAspect CoverageProblem :: OtherAspect -- | Code which is being type-checked. TypeChecks :: OtherAspect -- | Function declaration without matching definition. MissingDefinition :: OtherAspect -- | Unusable instance etc. InstanceProblem :: OtherAspect -- | Nothing serious, just a beauty flaw. CosmeticProblem :: OtherAspect CatchallClause :: OtherAspect ConfluenceProblem :: OtherAspect -- | Syntactic aspects of the code. (These cannot overlap.) -- -- Meta information which can be associated with a character/character -- range. data Aspects Aspects :: Maybe Aspect -> Set OtherAspect -> String -> Maybe DefinitionSite -> TokenBased -> Aspects [aspect] :: Aspects -> Maybe Aspect [otherAspects] :: Aspects -> Set OtherAspect -- | This note, if not null, can be displayed as a tool-tip or something -- like that. It should contain useful information about the range (like -- the module containing a certain identifier, or the fixity of an -- operator). [note] :: Aspects -> String -- | The definition site of the annotated thing, if applicable and known. [definitionSite] :: Aspects -> Maybe DefinitionSite -- | Is this entry token-based? [tokenBased] :: Aspects -> TokenBased data DefinitionSite DefinitionSite :: TopLevelModuleName' Range -> Int -> Bool -> Maybe String -> DefinitionSite -- | The defining module. [defSiteModule] :: DefinitionSite -> TopLevelModuleName' Range -- | The file position in that module. File positions are counted from 1. [defSitePos] :: DefinitionSite -> Int -- | Has this DefinitionSite been created at the defining site of -- the name? [defSiteHere] :: DefinitionSite -> Bool -- | A pretty name for the HTML linking. [defSiteAnchor] :: DefinitionSite -> Maybe String -- | Is the highlighting "token-based", i.e. based only on information from -- the lexer? data TokenBased TokenBased :: TokenBased NotOnlyTokenBased :: TokenBased -- | A limited kind of syntax highlighting information: a pair consisting -- of Ranges and Aspects. -- -- Note the invariant which RangePairs should satisfy -- (rangePairInvariant). newtype RangePair RangePair :: (Ranges, Aspects) -> RangePair [rangePair] :: RangePair -> (Ranges, Aspects) -- | Invariant for RangePair. rangePairInvariant :: RangePair -> Bool -- | Syntax highlighting information, represented by maps from positions to -- Aspects. -- -- The first position in the file has number 1. newtype PositionMap PositionMap :: IntMap Aspects -> PositionMap [positionMap] :: PositionMap -> IntMap Aspects -- | Highlighting info with delayed merging. -- -- Merging large sets of highlighting info repeatedly might be costly. -- The idea of this type is to accumulate small pieces of highlighting -- information, and then to merge them all at the end. -- -- Note the invariant which values of this type should satisfy -- (delayedMergeInvariant). newtype DelayedMerge hl DelayedMerge :: Endo [hl] -> DelayedMerge hl -- | Invariant for DelayedMerge hl, parametrised by the -- invariant for hl. -- -- Additionally the endofunction should be extensionally equal to (fs -- ++) for some list fs. delayedMergeInvariant :: (hl -> Bool) -> DelayedMerge hl -> Bool -- | Highlighting information. -- -- Note the invariant which values of this type should satisfy -- (highlightingInfoInvariant). -- -- This is a type synonym in order to make it easy to change to another -- representation. type HighlightingInfo = RangeMap Aspects -- | The invariant for HighlightingInfo. highlightingInfoInvariant :: HighlightingInfo -> Bool -- | A type that is intended to be used when constructing highlighting -- information. -- -- Note the invariant which values of this type should satisfy -- (highlightingInfoBuilderInvariant). -- -- This is a type synonym in order to make it easy to change to another -- representation. -- -- The type should be an instance of IsBasicRangeMap -- Aspects, Semigroup and Monoid, and there -- should be an instance of Convert -- HighlightingInfoBuilder HighlightingInfo. type HighlightingInfoBuilder = DelayedMerge RangePair -- | The invariant for HighlightingInfoBuilder. -- -- Additionally the endofunction should be extensionally equal to (fs -- ++) for some list fs. highlightingInfoBuilderInvariant :: HighlightingInfoBuilder -> Bool -- | A variant of mempty with tokenBased set to -- NotOnlyTokenBased. parserBased :: Aspects -- | Conversion from classification of the scope checker. kindOfNameToNameKind :: KindOfName -> NameKind -- | A class that is intended to make it easy to swap between different -- range map implementations. -- -- Note that some RangeMap operations are not included in this -- class. class IsBasicRangeMap a m | m -> a -- | The map singleton rs x contains the ranges from -- rs, and every position in those ranges is associated with -- x. singleton :: IsBasicRangeMap a m => Ranges -> a -> m -- | Converts range maps to IntMaps from positions to values. toMap :: IsBasicRangeMap a m => m -> IntMap a -- | Converts the map to a list. The ranges are non-overlapping and -- non-empty, and earlier ranges precede later ones in the list. toList :: IsBasicRangeMap a m => m -> [(Range, a)] -- | Returns the smallest range covering everything in the map (or -- Nothing, if the range would be empty). -- -- Note that the default implementation of this operation might be -- inefficient. coveringRange :: IsBasicRangeMap a m => m -> Maybe Range -- | Like singleton, but with several Ranges instead of only -- one. several :: (IsBasicRangeMap a hl, Monoid hl) => [Ranges] -> a -> hl -- | Conversion between different types. class Convert a b convert :: Convert a b => a -> b -- | Returns a RangeMap overlapping the given range, as well as the -- rest of the map. insideAndOutside :: Range -> RangeMap a -> (RangeMap a, RangeMap a) -- | Restricts the RangeMap to the given range. restrictTo :: Range -> RangeMap a -> RangeMap a instance Agda.Interaction.Highlighting.Precise.Convert (Agda.Interaction.Highlighting.Precise.DelayedMerge Agda.Interaction.Highlighting.Precise.RangePair) Agda.Interaction.Highlighting.Precise.PositionMap instance Agda.Interaction.Highlighting.Precise.Convert (Agda.Interaction.Highlighting.Precise.DelayedMerge Agda.Interaction.Highlighting.Precise.PositionMap) (Agda.Utils.RangeMap.RangeMap Agda.Syntax.Common.Aspect.Aspects) instance Agda.Interaction.Highlighting.Precise.Convert (Agda.Interaction.Highlighting.Precise.DelayedMerge Agda.Interaction.Highlighting.Precise.RangePair) (Agda.Utils.RangeMap.RangeMap Agda.Syntax.Common.Aspect.Aspects) instance GHC.Internal.Base.Monoid hl => Agda.Interaction.Highlighting.Precise.Convert (Agda.Interaction.Highlighting.Precise.DelayedMerge hl) hl instance Agda.Interaction.Highlighting.Precise.Convert Agda.Interaction.Highlighting.Precise.PositionMap (Agda.Utils.RangeMap.RangeMap Agda.Syntax.Common.Aspect.Aspects) instance Agda.Interaction.Highlighting.Precise.Convert (Agda.Utils.RangeMap.RangeMap Agda.Syntax.Common.Aspect.Aspects) (Agda.Utils.RangeMap.RangeMap Agda.Syntax.Common.Aspect.Aspects) instance Agda.Utils.RangeMap.IsBasicRangeMap Agda.Syntax.Common.Aspect.Aspects (Agda.Interaction.Highlighting.Precise.DelayedMerge Agda.Interaction.Highlighting.Precise.RangePair) instance Agda.Utils.RangeMap.IsBasicRangeMap Agda.Syntax.Common.Aspect.Aspects (Agda.Interaction.Highlighting.Precise.DelayedMerge Agda.Interaction.Highlighting.Precise.PositionMap) instance Agda.Utils.RangeMap.IsBasicRangeMap Agda.Syntax.Common.Aspect.Aspects Agda.Interaction.Highlighting.Precise.PositionMap instance Agda.Utils.RangeMap.IsBasicRangeMap Agda.Syntax.Common.Aspect.Aspects Agda.Interaction.Highlighting.Precise.RangePair instance GHC.Internal.Base.Semigroup a => Agda.Utils.RangeMap.IsBasicRangeMap a (Agda.Interaction.Highlighting.Precise.DelayedMerge (Agda.Utils.RangeMap.RangeMap a)) instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Aspect.Aspects instance GHC.Internal.Base.Monoid (Agda.Interaction.Highlighting.Precise.DelayedMerge hl) instance GHC.Internal.Base.Monoid Agda.Interaction.Highlighting.Precise.PositionMap instance GHC.Internal.Base.Monoid Agda.Syntax.Common.Aspect.TokenBased instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.Precise.PositionMap instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.Precise.RangePair instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Aspect.Aspects instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Aspect.DefinitionSite instance GHC.Internal.Base.Semigroup (Agda.Interaction.Highlighting.Precise.DelayedMerge hl) instance GHC.Internal.Base.Semigroup Agda.Interaction.Highlighting.Precise.PositionMap instance GHC.Internal.Base.Semigroup Agda.Syntax.Common.Aspect.TokenBased instance GHC.Internal.Show.Show hl => GHC.Internal.Show.Show (Agda.Interaction.Highlighting.Precise.DelayedMerge hl) instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.Precise.PositionMap instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.Precise.RangePair -- | Agda-specific benchmarking structure. module Agda.Benchmarking -- | Phases to allocate CPU time to. data Phase -- | Happy parsing and operator parsing. Parsing :: Phase -- | Import chasing. Import :: Phase -- | Reading interface files. Deserialization :: Phase -- | Scope checking and translation to abstract syntax. Scoping :: Phase -- | Type checking and translation to internal syntax. Typing :: Phase -- | Termination checking. Termination :: Phase -- | Polarity computation. Polarity :: Phase -- | Positivity checking. Positivity :: Phase -- | Injectivity checking. Injectivity :: Phase -- | Checking for projection likeness. ProjectionLikeness :: Phase -- | Coverage checking and compilation to case trees. Coverage :: Phase -- | Generating highlighting info. Highlighting :: Phase -- | Writing interface files. Serialization :: Phase -- | Dead code elimination. DeadCode :: Phase -- | Unfolding all metas before serialization. InterfaceInstantiateFull :: Phase -- | Dead code reachable definitions subphase. DeadCodeReachable :: Phase -- | Subphase for Termination. Graph :: Phase -- | Subphase for Termination. RecCheck :: Phase -- | Subphase for Termination. Reduce :: Phase -- | Subphase for Termination. Level :: Phase -- | Subphase for Termination. Compare :: Phase -- | Subphase for Termination. With :: Phase -- | Subphase for Import. ModuleName :: Phase -- | Subphase for Deserialization: compacting interfaces. Compaction :: Phase -- | Subphase for Serialization. BuildInterface :: Phase -- | Subphase for Serialization. Sort :: Phase -- | Subphase for Serialization. BinaryEncode :: Phase -- | Subphase for Serialization. Compress :: Phase -- | Subphase for Parsing. OperatorsExpr :: Phase -- | Subphase for Parsing. OperatorsPattern :: Phase -- | Subphase for Typing: free variable computation. Free :: Phase -- | Subphase for Typing: occurs check for solving metas. OccursCheck :: Phase -- | Subphase for Typing: checking the LHS CheckLHS :: Phase -- | Subphase for Typing: checking the RHS CheckRHS :: Phase -- | Subphase for Typing: checking a type signature TypeSig :: Phase -- | Subphase for Typing: generalizing over variables Generalize :: Phase -- | Subphase for Typing: solving instance goals InstanceSearch :: Phase -- | Subphase for Typing: evaluating elaborator reflection Reflection :: Phase -- | Subphase for Typing: copying definitions for a module macro ApplySection :: Phase -- | Subphase for InstanceSearch: collecting initial candidates InitialCandidates :: Phase -- | Subphase for InstanceSearch: checking candidates for validity FilterCandidates :: Phase -- | Subphase for InstanceSearch: ordering candidates for -- specificity OrderCandidates :: Phase -- | Subphase for InstanceSearch: reducing overlapping instances CheckOverlap :: Phase -- | Subphase for CheckLHS: unification of the indices UnifyIndices :: Phase InverseNameLookup :: Phase InverseModuleLookup :: Phase InverseInScope :: Phase InverseNameModuleRecompute :: Phase InverseInScopeRecompute :: Phase TopModule :: TopLevelModuleName -> Phase -- | Generating left inverses in LHS unification in cubical or -- cubical-compatible mode. CubicalLeftInversion :: Phase Typeclass :: QName -> Phase Definition :: QName -> Phase type Benchmark = Benchmark Phase type Account = Account Phase isModuleAccount :: Account -> Bool isDefAccount :: Account -> Bool isInternalAccount :: Account -> Bool -- | Global variable to store benchmark statistics. benchmarks :: IORef Benchmark -- | Benchmark an IO computation and bill it to the given account. billToIO :: Account -> IO a -> IO a -- | Benchmark a pure computation and bill it to the given account. billToPure :: Account -> a -> a instance GHC.Internal.Classes.Eq Agda.Benchmarking.Phase instance GHC.Internal.Generics.Generic Agda.Benchmarking.Phase instance Agda.Utils.Benchmark.MonadBench GHC.Internal.Types.IO instance Control.DeepSeq.NFData Agda.Benchmarking.Phase instance GHC.Internal.Classes.Ord Agda.Benchmarking.Phase instance Agda.Syntax.Common.Pretty.Pretty Agda.Benchmarking.Phase instance GHC.Internal.Show.Show Agda.Benchmarking.Phase -- | Basic data types for library management. module Agda.Interaction.Library.Base -- | A symbolic library name. -- -- Library names are structured into the base name and a suffix of -- version numbers, e.g. mylib-1.2.3. The version suffix is -- optional. data LibName LibName :: Text -> [Integer] -> LibName -- | Actual library name. [libNameBase] :: LibName -> Text -- | Major version, minor version, subminor version, etc., all -- non-negative. [libNameVersion] :: LibName -> [Integer] -- | Split a library name into basename and a list of version numbers. -- --
--   parseLibName "foo-1.2.3"    == LibName "foo" [1, 2, 3]
--   parseLibName "foo-01.002.3" == LibName "foo" [1, 2, 3]
--   
-- -- Note that because of leading zeros, parseLibName is not -- injective. (prettyShow . parseLibName would produce a normal -- form.) parseLibName :: String -> LibName data LibrariesFile LibrariesFile :: FilePath -> Bool -> LibrariesFile -- | E.g. ~.agdalibraries. [lfPath] :: LibrariesFile -> FilePath -- | The libraries file might not exist, but we may print its assumed -- location in error messages. [lfExists] :: LibrariesFile -> Bool -- | A symbolic executable name. type ExeName = Text type ExeMap = Map ExeName FilePath data ExecutablesFile ExecutablesFile :: FilePath -> Bool -> ExecutablesFile -- | E.g. ~.agdaexecutables. [efPath] :: ExecutablesFile -> FilePath -- | The executables file might not exist, but we may print its assumed -- location in error messages. [efExists] :: ExecutablesFile -> Bool -- | The special name "." is used to indicated that the current -- directory should count as a project root. libNameForCurrentDir :: LibName -- | A file can either belong to a project located at a given root -- containing an .agda-lib file, or be part of the default project. data ProjectConfig ProjectConfig :: FilePath -> FilePath -> Int -> ProjectConfig -- | Directory which contains the .agda-lib file for the current -- project. [configRoot] :: ProjectConfig -> FilePath -- | .agda-lib file relative to configRoot (filename only, -- no directory). [configAgdaLibFile] :: ProjectConfig -> FilePath -- | How many directories above the Agda file is the .agda-lib -- file located? [configAbove] :: ProjectConfig -> Int DefaultProjectConfig :: ProjectConfig -- | The options from an OPTIONS pragma (or a .agda-lib -- file). -- -- In the future it might be nice to switch to a more structured -- representation. Note that, currently, there is not a one-to-one -- correspondence between list elements and options. data OptionsPragma OptionsPragma :: [String] -> Range -> OptionsPragma -- | The options. [pragmaStrings] :: OptionsPragma -> [String] -- | The range of the options in the pragma (not including things like an -- OPTIONS keyword). [pragmaRange] :: OptionsPragma -> Range -- | Content of a .agda-lib file. data AgdaLibFile AgdaLibFile :: LibName -> FilePath -> Int -> [FilePath] -> [LibName] -> OptionsPragma -> AgdaLibFile -- | The symbolic name of the library. [_libName] :: AgdaLibFile -> LibName -- | Path to this .agda-lib file (not content of the file). [_libFile] :: AgdaLibFile -> FilePath -- | How many directories above the Agda file is the .agda-lib -- file located? [_libAbove] :: AgdaLibFile -> Int -- | Roots where to look for the modules of the library. [_libIncludes] :: AgdaLibFile -> [FilePath] -- | Dependencies. [_libDepends] :: AgdaLibFile -> [LibName] -- | Default pragma options for all files in the library. [_libPragmas] :: AgdaLibFile -> OptionsPragma emptyLibFile :: AgdaLibFile lensConfigAbove :: Lens' ProjectConfig Int libName :: Lens' AgdaLibFile LibName libFile :: Lens' AgdaLibFile FilePath libAbove :: Lens' AgdaLibFile Int libIncludes :: Lens' AgdaLibFile [FilePath] libDepends :: Lens' AgdaLibFile [LibName] libPragmas :: Lens' AgdaLibFile OptionsPragma type LineNumber = Int -- | Information about which .agda-lib file we are reading and -- from where in the libraries file it came from. data LibPositionInfo LibPositionInfo :: Maybe FilePath -> LineNumber -> FilePath -> LibPositionInfo -- | Name of libraries file. [libFilePos] :: LibPositionInfo -> Maybe FilePath -- | Line number in libraries file. [lineNumPos] :: LibPositionInfo -> LineNumber -- | Library file. [filePos] :: LibPositionInfo -> FilePath data LibWarning LibWarning :: Maybe LibPositionInfo -> LibWarning' -> LibWarning -- | Library Warnings. data LibWarning' UnknownField :: String -> LibWarning' libraryWarningName :: LibWarning -> WarningName data LibError LibError :: Maybe LibPositionInfo -> LibError' -> LibError -- | Collected errors while processing library files. data LibError' -- | The user specified replacement for the default libraries file -- does not exist. LibrariesFileNotFound :: FilePath -> LibError' -- | Raised when a library name could not successfully be resolved to an -- .agda-lib file. LibNotFound :: LibrariesFile -> LibName -> LibError' -- | Raised when a library name is defined in several .agda-lib -- files. AmbiguousLib :: LibName -> List2 AgdaLibFile -> LibError' -- | The given project root contains more than one .agda-lib file. SeveralAgdaLibFiles :: FilePath -> List2 FilePath -> LibError' -- | The .agda-lib file could not be parsed. LibParseError :: LibParseError -> LibError' -- | An I/O Error occurred when reading a file. ReadError :: IOException -> String -> LibError' -- | The executables file contains duplicate entries. DuplicateExecutable :: FilePath -> Text -> List2 (LineNumber, FilePath) -> LibError' -- | Exceptions thrown by the .agda-lib parser. data LibParseError -- | An invalid library name, e.g., containing spaces. BadLibraryName :: String -> LibParseError -- | I/O error while reading file. ReadFailure :: FilePath -> IOException -> LibParseError -- | Missing these mandatory fields. MissingFields :: List1 String -> LibParseError -- | These fields occur each more than once. DuplicateFields :: List1 String -> LibParseError -- | At the given line number, a field name is missing before the -- :. MissingFieldName :: LineNumber -> LibParseError -- | At the given line number, an invalid field name is encountered before -- the :. (E.g., containing spaces.) BadFieldName :: LineNumber -> String -> LibParseError -- | At the given line number, the given field is not followed by -- :. MissingColonForField :: LineNumber -> String -> LibParseError -- | At the given line number, indented text (content) is not preceded by a -- field. ContentWithoutField :: LineNumber -> LibParseError -- | Collection of LibErrors and LibWarnings. type LibErrWarns = [Either LibError LibWarning] warnings :: MonadWriter LibErrWarns m => List1 LibWarning -> m () warnings' :: MonadWriter LibErrWarns m => List1 LibWarning' -> m () raiseErrors' :: MonadWriter LibErrWarns m => List1 LibError' -> m () raiseErrors :: MonadWriter LibErrWarns m => List1 LibError -> m () -- | Collects LibErrors and LibWarnings. type LibErrorIO = WriterT LibErrWarns StateT LibState IO -- | Throws LibErrors exceptions, still collects LibWarnings. type LibM = ExceptT LibErrors WriterT [LibWarning] StateT LibState IO type LibState = LibCache -- | Cache locations of project configurations and parsed -- .agda-lib files. data LibCache LibCache :: Map FilePath ProjectConfig -> Map FilePath AgdaLibFile -> LibCache -- | Map from directories to paths of closest enclosing .agda-lib -- files (or DefaultProjectConfig if there are none). [projectConfigs] :: LibCache -> Map FilePath ProjectConfig -- | Contents of .agda-lib files that have already been parsed. [agdaLibFiles] :: LibCache -> Map FilePath AgdaLibFile -- | Collected errors when processing an .agda-lib file. data LibErrors LibErrors :: [AgdaLibFile] -> List1 LibError -> LibErrors [libErrorsInstalledLibraries] :: LibErrors -> [AgdaLibFile] [libErrors] :: LibErrors -> List1 LibError runLibM :: LibM a -> LibState -> IO ((Either LibErrors a, [LibWarning]), LibState) getCachedProjectConfig :: (MonadState LibState m, MonadIO m) => FilePath -> m (Maybe ProjectConfig) storeCachedProjectConfig :: (MonadState LibState m, MonadIO m) => FilePath -> ProjectConfig -> m () getCachedAgdaLibFile :: (MonadState LibState m, MonadIO m) => FilePath -> m (Maybe AgdaLibFile) storeCachedAgdaLibFile :: (MonadState LibState m, MonadIO m) => FilePath -> AgdaLibFile -> m () -- | Pretty-print LibError. formatLibError :: [AgdaLibFile] -> LibError -> Doc -- | Pretty-print LibErrors. formatLibErrors :: LibErrors -> Doc -- | Does a parse error contain a line number? hasLineNumber :: LibParseError -> Maybe LineNumber -- | Compute a position position prefix. -- -- Depending on the error to be printed, it will -- -- formatLibPositionInfo :: LibPositionInfo -> LibParseError -> Doc prettyInstalledLibraries :: [AgdaLibFile] -> Doc instance GHC.Internal.Classes.Eq Agda.Interaction.Library.Base.LibName instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.AgdaLibFile instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.ExecutablesFile instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibCache instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibError instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibError' instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibErrors instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibName instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibParseError instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibPositionInfo instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibWarning instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibWarning' instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.LibrariesFile instance GHC.Internal.Generics.Generic Agda.Interaction.Library.Base.ProjectConfig instance Data.Hashable.Class.Hashable Agda.Interaction.Library.Base.LibName instance GHC.Internal.Base.Monoid Agda.Interaction.Library.Base.OptionsPragma instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.AgdaLibFile instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.ExecutablesFile instance Control.DeepSeq.NFData GHC.Internal.IO.Exception.IOException instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibCache instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibError instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibError' instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibErrors instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibName instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibParseError instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibPositionInfo instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibWarning instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibWarning' instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.LibrariesFile instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.OptionsPragma instance Control.DeepSeq.NFData Agda.Interaction.Library.Base.ProjectConfig instance Agda.Utils.Null.Null Agda.Interaction.Library.Base.LibCache instance Agda.Utils.Null.Null Agda.Interaction.Library.Base.LibName instance GHC.Internal.Classes.Ord Agda.Interaction.Library.Base.LibName instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.Library.Base.LibError' instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.Library.Base.LibName instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.Library.Base.LibParseError instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.Library.Base.LibWarning instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.Library.Base.LibWarning' instance GHC.Internal.Base.Semigroup Agda.Interaction.Library.Base.OptionsPragma instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.AgdaLibFile instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.ExecutablesFile instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibError instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibError' instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibErrors instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibName instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibParseError instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibPositionInfo instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibWarning instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibWarning' instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.LibrariesFile instance GHC.Internal.Show.Show Agda.Interaction.Library.Base.OptionsPragma -- | Parser for .agda-lib files. -- -- Example file: -- --
--   name: Main
--   depend:
--     standard-library
--   include: .
--     src more-src
--   
--   
--   
-- -- Should parse as: -- --
--   AgdaLib
--     { libName     = Main
--     , libFile     = path_to_this_file
--     , libIncludes = [ "." , "src" , "more-src" ]
--     , libDepends  = [ "standard-library" ]
--     }
--   
--   
module Agda.Interaction.Library.Parse -- | Parse .agda-lib file. -- -- Sets libFile name and turn mentioned include directories into -- absolute pathes (provided the given FilePath is absolute). parseLibFile :: FilePath -> IO (P AgdaLibFile) -- | Break a comma-separated string. Result strings are trimmed. splitCommas :: String -> [String] -- | Remove leading whitespace and line comment. trimLineComment :: String -> String runP :: P a -> (Either LibParseError a, [LibWarning']) instance GHC.Internal.Show.Show Agda.Interaction.Library.Parse.GenericLine -- | Converting generic ranges to Agda's ranges. module Agda.Interaction.Highlighting.Range -- | Converts a Range to a Ranges. rToR :: Range -> Ranges -- | Converts a Range, seen as a continuous range, to a -- Range. rangeToRange :: Range -> Range -- | Overloaded zip and zipWith. -- -- This module provides the Zip class to overload zipping -- functions for variants of the list type ('[]', List1, -- List2, ListInf). -- -- Motivation: In practice, we often zip a finite list with an infinite -- list, e.g. zipWith f xs (ys ++ repeat z). We can know -- statically in this case that the resulting considers each xs -- by rewriting this to zipWith f xs (ListInf.pad ys z) -- statically exposing the infinite nature of the second list. To avoid -- cluttering the namespace with 4*4 variants of zipWith for all -- combination of our list types, we introduce an overloaded version. -- -- Import this module as follows: -- --
--   import Prelude hiding (zip, zipWith)
--   import Agda.Utils.Zip
--   
module Agda.Utils.Zip class Zip (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) | f g -> h zip :: Zip f g h => f a -> g b -> h (a, b) zipWith :: Zip f g h => (a -> b -> c) -> f a -> g b -> h c instance Agda.Utils.Zip.Zip Agda.Utils.ListInf.ListInf Agda.Utils.ListInf.ListInf Agda.Utils.ListInf.ListInf instance Agda.Utils.Zip.Zip Agda.Utils.ListInf.ListInf Agda.Utils.List2.List2 Agda.Utils.List2.List2 instance Agda.Utils.Zip.Zip Agda.Utils.ListInf.ListInf [] [] instance Agda.Utils.Zip.Zip Agda.Utils.ListInf.ListInf Agda.Utils.List1.List1 Agda.Utils.List1.List1 instance Agda.Utils.Zip.Zip Agda.Utils.List2.List2 Agda.Utils.ListInf.ListInf Agda.Utils.List2.List2 instance Agda.Utils.Zip.Zip Agda.Utils.List2.List2 Agda.Utils.List2.List2 Agda.Utils.List2.List2 instance Agda.Utils.Zip.Zip Agda.Utils.List2.List2 [] [] instance Agda.Utils.Zip.Zip Agda.Utils.List2.List2 Agda.Utils.List1.List1 Agda.Utils.List1.List1 instance Agda.Utils.Zip.Zip [] Agda.Utils.ListInf.ListInf [] instance Agda.Utils.Zip.Zip [] Agda.Utils.List2.List2 [] instance Agda.Utils.Zip.Zip [] [] [] instance Agda.Utils.Zip.Zip [] Agda.Utils.List1.List1 [] instance Agda.Utils.Zip.Zip Agda.Utils.List1.List1 Agda.Utils.ListInf.ListInf Agda.Utils.List1.List1 instance Agda.Utils.Zip.Zip Agda.Utils.List1.List1 Agda.Utils.List2.List2 Agda.Utils.List1.List1 instance Agda.Utils.Zip.Zip Agda.Utils.List1.List1 [] [] instance Agda.Utils.Zip.Zip Agda.Utils.List1.List1 Agda.Utils.List1.List1 Agda.Utils.List1.List1 -- | As a concrete name, a notation is a non-empty list of alternating -- IdParts and holes. In contrast to concrete names, holes can be -- binders. -- -- Example: syntax fmap (λ x → e) xs = for x ∈ xs return e -- -- The declared notation for fmap is for_∈_return_ -- where the first hole is a binder. module Agda.Syntax.Notation -- | Data type constructed in the Happy parser; converted to -- NotationPart before it leaves the Happy code. data HoleName -- | λ x₁ … xₙ → y: The first argument contains the bound names. LambdaHole :: List1 RString -> RString -> HoleName [_bindHoleNames] :: HoleName -> List1 RString [holeName] :: HoleName -> RString -- | Simple named hole with hiding. ExprHole :: RString -> HoleName [holeName] :: HoleName -> RString -- | Is the hole a binder? isLambdaHole :: HoleName -> Bool -- | Get a flat list of identifier parts of a notation. stringParts :: Notation -> [String] -- | Target argument position of a part (Nothing if it is not a hole). holeTarget :: NotationPart -> Maybe Int -- | Is the part a hole? isAHole :: NotationPart -> Bool -- | Is the part a binder? isBinder :: NotationPart -> Bool -- | Classification of notations. data NotationKind -- | Ex: _bla_blub_. InfixNotation :: NotationKind -- | Ex: _bla_blub. PrefixNotation :: NotationKind -- | Ex: bla_blub_. PostfixNotation :: NotationKind -- | Ex: bla_blub. NonfixNotation :: NotationKind NoNotation :: NotationKind -- | Classify a notation by presence of leading and/or trailing -- normal holes. notationKind :: Notation -> NotationKind -- | Analogue of isPrePostOrInfixOperator: prefix, infix, or -- postfix. isPrePostOrInfixNotation :: Notation -> Bool -- | From notation with names to notation with indices. -- -- An example (with some parts of the code omitted): The lists -- ["for", "x", "∈", "xs", "return", "e"] and -- [LambdaHole ("x" :| []) "e", ExprHole "xs"] are -- mapped to the following notation: [ IdPart "for" , -- VarPart (BoundVariablePosition 0 0) , IdPart "∈" -- , HolePart 1 , IdPart "return" , HolePart 0 ] -- mkNotation :: [NamedArg HoleName] -> [RString] -> Either String Notation -- | All the notation information related to a name. data NewNotation NewNotation :: QName -> Set1 Name -> Fixity -> Notation -> Bool -> NewNotation [notaName] :: NewNotation -> QName -- | The names the syntax and/or fixity belong to. -- -- Invariant: Every name in the list matches notaName. [notaNames] :: NewNotation -> Set1 Name -- | Associativity and precedence (fixity) of the names. [notaFixity] :: NewNotation -> Fixity -- | Syntax associated with the names. [notation] :: NewNotation -> Notation -- | True if the notation comes from an operator (rather than a syntax -- declaration). [notaIsOperator] :: NewNotation -> Bool -- | If an operator has no specific notation, then it is computed from its -- name. namesToNotation :: QName -> Name -> NewNotation -- | Replace noFixity by defaultFixity. useDefaultFixity :: NewNotation -> NewNotation -- | Return the IdParts of a notation, the first part qualified, the -- other parts unqualified. This allows for qualified use of operators, -- e.g., M.for x ∈ xs return e, or x ℕ.+ y. notationNames :: NewNotation -> [QName] -- | Create a Notation (without binders) from a concrete -- Name. Does the obvious thing: Holes become -- HoleParts, Ids become IdParts. If Name -- has no Holes, it returns noNotation. syntaxOf :: Name -> Notation -- | Merges NewNotations that have the same precedence level and -- notation, with two exceptions: -- -- -- -- If NewNotations that are merged have distinct associativities, -- then they get NonAssoc as their associativity. -- -- Precondition: No Name may occur in more than one list element. -- Every NewNotation must have the same notaName. -- -- Postcondition: No Name occurs in more than one list element. mergeNotations :: List1 NewNotation -> List1 NewNotation -- | Check if a notation contains any lambdas (in which case it cannot be -- used in a pattern). isLambdaNotation :: NewNotation -> Bool -- | Lens for Fixity in NewNotation. _notaFixity :: Lens' NewNotation Fixity -- | Sections, as well as non-sectioned operators. data NotationSection NotationSection :: NewNotation -> NotationKind -> Maybe FixityLevel -> Bool -> NotationSection [sectNotation] :: NotationSection -> NewNotation -- | For non-sectioned operators this should match the notation's -- notationKind. [sectKind] :: NotationSection -> NotationKind -- | Effective precedence level. Nothing for closed notations. [sectLevel] :: NotationSection -> Maybe FixityLevel -- | False for non-sectioned operators. [sectIsSection] :: NotationSection -> Bool -- | Converts a notation to a (non-)section. noSection :: NewNotation -> NotationSection instance GHC.Internal.Classes.Eq Agda.Syntax.Notation.NotationKind instance GHC.Internal.Generics.Generic Agda.Syntax.Notation.NewNotation instance GHC.Internal.Generics.Generic Agda.Syntax.Notation.NotationKind instance GHC.Internal.Generics.Generic Agda.Syntax.Notation.NotationSection instance Agda.Syntax.Common.LensFixity Agda.Syntax.Notation.NewNotation instance Control.DeepSeq.NFData Agda.Syntax.Notation.NewNotation instance Control.DeepSeq.NFData Agda.Syntax.Notation.NotationKind instance Control.DeepSeq.NFData Agda.Syntax.Notation.NotationSection instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Notation.NewNotation instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Notation.NotationKind instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Notation.NotationSection instance GHC.Internal.Show.Show Agda.Syntax.Notation.NewNotation instance GHC.Internal.Show.Show Agda.Syntax.Notation.NotationKind instance GHC.Internal.Show.Show Agda.Syntax.Notation.NotationSection module Agda.Syntax.Concrete.Operators.Parser placeholder :: PositionInName -> Parser e (MaybePlaceholder e) maybePlaceholder :: Maybe PositionInName -> Parser e e -> Parser e (MaybePlaceholder e) satNoPlaceholder :: (e -> Maybe a) -> Parser e a data ExprView e LocalV :: QName -> ExprView e WildV :: e -> ExprView e OtherV :: e -> ExprView e AppV :: e -> NamedArg e -> ExprView e -- | The QName is possibly ambiguous, but it must correspond to one -- of the names in the set. OpAppV :: QName -> Set1 Name -> OpAppArgs' e -> ExprView e HiddenArgV :: Named_ e -> ExprView e InstanceArgV :: Named_ e -> ExprView e LamV :: List1 LamBinding -> e -> ExprView e ParenV :: e -> ExprView e class HasRange e => IsExpr e exprView :: IsExpr e => e -> ExprView e unExprView :: IsExpr e => ExprView e -> e patternView :: IsExpr e => e -> Maybe Pattern -- | Should sections be parsed? data ParseSections ParseSections :: ParseSections DoNotParseSections :: ParseSections -- | Runs a parser. If sections should be parsed, then identifiers with at -- least two name parts are split up into multiple tokens, using -- PositionInName to record the tokens' original positions within -- their respective identifiers. parse :: IsExpr e => (ParseSections, Parser e a) -> [e] -> [a] -- | Parse a specific identifier as a NamePart partP :: IsExpr e => [Name] -> RawName -> Parser e Range -- | Parses a split-up, unqualified name consisting of at least two name -- parts. -- -- The parser does not check that underscores and other name parts -- alternate. The range of the resulting name is the range of the first -- name part that is not an underscore. atLeastTwoParts :: IsExpr e => Parser e Name -- | Parses a potentially pattern-matching binder patternBinder :: IsExpr e => Parser e Binder -- | Used to define the return type of opP. type family OperatorType (k :: NotationKind) e -- | A singleton type for NotationKind (except for the constructor -- NoNotation). data NK (k :: NotationKind) [In] :: NK 'InfixNotation [Pre] :: NK 'PrefixNotation [Post] :: NK 'PostfixNotation [Non] :: NK 'NonfixNotation -- | Parse the "operator part" of the given notation. -- -- Normal holes (but not binders) at the beginning and end are ignored. -- -- If the notation does not contain any binders, then a section notation -- is allowed. opP :: forall e (k :: NotationKind). IsExpr e => ParseSections -> Parser e e -> NewNotation -> NK k -> Parser e (OperatorType k e) argsP :: IsExpr e => Parser e e -> Parser e [NamedArg e] appP :: IsExpr e => Parser e e -> Parser e [NamedArg e] -> Parser e e atomP :: IsExpr e => (QName -> Bool) -> Parser e e instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Operators.Parser.ParseSections instance Agda.Syntax.Concrete.Operators.Parser.IsExpr e => Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.Operators.Parser.ExprView e) instance Agda.Syntax.Concrete.Operators.Parser.IsExpr Agda.Syntax.Concrete.Expr instance Agda.Syntax.Concrete.Operators.Parser.IsExpr Agda.Syntax.Concrete.Pattern instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Operators.Parser.ParseSections -- | Collecting fixity declarations (and polarity pragmas) for concrete -- declarations. module Agda.Syntax.Concrete.Fixity type Fixities = Map Name Fixity' type Polarities = Map Name PragmaPolarities class Monad m => MonadFixityError (m :: Type -> Type) throwMultipleFixityDecls :: MonadFixityError m => List1 (Name, Pair Fixity') -> m a throwMultiplePolarityPragmas :: MonadFixityError m => List1 Name -> m a warnUnknownNamesInFixityDecl :: MonadFixityError m => Set1 Name -> m () warnUnknownNamesInPolarityPragmas :: MonadFixityError m => Set1 Name -> m () warnUnknownFixityInMixfixDecl :: MonadFixityError m => Set1 Name -> m () warnPolarityPragmasButNotPostulates :: MonadFixityError m => Set1 Name -> m () warnEmptyPolarityPragma :: MonadFixityError m => Range -> m () warnFixityDeclarationForNonOperator :: MonadFixityError m => Range -> Name -> m () data DoWarn NoWarn :: DoWarn DoWarn :: DoWarn -- | Get the fixities and polarity pragmas from the current block. Doesn't -- go inside modules and where blocks. The reason for this is that these -- declarations have to appear at the same level (or possibly outside an -- abstract or mutual block) as their target declaration. fixitiesAndPolarities :: MonadFixityError m => DoWarn -> [Declaration] -> m (Fixities, Polarities) instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Fixity.DoWarn instance GHC.Internal.Base.Monoid Agda.Syntax.Concrete.Fixity.DeclaredNames instance Agda.Syntax.Concrete.Fixity.MonadFixityError m => GHC.Internal.Base.Monoid (Agda.Syntax.Concrete.Fixity.MonadicFixPol m) instance GHC.Internal.Base.Semigroup Agda.Syntax.Concrete.Fixity.DeclaredNames instance Agda.Syntax.Concrete.Fixity.MonadFixityError m => GHC.Internal.Base.Semigroup (Agda.Syntax.Concrete.Fixity.MonadicFixPol m) instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Fixity.DoWarn -- | This module defines the notion of a scope and operations on scopes. module Agda.Syntax.Scope.Base -- | A scope is a named collection of names partitioned into public and -- private names. data Scope Scope :: ModuleName -> [ModuleName] -> ScopeNameSpaces -> Map QName ModuleName -> Maybe DataOrRecordModule -> Scope [scopeName] :: Scope -> ModuleName [scopeParents] :: Scope -> [ModuleName] [scopeNameSpaces] :: Scope -> ScopeNameSpaces [scopeImports] :: Scope -> Map QName ModuleName [scopeDatatypeModule] :: Scope -> Maybe DataOrRecordModule data DataOrRecordModule IsDataModule :: DataOrRecordModule IsRecordModule :: DataOrRecordModule -- | See Access. data NameSpaceId -- | Things not exported by this module. PrivateNS :: NameSpaceId -- | Things defined and exported by this module. PublicNS :: NameSpaceId -- | Things from open public, exported by this module. ImportedNS :: NameSpaceId allNameSpaces :: [NameSpaceId] type ScopeNameSpaces = [(NameSpaceId, NameSpace)] localNameSpace :: Access -> NameSpaceId nameSpaceAccess :: NameSpaceId -> Access -- | Get a NameSpace from Scope. scopeNameSpace :: NameSpaceId -> Scope -> NameSpace -- | A lens for scopeNameSpaces updateScopeNameSpaces :: (ScopeNameSpaces -> ScopeNameSpaces) -> Scope -> Scope -- | `Monadic' lens (Functor sufficient). updateScopeNameSpacesM :: Functor m => (ScopeNameSpaces -> m ScopeNameSpaces) -> Scope -> m Scope -- | The complete information about the scope at a particular program point -- includes the scope stack, the local variables, and the context -- precedence. data ScopeInfo ScopeInfo :: ModuleName -> Map ModuleName Scope -> LocalVars -> LocalVars -> PrecedenceStack -> NameMap -> ModuleMap -> InScopeSet -> Fixities -> Polarities -> ScopeInfo [_scopeCurrent] :: ScopeInfo -> ModuleName [_scopeModules] :: ScopeInfo -> Map ModuleName Scope -- | The variables that will be bound at the end of the current block of -- variables (i.e. clause). We collect them here instead of binding them -- immediately so we can avoid shadowing between variables in the same -- variable block. [_scopeVarsToBind] :: ScopeInfo -> LocalVars [_scopeLocals] :: ScopeInfo -> LocalVars [_scopePrecedence] :: ScopeInfo -> PrecedenceStack [_scopeInverseName] :: ScopeInfo -> NameMap [_scopeInverseModule] :: ScopeInfo -> ModuleMap [_scopeInScope] :: ScopeInfo -> InScopeSet -- | Maps concrete names C.Name to fixities [_scopeFixities] :: ScopeInfo -> Fixities -- | Maps concrete names C.Name to polarities [_scopePolarities] :: ScopeInfo -> Polarities -- | For the sake of highlighting, the _scopeInverseName map also -- stores the KindOfName of an A.QName. data NameMapEntry NameMapEntry :: KindOfName -> List1 QName -> NameMapEntry -- | The anameKind. [qnameKind] :: NameMapEntry -> KindOfName -- | Possible renderings of the abstract name. [qnameConcrete] :: NameMapEntry -> List1 QName type NameMap = HashMap NameId NameMapEntry type ModuleMap = HashMap ModuleName [QName] -- | Local variables. type LocalVars = AssocList Name LocalVar -- | For each bound variable, we want to know whether it was bound by a λ, -- Π, module telescope, pattern, or let. data BindingSource -- | λ (currently also used for Π and module parameters) LambdaBound :: BindingSource -- | f ... =. Remember Hiding for pattern variables -- {x} and {{x}}. This information is only used for -- checking pattern synonyms. It is not serialized. PatternBound :: Hiding -> BindingSource -- |
--   let ... in
--   
LetBound :: BindingSource -- |
--   | ... in q
--   
WithBound :: BindingSource -- | Binding added to scope by one of context-manipulating reflection -- primitives MacroBound :: BindingSource -- | A local variable can be shadowed by an import. In case of reference to -- a shadowed variable, we want to report a scope error. data LocalVar LocalVar :: Name -> BindingSource -> [AbstractName] -> LocalVar -- | Unique ID of local variable. [localVar] :: LocalVar -> Name -- | Kind of binder used to introduce the variable (λ, -- let, ...). [localBindingSource] :: LocalVar -> BindingSource -- | If this list is not empty, the local variable is shadowed by one or -- more imports. [localShadowedBy] :: LocalVar -> [AbstractName] -- | Shadow a local name by a non-empty list of imports. shadowLocal :: List1 AbstractName -> LocalVar -> LocalVar -- | Treat patternBound variable as a module parameter patternToModuleBound :: LocalVar -> LocalVar -- | Project name of unshadowed local variable. notShadowedLocal :: LocalVar -> Maybe Name -- | Get all locals that are not shadowed by imports. notShadowedLocals :: LocalVars -> AssocList Name Name -- | Lenses for ScopeInfo components scopeCurrent :: Lens' ScopeInfo ModuleName scopeModules :: Lens' ScopeInfo (Map ModuleName Scope) scopeVarsToBind :: Lens' ScopeInfo LocalVars scopeLocals :: Lens' ScopeInfo LocalVars scopePrecedence :: Lens' ScopeInfo PrecedenceStack scopeInverseName :: Lens' ScopeInfo NameMap scopeInverseModule :: Lens' ScopeInfo ModuleMap scopeInScope :: Lens' ScopeInfo InScopeSet scopeFixities :: Lens' ScopeInfo Fixities scopePolarities :: Lens' ScopeInfo Polarities scopeFixitiesAndPolarities :: Lens' ScopeInfo (Fixities, Polarities) -- | Lens for scopeVarsToBind. updateVarsToBind :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo setVarsToBind :: LocalVars -> ScopeInfo -> ScopeInfo -- | Lens for scopeLocals. updateScopeLocals :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo setScopeLocals :: LocalVars -> ScopeInfo -> ScopeInfo -- | A NameSpace contains the mappings from concrete names that -- the user can write to the abstract fully qualified names that the type -- checker wants to read. data NameSpace NameSpace :: NamesInScope -> NamePartsInScope -> ModulesInScope -> InScopeSet -> NameSpace -- | Maps concrete names to a list of abstract names. If this is part of a -- scope produced by an ImportDirective, the concrete names should -- (where possible) match those of the directive. E.g., if the directive -- mentions using (x), then the concrete x in the map -- should be this x rather then the x from the original -- scope that is restricted by the import directive. This is important -- for the highlighting of the UnusedImports warning. [nsNames] :: NameSpace -> NamesInScope -- | Maps name parts to a list of abstract names in which the name part -- occurs. [nsNameParts] :: NameSpace -> NamePartsInScope -- | Maps concrete module names to a list of abstract module names. [nsModules] :: NameSpace -> ModulesInScope -- | All abstract names targeted by a concrete name in scope. Computed by -- recomputeInScopeSets. [nsInScope] :: NameSpace -> InScopeSet type ThingsInScope a = Map Name List1 a type NamesInScope = ThingsInScope AbstractName type NamePartsInScope = Map RawName NamesInScope type ModulesInScope = ThingsInScope AbstractModule type InScopeSet = Set QName -- | Set of types consisting of exactly AbstractName and -- AbstractModule. -- -- A GADT just for some dependent-types trickery. data InScopeTag a [NameTag] :: InScopeTag AbstractName [ModuleTag] :: InScopeTag AbstractModule -- | Type class for some dependent-types trickery. class Ord a => InScope a inScopeTag :: InScope a => InScopeTag a -- | inNameSpace selects either the name map or the module name -- map from a NameSpace. What is selected is determined by result -- type (using the dependent-type trickery). inNameSpace :: InScope a => NameSpace -> ThingsInScope a -- | Non-dependent tag for name or module. data NameOrModule NameNotModule :: NameOrModule ModuleNotName :: NameOrModule -- | Names that are relevant to operator parsing. data OperatorScope OpScope :: Bool -> Map QName (List1 AbstractName) -> AssocList Name Name -> OperatorScope -- | Are there any operators or notations in scope? [osHasOps] :: OperatorScope -> Bool -- | All relevant names in global scope. [osScope] :: OperatorScope -> Map QName (List1 AbstractName) -- | Relevant names in local scope. [osLocals] :: OperatorScope -> AssocList Name Name -- | A set of module and definition names that were explicitly referred to -- during scope checking. data LiveNames -- | We encountered these names during scope-checking, so they should be -- preserved. SomeLiveNames :: Set ModuleName -> Set QName -> LiveNames [liveModules] :: LiveNames -> Set ModuleName [liveNames] :: LiveNames -> Set QName -- | An interaction point can see this copy, so we should preserve every -- name. AllLiveNames :: LiveNames -- | Is the given name alive in this set? -- -- Note: a qualified name can be kept alive by liveness of any of the -- modules it belongs to. isNameAlive :: QName -> LiveNames -> Bool -- | Is the given module (or one of its parents) a member of the set? isModuleAlive :: ModuleName -> LiveNames -> Bool -- | Information gathered during scope checking for the unused-imports -- warning when a module is opened. data OpenedModule OpenedModule :: KwRange -> ModuleName -> ModuleName -> Bool -> NamesInScope -> ModulesInScope -> Set Name -> OpenedModule -- | Range of the open keyword. [openedRange] :: OpenedModule -> KwRange -- | Module we opened. [openedModule] :: OpenedModule -> ModuleName -- | Parent module into which we merged the opened module. [openedParent] :: OpenedModule -> ModuleName -- | Whether the open statement comes with using or -- renaming. [openedHasDir] :: OpenedModule -> Bool -- | The names imported by the open statement. The keys -- (Name) of this map should be the concrete names of the opening -- directive, if such was given. [openedNameScope] :: OpenedModule -> NamesInScope -- | The modules imported by the open statement. The keys -- (Name) of this map should be the concrete names of the opening -- directive, if such was given. [openedModuleScope] :: OpenedModule -> ModulesInScope -- | Modules among openedModuleScope that accompany a name in -- openedNameScope (e.g. the module of a data type or record type) -- and are not mentioned explicitly in the opening directive. These are -- not reported individually when unused. [openedCompanions] :: OpenedModule -> Set Name -- | Information gathered during scope checking for the unused-imports -- warning. data UnusedImportsState UnusedImportsState :: [AbstractName] -> IntMap (List2 AbstractName) -> [AbstractModule] -> IntMap OpenedModule -> UnusedImportsState -- | Names that were unambiguously resolved from a concrete name in the -- source. [unambiguousLookups] :: UnusedImportsState -> [AbstractName] -- | Names that were ambiguously resolved from a concrete name in the -- source. They are stored with their position in the file that is -- matched with disambiguation information produced by the type checker. [ambiguousLookups] :: UnusedImportsState -> IntMap (List2 AbstractName) -- | Modules that were resolved from a concrete name in the source, either -- directly or as the qualifier of a qualified name. [moduleLookups] :: UnusedImportsState -> [AbstractModule] -- | Log of module opens with the names they brought into scope. [openedModules] :: UnusedImportsState -> IntMap OpenedModule lensUnambiguousLookups :: Lens' UnusedImportsState [AbstractName] lensAmbiguousLookups :: Lens' UnusedImportsState (IntMap (List2 AbstractName)) lensModuleLookups :: Lens' UnusedImportsState [AbstractModule] lensOpenedModules :: Lens' UnusedImportsState (IntMap OpenedModule) -- | All kinds of regular definitions. defNameKinds :: [KindOfName] isDefName :: KindOfName -> Bool -- | Constructor and pattern synonyms. conLikeNameKinds :: [KindOfName] isConName :: KindOfName -> Maybe Induction conKindOfName :: Induction -> KindOfName -- | For ambiguous constructors, we might have both alternatives of -- Induction. In this case, we default to ConName. conKindOfName' :: Foldable t => t Induction -> KindOfName -- | For ambiguous constructors, we might have both alternatives of -- Induction. In this case, we default to Inductive. approxConInduction :: Foldable t => t Induction -> Induction exactConInduction :: Foldable t => t Induction -> Maybe Induction -- | Only return [Co]ConName if no ambiguity. exactConName :: Foldable t => t Induction -> Maybe KindOfName -- | A set of KindOfName, for the sake of elemKindsOfNames. data KindsOfNames AllKindsOfNames :: KindsOfNames -- | Only these kinds. SomeKindsOfNames :: Set KindOfName -> KindsOfNames -- | All but these Kinds. ExceptKindsOfNames :: Set KindOfName -> KindsOfNames elemKindsOfNames :: KindOfName -> KindsOfNames -> Bool allKindsOfNames :: KindsOfNames someKindsOfNames :: [KindOfName] -> KindsOfNames exceptKindsOfNames :: [KindOfName] -> KindsOfNames -- | Decorate something with KindOfName data WithKind a WithKind :: KindOfName -> a -> WithKind a [theKind] :: WithKind a -> KindOfName [kindedThing] :: WithKind a -> a data ResolvedName -- | Local variable bound by λ, Π, module telescope, pattern, let. VarName :: Name -> BindingSource -> ResolvedName [resolvedVar] :: ResolvedName -> Name -- | What kind of binder? [resolvedBindingSource] :: ResolvedName -> BindingSource -- | Function, data/record type, postulate. DefinedName :: Access -> AbstractName -> Suffix -> ResolvedName -- | Record field name. Needs to be distinguished to parse copatterns. FieldName :: List1 AbstractName -> ResolvedName -- | Data or record constructor name. ConstructorName :: Set1 Induction -> List1 AbstractName -> ResolvedName -- | Name of pattern synonym. PatternSynResName :: List1 AbstractName -> ResolvedName -- | Unbound name. UnknownName :: ResolvedName -- | Why is a resolved name ambiguous? What did it resolve to? -- -- Invariant (statically enforced): At least two resolvents in total. data AmbiguousNameReason -- | The name resolves both to a local variable and some declared names. AmbiguousLocalVar :: LocalVar -> List1 AbstractName -> AmbiguousNameReason -- | The name resolves to at least 2 declared names. AmbiguousDeclName :: List2 AbstractName -> AmbiguousNameReason -- | A failure in name resolution, indicating the reason that a name which -- is in scope could not be returned from tryResolveName. data NameResolutionError -- | Ambiguous names are not supported in this situation. IllegalAmbiguity :: AmbiguousNameReason -> NameResolutionError -- | The name was Foo.constructor, and Foo is in scope, -- but it is not a record. ConstrOfNonRecord :: QName -> ResolvedName -> NameResolutionError -- | The flat list of ambiguous names in AmbiguousNameReason. ambiguousNamesInReason :: AmbiguousNameReason -> List2 QName data WhyInScopeData WhyInScopeData :: QName -> FilePath -> Maybe LocalVar -> [AbstractName] -> [AbstractModule] -> WhyInScopeData whyInScopeDataFromAmbiguousQName :: QName -> AmbiguousQName -> Maybe WhyInScopeData whyInScopeDataFromAbstractName :: QName -> AbstractName -> WhyInScopeData whyInScopeDataFromAmbiguousNameReason :: QName -> AmbiguousNameReason -> WhyInScopeData mergeNames :: Eq a => ThingsInScope a -> ThingsInScope a -> ThingsInScope a mergeNamesMany :: Eq a => [ThingsInScope a] -> ThingsInScope a -- | The empty name space. emptyNameSpace :: NameSpace -- | Map functions over the names and modules in a name space. mapNameSpace :: (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> NameSpace -> NameSpace -- | Zip together two name spaces. zipNameSpace :: (NamesInScope -> NamesInScope -> NamesInScope) -> (NamePartsInScope -> NamePartsInScope -> NamePartsInScope) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet -> InScopeSet) -> NameSpace -> NameSpace -> NameSpace -- | Map monadic function over a namespace. mapNameSpaceM :: Applicative m => (NamesInScope -> m NamesInScope) -> (ModulesInScope -> m ModulesInScope) -> (InScopeSet -> m InScopeSet) -> NameSpace -> m NameSpace -- | The empty scope. emptyScope :: Scope -- | The empty scope info. emptyScopeInfo :: ScopeInfo -- | Map functions over the names and modules in a scope. mapScope :: (NameSpaceId -> NamesInScope -> NamesInScope) -> (NameSpaceId -> ModulesInScope -> ModulesInScope) -> (NameSpaceId -> InScopeSet -> InScopeSet) -> Scope -> Scope -- | Same as mapScope but applies the same function to all name -- spaces. mapScope_ :: (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> Scope -> Scope -- | Same as mapScope but applies the function only on the given -- name space. mapScopeNS :: NameSpaceId -> (NamesInScope -> NamesInScope) -> (ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet) -> Scope -> Scope -- | Map monadic functions over the names and modules in a scope. mapScopeM :: Applicative m => (NameSpaceId -> NamesInScope -> m NamesInScope) -> (NameSpaceId -> ModulesInScope -> m ModulesInScope) -> (NameSpaceId -> InScopeSet -> m InScopeSet) -> Scope -> m Scope -- | Same as mapScopeM but applies the same function to both the -- public and private name spaces. mapScopeM_ :: Applicative m => (NamesInScope -> m NamesInScope) -> (ModulesInScope -> m ModulesInScope) -> (InScopeSet -> m InScopeSet) -> Scope -> m Scope -- | Zip together two scopes. The resulting scope has the same name as the -- first scope. zipScope :: (NameSpaceId -> NamesInScope -> NamesInScope -> NamesInScope) -> (NameSpaceId -> NamePartsInScope -> NamePartsInScope -> NamePartsInScope) -> (NameSpaceId -> ModulesInScope -> ModulesInScope -> ModulesInScope) -> (NameSpaceId -> InScopeSet -> InScopeSet -> InScopeSet) -> Scope -> Scope -> Scope -- | Same as zipScope but applies the same function to both the -- public and private name spaces. zipScope_ :: (NamesInScope -> NamesInScope -> NamesInScope) -> (NamePartsInScope -> NamePartsInScope -> NamePartsInScope) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> (InScopeSet -> InScopeSet -> InScopeSet) -> Scope -> Scope -> Scope -- | Recompute the inScope sets of a scope. recomputeInScopeSets :: Scope -> Scope -- | Filter a scope keeping only concrete names matching the predicates. -- The first predicate is applied to the names and the second to the -- modules. filterScope :: (Name -> Bool) -> (Name -> Bool) -> Scope -> Scope -- | Filter a scope keeping only concrete names matching the predicates. -- The first predicate is applied to the names and the second to the -- modules. mapScopeMaybe :: (Name -> Maybe Name) -> (Name -> Maybe Name) -> Scope -> Scope -- | Return all names in a scope. allNamesInScope :: InScope a => Scope -> ThingsInScope a allNamesInScope' :: InScope a => Scope -> ThingsInScope (a, Access) -- | Look up a single name in the current scope. -- -- This is equivalent to Map.lookup n . allNamesInScope', but -- more efficient when only a single name needs to be looked up. findNameInScope :: InScope a => Name -> Scope -> [(a, Access)] -- | Returns the scope's non-private names. exportedNamesInScope :: InScope a => Scope -> ThingsInScope a namesInScope :: InScope a => [NameSpaceId] -> Scope -> ThingsInScope a allThingsInScope :: Scope -> NameSpace thingsInScope :: [NameSpaceId] -> Scope -> NameSpace -- | Merge two scopes. The result has the name of the first scope. mergeScope :: Scope -> Scope -> Scope -- | Merge a non-empty list of scopes. The result has the name of the first -- scope in the list. mergeScopes :: [Scope] -> Scope -- | Move all names in a scope to the given name space (except never move -- from Imported to Public). setScopeAccess :: NameSpaceId -> Scope -> Scope -- | Update a particular name space. setNameSpace :: NameSpaceId -> NameSpace -> Scope -> Scope -- | Modify a particular name space. modifyNameSpace :: NameSpaceId -> (NameSpace -> NameSpace) -> Scope -> Scope addNameToNameParts :: Name -> AbstractName -> NamePartsInScope -> NamePartsInScope -- | Add all associated name parts of a name (operator parts, notation -- parts) to the scope. addNamePartsToScope :: NameSpaceId -> Name -> AbstractName -> Scope -> Scope -- | Recompute name parts in the namespaces. recomputeNameParts :: Scope -> Scope -- | Add a name to a scope. addNameToScope :: NameSpaceId -> Name -> AbstractName -> Scope -> Scope -- | Remove a name from a scope. Caution: does not update the nsInScope -- set. This is only used by rebindName and in that case we add the name -- right back (but with a different kind). removeNameFromScope :: NameSpaceId -> Name -> Scope -> Scope -- | Add a module to a scope. addModuleToScope :: NameSpaceId -> Name -> AbstractModule -> Scope -> Scope -- | When we get here we cannot have both using and -- hiding. data UsingOrHiding UsingOnly :: [ImportedName] -> UsingOrHiding HidingOnly :: [ImportedName] -> UsingOrHiding usingOrHiding :: ImportDirective -> UsingOrHiding -- | Apply an ImportDirective to a scope: -- --
    --
  1. rename keys (C.Name) according to renaming;
  2. --
  3. for untouched keys, either of
  4. --
-- -- a) remove keys according to hiding, or b) filter keys -- according to using. -- -- Both steps could be done in one pass, by first preparing key-filtering -- functions C.Name -> Maybe C.Name for defined names and -- module names. However, the penalty of doing it in two passes should -- not be too high. (Doubling the run time.) applyImportDirective :: ImportDirective -> Scope -> Scope -- | Version of applyImportDirective that also returns sets of name -- and module name clashes introduced by renaming to identifiers -- that are already imported by using or lack of -- hiding. applyImportDirective_ :: ImportDirective -> Scope -> (Scope, (Set Name, Set Name)) -- | Rename the abstract names in a scope. renameCanonicalNames :: Map QName QName -> Map ModuleName ModuleName -> Scope -> Scope -- | Remove private name space of a scope. -- -- Should be a right identity for exportedNamesInScope. -- exportedNamesInScope . restrictPrivate == -- exportedNamesInScope. restrictPrivate :: Scope -> Scope -- | Remove private things from the given module from a scope. restrictLocalPrivate :: ModuleName -> Scope -> Scope -- | Filter privates out of a ScopeInfo withoutPrivates :: ScopeInfo -> ScopeInfo -- | Disallow using generalized variables from the scope disallowGeneralizedVars :: Scope -> Scope -- | Add an explanation to why things are in scope. inScopeBecause :: (WhyInScope -> WhyInScope) -> Scope -> Scope -- | Get the public parts of the public modules of a scope publicModules :: ScopeInfo -> Map ModuleName Scope publicNames :: ScopeInfo -> Set AbstractName publicNamesOfModules :: Map ModuleName Scope -> [AbstractName] everythingInScope :: ScopeInfo -> NameSpace -- | Get all concrete names in scope. Includes bound variables. concreteNamesInScope :: ScopeInfo -> Set QName -- | Look up a name in the scope scopeLookup :: InScope a => QName -> ScopeInfo -> [a] scopeLookup' :: InScope a => QName -> ScopeInfo -> [(a, Access)] -- | The scope of the given module. scopeOfModule :: ScopeInfo -> ModuleName -> Scope -- | The current scope and the scopes of its parents. scopeAndParents :: ScopeInfo -> [Scope] -- | Find a concrete, possibly qualified name in scope s. The -- qualifiers are resolved to modules whose public scopes are searched. findQNameInScope :: InScope a => ScopeInfo -> QName -> Scope -> [(a, Access)] -- | Resolve a qualifier x in scope s to the modules -- named x and their public scopes. qualifierScopes :: ScopeInfo -> Name -> Scope -> [(AbstractModule, Scope)] -- | For a qualified name x.q resolving to one of the given things -- ys, find the modules x in the current scope (or its -- parents) through which q resolves to some of ys. -- -- Used to mark the qualifier x as used for the unused-imports -- analysis. scopeLookupQualifier :: InScope a => QName -> [a] -> ScopeInfo -> [AbstractModule] data AllowAmbiguousNames -- | Used for instance arguments to check whether a name is in scope, but -- we do not care whether is is ambiguous AmbiguousAnything :: AllowAmbiguousNames -- | Ambiguous constructors, projections, or pattern synonyms. AmbiguousConProjs :: AllowAmbiguousNames AmbiguousNothing :: AllowAmbiguousNames isNameInScope :: QName -> ScopeInfo -> Bool isNameInScopeUnqualified :: QName -> ScopeInfo -> Bool -- | Find the concrete names that map (uniquely) to a given abstract -- qualified name. Sort by number of modules in the qualified name, -- unqualified names first. inverseScopeLookupName :: QName -> ScopeInfo -> [QName] inverseScopeLookupName' :: AllowAmbiguousNames -> QName -> ScopeInfo -> [QName] -- | A version of inverseScopeLookupName that also delivers the -- KindOfName. Used in highlighting. inverseScopeLookupName'' :: AllowAmbiguousNames -> QName -> ScopeInfo -> Maybe NameMapEntry -- | Find the concrete names that map (uniquely) to a given abstract module -- name. Sort by length, shortest first. inverseScopeLookupModule :: ModuleName -> ScopeInfo -> [QName] inverseScopeLookupModule' :: AllowAmbiguousNames -> ModuleName -> ScopeInfo -> [QName] recomputeInScopeSet :: ScopeInfo -> Set QName recomputeInverseNamesAndModules :: ScopeInfo -> (NameMap, ModuleMap) recomputeInverseScope' :: ScopeInfo -> ScopeInfo -- | Set the nameBindingSite in an abstract name. class SetBindingSite a setBindingSite :: SetBindingSite a => Range -> a -> a ($dmsetBindingSite) :: forall b (t :: Type -> Type). (SetBindingSite a, SetBindingSite b, Functor t, t b ~ a) => Range -> a -> a prettyNameSpace :: NameSpace -> [Doc] newtype PrettyWithInstance a PrettyWithInstance :: a -> PrettyWithInstance a newtype PrettyWithBindingSite a PrettyWithBindingSite :: a -> PrettyWithBindingSite a -- | Add first string only if list is non-empty. blockOfLines :: Doc -> [Doc] -> [Doc] instance GHC.Internal.Enum.Bounded Agda.Syntax.Scope.Base.DataOrRecordModule instance GHC.Internal.Enum.Bounded Agda.Syntax.Scope.Base.NameOrModule instance GHC.Internal.Enum.Bounded Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Internal.Enum.Enum Agda.Syntax.Scope.Base.DataOrRecordModule instance GHC.Internal.Enum.Enum Agda.Syntax.Scope.Base.NameOrModule instance GHC.Internal.Enum.Enum Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.AllowAmbiguousNames instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.BindingSource instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.DataOrRecordModule instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.LiveNames instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.LocalVar instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.NameOrModule instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.NameSpace instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.OperatorScope instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.ResolvedName instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.Scope instance GHC.Internal.Classes.Eq Agda.Syntax.Scope.Base.ScopeInfo instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Scope.Base.WithKind a) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Scope.Base.WithKind instance GHC.Internal.Base.Functor Agda.Syntax.Scope.Base.WithKind instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.AmbiguousNameReason instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.BindingSource instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.DataOrRecordModule instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.LocalVar instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.NameMapEntry instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.NameOrModule instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.NameResolutionError instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.NameSpace instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.OpenedModule instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.OperatorScope instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.ResolvedName instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.Scope instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.ScopeInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Scope.Base.UnusedImportsState instance Agda.Syntax.Scope.Base.InScope Agda.Syntax.Abstract.Name.AbstractModule instance Agda.Syntax.Scope.Base.InScope Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Common.IsInstanceDef a => Agda.Syntax.Common.IsInstanceDef (Agda.Syntax.Scope.Base.PrettyWithBindingSite a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Scope.Base.ScopeInfo instance GHC.Internal.Base.Monoid Agda.Syntax.Scope.Base.LiveNames instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.AmbiguousNameReason instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.BindingSource instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.DataOrRecordModule instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.LocalVar instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.NameMapEntry instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.NameOrModule instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.NameSpace instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.NameSpaceId instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.OperatorScope instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.ResolvedName instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.Scope instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.ScopeInfo instance Agda.Utils.Null.Null Agda.Syntax.Scope.Base.OpenedModule instance Agda.Utils.Null.Null Agda.Syntax.Scope.Base.OperatorScope instance Agda.Utils.Null.Null Agda.Syntax.Scope.Base.Scope instance Agda.Utils.Null.Null Agda.Syntax.Scope.Base.ScopeInfo instance Agda.Utils.Null.Null Agda.Syntax.Scope.Base.UnusedImportsState instance GHC.Internal.Classes.Ord Agda.Syntax.Scope.Base.LocalVar instance GHC.Internal.Classes.Ord Agda.Syntax.Scope.Base.NameOrModule instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Scope.Base.WithKind a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.BindingSource instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.LiveNames instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.LocalVar instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.NameSpace instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.NameSpaceId instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.OperatorScope instance (Agda.Syntax.Abstract.Name.HasNameBindingSite a, Agda.Syntax.Common.Pretty.Pretty a) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Scope.Base.PrettyWithBindingSite a) instance (Agda.Syntax.Common.IsInstanceDef a, Agda.Syntax.Common.Pretty.Pretty a) => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Scope.Base.PrettyWithInstance a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.ResolvedName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.Scope instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Scope.Base.ScopeInfo instance GHC.Internal.Base.Semigroup Agda.Syntax.Scope.Base.LiveNames instance GHC.Internal.Base.Semigroup Agda.Syntax.Scope.Base.NameMapEntry instance Agda.Syntax.Scope.Base.SetBindingSite Agda.Syntax.Abstract.Name.AbstractModule instance Agda.Syntax.Scope.Base.SetBindingSite Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Scope.Base.SetBindingSite a => Agda.Syntax.Scope.Base.SetBindingSite [a] instance Agda.Syntax.Scope.Base.SetBindingSite Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Scope.Base.SetBindingSite Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Scope.Base.SetBindingSite a => Agda.Syntax.Scope.Base.SetBindingSite (Agda.Utils.List1.List1 a) instance Agda.Syntax.Scope.Base.SetBindingSite Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.AllowAmbiguousNames instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.AmbiguousNameReason instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.BindingSource instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.DataOrRecordModule instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.LocalVar instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.NameMapEntry instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.NameOrModule instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.NameResolutionError instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.NameSpace instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.OperatorScope instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.ResolvedName instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.Scope instance GHC.Internal.Show.Show Agda.Syntax.Scope.Base.ScopeInfo instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Scope.Base.WithKind a) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Scope.Base.WithKind -- | An info object contains additional information about a piece of -- abstract syntax that isn't part of the actual syntax. For instance, it -- might contain the source code position of an expression or the -- concrete syntax that an internal expression originates from. module Agda.Syntax.Info -- | Kind of a meta: the method how to solve it. data MetaKind -- | Meta variable solved by instance search. InstanceMeta :: MetaKind -- | Meta variable solved by unification (default). UnificationMeta :: MetaKind -- | Default meta kind from its Hiding context. hidingToMetaKind :: Hiding -> MetaKind -- | Name suggestion for meta variable. Empty string means no suggestion. type MetaNameSuggestion = String -- | Information associated to a meta variable in the abstract syntax. data MetaInfo MetaInfo :: Range -> ScopeInfo -> Maybe MetaId -> MetaNameSuggestion -> MetaKind -> MetaInfo [metaRange] :: MetaInfo -> Range [metaScope] :: MetaInfo -> ScopeInfo [metaNumber] :: MetaInfo -> Maybe MetaId [metaNameSuggestion] :: MetaInfo -> MetaNameSuggestion [metaKind] :: MetaInfo -> MetaKind emptyMetaInfo :: MetaInfo newtype ExprInfo ExprRange :: Range -> ExprInfo exprNoRange :: ExprInfo -- | Information about application data AppInfo AppInfo :: Range -> Origin -> ParenPreference -> AppInfo [appRange] :: AppInfo -> Range [appOrigin] :: AppInfo -> Origin -- | Do we prefer a lambda argument with or without parens? [appParens] :: AppInfo -> ParenPreference -- | Default is system inserted and prefer parens. defaultAppInfo :: Range -> AppInfo -- | AppInfo with no range information. defaultAppInfo_ :: AppInfo data ModuleInfo ModuleInfo :: Range -> Range -> Maybe Name -> OpenShortHand -> Maybe ImportDirective -> ModuleInfo [minfoRange] :: ModuleInfo -> Range -- | The range of the "as" and "to" keywords, if any. Retained for -- highlighting purposes. [minfoAsTo] :: ModuleInfo -> Range -- | The "as" module name, if any. Retained for highlighting purposes. [minfoAsName] :: ModuleInfo -> Maybe Name [minfoOpenShort] :: ModuleInfo -> OpenShortHand -- | Retained for abstractToConcrete of ModuleMacro. [minfoDirective] :: ModuleInfo -> Maybe ImportDirective newtype LetInfo LetRange :: Range -> LetInfo data DefInfo' t DefInfo :: Fixity' -> Access -> IsAbstract -> IsOpaque -> IsInstance -> IsMacro -> DeclInfo -> TacticAttribute' t -> DefInfo' t [defFixity] :: DefInfo' t -> Fixity' [defAccess] :: DefInfo' t -> Access [defAbstract] :: DefInfo' t -> IsAbstract [defOpaque] :: DefInfo' t -> IsOpaque [defInstance] :: DefInfo' t -> IsInstance [defMacro] :: DefInfo' t -> IsMacro [defInfo] :: DefInfo' t -> DeclInfo [defTactic] :: DefInfo' t -> TacticAttribute' t mkDefInfo :: Name -> Fixity' -> Access -> IsAbstract -> Range -> DefInfo' t -- | Same as mkDefInfo but where we can also give the -- IsInstance mkDefInfoInstance :: Name -> Fixity' -> Access -> IsAbstract -> IsInstance -> IsMacro -> Range -> DefInfo' t data DeclInfo DeclInfo :: Name -> Range -> DeclInfo [declName] :: DeclInfo -> Name [declRange] :: DeclInfo -> Range data MutualInfo MutualInfo :: TerminationCheck Name -> CoverageCheck -> PositivityCheck -> Range -> MutualInfo [mutualTerminationCheck] :: MutualInfo -> TerminationCheck Name [mutualCoverageCheck] :: MutualInfo -> CoverageCheck [mutualPositivityCheck] :: MutualInfo -> PositivityCheck [mutualRange] :: MutualInfo -> Range data LHSInfo LHSInfo :: Range -> ExpandedEllipsis -> LHSInfo [lhsRange] :: LHSInfo -> Range [lhsEllipsis] :: LHSInfo -> ExpandedEllipsis -- | For a general pattern we remember the source code position. newtype PatInfo PatRange :: Range -> PatInfo -- | Empty range for patterns. patNoRange :: PatInfo -- | Constructor pattern info. data ConPatInfo ConPatInfo :: ConOrigin -> PatInfo -> ConPatLazy -> ConPatInfo -- | Does this pattern come form the eta-expansion of an implicit pattern? [conPatOrigin] :: ConPatInfo -> ConOrigin [conPatInfo] :: ConPatInfo -> PatInfo [conPatLazy] :: ConPatInfo -> ConPatLazy -- | Has the constructor pattern a dotted (forced) constructor? data ConPatLazy -- | Dotted constructor. ConPatLazy :: ConPatLazy -- | Ordinary constructor. ConPatEager :: ConPatLazy instance Agda.Syntax.Common.AllAreOpaque (Agda.Syntax.Info.DefInfo' t) instance Agda.Syntax.Common.AnyIsAbstract (Agda.Syntax.Info.DefInfo' t) instance GHC.Internal.Enum.Bounded Agda.Syntax.Info.ConPatLazy instance GHC.Internal.Enum.Enum Agda.Syntax.Info.ConPatLazy instance GHC.Internal.Classes.Eq Agda.Syntax.Info.AppInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.ConPatInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.ConPatLazy instance GHC.Internal.Classes.Eq Agda.Syntax.Info.DeclInfo instance GHC.Internal.Classes.Eq t => GHC.Internal.Classes.Eq (Agda.Syntax.Info.DefInfo' t) instance GHC.Internal.Classes.Eq Agda.Syntax.Info.ExprInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.LHSInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.LetInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.MetaInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.MetaKind instance GHC.Internal.Classes.Eq Agda.Syntax.Info.ModuleInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.MutualInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Info.PatInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Info.AppInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Info.ConPatInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Info.ConPatLazy instance GHC.Internal.Generics.Generic Agda.Syntax.Info.DeclInfo instance GHC.Internal.Generics.Generic (Agda.Syntax.Info.DefInfo' t) instance GHC.Internal.Generics.Generic Agda.Syntax.Info.LHSInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Info.MetaInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Info.MetaKind instance GHC.Internal.Generics.Generic Agda.Syntax.Info.ModuleInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Info.MutualInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.AppInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.DeclInfo instance Agda.Syntax.Position.HasRange (Agda.Syntax.Info.DefInfo' t) instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.ExprInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.LHSInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.LetInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.MetaInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.ModuleInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.MutualInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.PatInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.AppInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.DeclInfo instance Agda.Syntax.Position.KillRange (Agda.Syntax.Info.DefInfo' t) instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.ExprInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.LHSInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.LetInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.MetaInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.ModuleInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.MutualInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.PatInfo instance Agda.Syntax.Common.LensIsAbstract (Agda.Syntax.Info.DefInfo' t) instance Agda.Syntax.Common.LensIsOpaque (Agda.Syntax.Info.DefInfo' t) instance Agda.Syntax.Common.LensOrigin Agda.Syntax.Info.AppInfo instance GHC.Internal.Base.Monoid Agda.Syntax.Info.PatInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.AppInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.ConPatInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.ConPatLazy instance Control.DeepSeq.NFData Agda.Syntax.Info.DeclInfo instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Agda.Syntax.Info.DefInfo' t) instance Control.DeepSeq.NFData Agda.Syntax.Info.ExprInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.LHSInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.LetInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.MetaInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.MetaKind instance Control.DeepSeq.NFData Agda.Syntax.Info.ModuleInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.MutualInfo instance Control.DeepSeq.NFData Agda.Syntax.Info.PatInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.AppInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.ExprInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.LHSInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.LetInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.MetaInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.MetaKind instance Agda.Utils.Null.Null Agda.Syntax.Info.MutualInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.PatInfo instance GHC.Internal.Classes.Ord Agda.Syntax.Info.AppInfo instance GHC.Internal.Classes.Ord Agda.Syntax.Info.ConPatLazy instance GHC.Internal.Base.Semigroup Agda.Syntax.Info.PatInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.DeclInfo instance Agda.Syntax.Position.SetRange (Agda.Syntax.Info.DefInfo' t) instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.ModuleInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.PatInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.AppInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.ConPatInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.ConPatLazy instance GHC.Internal.Show.Show Agda.Syntax.Info.DeclInfo instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.Syntax.Info.DefInfo' t) instance GHC.Internal.Show.Show Agda.Syntax.Info.ExprInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.LHSInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.LetInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.MetaInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.MetaKind instance GHC.Internal.Show.Show Agda.Syntax.Info.ModuleInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.MutualInfo instance GHC.Internal.Show.Show Agda.Syntax.Info.PatInfo -- | Data structures for the type checker. -- -- Part of Agda.TypeChecking.Monad.Base, extracted to avoid import -- cycles. module Agda.TypeChecking.Monad.Base.Types pattern CxEmpty :: Context pattern CxExtend :: ContextEntry -> Context -> Context pattern CxExtendVar :: Name -> Dom Type -> Context -> Context cxDrop :: Nat -> Context -> Context -- | Does not raise the retrieved entry! cxLookup :: Nat -> Context -> Maybe ContextEntry -- | Assumes the list of entries to be prepended follows the context -- ordering convention (earlier entries depend on later ones) cxPrepend :: [ContextEntry] -> Context -> Context -- | The returned prefix follows the context ordering convention (earlier -- entries depend on later ones) cxSplitAt :: Nat -> Context -> ([ContextEntry], Context) -- | The returned list of context entries follows the context ordering -- convention (earlier entries depend on later ones) cxTake :: Nat -> Context -> [ContextEntry] cxWithIndex :: (Nat -> ContextEntry -> a) -> Context -> [a] isPrimitiveModule :: IsBuiltinModule -> Bool lensFileDictBuiltinModuleIds :: Lens' FileDictWithBuiltins BuiltinModuleIds lensFileDictFileDictBuilder :: Lens' FileDictWithBuiltins FileDictBuilder lensFileDictPrimitiveLibDir :: Lens' FileDictWithBuiltins PrimitiveLibDir lensPairModuleToSource :: Lens' (FileDictWithBuiltins, ModuleToSourceId) ModuleToSource -- | Collection of FileIds of primitive modules. type BuiltinModuleIds = EnumMap FileId IsBuiltinModule data Comparison CmpEq :: Comparison CmpLeq :: Comparison type Context = Context' ContextEntry -- | The Context is a stack of ContextEntrys. Unlike -- telescopes, later context entries are bound in earlier ones. newtype Context' a Context :: [a] -> Context' a [cxEntries] :: Context' a -> [a] data ContextEntry CtxVar :: Name -> Dom Type -> ContextEntry [ceName] :: ContextEntry -> Name [ceType] :: ContextEntry -> Dom Type -- | Translation between AbsolutePath and FileId that also -- knows about Agda's builtin modules. data FileDictWithBuiltins FileDictWithBuiltins :: FileDictBuilder -> BuiltinModuleIds -> PrimitiveLibDir -> FileDictWithBuiltins -- | (Building a) translation between AbsolutePath and -- FileId. [fileDictBuilder] :: FileDictWithBuiltins -> FileDictBuilder -- | For the known FileIds, remember whether they refer to Agda's -- builtin modules. [builtinModuleIds] :: FileDictWithBuiltins -> BuiltinModuleIds -- | The absolute path to the directory with the builtin modules. Needs to -- be set upon initialization. [primitiveLibDir] :: FileDictWithBuiltins -> PrimitiveLibDir -- | How much highlighting should be sent to the user interface? data HighlightingLevel None :: HighlightingLevel NonInteractive :: HighlightingLevel -- | This includes both non-interactive highlighting and interactive -- highlighting of the expression that is currently being type-checked. Interactive :: HighlightingLevel -- | How should highlighting be sent to the user interface? data HighlightingMethod -- | Via stdout. Direct :: HighlightingMethod -- | Both via files and via stdout. Indirect :: HighlightingMethod -- | Datatype representing a single boundary condition: x_0 = u_0, ... ,x_n -- = u_n ⊢ t = ?n es data IPFace' t IPFace' :: [(t, t)] -> t -> IPFace' t [faceEqns] :: IPFace' t -> [(t, t)] [faceRHS] :: IPFace' t -> t -- | Discern Agda's primitive modules from other file modules. -- isPrimitiveModule implies -- IsBuiltinModuleWithSafePostulate implies -- isBuiltinModule. Keep constructors in this order! data IsBuiltinModule -- | Agda.Primitive. IsAgdaPrimitive :: IsBuiltinModule -- | Agda.Primitive.Cubical. IsAgdaPrimitiveCubical :: IsBuiltinModule -- | Safe module, e.g. Agda.Builtin.Equality. IsBuiltinModuleWithSafePostulates :: IsBuiltinModule -- | Any builtin module. IsBuiltinModule :: IsBuiltinModule data IsWithFunction a NoWithFunction :: IsWithFunction a WithFunction :: a -> IsWithFunction a data ModuleToSource ModuleToSource :: FileDictWithBuiltins -> ModuleToSourceId -> ModuleToSource [fileDict] :: ModuleToSource -> FileDictWithBuiltins [moduleToSourceId] :: ModuleToSource -> ModuleToSourceId -- | Maps top-level module names to the corresponding source file ids. type ModuleToSourceId = Map TopLevelModuleName SourceFile -- | For printing, we couple a meta with its name suggestion. data NamedMeta NamedMeta :: MetaNameSuggestion -> MetaId -> NamedMeta [nmSuggestion] :: NamedMeta -> MetaNameSuggestion [nmid] :: NamedMeta -> MetaId -- | Polarity for equality and subtype checking. data Polarity -- | monotone Covariant :: Polarity -- | antitone Contravariant :: Polarity -- | no information (mixed variance) Invariant :: Polarity -- | constant Nonvariant :: Polarity type PrimitiveLibDir = AbsolutePath -- | SourceFiles must exist and be registered in our file -- dictionary. newtype SourceFile SourceFile :: FileId -> SourceFile [srcFileId] :: SourceFile -> FileId data TopLevelModuleNameWithSourceFile TopLevelModuleNameWithSourceFile :: TopLevelModuleName -> SourceFile -> TopLevelModuleNameWithSourceFile [fileModuleName] :: TopLevelModuleNameWithSourceFile -> TopLevelModuleName [fileModuleSourceFile] :: TopLevelModuleNameWithSourceFile -> SourceFile -- | Top-level module names (with constant-time comparisons). type TopLevelModuleName = TopLevelModuleName' Range data FileDictBuilder -- | Unique identifier of a file. data FileId -- | Paths which are known to be absolute. -- -- Note that the Eq and Ord instances do not check if -- different paths point to the same files or directories. data AbsolutePath instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Types.Comparison instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Types.HighlightingLevel instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Types.HighlightingMethod instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Types.IsBuiltinModule instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Types.Polarity instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Types.SourceFile instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Monad.Base.Types.Context' instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Monad.Base.Types.IsWithFunction instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.Types.Context' instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.Types.IsWithFunction instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.Comparison instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.Types.Context' a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.ContextEntry instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.FileDictWithBuiltins instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.HighlightingLevel instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.HighlightingMethod instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.IsBuiltinModule instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.Polarity instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.SourceFile instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Types.TopLevelModuleNameWithSourceFile instance Agda.Syntax.Common.LensArgInfo Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensCohesion Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensHiding Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensModalPolarity Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensOrigin Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensQuantity Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.Context instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.FileDictWithBuiltins instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.IsBuiltinModule instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.SourceFile instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.TopLevelModuleNameWithSourceFile instance Agda.Utils.Null.Null (Agda.TypeChecking.Monad.Base.Types.Context' a) instance Agda.Utils.Null.Null (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.Types.HighlightingLevel instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.Types.IsBuiltinModule instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.Types.SourceFile instance GHC.Internal.Read.Read Agda.TypeChecking.Monad.Base.Types.HighlightingLevel instance GHC.Internal.Read.Read Agda.TypeChecking.Monad.Base.Types.HighlightingMethod instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.Comparison instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.Types.Context' a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.ContextEntry instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.HighlightingLevel instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.HighlightingMethod instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.IsBuiltinModule instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.Polarity instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.SourceFile instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Types.TopLevelModuleNameWithSourceFile instance Agda.Utils.Size.Sized (Agda.TypeChecking.Monad.Base.Types.Context' a) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Monad.Base.Types.Context' instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Monad.Base.Types.IsWithFunction -- | Syntax of size expressions and constraints. module Agda.TypeChecking.SizedTypes.Syntax -- | Constant finite sizes n >= 0. newtype Offset O :: Int -> Offset -- | Fixed size variables i. newtype Rigid RigidId :: String -> Rigid [rigidId] :: Rigid -> String -- | Size meta variables X to solve for. newtype Flex FlexId :: String -> Flex [flexId] :: Flex -> String -- | Size expressions appearing in constraints. data SizeExpr' rigid flex -- | Constant number n. Const :: Offset -> SizeExpr' rigid flex [offset] :: SizeExpr' rigid flex -> Offset -- | Variable plus offset i + n. Rigid :: rigid -> Offset -> SizeExpr' rigid flex [rigid] :: SizeExpr' rigid flex -> rigid [offset] :: SizeExpr' rigid flex -> Offset -- | Infinity ∞. Infty :: SizeExpr' rigid flex -- | Meta variable X + n. Flex :: flex -> Offset -> SizeExpr' rigid flex [flex] :: SizeExpr' rigid flex -> flex [offset] :: SizeExpr' rigid flex -> Offset type SizeExpr = SizeExpr' Rigid Flex -- | Comparison operator, e.g. for size expression. data Cmp -- | <. Lt :: Cmp -- | ≤. Le :: Cmp -- | Constraint: an inequation between size expressions, e.g. X < -- ∞ or i + 3 ≤ j. data Constraint' rigid flex Constraint :: SizeExpr' rigid flex -> Cmp -> SizeExpr' rigid flex -> Constraint' rigid flex [leftExpr] :: Constraint' rigid flex -> SizeExpr' rigid flex [cmp] :: Constraint' rigid flex -> Cmp [rightExpr] :: Constraint' rigid flex -> SizeExpr' rigid flex type Constraint = Constraint' Rigid Flex -- | What type of solution are we looking for? data Polarity Least :: Polarity Greatest :: Polarity -- | Assigning a polarity to a flexible variable. data PolarityAssignment flex PolarityAssignment :: Polarity -> flex -> PolarityAssignment flex -- | Type of solution wanted for each flexible. type Polarities flex = Map flex Polarity emptyPolarities :: Polarities flex polaritiesFromAssignments :: Ord flex => [PolarityAssignment flex] -> Polarities flex -- | Default polarity is Least. getPolarity :: Ord flex => Polarities flex -> flex -> Polarity -- | Partial substitution from flexible variables to size expression. newtype Solution rigid flex Solution :: Map flex (SizeExpr' rigid flex) -> Solution rigid flex [theSolution] :: Solution rigid flex -> Map flex (SizeExpr' rigid flex) emptySolution :: Solution r f -- | Executing a substitution. class Substitute r f a subst :: Substitute r f a => Solution r f -> a -> a type CTrans r f = Constraint' r f -> Maybe [Constraint' r f] -- | Returns Nothing if the constraint is contradictory. simplify1 :: Eq r => CTrans r f -> CTrans r f -- | Le acts as True, Lt as False. ifLe :: Cmp -> a -> a -> a -- | Interpret Cmp as relation on Offset. compareOffset :: Offset -> Cmp -> Offset -> Bool -- | Offsets + n must be non-negative class ValidOffset a validOffset :: ValidOffset a => a -> Bool -- | Make offsets non-negative by rounding up. class TruncateOffset a truncateOffset :: TruncateOffset a => a -> a -- | The rigid variables contained in a pice of syntax. class Ord RigidOf a => Rigids a where { type RigidOf a; } rigids :: Rigids a => a -> Set (RigidOf a) -- | The flexibe variables contained in a pice of syntax. class Ord FlexOf a => Flexs a where { type FlexOf a; } flexs :: Flexs a => a -> Set (FlexOf a) -- | Identifiers for rigid variables. data NamedRigid NamedRigid :: String -> Int -> NamedRigid -- | Name for printing in debug messages. [rigidName] :: NamedRigid -> String -- | De Bruijn index. [rigidIndex] :: NamedRigid -> Int -- | Size metas in size expressions. data SizeMeta SizeMeta :: MetaId -> [Int] -> SizeMeta [sizeMetaId] :: SizeMeta -> MetaId -- | De Bruijn indices. [sizeMetaArgs] :: SizeMeta -> [Int] -- | Size expression with de Bruijn indices. type DBSizeExpr = SizeExpr' NamedRigid SizeMeta type SizeConstraint = Constraint' NamedRigid SizeMeta -- | Size constraint with de Bruijn indices. data HypSizeConstraint HypSizeConstraint :: Context -> [Nat] -> [SizeConstraint] -> SizeConstraint -> HypSizeConstraint [sizeContext] :: HypSizeConstraint -> Context -- | DeBruijn indices [sizeHypIds] :: HypSizeConstraint -> [Nat] -- | Living in Context. [sizeHypotheses] :: HypSizeConstraint -> [SizeConstraint] -- | Living in Context. [sizeConstraint] :: HypSizeConstraint -> SizeConstraint instance GHC.Internal.Enum.Bounded Agda.TypeChecking.SizedTypes.Syntax.Cmp instance Agda.TypeChecking.SizedTypes.Utils.Dioid Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Internal.Enum.Enum Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Internal.Enum.Enum Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Flex instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Polarity instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Rigid instance (GHC.Internal.Classes.Eq rigid, GHC.Internal.Classes.Eq flex) => GHC.Internal.Classes.Eq (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.SizeMeta instance GHC.Internal.Classes.Ord flex => Agda.TypeChecking.SizedTypes.Syntax.Flexs (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid flex) instance Agda.TypeChecking.SizedTypes.Syntax.Flexs Agda.TypeChecking.SizedTypes.Syntax.HypSizeConstraint instance Agda.TypeChecking.SizedTypes.Syntax.Flexs a => Agda.TypeChecking.SizedTypes.Syntax.Flexs [a] instance GHC.Internal.Classes.Ord flex => Agda.TypeChecking.SizedTypes.Syntax.Flexs (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Internal.Data.Foldable.Foldable (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid) instance GHC.Internal.Data.Foldable.Foldable (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid) instance GHC.Internal.Base.Functor (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid) instance GHC.Internal.Base.Functor (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid) instance GHC.Internal.Generics.Generic Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Internal.Generics.Generic (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid flex) instance GHC.Internal.Generics.Generic Agda.TypeChecking.SizedTypes.Syntax.HypSizeConstraint instance GHC.Internal.Generics.Generic Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance GHC.Internal.Generics.Generic Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Internal.Generics.Generic (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Internal.Generics.Generic Agda.TypeChecking.SizedTypes.Syntax.SizeMeta instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.Syntax.Cmp instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.Syntax.Offset instance Control.DeepSeq.NFData Agda.TypeChecking.SizedTypes.Syntax.Cmp instance (Control.DeepSeq.NFData r, Control.DeepSeq.NFData f) => Control.DeepSeq.NFData (Agda.TypeChecking.SizedTypes.Syntax.Constraint' r f) instance Control.DeepSeq.NFData Agda.TypeChecking.SizedTypes.Syntax.HypSizeConstraint instance Control.DeepSeq.NFData Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance Control.DeepSeq.NFData Agda.TypeChecking.SizedTypes.Syntax.Offset instance (Control.DeepSeq.NFData r, Control.DeepSeq.NFData f) => Control.DeepSeq.NFData (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance Control.DeepSeq.NFData Agda.TypeChecking.SizedTypes.Syntax.SizeMeta instance Agda.Utils.Null.Null (Agda.TypeChecking.SizedTypes.Syntax.Solution rigid flex) instance GHC.Internal.Num.Num Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Flex instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Polarity instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Rigid instance (GHC.Internal.Classes.Ord rigid, GHC.Internal.Classes.Ord flex) => GHC.Internal.Classes.Ord (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.SizeMeta instance Agda.TypeChecking.SizedTypes.Utils.Plus Agda.TypeChecking.SizedTypes.Syntax.NamedRigid GHC.Internal.Types.Int Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance Agda.TypeChecking.SizedTypes.Utils.Plus Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.Utils.Plus (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) Agda.TypeChecking.SizedTypes.Syntax.Offset (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Cmp instance (Agda.Syntax.Common.Pretty.Pretty r, Agda.Syntax.Common.Pretty.Pretty f) => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.Constraint' r f) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Flex instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Polarity instance Agda.Syntax.Common.Pretty.Pretty flex => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.PolarityAssignment flex) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Rigid instance (Agda.Syntax.Common.Pretty.Pretty r, Agda.Syntax.Common.Pretty.Pretty f) => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.SizeMeta instance (Agda.Syntax.Common.Pretty.Pretty r, Agda.Syntax.Common.Pretty.Pretty f) => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.Solution r f) instance GHC.Internal.Classes.Ord r => Agda.TypeChecking.SizedTypes.Syntax.Rigids (Agda.TypeChecking.SizedTypes.Syntax.Constraint' r f) instance Agda.TypeChecking.SizedTypes.Syntax.Rigids a => Agda.TypeChecking.SizedTypes.Syntax.Rigids [a] instance GHC.Internal.Classes.Ord r => Agda.TypeChecking.SizedTypes.Syntax.Rigids (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Cmp instance (GHC.Internal.Show.Show rigid, GHC.Internal.Show.Show flex) => GHC.Internal.Show.Show (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid flex) instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Flex instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.HypSizeConstraint instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.NamedRigid instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Rigid instance (GHC.Internal.Show.Show rigid, GHC.Internal.Show.Show flex) => GHC.Internal.Show.Show (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Syntax.SizeMeta instance (GHC.Internal.Show.Show rigid, GHC.Internal.Show.Show flex) => GHC.Internal.Show.Show (Agda.TypeChecking.SizedTypes.Syntax.Solution rigid flex) instance GHC.Internal.Classes.Ord f => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f (Agda.TypeChecking.SizedTypes.Syntax.Constraint' r f) instance Agda.TypeChecking.SizedTypes.Syntax.Substitute r f a => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f [a] instance Agda.TypeChecking.SizedTypes.Syntax.Substitute r f a => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f (Data.Map.Internal.Map k a) instance GHC.Internal.Classes.Ord f => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance GHC.Internal.Classes.Ord f => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f (Agda.TypeChecking.SizedTypes.Syntax.Solution r f) instance Agda.TypeChecking.SizedTypes.Utils.Top Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Internal.Data.Traversable.Traversable (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid) instance GHC.Internal.Data.Traversable.Traversable (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid) instance Agda.TypeChecking.SizedTypes.Syntax.TruncateOffset Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.Syntax.TruncateOffset (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance Agda.TypeChecking.SizedTypes.Syntax.ValidOffset Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.Syntax.ValidOffset (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) module Agda.TypeChecking.Serialise.Base bumpFresh :: FreshAndReuse -> IO Word32 bumpReuse :: FreshAndReuse -> IO () cacheVar :: Int -> Maybe Word32 -- | Creates an empty dictionary. emptyDict :: Bool -> IO Dict farEmpty :: IO FreshAndReuse fingerprintNoinline :: TypeRep -> Fingerprint getFresh :: FreshAndReuse -> IO Word32 getReuse :: FreshAndReuse -> IO Word32 -- | The actual logic of tickICode is cold code, so it's -- out-of-line, to decrease code size and avoid cache pollution. goTickIcode :: Typeable a => Proxy a -> S () icodeDouble :: Double -> S Word32 icodeInteger :: Integer -> S Word32 icodeLText :: Text -> S Word32 -- | icode only if thing has not been seen before. icodeMemo :: Hashable a => (Dict -> HashTableLU a Word32) -> (Dict -> FreshAndReuse) -> a -> S Word32 -> S Word32 -- | icodeN tag t a1 ... an serialises the arguments a1, -- ..., an of the constructor t together with a tag -- tag picked to disambiguate between different constructors. It -- corresponds to icodeNode . (tag :) =<< mapM icode [a1, ..., -- an] icodeN :: (ICODE (Word32 -> t) (Arity (Word32 -> t)), StrictCurrying (Domains (Word32 -> t)) (S Word32), All EmbPrj (Domains (Word32 -> t))) => Word32 -> t -> Arrows (Domains t) (S Word32) -- | icodeN' is the same as icodeN except that there is -- no tag icodeN' :: (ICODE t (Arity t), StrictCurrying (Domains t) (S Word32), All EmbPrj (Domains t)) => t -> Arrows (Domains t) (S Word32) icodeNode :: Node -> S Word32 icodeSText :: Text -> S Word32 icodeString :: String -> S Word32 icodeVarSet :: VarSet -> S Word32 lookupME :: Proxy a -> Fingerprint -> MemoEntry -> (# a | (# #) #) malformed :: R a malformedIO :: IO a -- | Computing a key of an abstract name. nameIdR :: Name -> NameIdR -- | Computing a key of a qualified name. qnameId :: QName -> QNameId -- | Increase entry for a in stats. tickICode :: Typeable a => a -> S () uncacheVar :: Word32 -> Maybe Term valuN :: (VALU t (Arity t), StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)), All EmbPrj (Domains t)) => t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t)) valueN :: (VALU t (Arity t), All EmbPrj (CoDomain t ': Domains t)) => t -> Word32 -> R (CoDomain t) varRangeStart :: Word32 -- | vcase value ix decodes thing represented by ix :: -- Word32 via the valu function and stores it in -- nodeMemo. If ix is present in nodeMemo, -- valu is not used, but the thing is read from nodeMemo -- instead. vcase :: EmbPrj a => (Node -> R a) -> Word32 -> R a -- | Decoder arguments. data Decode Decode :: IOArray MemoEntry -> Compact -> Array Node -> Array String -> Array Text -> Array Text -> Array Integer -> Array VarSet -> Array Double -> HashTableLL AbsolutePath AbsolutePath -> IORef ModuleToSource -> List1 AbsolutePath -> Decode -- | Created and modified by decoder. Used to introduce sharing while -- deserializing objects. [nodeMemo] :: Decode -> IOArray MemoEntry -- | Compact region where the decoded interface is allocated. [arena] :: Decode -> Compact -- | Obtained from interface. [nodeA] :: Decode -> Array Node -- | Obtained from interface. [stringA] :: Decode -> Array String -- | Obtained from interface. [lTextA] :: Decode -> Array Text -- | Obtained from interface. [sTextA] :: Decode -> Array Text -- | Obtained from interface. [integerA] :: Decode -> Array Integer -- | Obtained from interface. [varSetA] :: Decode -> Array VarSet -- | Obtained from interface. [doubleA] :: Decode -> Array Double -- | Memoizes filepaths computed for RangeFile-s. [filePathMemo] :: Decode -> HashTableLL AbsolutePath AbsolutePath -- | Maps module names to file names. Constructed by the decoder. [modFile] :: Decode -> IORef ModuleToSource -- | The include directories. [includes] :: Decode -> List1 AbsolutePath -- | State of the the encoder. data Dict Dict :: HashTableLU Node Word32 -> HashTableLU String Word32 -> HashTableLU Text Word32 -> HashTableLU Text Word32 -> HashTableLU Integer Word32 -> HashTableLU VarSet Word32 -> HashTableLU Word64 Word32 -> HashTableLU NameIdR Word32 -> HashTableLU QNameId Word32 -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> FreshAndReuse -> HashTableLU String Int -> Bool -> Dict -- | Written to interface file. [nodeD] :: Dict -> HashTableLU Node Word32 -- | Written to interface file. [stringD] :: Dict -> HashTableLU String Word32 -- | Written to interface file. [lTextD] :: Dict -> HashTableLU Text Word32 -- | Written to interface file. [sTextD] :: Dict -> HashTableLU Text Word32 -- | Written to interface file. [integerD] :: Dict -> HashTableLU Integer Word32 -- | Written to interface file. Andreas, 2026-08-29, issue #8697: The -- Double dictionary is keyed by the bit pattern of the -- Double, because the 'Eq Double' instance identifies -- 0.0 and -0.0, which would make hash-consing conflate -- these two distinct literals. (This is the inconsistency of issue -- #2169, which is why 'Eq Literal' compares Doubles bitwise.) [varSetD] :: Dict -> HashTableLU VarSet Word32 -- | Written to interface file (as Doubles). Dicitionaries which are -- not serialized, but provide short cuts to speed up serialization: -- Andreas, Makoto, AIM XXI Memoizing A.Name does not buy us much if we -- already memoize A.QName. Andreas, 2026-03-12 Memoizing A.Name saves -- ~17% of serialization time (25s -> 21s for std-lib). [doubleD] :: Dict -> HashTableLU Word64 Word32 -- | Not written to interface file. [nameD] :: Dict -> HashTableLU NameIdR Word32 -- | Not written to interface file. Fresh UIDs and reuse statistics: [qnameD] :: Dict -> HashTableLU QNameId Word32 [nodeC] :: Dict -> FreshAndReuse [stringC] :: Dict -> FreshAndReuse [lTextC] :: Dict -> FreshAndReuse [sTextC] :: Dict -> FreshAndReuse [integerC] :: Dict -> FreshAndReuse [varSetC] :: Dict -> FreshAndReuse [doubleC] :: Dict -> FreshAndReuse [termC] :: Dict -> FreshAndReuse [nameC] :: Dict -> FreshAndReuse [qnameC] :: Dict -> FreshAndReuse [stats] :: Dict -> HashTableLU String Int -- | If True collect in stats the quantities of calls to -- icode for each Typeable a. [collectStats] :: Dict -> Bool class Typeable a => EmbPrj a icode :: EmbPrj a => a -> S Word32 icod_ :: EmbPrj a => a -> S Word32 ($dmicod_) :: (EmbPrj a, Enum a) => a -> S Word32 value :: EmbPrj a => Word32 -> R a ($dmvalue) :: (EmbPrj a, Enum a, Bounded a) => Word32 -> R a type FreshAndReuse = IOArray Word32 -- | icodeArgs proxy (a1, ..., an) maps icode over -- a1, ..., an and returns the corresponding list of -- Word32. class ICODE t (a :: Nat) icodeArgs :: ICODE t a => Proxy t -> StrictProducts (Domains t) -> S Node -- | Association lists mapping TypeRep fingerprints to values. In some -- cases values with different types have the same serialized -- representation. This structure disambiguates them. data MemoEntry MEEmpty :: MemoEntry MECons :: Fingerprint -> (Any :: Type) -> MemoEntry -> MemoEntry -- | We need to distinguish Names with different -- nameBindingSite, so we complement the key NameId with -- that Range. data NameIdR NameIdR :: NameId -> Range -> NameIdR [nidNameId] :: NameIdR -> NameId [nidBindingSite] :: NameIdR -> Range -- | Two QNames are equal if their NameId is equal. type QNameId = NameIdR -- | Monad used by the decoder. -- -- TCM is not used because the associated overheads would make -- decoding slower. type R = ReaderT Decode IO -- | Monad used by the encoder. type S a = ReaderT Dict IO a class VALU t (a :: Nat) valuN' :: VALU t a => t -> StrictProducts (Constant Word32 (Domains t)) -> R (CoDomain t) valueArgs :: VALU t a => Proxy t -> Node -> Maybe (StrictProducts (Constant Word32 (Domains t))) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Serialise.Base.NameIdR instance GHC.Internal.Generics.Generic Agda.TypeChecking.Serialise.Base.NameIdR instance Data.Hashable.Class.Hashable Agda.TypeChecking.Serialise.Base.NameIdR instance Agda.TypeChecking.Serialise.Base.ICODE (a -> t) ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero) instance Agda.TypeChecking.Serialise.Base.ICODE (a -> b -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero)) instance Agda.TypeChecking.Serialise.Base.ICODE (a -> b -> c -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero))) instance Agda.TypeChecking.Serialise.Base.ICODE (a -> b -> c -> d -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero)))) instance Agda.TypeChecking.Serialise.Base.ICODE (a -> b -> c -> d -> e -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero))))) instance Agda.TypeChecking.Serialise.Base.ICODE t n => Agda.TypeChecking.Serialise.Base.ICODE (a -> b -> c -> d -> e -> f -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc n)))))) instance Agda.TypeChecking.Serialise.Base.ICODE t 'Agda.Utils.TypeLevel.Zero instance Agda.TypeChecking.Serialise.Base.VALU (a -> t) ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero) instance Agda.TypeChecking.Serialise.Base.VALU (a -> b -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero)) instance Agda.TypeChecking.Serialise.Base.VALU (a -> b -> c -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero))) instance Agda.TypeChecking.Serialise.Base.VALU (a -> b -> c -> d -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero)))) instance Agda.TypeChecking.Serialise.Base.VALU (a -> b -> c -> d -> e -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc 'Agda.Utils.TypeLevel.Zero))))) instance Agda.TypeChecking.Serialise.Base.VALU t n => Agda.TypeChecking.Serialise.Base.VALU (a -> b -> c -> d -> e -> f -> t) ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc ('Agda.Utils.TypeLevel.Suc n)))))) instance Agda.TypeChecking.Serialise.Base.VALU t 'Agda.Utils.TypeLevel.Zero -- | Serializing types that are not Agda-specific. module Agda.TypeChecking.Serialise.Instances.General icodeList :: EmbPrj a => [a] -> S Node valueList :: EmbPrj a => Node -> R [a] data KVS a b Cons :: a -> b -> KVS a b -> KVS a b Nil :: KVS a b icodeListPair :: (EmbPrj k, EmbPrj v) => KVS k v -> S Node valueListPair :: (EmbPrj k, EmbPrj v) => Node -> R [(k, v)] instance (Agda.TypeChecking.Serialise.Base.EmbPrj k, Agda.TypeChecking.Serialise.Base.EmbPrj v, Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.BiMap.Tag v)) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.BiMap.BiMap k v) instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Types.Bool instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Types.Char instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.DocTree.DocTree a) instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Types.Double instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (GHC.Internal.Data.Either.Either a b) instance (Data.Hashable.Class.Hashable k, Agda.TypeChecking.Serialise.Base.EmbPrj k, Agda.TypeChecking.Serialise.Base.EmbPrj v) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.HashMap.Internal.HashMap k v) instance (Data.Hashable.Class.Hashable a, Agda.TypeChecking.Serialise.Base.EmbPrj a) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.HashSet.Internal.HashSet a) instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Types.Int instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Int.Int32 instance Agda.TypeChecking.Serialise.Base.EmbPrj Data.IntSet.Internal.IntSet instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Bignum.Integer.Integer instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Base.String instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj [a] instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.List2.List2 a) instance (GHC.Internal.Classes.Ord a, Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Map.Internal.Map a b) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Strict.Maybe.Maybe a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.Set1.Set1 a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.List1.List1 a) instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Strict.Tuple.Pair a b) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Sequence.Internal.Seq a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Set.Internal.Set a) instance GHC.Internal.Data.Typeable.Internal.Typeable a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.SmallSet.SmallSet a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Data.Text.Internal.Text instance Agda.TypeChecking.Serialise.Base.EmbPrj Data.Text.Internal.Lazy.Text instance (GHC.Internal.Classes.Ord a, Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.Trie.Trie a b) instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (a, b) instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b, Agda.TypeChecking.Serialise.Base.EmbPrj c) => Agda.TypeChecking.Serialise.Base.EmbPrj (a, b, c) instance Agda.TypeChecking.Serialise.Base.EmbPrj () instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.VarSet.VarSet instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Base.Void instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, GHC.Internal.Data.Typeable.Internal.Typeable b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.WithDefault.WithDefault' a b) instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Word.Word32 instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Word.Word64 module Agda.Utils.Zipper class Zipper z where { type Carrier z; type Element z; } firstHole :: Zipper z => Carrier z -> Maybe (Element z, z) plugHole :: Zipper z => Element z -> z -> Carrier z nextHole :: Zipper z => Element z -> z -> Either (Carrier z) (Element z, z) data ListZipper a ListZip :: [a] -> [a] -> ListZipper a data ComposeZipper f g ComposeZip :: f -> g -> ComposeZipper f g instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Utils.Zipper.ListZipper a) instance GHC.Internal.Data.Foldable.Foldable Agda.Utils.Zipper.ListZipper instance GHC.Internal.Base.Functor Agda.Utils.Zipper.ListZipper instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Utils.Zipper.ListZipper a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Utils.Zipper.ListZipper a) instance GHC.Internal.Data.Traversable.Traversable Agda.Utils.Zipper.ListZipper instance (Agda.Utils.Zipper.Zipper f, Agda.Utils.Zipper.Zipper g, Agda.Utils.Zipper.Element f GHC.Internal.Types.~ Agda.Utils.Zipper.Carrier g) => Agda.Utils.Zipper.Zipper (Agda.Utils.Zipper.ComposeZipper f g) instance Agda.Utils.Zipper.Zipper (Agda.Utils.Zipper.ListZipper a) module Agda.Version -- | The version of Agda. version :: String -- | This package name. This is mainly intended for use in the test suites -- to filter ephemeral hash-fingerprinted package names like -- Agda-2.6.2-5ceeWeguf1QFMaHLput4zw. package :: String -- | Returns a URL corresponding to the given section in the documentation -- for the current version. docsUrl :: String -> String instance GHC.Internal.Generics.Generic Agda.Version.AnArbitrarySymbolInThisPackage module Agda.VersionCommit -- | Agda's version suffixed with the git commit hash. versionWithCommitInfo :: String -- | Information about current git commit, generated at compile time. commitInfo :: Maybe String -- | Agda's self-setup. module Agda.Setup -- | Get the path to ~/.agda (system-specific). Can be overwritten -- by the AGDA_DIR environment variable. -- -- (This is not to be confused with the directory getDataDir for -- the data files that Agda needs (e.g. the primitive modules).) getAgdaAppDir :: IO FilePath -- | This overrides the getDataDir from 'Paths_Agda'. See -- the documentation for the --print-agda-data-dir flag. getDataDir :: IO FilePath -- | This overrides the getDataFileName from 'Paths_Agda'. getDataFileName :: FilePath -> IO FilePath -- | False: Check whether we need to setup Agda. This function can -- be called when starting up Agda. -- -- True: force a setup e.g. when passing Agda option -- --setup. -- -- Copies the embedded data files to the designated data directory. setup :: Bool -> IO () -- | Setup up the emacs mode for Agda. module Agda.Setup.EmacsMode -- | Help topic for --emacs-mode. help :: String locateFlag :: String -- | Prints out the path to the Agda mode's main file (using UTF-8 and -- without any trailing newline). printEmacsModeFile :: IO () setupFlag :: String -- | Tries to set up the Agda mode in the given .emacs file. setupDotEmacs :: String -> IO () compileFlag :: String -- | Tries to compile the Agda mode's Emacs Lisp files. compileElispFiles :: IO () inform :: String -> IO () module Agda.Interaction.Options.Help -- | Interface to the help function data Help -- | General usage information GeneralHelp :: Help -- | Specialised usage information about TOPIC HelpFor :: HelpTopic -> Help -- | Usage information generation helpTopicUsage :: HelpTopic -> String -- | Conversion functions to strings string2HelpTopic :: String -> Maybe HelpTopic allHelpTopics :: [(String, HelpTopic)] instance GHC.Internal.Classes.Eq Agda.Interaction.Options.Help.Help instance GHC.Internal.Classes.Eq Agda.Interaction.Options.Help.HelpTopic instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Help.Help instance GHC.Internal.Generics.Generic Agda.Interaction.Options.Help.HelpTopic instance Control.DeepSeq.NFData Agda.Interaction.Options.Help.Help instance Control.DeepSeq.NFData Agda.Interaction.Options.Help.HelpTopic instance GHC.Internal.Show.Show Agda.Interaction.Options.Help.Help instance GHC.Internal.Show.Show Agda.Interaction.Options.Help.HelpTopic -- | Definitions and tools for arguments of command-line options. module Agda.Interaction.Options.Arguments -- | Print the possible values of an argument of the given type. optionValues :: Map String [String] -- | Argument to --color. colorArg :: String -- | Possible values for --color. colorValues :: [String] -- | Argument to --emacs-mode. emacsModeArg :: String -- | Possible values for --emacs-mode. emacsModeValues :: [String] -- | The argument to --erased-matches. erasedMatchesArg :: String -- | Possible values for --erased-matches. erasedMatchesValues :: [String] -- | Argument to --help. helpArg :: String -- | Possible values for --help. helpValues :: [String] -- | Argument to --profile. profileArg :: String -- | Possible values for --profile. profileValues :: [String] -- | Argument to --trace-imports. traceImportsArg :: String -- | Possible values for --trace-imports. traceImportsValues :: [String] -- | Argument to --warning. warningArg :: String -- | Possible values for --warning. warningValues :: [String] -- | Library management. -- -- Sample use: -- --
--   -- Get libraries as listed in .agda/libraries file.
--   libs <- getInstalledLibraries Nothing
--   
--   -- Get the libraries (and immediate paths) relevant for projectRoot.
--   -- This involves locating and processing the .agda-lib file for the project.
--   (libNames, includePaths) <-  getDefaultLibraries projectRoot True
--   
--   -- Get include paths of depended-on libraries.
--   resolvedPaths <- libraryIncludePaths Nothing libs libNames
--   
--   let allPaths = includePaths ++ resolvedPaths
--   
--   
module Agda.Interaction.Library -- | Get project root findProjectRoot :: FilePath -> LibM (Maybe FilePath) -- | Get dependencies and include paths for given project root: -- -- Look for .agda-lib files according to -- findAgdaLibFiles. If none are found, use default dependencies -- (according to defaults file) and current directory (project -- root). getDefaultLibraries :: FilePath -> Bool -> LibM ([LibName], [FilePath]) -- | Parse the descriptions of the libraries Agda knows about. -- -- Returns none if there is no libraries file. getInstalledLibraries :: Maybe FilePath -> LibM [AgdaLibFile] -- | Return the trusted executables Agda knows about. -- -- Returns none if there is no executables file. getTrustedExecutables :: LibM (Map ExeName FilePath) -- | Get all include pathes for a list of libraries to use. libraryIncludePaths :: Maybe FilePath -> [AgdaLibFile] -> [LibName] -> LibM [FilePath] -- | Get the content of the .agda-lib file in the given project -- root. getAgdaLibFile :: FilePath -> LibM [AgdaLibFile] -- | Returns the absolute default lib dir. This directory is used to store -- the Primitive.agda file. getPrimitiveLibDir :: IO AbsolutePath -- | Determine whether the second absolute path refers to one of Agda's -- primitive modules. The first argument should be the result of -- getPrimitiveLibDir. classifyBuiltinModule_ :: AbsolutePath -> AbsolutePath -> Maybe IsBuiltinModule -- | All builtin modules. builtinModules :: Set FilePath -- | These builtins may use postulates, and are still considered -- --safe. builtinModulesWithSafePostulates :: Set FilePath -- | These builtins may not use postulates under --safe. They are -- not automatically unsafe, but will be if they use an unsafe feature. builtinModulesWithUnsafePostulates :: Set FilePath primitiveModules :: Set FilePath -- | A symbolic library name. -- -- Library names are structured into the base name and a suffix of -- version numbers, e.g. mylib-1.2.3. The version suffix is -- optional. data LibName -- | Split a library name into basename and a list of version numbers. -- --
--   parseLibName "foo-1.2.3"    == LibName "foo" [1, 2, 3]
--   parseLibName "foo-01.002.3" == LibName "foo" [1, 2, 3]
--   
-- -- Note that because of leading zeros, parseLibName is not -- injective. (prettyShow . parseLibName would produce a normal -- form.) parseLibName :: String -> LibName -- | The options from an OPTIONS pragma (or a .agda-lib -- file). -- -- In the future it might be nice to switch to a more structured -- representation. Note that, currently, there is not a one-to-one -- correspondence between list elements and options. data OptionsPragma OptionsPragma :: [String] -> Range -> OptionsPragma -- | The options. [pragmaStrings] :: OptionsPragma -> [String] -- | The range of the options in the pragma (not including things like an -- OPTIONS keyword). [pragmaRange] :: OptionsPragma -> Range -- | Content of a .agda-lib file. data AgdaLibFile AgdaLibFile :: LibName -> FilePath -> Int -> [FilePath] -> [LibName] -> OptionsPragma -> AgdaLibFile -- | The symbolic name of the library. [_libName] :: AgdaLibFile -> LibName -- | Path to this .agda-lib file (not content of the file). [_libFile] :: AgdaLibFile -> FilePath -- | How many directories above the Agda file is the .agda-lib -- file located? [_libAbove] :: AgdaLibFile -> Int -- | Roots where to look for the modules of the library. [_libIncludes] :: AgdaLibFile -> [FilePath] -- | Dependencies. [_libDepends] :: AgdaLibFile -> [LibName] -- | Default pragma options for all files in the library. [_libPragmas] :: AgdaLibFile -> OptionsPragma -- | A symbolic executable name. type ExeName = Text -- | Throws LibErrors exceptions, still collects LibWarnings. type LibM = ExceptT LibErrors WriterT [LibWarning] StateT LibState IO -- | Raise collected LibErrors as exception. mkLibM :: [AgdaLibFile] -> LibErrorIO a -> LibM a data LibWarning LibWarning :: Maybe LibPositionInfo -> LibWarning' -> LibWarning -- | Information about which .agda-lib file we are reading and -- from where in the libraries file it came from. data LibPositionInfo LibPositionInfo :: Maybe FilePath -> LineNumber -> FilePath -> LibPositionInfo -- | Name of libraries file. [libFilePos] :: LibPositionInfo -> Maybe FilePath -- | Line number in libraries file. [lineNumPos] :: LibPositionInfo -> LineNumber -- | Library file. [filePos] :: LibPositionInfo -> FilePath libraryWarningName :: LibWarning -> WarningName -- | A file can either belong to a project located at a given root -- containing an .agda-lib file, or be part of the default project. data ProjectConfig ProjectConfig :: FilePath -> FilePath -> Int -> ProjectConfig -- | Directory which contains the .agda-lib file for the current -- project. [configRoot] :: ProjectConfig -> FilePath -- | .agda-lib file relative to configRoot (filename only, -- no directory). [configAgdaLibFile] :: ProjectConfig -> FilePath -- | How many directories above the Agda file is the .agda-lib -- file located? [configAbove] :: ProjectConfig -> Int DefaultProjectConfig :: ProjectConfig -- | Generalized version of findLib for testing. -- --
--   findLib' id "a"   [ "a-1", "a-02", "a-2", "b" ] == [ "a-02", "a-2" ]
--   
-- --
--   findLib' id "a"   [ "a", "a-1", "a-01", "a-2", "b" ] == [ "a" ]
--   findLib' id "a-1" [ "a", "a-1", "a-01", "a-2", "b" ] == [ "a-1", "a-01" ]
--   findLib' id "a-2" [ "a", "a-1", "a-01", "a-2", "b" ] == [ "a-2" ]
--   findLib' id "c"   [ "a", "a-1", "a-01", "a-2", "b" ] == []
--   
findLib' :: (a -> LibName) -> LibName -> [a] -> [a] -- | Default values for the options. module Agda.Interaction.Options.Default defaultOptions :: CommandLineOptions defaultPragmaOptions :: PragmaOptions instance Agda.Utils.Null.Null Agda.Interaction.Options.Types.CommandLineOptions instance Agda.Utils.Null.Null Agda.Interaction.Options.Types.PragmaOptions module Agda.Syntax.Common.Pretty.ANSI -- | Print an annotated, pretty-printing DocTree onto a -- VT100-compatible terminal. printTreeAnsi :: DocTree -> IO () putDocLn :: (MonadIO m, HasOptions m) => Doc -> m () putDocTree :: (MonadIO m, HasOptions m) => DocTree -> m () putDocTreeLn :: (MonadIO m, HasOptions m) => DocTree -> m () -- | Tools for shell completion scripts. -- -- Bash completion takes a list of completion words (the current -- commandline) and a completion index (the current word to be completed) -- and returns a list of possible completions of this word. -- -- To do bash completion inside Agda, we need to pass this data to -- Agda. So we equip Agda with a special option -- --bash-completion which takes first the completion index -- (number) and then the completion words. E.g. -- --
--   agda --bash-completion 1 --warn
--   
-- -- This should complete --warn to --warning=. -- --
--   agda --bash-completion 1 --warning=
--   
-- -- This would list the possible values for WARNING. However, these are -- too many and one may get the annoying question whether one really -- wants to see all. So we should only produce a small enough list. We -- show the common prefixes of all values up to a maximal number -- (threshold). To this end, we may store the possible completion as a -- compressed trie where instead of letters we use maximal -- non-overlapping prefixes. Then we compute a fair truncation of the -- tree so that the total number of leaves stay below the threshold. module Agda.Interaction.Options.BashCompletion type Help = String printedOptions :: [String] printedOptionsWithHelp :: [(String, Help)] -- | Print just the names of the given options (e.g. for bash completion -- scripts). For long options with finitely enumerable arguments, print -- all variants. printOptions :: [OptDescr a] -> [(String, Help)] -- | Should the completions be truncated to a given maximum number -- of prefixes? type Truncate = Maybe Int -- | Handle the option --bash-complete. It expects the index -- COMP_CWORD as first argument that tells which of the -- following arguments COMP_WORDS is supposed to be completed. -- -- It either returns an error message or the result for -- COMPREPLY. bashComplete :: Truncate -> [String] -> Either String String -- | The result of an invokation of (bash) completion. data Completion Completion :: Maybe String -> [(String, Help)] -> Completion -- | If Nothing, then the completion word cannot become a valid -- option ever. [extended] :: Completion -> Maybe String -- | If null, the extended word cannot be further completed. [completions] :: Completion -> [(String, Help)] -- | Cached trie of options. optionsTrie :: Trie Char Help -- | Complete the given word as an option. complete :: Truncate -> String -> Completion module Agda.Interaction.Options -- | Checks that the given options are consistent. Also makes adjustments -- (e.g. when one option implies another). checkOpts :: (MonadError OptionError m, MonadWriter OptionWarnings m) => CommandLineOptions -> m CommandLineOptions -- | Command line options of previous versions of Agda. Should not be -- listed in the usage info, put parsed by GetOpt for good error -- messaging. deadStandardOptions :: [OptDescr (Flag CommandLineOptions)] defaultInteractionOptions :: PragmaOptions -- | Simple interface for Agda.Utils.GetOpt Could be moved to -- Agda.Utils.Options (does not exist yet) getOptSimple :: [String] -> [OptDescr (Flag opts)] -> (String -> Flag opts) -> Flag opts impliedPragmaOptions :: [ImpliedPragmaOption] -- | Infective and coinfective options. -- -- Note that --cubical[=full] and --cubical=erased are -- "jointly infective": if one of them is used in one module, then one or -- the other must be used in all modules that depend on this module. infectiveCoinfectiveOptions :: [InfectiveCoinfectiveOption] inputFlag :: FilePath -> Flag CommandLineOptions -- | Latex pragma options. latexPragmaOptions :: (String, [OptDescr (Flag PragmaOptions)]) lensOptAllowExec :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptAllowIncompleteMatch :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptAllowUnsolved :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptAutoInline :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptBacktrackingInstances :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptCaching :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptCallByName :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptCohesion :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptCompileMain :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptConfluenceCheck :: Functor f => (Maybe ConfluenceCheck -> f (Maybe ConfluenceCheck)) -> PragmaOptions -> f PragmaOptions lensOptCopatterns :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptCountClusters :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptCubical :: Functor f => (Maybe Cubical -> f (Maybe Cubical)) -> PragmaOptions -> f PragmaOptions lensOptCubicalCompatible :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptCumulativity :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptDoubleCheck :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptEraseRecordParameters :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptErasedMatches :: Functor f => (AllowedErasedMatchesWithDefaults -> f AllowedErasedMatchesWithDefaults) -> PragmaOptions -> f PragmaOptions lensOptErasure :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptEta :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptExactSplit :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptExperimentalIrrelevance :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptExperimentalLazyInstances :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptFastReduce :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptFirstOrder :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptFlatSplit :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptForcing :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptGuarded :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptGuardedness :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptHiddenArgumentPuns :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptImportSorts :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptInferAbsurdClauses :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptInjectiveTypeConstructors :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptInstanceSearchDepth :: Functor f => (Int -> f Int) -> PragmaOptions -> f PragmaOptions lensOptInversionMaxDepth :: Functor f => (Int -> f Int) -> PragmaOptions -> f PragmaOptions lensOptIrrelevance :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptIrrelevantProjections :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptKeepCoveringClauses :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptKeepPatternVariables :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptLevelUniverse :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptLoadPrimitives :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptLocalRewriting :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptNoUniverseCheck :: Functor f => (WithDefault 'False -> f (WithDefault 'False)) -> PragmaOptions -> f PragmaOptions lensOptOccurrence :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptOmegaInOmega :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptPatternMatching :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptPolarity :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptPositivityCheck :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptPostfixProjections :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptPrintPatternSynonyms :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptProfiling :: Functor f => (ProfileOptions -> f ProfileOptions) -> PragmaOptions -> f PragmaOptions lensOptProjectionLike :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptProp :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptQualifiedInstances :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptRequireUniqueMetaSolutions :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptRewriting :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptSafe :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptSaveMetas :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptShowIdentitySubstitutions :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptShowImplicit :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptShowIrrelevant :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptSizedTypes :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptSyntacticEquality :: Functor f => (Maybe Int -> f (Maybe Int)) -> PragmaOptions -> f PragmaOptions lensOptTerminationCheck :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptTerminationDepth :: Functor f => (CutOff -> f CutOff) -> PragmaOptions -> f PragmaOptions lensOptTwoLevel :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions lensOptUniverseCheck :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptUniversePolymorphism :: Functor f => (WithDefault' Bool 'True -> f (WithDefault' Bool 'True)) -> PragmaOptions -> f PragmaOptions lensOptUseUnicode :: Functor f => (WithDefault' UnicodeOrAscii 'True -> f (WithDefault' UnicodeOrAscii 'True)) -> PragmaOptions -> f PragmaOptions lensOptVerbose :: Functor f => (Maybe (Trie VerboseKeyItem VerboseLevel) -> f (Maybe (Trie VerboseKeyItem VerboseLevel))) -> PragmaOptions -> f PragmaOptions lensOptWarningMode :: Functor f => (WarningMode -> f WarningMode) -> PragmaOptions -> f PragmaOptions lensOptWithoutK :: Functor f => (WithDefault' Bool 'False -> f (WithDefault' Bool 'False)) -> PragmaOptions -> f PragmaOptions -- | Map a function over the long options. Also removes the short options. -- Will be used to add the plugin name to the plugin options. mapFlag :: (String -> String) -> OptDescr a -> OptDescr a optAllowExec :: PragmaOptions -> Bool optAllowIncompleteMatch :: PragmaOptions -> Bool optAllowUnsolved :: PragmaOptions -> Bool optAutoInline :: PragmaOptions -> Bool optBacktrackingInstances :: PragmaOptions -> Bool optCaching :: PragmaOptions -> Bool optCallByName :: PragmaOptions -> Bool -- | optCohesion is implied by optFlatSplit. optCohesion :: PragmaOptions -> Bool optCompileNoMain :: PragmaOptions -> Bool optConfluenceCheck :: PragmaOptions -> Maybe ConfluenceCheck optCopatterns :: PragmaOptions -> Bool optCountClusters :: PragmaOptions -> Bool optCubical :: PragmaOptions -> Maybe Cubical optCubicalCompatible :: PragmaOptions -> Bool optCumulativity :: PragmaOptions -> Bool optDoubleCheck :: PragmaOptions -> Bool optEraseRecordParameters :: PragmaOptions -> Bool optErasedMatches :: PragmaOptions -> AllowedErasedMatches -- | optErasure is implied by optEraseRecordParameters, -- optFunext and optPropext. optErasure is also -- implied by an explicitly given --erased-matches with an -- argument distinct from =none. optErasure :: PragmaOptions -> Bool optEta :: PragmaOptions -> Bool optExperimentalIrrelevance :: PragmaOptions -> Bool optFastReduce :: PragmaOptions -> Bool optFirstOrder :: PragmaOptions -> Bool optFlatSplit :: PragmaOptions -> Bool optForcedArgumentRecursion :: PragmaOptions -> Bool optForcing :: PragmaOptions -> Bool -- | optFunext is implied by optQuotients. optFunext :: PragmaOptions -> Bool optGuarded :: PragmaOptions -> Bool optGuardedness :: PragmaOptions -> Bool optHiddenArgumentPuns :: PragmaOptions -> Bool -- | optImportSorts requires optLoadPrimitives. optImportSorts :: PragmaOptions -> Bool optInferAbsurdClauses :: PragmaOptions -> Bool optInjectiveTypeConstructors :: PragmaOptions -> Bool optInstanceSearchDepth :: PragmaOptions -> Int optInversionMaxDepth :: PragmaOptions -> Int optIrrelevance :: PragmaOptions -> Bool optIrrelevantProjections :: PragmaOptions -> Bool optKeepCoveringClauses :: PragmaOptions -> Bool optKeepPatternVariables :: PragmaOptions -> Bool optLargeIndices :: PragmaOptions -> Bool optLevelUniverse :: PragmaOptions -> Bool optLoadPrimitives :: PragmaOptions -> Bool optLocalRewriting :: PragmaOptions -> Bool optOccurrence :: PragmaOptions -> Bool optOmegaInOmega :: PragmaOptions -> Bool optPatternMatching :: PragmaOptions -> Bool optPolarity :: PragmaOptions -> Bool optPositivityCheck :: PragmaOptions -> Bool optPostfixProjections :: PragmaOptions -> Bool optPrintPatternSynonyms :: PragmaOptions -> Bool optProfiling :: PragmaOptions -> ProfileOptions optProjectionLike :: PragmaOptions -> Bool optProp :: PragmaOptions -> Bool optPropext :: PragmaOptions -> Bool optQualifiedInstances :: PragmaOptions -> Bool optQuoteMetas :: PragmaOptions -> Bool optQuotients :: PragmaOptions -> Bool optRequireUniqueMetaSolutions :: PragmaOptions -> Bool optRewriting :: PragmaOptions -> Bool optSafe :: PragmaOptions -> Bool optSaveMetas :: PragmaOptions -> Bool optShowGeneralized :: PragmaOptions -> Bool optShowIdentitySubstitutions :: PragmaOptions -> Bool optShowImplicit :: PragmaOptions -> Bool optShowIrrelevant :: PragmaOptions -> Bool optSizedTypes :: PragmaOptions -> Bool optSyntacticEquality :: PragmaOptions -> Maybe Int optTerminationCheck :: PragmaOptions -> Bool optTerminationDepth :: PragmaOptions -> CutOff optTwoLevel :: PragmaOptions -> Bool optUniverseCheck :: PragmaOptions -> Bool optUniversePolymorphism :: PragmaOptions -> Bool optUseUnicode :: PragmaOptions -> UnicodeOrAscii optVerbose :: PragmaOptions -> Maybe (Trie VerboseKeyItem VerboseLevel) optWarningMode :: PragmaOptions -> WarningMode optWithoutK :: PragmaOptions -> Bool optionGroups :: [(String, [OptDescr (Flag CommandLineOptions)])] optionWarningName :: OptionWarning -> WarningName -- | Parse options for a plugin. parsePluginOptions :: [String] -> [OptDescr (Flag opts)] -> Flag opts -- | Parse options from an options pragma. parsePragmaOptions :: OptionsPragma -> CommandLineOptions -> OptM PragmaOptions parseVerboseKey :: VerboseKey -> [VerboseKeyItem] -- | This function returns True if the file should be rechecked. recheckBecausePragmaOptionsChanged :: PragmaOptions -> PragmaOptions -> Bool runOptM :: OptM opts -> (Either OptionError opts, OptionWarnings) safeFlag :: Flag PragmaOptions -- | This list should contain all options defined in this module. standardOptions :: [OptDescr (Flag CommandLineOptions)] -- | Removes RTS options from a list of options. stripRTS :: [String] -> [String] -- | Check for unsafe pragmas. Gives a list of used unsafe flags. unsafePragmaOptions :: PragmaOptions -> [String] defaultOptions :: CommandLineOptions defaultPragmaOptions :: PragmaOptions -- | The default termination depth. defaultCutOff :: CutOff -- | f :: Flag opts is an action on the option record that results -- from parsing an option. f opts produces either an error -- message or an updated options record type Flag opts = opts -> OptM opts data ImpliedPragmaOption [ImpliesPragmaOption] :: forall (a :: Bool) (b :: Bool). String -> Bool -> (PragmaOptions -> WithDefault a) -> String -> Bool -> (PragmaOptions -> WithDefault b) -> ImpliedPragmaOption -- | Descriptions of infective and coinfective options. data InfectiveCoinfectiveOption ICOption :: (PragmaOptions -> Bool) -> String -> InfectiveCoinfective -> (PragmaOptions -> PragmaOptions -> Bool) -> (PragmaOptions -> PragmaOptions -> TopLevelModuleName -> Doc) -> InfectiveCoinfectiveOption -- | Is the option active? [icOptionActive] :: InfectiveCoinfectiveOption -> PragmaOptions -> Bool -- | A description of the option (typically a flag that activates the -- option). [icOptionDescription] :: InfectiveCoinfectiveOption -> String -- | Is the option (roughly speaking) infective or coinfective? [icOptionKind] :: InfectiveCoinfectiveOption -> InfectiveCoinfective -- | This function returns True exactly when, from the perspective -- of the option in question, the options in the current module (the -- first argument) are compatible with the options in a given imported -- module (the second argument). [icOptionOK] :: InfectiveCoinfectiveOption -> PragmaOptions -> PragmaOptions -> Bool -- | A warning message that should be used if this option is not used -- correctly. The given module name is the name of an imported module for -- which icOptionOK failed for the first two arguments. [icOptionWarning] :: InfectiveCoinfectiveOption -> PragmaOptions -> PragmaOptions -> TopLevelModuleName -> Doc -- | The options parse monad OptM collects warnings that are not -- discarded when a fatal error occurrs data OptM a type OptionError = String -- | Warnings when parsing options. data OptionWarning -- | Name of option changed in a newer version of Agda. OptionRenamed :: String -> String -> OptionWarning [oldOptionName] :: OptionWarning -> String [newOptionName] :: OptionWarning -> String -- | A problem with setting or unsetting a warning. WarningProblem :: WarningModeError -> OptionWarning -- | Confluence checking for local rewrite rules is unimplemented. LocalRewritingConfluenceCheck :: OptionWarning data CommandLineOptions Options :: String -> Maybe FilePath -> [FilePath] -> [AbsolutePath] -> [LibName] -> Maybe FilePath -> Bool -> Bool -> Integer -> Map ExeName FilePath -> Bool -> Bool -> Bool -> Maybe PrintAgdaVersion -> Maybe Help -> Bool -> Bool -> Set EmacsModeCommand -> Bool -> Bool -> Bool -> Bool -> Maybe FilePath -> Bool -> Bool -> Bool -> Bool -> PragmaOptions -> Bool -> Bool -> DiagnosticsColours -> Bool -> Parallelism -> CommandLineOptions [optProgramName] :: CommandLineOptions -> String [optInputFile] :: CommandLineOptions -> Maybe FilePath [optIncludePaths] :: CommandLineOptions -> [FilePath] -- | The list should not contain duplicates. [optAbsoluteIncludePaths] :: CommandLineOptions -> [AbsolutePath] [optLibraries] :: CommandLineOptions -> [LibName] -- | Use this (if Just) instead of ~/.agda/libraries. [optOverrideLibrariesFile] :: CommandLineOptions -> Maybe FilePath -- | Use ~/.agda/defaults. [optDefaultLibs] :: CommandLineOptions -> Bool -- | look for .agda-lib files. [optUseLibs] :: CommandLineOptions -> Bool -- | Configure notifications about imported modules. [optTraceImports] :: CommandLineOptions -> Integer -- | Map names of trusted executables to absolute paths. [optTrustedExecutables] :: CommandLineOptions -> Map ExeName FilePath [optPrintAgdaDataDir] :: CommandLineOptions -> Bool [optPrintAgdaAppDir] :: CommandLineOptions -> Bool -- | Print all options as a simple list (for implementing bash completion). [optPrintOptions] :: CommandLineOptions -> Bool [optPrintVersion] :: CommandLineOptions -> Maybe PrintAgdaVersion [optPrintHelp] :: CommandLineOptions -> Maybe Help -- | --build-library: Build all modules in the current library. [optBuildLibrary] :: CommandLineOptions -> Bool -- | Force Agda to self-setup at startup. [optSetup] :: CommandLineOptions -> Bool -- | Emacs mode administration (formerly done by the agda-mode -- executable). Accepted subcommands: locate, setup, -- compile. Can be given several times, subcommands are -- accumulated in the set. [optEmacsMode] :: CommandLineOptions -> Set EmacsModeCommand -- | Agda REPL (-I). [optInteractive] :: CommandLineOptions -> Bool -- | --interaction mode. [optGHCiInteraction] :: CommandLineOptions -> Bool -- | --interaction-json mode. [optJSONInteraction] :: CommandLineOptions -> Bool -- | Exit if an interactive command fails. [optExitOnError] :: CommandLineOptions -> Bool -- | In the absence of a path the project root is used. [optCompileDir] :: CommandLineOptions -> Maybe FilePath [optGenerateVimFile] :: CommandLineOptions -> Bool [optIgnoreInterfaces] :: CommandLineOptions -> Bool [optIgnoreAllInterfaces] :: CommandLineOptions -> Bool [optWriteInterfaces] :: CommandLineOptions -> Bool [optPragmaOptions] :: CommandLineOptions -> PragmaOptions -- | Should the top-level module only be scope-checked, and not -- type-checked? [optOnlyScopeChecking] :: CommandLineOptions -> Bool -- | Should code points that are not supported by the locale be -- transliterated? [optTransliterate] :: CommandLineOptions -> Bool -- | Configure colour output. [optDiagnosticsColour] :: CommandLineOptions -> DiagnosticsColours -- | In literate Markdown/Typst, only treat ```agda blocks as -- code. [optMdOnlyAgdaBlocks] :: CommandLineOptions -> Bool -- | Should imports be type-checked in parallel? [optParallelChecking] :: CommandLineOptions -> Parallelism data ConfluenceCheck LocalConfluenceCheck :: ConfluenceCheck GlobalConfluenceCheck :: ConfluenceCheck data DiagnosticsColours AlwaysColour :: DiagnosticsColours NeverColour :: DiagnosticsColours AutoColour :: DiagnosticsColours -- | If several --emacs-mode commands are given, they are executed -- in the order as given in this datatype. data EmacsModeCommand -- | Compile the .el files to .elc. EmacsModeCompile :: EmacsModeCommand -- | Add the initialization lines to .emacs. EmacsModeSetup :: EmacsModeCommand -- | Print the installation location of agda2.el. EmacsModeLocate :: EmacsModeCommand -- | Infective or coinfective? data InfectiveCoinfective Infective :: InfectiveCoinfective Coinfective :: InfectiveCoinfective -- | Options which can be set in a pragma. data PragmaOptions PragmaOptions :: WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault' UnicodeOrAscii 'True -> Verbosity -> ProfileOptions -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> CutOff -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> AllowedErasedMatchesWithDefaults -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> Maybe Cubical -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'True -> WithDefault 'True -> Int -> WithDefault 'False -> WithDefault 'True -> Int -> WithDefault 'False -> WithDefault 'False -> Maybe Int -> WarningMode -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> Maybe ConfluenceCheck -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> PragmaOptions [_optShowImplicit] :: PragmaOptions -> WithDefault 'False -- | Show generalized parameters in Pi types [_optShowGeneralized] :: PragmaOptions -> WithDefault 'True [_optShowIrrelevant] :: PragmaOptions -> WithDefault 'False [_optUseUnicode] :: PragmaOptions -> WithDefault' UnicodeOrAscii 'True [_optVerbose] :: PragmaOptions -> Verbosity [_optProfiling] :: PragmaOptions -> ProfileOptions [_optIrrelevance] :: PragmaOptions -> WithDefault 'True [_optProp] :: PragmaOptions -> WithDefault 'False [_optLevelUniverse] :: PragmaOptions -> WithDefault 'False [_optTwoLevel] :: PragmaOptions -> WithDefault 'False [_optAllowUnsolved] :: PragmaOptions -> WithDefault 'False [_optAllowIncompleteMatch] :: PragmaOptions -> WithDefault 'False [_optPositivityCheck] :: PragmaOptions -> WithDefault 'True [_optTerminationCheck] :: PragmaOptions -> WithDefault 'True -- | Cut off structural order comparison at some depth in termination -- checker? [_optTerminationDepth] :: PragmaOptions -> CutOff [_optUniverseCheck] :: PragmaOptions -> WithDefault 'True [_optOmegaInOmega] :: PragmaOptions -> WithDefault 'False [_optCumulativity] :: PragmaOptions -> WithDefault 'False [_optSizedTypes] :: PragmaOptions -> WithDefault 'False [_optGuardedness] :: PragmaOptions -> WithDefault 'False [_optInjectiveTypeConstructors] :: PragmaOptions -> WithDefault 'False [_optUniversePolymorphism] :: PragmaOptions -> WithDefault 'True [_optIrrelevantProjections] :: PragmaOptions -> WithDefault 'False -- | irrelevant levels, irrelevant data matching [_optExperimentalIrrelevance] :: PragmaOptions -> WithDefault 'False [_optWithoutK] :: PragmaOptions -> WithDefault 'False [_optCubicalCompatible] :: PragmaOptions -> WithDefault 'False -- | Allow definitions by copattern matching? [_optCopatterns] :: PragmaOptions -> WithDefault 'True -- | Is pattern matching allowed in the current file? [_optPatternMatching] :: PragmaOptions -> WithDefault 'True [_optExactSplit] :: PragmaOptions -> WithDefault 'False -- | Should patterns of the form {x} or ⦃ x ⦄ be -- interpreted as puns? [_optHiddenArgumentPuns] :: PragmaOptions -> WithDefault 'False [_optEta] :: PragmaOptions -> WithDefault 'True -- | Perform the forcing analysis on data constructors? [_optForcing] :: PragmaOptions -> WithDefault 'True -- | Perform the projection-likeness analysis on functions? [_optProjectionLike] :: PragmaOptions -> WithDefault 'True [_optErasure] :: PragmaOptions -> WithDefault 'False -- | What kinds of erased matches are allowed? [_optErasedMatches] :: PragmaOptions -> AllowedErasedMatchesWithDefaults -- | Mark parameters of record modules as erased? [_optEraseRecordParameters] :: PragmaOptions -> WithDefault 'False -- | Can rewrite rules be added and used? [_optRewriting] :: PragmaOptions -> WithDefault 'False -- | Can local rewrite rules be added and used? [_optLocalRewriting] :: PragmaOptions -> WithDefault 'False [_optCubical] :: PragmaOptions -> Maybe Cubical [_optGuarded] :: PragmaOptions -> WithDefault 'False -- | Should we speculatively unify function applications as if they were -- injective? Implies optRequireUniqueMetaSolutions. [_optFirstOrder] :: PragmaOptions -> WithDefault 'False -- | Forbid non-unique meta solutions allowed. For instance from -- INJECTIVE_FOR_INFERENCE pragmas. [_optRequireUniqueMetaSolutions] :: PragmaOptions -> WithDefault 'True -- | Should system generated projections ProjSystem be printed -- postfix (True) or prefix (False). [_optPostfixProjections] :: PragmaOptions -> WithDefault 'True -- | Should case splitting replace variables with dot patterns (False) or -- keep them as variables (True). [_optKeepPatternVariables] :: PragmaOptions -> WithDefault 'True -- | Should case splitting and coverage checking try to discharge absurd -- clauses? Default: True, but False might make coverage -- checking considerably faster in some cases. [_optInferAbsurdClauses] :: PragmaOptions -> WithDefault 'True [_optInstanceSearchDepth] :: PragmaOptions -> Int [_optBacktrackingInstances] :: PragmaOptions -> WithDefault 'False -- | Should instance search consider instances with qualified names? [_optQualifiedInstances] :: PragmaOptions -> WithDefault 'True [_optInversionMaxDepth] :: PragmaOptions -> Int [_optSafe] :: PragmaOptions -> WithDefault 'False [_optDoubleCheck] :: PragmaOptions -> WithDefault 'False -- | Should the conversion checker use the syntactic equality shortcut? -- Nothing means that it should. Just n, for a -- non-negative number n, means that syntactic equality checking -- gets n units of fuel. If the fuel becomes zero, then -- syntactic equality checking is turned off. The fuel counter is -- decreased in the failure continuation of -- checkSyntacticEquality. [_optSyntacticEquality] :: PragmaOptions -> Maybe Int [_optWarningMode] :: PragmaOptions -> WarningMode -- | Treat the module given at the command line or via interaction as main -- module in compilation? [_optCompileMain] :: PragmaOptions -> WithDefault 'True [_optCaching] :: PragmaOptions -> WithDefault 'True -- | Count extended grapheme clusters rather than code points when -- generating LaTeX. [_optCountClusters] :: PragmaOptions -> WithDefault 'False -- | Automatic compile-time inlining for simple definitions (unless marked -- NOINLINE). [_optAutoInline] :: PragmaOptions -> WithDefault 'False [_optPrintPatternSynonyms] :: PragmaOptions -> WithDefault 'True -- | Use the Agda abstract machine (fastReduce)? [_optFastReduce] :: PragmaOptions -> WithDefault 'True -- | Use call-by-name instead of call-by-need. [_optCallByName] :: PragmaOptions -> WithDefault 'False -- | Check confluence of rewrite rules? [_optConfluenceCheck] :: PragmaOptions -> Maybe ConfluenceCheck -- | Are the cohesion modalities available? [_optCohesion] :: PragmaOptions -> WithDefault 'False -- | Can we split on a (@flat x : A) argument? [_optFlatSplit] :: PragmaOptions -> WithDefault 'False -- | Can we use modal polarities (++, +, etc.)? [_optPolarity] :: PragmaOptions -> WithDefault 'False -- | Perform automated occurrence analysis for functions? [_optOccurrence] :: PragmaOptions -> WithDefault 'True -- | Can Agda.Builtin.Erased.Funext be used? [_optFunext] :: PragmaOptions -> WithDefault 'False -- | Can Agda.Builtin.Erased.Propext be used? [_optPropext] :: PragmaOptions -> WithDefault 'False -- | Can Agda.Builtin.Erased.Quotient be used? [_optQuotients] :: PragmaOptions -> WithDefault 'False -- | Should every top-level module start with an implicit statement -- open import Agda.Primitive using (Set; Prop)? [_optImportSorts] :: PragmaOptions -> WithDefault 'True -- | Should we load the primitive modules at all? This is a stronger form -- of optImportSorts. [_optLoadPrimitives] :: PragmaOptions -> WithDefault 'True -- | Allow running external executables from meta programs. [_optAllowExec] :: PragmaOptions -> WithDefault 'False -- | Save meta-variables to interface files. [_optSaveMetas] :: PragmaOptions -> WithDefault 'False -- | Show identity substitutions when pretty-printing terms (i.e. always -- show all arguments of a metavariable). [_optShowIdentitySubstitutions] :: PragmaOptions -> WithDefault 'False -- | Do not discard clauses constructed by the coverage checker (needed for -- some external backends). [_optKeepCoveringClauses] :: PragmaOptions -> WithDefault 'False -- | Allow large indices, and large forced arguments in constructors. [_optLargeIndices] :: PragmaOptions -> WithDefault 'False -- | Allow recursion on forced constructor arguments. [_optForcedArgumentRecursion] :: PragmaOptions -> WithDefault 'True -- | Defer instance search based on discrimination tree results [_optExperimentalLazyInstances] :: PragmaOptions -> WithDefault 'False [_optQuoteMetas] :: PragmaOptions -> WithDefault 'False -- | Options --version and --numeric-version (last wins). data PrintAgdaVersion -- | Print Agda version information. PrintAgdaVersion :: PrintAgdaVersion -- | Print Agda version number. PrintAgdaNumericVersion :: PrintAgdaVersion type VerboseKey = String type VerboseLevel = Int -- | Nothing is used if no verbosity options have been given, thus -- making it possible to handle the default case relatively quickly. Note -- that Nothing corresponds to a trie with verbosity level 1 for -- the empty path. type Verbosity = Maybe Trie VerboseKeyItem VerboseLevel -- | A WarningMode has two components: a set of warnings to be -- displayed and a flag stating whether warnings should be turned into -- fatal errors. data WarningMode WarningMode :: Set WarningName -> Bool -> WarningMode -- | Invariant: When UnusedImportsAll_ is in the warning set, so -- must be UnusedImports_. [_warningSet] :: WarningMode -> Set WarningName [_warn2Error] :: WarningMode -> Bool -- | We want to know whether we are allowed to insert unicode characters or -- not. data UnicodeOrAscii -- | true: Unicode characters are allowed. UnicodeOk :: UnicodeOrAscii -- | 'false: Stick to ASCII. AsciiOnly :: UnicodeOrAscii -- | Describes whether an option takes an argument or not, and if so how -- the argument is injected into a value of type a. data ArgDescr a -- | no argument expected NoArg :: a -> ArgDescr a -- | option requires argument ReqArg :: (String -> a) -> String -> ArgDescr a -- | optional argument OptArg :: (Maybe String -> a) -> String -> ArgDescr a -- | Each OptDescr describes a single option. -- -- The arguments to Option are: -- -- data OptDescr a -- | description of a single options: Option :: [Char] -> [String] -> ArgDescr a -> String -> OptDescr a class (Functor m, Applicative m, Monad m) => HasOptions (m :: Type -> Type) -- | Returns the pragma options which are currently in effect. pragmaOptions :: HasOptions m => m PragmaOptions ($dmpragmaOptions) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasOptions m, HasOptions n, MonadTrans t, m ~ t n) => m PragmaOptions -- | Returns the command line options which are currently in effect. commandLineOptions :: HasOptions m => m CommandLineOptions ($dmcommandLineOptions) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasOptions m, HasOptions n, MonadTrans t, m ~ t n) => m CommandLineOptions data CommandLineOptions Options :: String -> Maybe FilePath -> [FilePath] -> [AbsolutePath] -> [LibName] -> Maybe FilePath -> Bool -> Bool -> Integer -> Map ExeName FilePath -> Bool -> Bool -> Bool -> Maybe PrintAgdaVersion -> Maybe Help -> Bool -> Bool -> Set EmacsModeCommand -> Bool -> Bool -> Bool -> Bool -> Maybe FilePath -> Bool -> Bool -> Bool -> Bool -> PragmaOptions -> Bool -> Bool -> DiagnosticsColours -> Bool -> Parallelism -> CommandLineOptions [optProgramName] :: CommandLineOptions -> String [optInputFile] :: CommandLineOptions -> Maybe FilePath [optIncludePaths] :: CommandLineOptions -> [FilePath] -- | The list should not contain duplicates. [optAbsoluteIncludePaths] :: CommandLineOptions -> [AbsolutePath] [optLibraries] :: CommandLineOptions -> [LibName] -- | Use this (if Just) instead of ~/.agda/libraries. [optOverrideLibrariesFile] :: CommandLineOptions -> Maybe FilePath -- | Use ~/.agda/defaults. [optDefaultLibs] :: CommandLineOptions -> Bool -- | look for .agda-lib files. [optUseLibs] :: CommandLineOptions -> Bool -- | Configure notifications about imported modules. [optTraceImports] :: CommandLineOptions -> Integer -- | Map names of trusted executables to absolute paths. [optTrustedExecutables] :: CommandLineOptions -> Map ExeName FilePath [optPrintAgdaDataDir] :: CommandLineOptions -> Bool [optPrintAgdaAppDir] :: CommandLineOptions -> Bool -- | Print all options as a simple list (for implementing bash completion). [optPrintOptions] :: CommandLineOptions -> Bool [optPrintVersion] :: CommandLineOptions -> Maybe PrintAgdaVersion [optPrintHelp] :: CommandLineOptions -> Maybe Help -- | --build-library: Build all modules in the current library. [optBuildLibrary] :: CommandLineOptions -> Bool -- | Force Agda to self-setup at startup. [optSetup] :: CommandLineOptions -> Bool -- | Emacs mode administration (formerly done by the agda-mode -- executable). Accepted subcommands: locate, setup, -- compile. Can be given several times, subcommands are -- accumulated in the set. [optEmacsMode] :: CommandLineOptions -> Set EmacsModeCommand -- | Agda REPL (-I). [optInteractive] :: CommandLineOptions -> Bool -- | --interaction mode. [optGHCiInteraction] :: CommandLineOptions -> Bool -- | --interaction-json mode. [optJSONInteraction] :: CommandLineOptions -> Bool -- | Exit if an interactive command fails. [optExitOnError] :: CommandLineOptions -> Bool -- | In the absence of a path the project root is used. [optCompileDir] :: CommandLineOptions -> Maybe FilePath [optGenerateVimFile] :: CommandLineOptions -> Bool [optIgnoreInterfaces] :: CommandLineOptions -> Bool [optIgnoreAllInterfaces] :: CommandLineOptions -> Bool [optWriteInterfaces] :: CommandLineOptions -> Bool [optPragmaOptions] :: CommandLineOptions -> PragmaOptions -- | Should the top-level module only be scope-checked, and not -- type-checked? [optOnlyScopeChecking] :: CommandLineOptions -> Bool -- | Should code points that are not supported by the locale be -- transliterated? [optTransliterate] :: CommandLineOptions -> Bool -- | Configure colour output. [optDiagnosticsColour] :: CommandLineOptions -> DiagnosticsColours -- | In literate Markdown/Typst, only treat ```agda blocks as -- code. [optMdOnlyAgdaBlocks] :: CommandLineOptions -> Bool -- | Should imports be type-checked in parallel? [optParallelChecking] :: CommandLineOptions -> Parallelism data ConfluenceCheck LocalConfluenceCheck :: ConfluenceCheck GlobalConfluenceCheck :: ConfluenceCheck data DiagnosticsColours AlwaysColour :: DiagnosticsColours NeverColour :: DiagnosticsColours AutoColour :: DiagnosticsColours -- | If several --emacs-mode commands are given, they are executed -- in the order as given in this datatype. data EmacsModeCommand -- | Compile the .el files to .elc. EmacsModeCompile :: EmacsModeCommand -- | Add the initialization lines to .emacs. EmacsModeSetup :: EmacsModeCommand -- | Print the installation location of agda2.el. EmacsModeLocate :: EmacsModeCommand -- | Infective or coinfective? data InfectiveCoinfective Infective :: InfectiveCoinfective Coinfective :: InfectiveCoinfective class LensPragmaOptions a getPragmaOptions :: LensPragmaOptions a => a -> PragmaOptions setPragmaOptions :: LensPragmaOptions a => PragmaOptions -> a -> a mapPragmaOptions :: LensPragmaOptions a => (PragmaOptions -> PragmaOptions) -> a -> a lensPragmaOptions :: LensPragmaOptions a => Lens' a PragmaOptions data Parallelism Sequential :: Parallelism Parallel :: Maybe Int -> Parallelism -- | Options which can be set in a pragma. data PragmaOptions PragmaOptions :: WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault' UnicodeOrAscii 'True -> Verbosity -> ProfileOptions -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> CutOff -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> AllowedErasedMatchesWithDefaults -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> Maybe Cubical -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'True -> WithDefault 'True -> Int -> WithDefault 'False -> WithDefault 'True -> Int -> WithDefault 'False -> WithDefault 'False -> Maybe Int -> WarningMode -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> Maybe ConfluenceCheck -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'False -> WithDefault 'True -> WithDefault 'False -> WithDefault 'False -> PragmaOptions [_optShowImplicit] :: PragmaOptions -> WithDefault 'False -- | Show generalized parameters in Pi types [_optShowGeneralized] :: PragmaOptions -> WithDefault 'True [_optShowIrrelevant] :: PragmaOptions -> WithDefault 'False [_optUseUnicode] :: PragmaOptions -> WithDefault' UnicodeOrAscii 'True [_optVerbose] :: PragmaOptions -> Verbosity [_optProfiling] :: PragmaOptions -> ProfileOptions [_optIrrelevance] :: PragmaOptions -> WithDefault 'True [_optProp] :: PragmaOptions -> WithDefault 'False [_optLevelUniverse] :: PragmaOptions -> WithDefault 'False [_optTwoLevel] :: PragmaOptions -> WithDefault 'False [_optAllowUnsolved] :: PragmaOptions -> WithDefault 'False [_optAllowIncompleteMatch] :: PragmaOptions -> WithDefault 'False [_optPositivityCheck] :: PragmaOptions -> WithDefault 'True [_optTerminationCheck] :: PragmaOptions -> WithDefault 'True -- | Cut off structural order comparison at some depth in termination -- checker? [_optTerminationDepth] :: PragmaOptions -> CutOff [_optUniverseCheck] :: PragmaOptions -> WithDefault 'True [_optOmegaInOmega] :: PragmaOptions -> WithDefault 'False [_optCumulativity] :: PragmaOptions -> WithDefault 'False [_optSizedTypes] :: PragmaOptions -> WithDefault 'False [_optGuardedness] :: PragmaOptions -> WithDefault 'False [_optInjectiveTypeConstructors] :: PragmaOptions -> WithDefault 'False [_optUniversePolymorphism] :: PragmaOptions -> WithDefault 'True [_optIrrelevantProjections] :: PragmaOptions -> WithDefault 'False -- | irrelevant levels, irrelevant data matching [_optExperimentalIrrelevance] :: PragmaOptions -> WithDefault 'False [_optWithoutK] :: PragmaOptions -> WithDefault 'False [_optCubicalCompatible] :: PragmaOptions -> WithDefault 'False -- | Allow definitions by copattern matching? [_optCopatterns] :: PragmaOptions -> WithDefault 'True -- | Is pattern matching allowed in the current file? [_optPatternMatching] :: PragmaOptions -> WithDefault 'True [_optExactSplit] :: PragmaOptions -> WithDefault 'False -- | Should patterns of the form {x} or ⦃ x ⦄ be -- interpreted as puns? [_optHiddenArgumentPuns] :: PragmaOptions -> WithDefault 'False [_optEta] :: PragmaOptions -> WithDefault 'True -- | Perform the forcing analysis on data constructors? [_optForcing] :: PragmaOptions -> WithDefault 'True -- | Perform the projection-likeness analysis on functions? [_optProjectionLike] :: PragmaOptions -> WithDefault 'True [_optErasure] :: PragmaOptions -> WithDefault 'False -- | What kinds of erased matches are allowed? [_optErasedMatches] :: PragmaOptions -> AllowedErasedMatchesWithDefaults -- | Mark parameters of record modules as erased? [_optEraseRecordParameters] :: PragmaOptions -> WithDefault 'False -- | Can rewrite rules be added and used? [_optRewriting] :: PragmaOptions -> WithDefault 'False -- | Can local rewrite rules be added and used? [_optLocalRewriting] :: PragmaOptions -> WithDefault 'False [_optCubical] :: PragmaOptions -> Maybe Cubical [_optGuarded] :: PragmaOptions -> WithDefault 'False -- | Should we speculatively unify function applications as if they were -- injective? Implies optRequireUniqueMetaSolutions. [_optFirstOrder] :: PragmaOptions -> WithDefault 'False -- | Forbid non-unique meta solutions allowed. For instance from -- INJECTIVE_FOR_INFERENCE pragmas. [_optRequireUniqueMetaSolutions] :: PragmaOptions -> WithDefault 'True -- | Should system generated projections ProjSystem be printed -- postfix (True) or prefix (False). [_optPostfixProjections] :: PragmaOptions -> WithDefault 'True -- | Should case splitting replace variables with dot patterns (False) or -- keep them as variables (True). [_optKeepPatternVariables] :: PragmaOptions -> WithDefault 'True -- | Should case splitting and coverage checking try to discharge absurd -- clauses? Default: True, but False might make coverage -- checking considerably faster in some cases. [_optInferAbsurdClauses] :: PragmaOptions -> WithDefault 'True [_optInstanceSearchDepth] :: PragmaOptions -> Int [_optBacktrackingInstances] :: PragmaOptions -> WithDefault 'False -- | Should instance search consider instances with qualified names? [_optQualifiedInstances] :: PragmaOptions -> WithDefault 'True [_optInversionMaxDepth] :: PragmaOptions -> Int [_optSafe] :: PragmaOptions -> WithDefault 'False [_optDoubleCheck] :: PragmaOptions -> WithDefault 'False -- | Should the conversion checker use the syntactic equality shortcut? -- Nothing means that it should. Just n, for a -- non-negative number n, means that syntactic equality checking -- gets n units of fuel. If the fuel becomes zero, then -- syntactic equality checking is turned off. The fuel counter is -- decreased in the failure continuation of -- checkSyntacticEquality. [_optSyntacticEquality] :: PragmaOptions -> Maybe Int [_optWarningMode] :: PragmaOptions -> WarningMode -- | Treat the module given at the command line or via interaction as main -- module in compilation? [_optCompileMain] :: PragmaOptions -> WithDefault 'True [_optCaching] :: PragmaOptions -> WithDefault 'True -- | Count extended grapheme clusters rather than code points when -- generating LaTeX. [_optCountClusters] :: PragmaOptions -> WithDefault 'False -- | Automatic compile-time inlining for simple definitions (unless marked -- NOINLINE). [_optAutoInline] :: PragmaOptions -> WithDefault 'False [_optPrintPatternSynonyms] :: PragmaOptions -> WithDefault 'True -- | Use the Agda abstract machine (fastReduce)? [_optFastReduce] :: PragmaOptions -> WithDefault 'True -- | Use call-by-name instead of call-by-need. [_optCallByName] :: PragmaOptions -> WithDefault 'False -- | Check confluence of rewrite rules? [_optConfluenceCheck] :: PragmaOptions -> Maybe ConfluenceCheck -- | Are the cohesion modalities available? [_optCohesion] :: PragmaOptions -> WithDefault 'False -- | Can we split on a (@flat x : A) argument? [_optFlatSplit] :: PragmaOptions -> WithDefault 'False -- | Can we use modal polarities (++, +, etc.)? [_optPolarity] :: PragmaOptions -> WithDefault 'False -- | Perform automated occurrence analysis for functions? [_optOccurrence] :: PragmaOptions -> WithDefault 'True -- | Can Agda.Builtin.Erased.Funext be used? [_optFunext] :: PragmaOptions -> WithDefault 'False -- | Can Agda.Builtin.Erased.Propext be used? [_optPropext] :: PragmaOptions -> WithDefault 'False -- | Can Agda.Builtin.Erased.Quotient be used? [_optQuotients] :: PragmaOptions -> WithDefault 'False -- | Should every top-level module start with an implicit statement -- open import Agda.Primitive using (Set; Prop)? [_optImportSorts] :: PragmaOptions -> WithDefault 'True -- | Should we load the primitive modules at all? This is a stronger form -- of optImportSorts. [_optLoadPrimitives] :: PragmaOptions -> WithDefault 'True -- | Allow running external executables from meta programs. [_optAllowExec] :: PragmaOptions -> WithDefault 'False -- | Save meta-variables to interface files. [_optSaveMetas] :: PragmaOptions -> WithDefault 'False -- | Show identity substitutions when pretty-printing terms (i.e. always -- show all arguments of a metavariable). [_optShowIdentitySubstitutions] :: PragmaOptions -> WithDefault 'False -- | Do not discard clauses constructed by the coverage checker (needed for -- some external backends). [_optKeepCoveringClauses] :: PragmaOptions -> WithDefault 'False -- | Allow large indices, and large forced arguments in constructors. [_optLargeIndices] :: PragmaOptions -> WithDefault 'False -- | Allow recursion on forced constructor arguments. [_optForcedArgumentRecursion] :: PragmaOptions -> WithDefault 'True -- | Defer instance search based on discrimination tree results [_optExperimentalLazyInstances] :: PragmaOptions -> WithDefault 'False [_optQuoteMetas] :: PragmaOptions -> WithDefault 'False -- | Options --version and --numeric-version (last wins). data PrintAgdaVersion -- | Print Agda version information. PrintAgdaVersion :: PrintAgdaVersion -- | Print Agda version number. PrintAgdaNumericVersion :: PrintAgdaVersion type VerboseKey = String type VerboseKeyItem = String1 type VerboseLevel = Int -- | Nothing is used if no verbosity options have been given, thus -- making it possible to handle the default case relatively quickly. Note -- that Nothing corresponds to a trie with verbosity level 1 for -- the empty path. type Verbosity = Maybe Trie VerboseKeyItem VerboseLevel -- | Pretty printer for the concrete syntax. module Agda.Syntax.Concrete.Pretty -- | Show the attributes necessary to recover a modality, in long-form -- (e.g. using at-syntax rather than dots). For the default modality, the -- result is at-ω (rather than the empty document). Suitable for showing -- modalities outside of binders. attributesForModality :: HasOptions m => Modality -> m Doc bracesAndSemicolons :: Foldable t => t Doc -> Doc isLabeled :: NamedArg Binder -> Maybe ArgName pHasEta0 :: HasEta0 -> Doc pRecord :: Erased -> Name -> [RecordDirective] -> Parameters -> Maybe Expr -> [Declaration] -> Doc pRecordDirective :: RecordDirective -> Doc prettyFiniteness :: BoundName -> Doc -> Doc prettyOpApp :: Pretty a => Aspects -> QName -> List1 (NamedArg (MaybePlaceholder a)) -> [Doc] prettyTactic :: BoundName -> Doc -> Doc prettyTactic' :: TacticAttribute -> Doc -> Doc qualifier :: Pretty a => Maybe a -> Doc -> Doc smashTel :: Telescope -> Telescope data NamedBinding NamedBinding :: Bool -> NamedArg Binder -> NamedBinding [withHiding] :: NamedBinding -> Bool [namedBinding] :: NamedBinding -> NamedArg Binder newtype Tel Tel :: Telescope -> Tel instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Concrete.Binder' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.BoundName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.DoStmt instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Expr instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.LHS instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.LHSCore instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.MaybePlaceholder a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Pretty.NamedBinding instance Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Concrete.OpApp Agda.Syntax.Concrete.Expr) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.OpenShortHand instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Pragma instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.RHS instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.RecordDirective instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Concrete.TacticAttribute' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Pretty.Tel instance Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Fixity.ThingWithFixity Agda.Syntax.Concrete.Name.Name) instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.WhereClause instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Concrete.Binder' a) instance GHC.Internal.Show.Show Agda.Syntax.Concrete.BoundName instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Declaration instance GHC.Internal.Show.Show Agda.Syntax.Concrete.DoStmt instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Expr instance GHC.Internal.Show.Show Agda.Syntax.Concrete.LHS instance GHC.Internal.Show.Show Agda.Syntax.Concrete.LHSCore instance GHC.Internal.Show.Show Agda.Syntax.Concrete.LamBinding instance GHC.Internal.Show.Show Agda.Syntax.Concrete.LamClause instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Module instance GHC.Internal.Show.Show Agda.Syntax.Concrete.ModuleApplication instance GHC.Internal.Show.Show Agda.Syntax.Concrete.ModuleAssignment instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Concrete.OpApp a) instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Pattern instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Pragma instance GHC.Internal.Show.Show Agda.Syntax.Concrete.RHS instance GHC.Internal.Show.Show Agda.Syntax.Concrete.TypedBinding instance GHC.Internal.Show.Show Agda.Syntax.Concrete.WhereClause -- | Split tree for transforming pattern clauses into case trees. -- -- The coverage checker generates a split tree from the clauses. The -- clause compiler uses it to transform clauses to case trees. -- -- The initial problem is a set of clauses. The root node designates on -- which argument to split and has subtrees for all the constructors. -- Splitting continues until there is only a single clause left at each -- leaf of the split tree. module Agda.TypeChecking.Coverage.SplitTree type SplitTree = SplitTree' SplitTag type SplitTrees = SplitTrees' SplitTag -- | Abstract case tree shape. data SplitTree' a -- | No more splits coming. We are at a single, all-variable clause. SplittingDone :: Int -> SplitTree' a -- | The number of variables bound in the clause [splitBindings] :: SplitTree' a -> Int -- | A split is necessary. SplitAt :: Arg Int -> LazySplit -> SplitTrees' a -> SplitTree' a -- | Arg. no to split at. [splitArg] :: SplitTree' a -> Arg Int [splitLazy] :: SplitTree' a -> LazySplit -- | Sub split trees. [splitTrees] :: SplitTree' a -> SplitTrees' a data LazySplit LazySplit :: LazySplit StrictSplit :: LazySplit -- | Split tree branching. A finite map from constructor names to -- splittrees A list representation seems appropriate, since we are -- expecting not so many constructors per data type, and there is no need -- for random access. type SplitTrees' a = [(a, SplitTree' a)] -- | Tag for labeling branches of a split tree. Each branch is associated -- to either a constructor or a literal, or is a catchall branch -- (currently only used for splitting on a literal type). data SplitTag SplitCon :: QName -> SplitTag SplitLit :: Literal -> SplitTag SplitCatchall :: SplitTag data SplitTreeLabel a SplitTreeLabel :: Maybe a -> Maybe (Arg Int) -> LazySplit -> Maybe Int -> SplitTreeLabel a -- | Nothing for root of split tree [lblConstructorName] :: SplitTreeLabel a -> Maybe a [lblSplitArg] :: SplitTreeLabel a -> Maybe (Arg Int) [lblLazy] :: SplitTreeLabel a -> LazySplit [lblBindings] :: SplitTreeLabel a -> Maybe Int -- | Convert a split tree into a Tree (for printing). toTree :: SplitTree' a -> Tree (SplitTreeLabel a) toTrees :: SplitTrees' a -> Forest (SplitTreeLabel a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Internal.Classes.Eq Agda.TypeChecking.Coverage.SplitTree.SplitTag instance GHC.Internal.Generics.Generic Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Internal.Generics.Generic Agda.TypeChecking.Coverage.SplitTree.SplitTag instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Control.DeepSeq.NFData Agda.TypeChecking.Coverage.SplitTree.LazySplit instance Control.DeepSeq.NFData Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance GHC.Internal.Classes.Ord Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Internal.Classes.Ord Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Coverage.SplitTree.SplitTreeLabel a) instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.SplitTree.SplitTag instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) module Agda.Syntax.Concrete.Definitions.Types -- | The nice declarations. No fixity declarations and function definitions -- are contained in a single constructor instead of spread out between -- type signatures and clauses. The private, postulate, -- abstract and instance modifiers have been -- distributed to the individual declarations. -- -- Observe the order of components: -- -- Range Fixity' Access IsAbstract IsInstance TerminationCheck -- PositivityCheck -- -- further attributes -- -- (Q)Name -- -- content (Expr, Declaration ...) data NiceDeclaration -- | IsAbstract argument: We record whether a declaration was made -- in an abstract block. -- -- ArgInfo argument: Axioms and functions can be declared -- irrelevant. (Hiding should be NotHidden.) Axiom :: Range -> Access -> IsAbstract -> IsInstance -> ArgInfo -> Name -> Expr -> NiceDeclaration NiceField :: Range -> Access -> IsAbstract -> IsInstance -> TacticAttribute -> Name -> Arg Expr -> NiceDeclaration PrimitiveFunction :: Range -> Access -> IsAbstract -> Name -> Arg Expr -> NiceDeclaration NiceMutual :: KwRange -> TerminationCheck -> CoverageCheck -> PositivityCheck -> List1 NiceDeclaration -> NiceDeclaration NiceModule :: Range -> Access -> IsAbstract -> Erased -> QName -> Telescope -> [Declaration] -> NiceDeclaration NiceModuleMacro :: Range -> Access -> Erased -> Name -> ModuleApplication -> OpenShortHand -> ImportDirective -> NiceDeclaration NiceOpen :: KwRange -> QName -> ImportDirective -> NiceDeclaration NiceImport :: OpenShortHand -> KwRange -> QName -> Either AsName RawOpenArgs -> ImportDirective -> NiceDeclaration NicePragma :: Range -> Pragma -> NiceDeclaration NiceRecSig :: Range -> Erased -> Access -> IsAbstract -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> Name -> Parameters -> Expr -> NiceDeclaration NiceDataSig :: Range -> Erased -> Access -> IsAbstract -> PositivityCheck -> UniverseCheck -> Name -> Parameters -> Expr -> NiceDeclaration -- | An uncategorized function clause, could be a function clause without -- type signature or a pattern lhs (e.g. for irrefutable let). The -- Declaration is the actual FunClause. NiceFunClause :: Range -> Access -> IsAbstract -> TerminationCheck -> CoverageCheck -> Catchall -> Declaration -> NiceDeclaration FunSig :: Range -> Access -> IsAbstract -> IsInstance -> IsMacro -> ArgInfo -> TerminationCheck -> CoverageCheck -> Name -> Expr -> NiceDeclaration -- | Block of function clauses (we have seen the type signature before). -- The Declarations are the original declarations that were -- processed into this FunDef and are only used in -- notSoNiceDeclaration. Andreas, 2017-01-01: Because of issue -- #2372, we add IsInstance here. An alias should know that it is -- an instance. FunDef :: Range -> List1 Declaration -> IsAbstract -> IsInstance -> TerminationCheck -> CoverageCheck -> Name -> List1 Clause -> NiceDeclaration NiceDataDef :: Range -> Origin -> IsAbstract -> PositivityCheck -> UniverseCheck -> Name -> DefParameters -> [NiceConstructor] -> NiceDeclaration NiceLoneConstructor :: KwRange -> [NiceConstructor] -> NiceDeclaration -- | (Maybe Range) gives range of the 'pattern' declaration. NiceRecDef :: Range -> Origin -> IsAbstract -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> Name -> [RecordDirective] -> DefParameters -> [Declaration] -> NiceDeclaration NicePatternSyn :: Range -> Access -> Name -> [WithHiding Name] -> Pattern -> NiceDeclaration NiceGeneralize :: Range -> Access -> ArgInfo -> TacticAttribute -> Name -> Expr -> NiceDeclaration NiceUnquoteDecl :: Range -> Access -> IsAbstract -> IsInstance -> TerminationCheck -> CoverageCheck -> [Name] -> Expr -> NiceDeclaration NiceUnquoteDef :: Range -> Access -> IsAbstract -> TerminationCheck -> CoverageCheck -> [Name] -> Expr -> NiceDeclaration NiceUnquoteData :: Range -> Access -> IsAbstract -> PositivityCheck -> UniverseCheck -> Name -> [Name] -> Expr -> NiceDeclaration NiceOpaque :: KwRange -> [QName] -> [NiceDeclaration] -> NiceDeclaration type TerminationCheck = TerminationCheck Measure -- | Termination measure is, for now, a variable name. type Measure = Name -- | Only Axioms. type NiceConstructor = NiceTypeSignature -- | Only Axioms. type NiceTypeSignature = NiceDeclaration -- | One clause in a function definition. There is no guarantee that the -- LHS actually declares the Name. We will have to check -- that later. data Clause Clause :: Name -> Catchall -> ArgInfo -> LHS -> RHS -> WhereClause -> [Clause] -> Clause -- | When processing a mutual block we collect the various checks present -- in the block before combining them. data MutualChecks MutualChecks :: [TerminationCheck] -> [CoverageCheck] -> [PositivityCheck] -> MutualChecks [mutualTermination] :: MutualChecks -> [TerminationCheck] [mutualCoverage] :: MutualChecks -> [CoverageCheck] [mutualPositivity] :: MutualChecks -> [PositivityCheck] -- | In an inferred mutual block we keep accumulating nice -- declarations until all of the lone signatures have an attached -- definition. The type is therefore a bit span-like: we return an -- initial segment (the inferred mutual block) together with leftovers. data InferredMutual InferredMutual :: MutualChecks -> [NiceDeclaration] -> [NiceDeclaration] -> InferredMutual [inferredChecks] :: InferredMutual -> MutualChecks [inferredBlock] :: InferredMutual -> [NiceDeclaration] [inferredLeftovers] :: InferredMutual -> [NiceDeclaration] extendInferredBlock :: NiceDeclaration -> InferredMutual -> InferredMutual -- | In an `interleaved mutual' block we collect the data signatures, -- function signatures, as well as their associated constructors and -- function clauses respectively. Each signature is given a position in -- the block (from 0 onwards) and each set of constructor / clauses is -- given a *distinct* one. This allows for interleaved forward -- declarations similar to what one gets in a new-style mutual block. type InterleavedMutual = Map Name InterleavedDecl data InterleavedDecl InterleavedData :: DeclNum -> NiceDeclaration -> Maybe (DeclNum, List1 (DefParameters, [NiceConstructor])) -> InterleavedDecl -- | Internal number of the data signature. [interleavedDeclNum] :: InterleavedDecl -> DeclNum -- | The data signature. [interleavedDeclSig] :: InterleavedDecl -> NiceDeclaration -- | Constructors associated to the data signature. [interleavedDataCons] :: InterleavedDecl -> Maybe (DeclNum, List1 (DefParameters, [NiceConstructor])) InterleavedFun :: DeclNum -> NiceDeclaration -> Maybe (DeclNum, List1 (List1 Declaration, List1 Clause)) -> InterleavedDecl -- | Internal number of the data signature. [interleavedDeclNum] :: InterleavedDecl -> DeclNum -- | The data signature. [interleavedDeclSig] :: InterleavedDecl -> NiceDeclaration -- | Function clauses associated to the function signature. [interleavedFunClauses] :: InterleavedDecl -> Maybe (DeclNum, List1 (List1 Declaration, List1 Clause)) -- | Extra state for the Nice monad to process interleaved mutual -- blocks. data InterleavedState ISt :: InterleavedMutual -> MutualChecks -> DeclNum -> InterleavedState [interleavedMutual] :: InterleavedState -> InterleavedMutual [interleavedMutualChecks] :: InterleavedState -> MutualChecks [interleavedCurrentDeclNum] :: InterleavedState -> DeclNum -- | Numbering declarations in an interleaved mutual block. type DeclNum = Int isInterleavedFun :: InterleavedDecl -> Maybe () isInterleavedData :: InterleavedDecl -> Maybe () -- | Several declarations expect only type signatures as sub-declarations. -- These are: data KindOfBlock -- | postulate. PostulateBlock :: KindOfBlock -- | primitive. PrimitiveBlock :: KindOfBlock -- | field. Ensured by parser. FieldBlock :: KindOfBlock -- | data ... where. Here we got a bad error message for Agda-2.5 -- (Issue 1698). DataBlock :: KindOfBlock -- | constructor, in interleaved mutual. ConstructorBlock :: KindOfBlock declName :: NiceDeclaration -> String data InMutual -- | we are nicifying a mutual block InMutual :: InMutual -- | we are nicifying decls not in a mutual block NotInMutual :: InMutual -- | The kind of the forward declaration. data DataRecOrFun -- | Name of a data type DataName :: PositivityCheck -> UniverseCheck -> DataRecOrFun [_kindPosCheck] :: DataRecOrFun -> PositivityCheck [_kindUniCheck] :: DataRecOrFun -> UniverseCheck -- | Name of a record type RecName :: PositivityCheck -> UniverseCheck -> ForceRecordEta -> DataRecOrFun [_kindPosCheck] :: DataRecOrFun -> PositivityCheck [_kindUniCheck] :: DataRecOrFun -> UniverseCheck [_kindForceEta] :: DataRecOrFun -> ForceRecordEta -- | Name of a function. FunName :: ArgInfo -> TerminationCheck -> CoverageCheck -> DataRecOrFun sameKind :: DataRecOrFun -> DataRecOrFun -> Bool -- | Monoidal for DataName and RecName. Returns just first -- FunName discarding the second one. mergeDataRecOrFun :: DataRecOrFun -> DataRecOrFun -> Maybe DataRecOrFun isFunName :: DataRecOrFun -> Bool terminationCheck :: DataRecOrFun -> TerminationCheck coverageCheck :: DataRecOrFun -> CoverageCheck positivityCheck :: DataRecOrFun -> PositivityCheck mutualChecks :: DataRecOrFun -> MutualChecks universeCheck :: DataRecOrFun -> UniverseCheck forceRecordEta :: DataRecOrFun -> ForceRecordEta instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Definitions.Types.InMutual instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Types.Clause instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Types.InterleavedDecl instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Common.LensArgInfo Agda.Syntax.Concrete.Definitions.Types.Clause instance GHC.Internal.Base.Monoid Agda.Syntax.Concrete.Definitions.Types.MutualChecks instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Types.Clause instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance GHC.Internal.Classes.Ord Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance GHC.Internal.Base.Semigroup Agda.Syntax.Concrete.Definitions.Types.MutualChecks instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Types.Clause instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Types.InMutual instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration module Agda.Syntax.Concrete.Definitions.Errors -- | Exception with internal source code callstack data DeclarationException DeclarationException :: CallStack -> DeclarationException' -> DeclarationException [deLocation] :: DeclarationException -> CallStack [deException] :: DeclarationException -> DeclarationException' -- | The exception type. data DeclarationException' MultipleEllipses :: Pattern -> DeclarationException' -- | The Range is the range of the previous definition. DuplicateDefinition :: Name -> Range -> DeclarationException' -- | The first Range is the range of the current declaration of _. -- The second Range is the range of the previous declaration of _. DuplicateAnonDeclaration :: Range -> Range -> DeclarationException' MissingWithClauses :: Name -> LHS -> DeclarationException' WrongDefinition :: Name -> DataRecOrFun -> DataRecOrFun -> DeclarationException' WrongContentBlock :: KindOfBlock -> Range -> DeclarationException' -- | In a mutual block, a clause could belong to any of the ≥2 type -- signatures (Name). AmbiguousFunClauses :: LHS -> List1 Name -> DeclarationException' -- | In an interleaved mutual block, a constructor could belong to any of -- the data signatures (Name) AmbiguousConstructor :: Range -> Name -> [Name] -> DeclarationException' -- | In a mutual block, all or none need a MEASURE pragma. Range is -- the one of the offending pragma or the mutual block. InvalidMeasureMutual :: Range -> DeclarationException' UnquoteDefRequiresSignature :: List1 Name -> DeclarationException' BadMacroDef :: NiceDeclaration -> DeclarationException' -- | An unfolding declaration was not the first declaration contained in an -- opaque block. UnfoldingOutsideOpaque :: KwRange -> DeclarationException' -- | opaque block nested in a mutual block. This can -- never happen, even with reordering. The KwRange is the one of -- the opaque keyword. OpaqueInMutual :: KwRange -> DeclarationException' -- | A declaration that breaks an implicit mutual block (named by the -- String argument) was present while the given lone type signatures were -- still without their definitions. DisallowedInterleavedMutual :: KwRange -> String -> List1 Name -> DeclarationException' -- | The name of the error. declarationExceptionString :: DeclarationException' -> String data DeclarationWarning DeclarationWarning :: CallStack -> DeclarationWarning' -> DeclarationWarning [dwLocation] :: DeclarationWarning -> CallStack [dwWarning] :: DeclarationWarning -> DeclarationWarning' -- | Non-fatal errors encountered in the Nicifier. data DeclarationWarning' -- | The modality of the clause (second ArgInfo, range of the -- warning) is different from the modality of the type signature (first -- ArgInfo). DivergentModalityInClause :: ArgInfo -> ArgInfo -> DeclarationWarning' -- | Empty abstract block. EmptyAbstract :: KwRange -> DeclarationWarning' -- | Empty data _ where block. EmptyConstructor :: KwRange -> DeclarationWarning' -- | Empty field block. EmptyField :: KwRange -> DeclarationWarning' -- | Empty variable block. EmptyGeneralize :: KwRange -> DeclarationWarning' -- | Empty instance block EmptyInstance :: KwRange -> DeclarationWarning' -- | Empty macro block. EmptyMacro :: KwRange -> DeclarationWarning' -- | Empty mutual block. EmptyMutual :: KwRange -> DeclarationWarning' -- | Empty postulate block. EmptyPostulate :: KwRange -> DeclarationWarning' -- | Empty private block. EmptyPrivate :: KwRange -> DeclarationWarning' -- | Empty primitive block. EmptyPrimitive :: KwRange -> DeclarationWarning' -- | POLARITY pragma without any polarities. EmptyPolarityPragma :: Range -> DeclarationWarning' -- | A fixity declaration for a closed operator or syntax. FixityDeclarationForNonOperator :: Range -> Name -> DeclarationWarning' -- | A Hidden identifier in a variable declaration. Hiding -- has no effect there as generalized variables are always hidden (or -- instance variables). HiddenGeneralize :: Range -> DeclarationWarning' -- | A {-# CATCHALL #-} pragma that does not precede a function clause. InvalidCatchallPragma :: Range -> DeclarationWarning' -- | Invalid constructor block (not inside an interleaved mutual block) InvalidConstructorBlock :: Range -> DeclarationWarning' -- | A {-# NON_COVERING #-} pragma that does not apply to any function. InvalidCoverageCheckPragma :: Range -> DeclarationWarning' -- | An entry in a data or record definition parameter that is not allowed -- here. Such parameters can only be names with hiding. The first -- Text says what is wrong and thus ignored. The second -- Text may contain extra details or clarification. InvalidDataOrRecDefParameter :: Range -> DataOrRecord_ -> Text -> Text -> DeclarationWarning' -- | A {-# ETA_EQUALITY #-} pragma that does not apply to any record type. InvalidEtaEqualityPragma :: Range -> DeclarationWarning' -- | A {-# NO_POSITIVITY_CHECK #-} pragma that does not apply to any data -- or record type. InvalidNoPositivityCheckPragma :: Range -> DeclarationWarning' -- | A {-# NO_UNIVERSE_CHECK #-} pragma that does not apply to a data or -- record type. InvalidNoUniverseCheckPragma :: Range -> DeclarationWarning' -- | A {-# TERMINATING #-} and {-# NON_TERMINATING #-} pragma that does not -- apply to any function. InvalidTerminationCheckPragma :: Range -> DeclarationWarning' -- | A misplaced tactic attribute. InvalidTacticAttribute :: Range -> DeclarationWarning' -- | A misplaced rewrite attribute. InvalidRewriteAttribute :: Range -> DeclarationWarning' -- | A data definition without a data signature. MissingDataDeclaration :: Name -> DeclarationWarning' -- | Declarations (e.g. type signatures) without a definition. MissingDefinitions :: List1 (Name, Range) -> DeclarationWarning' NotAllowedInMutual :: Range -> String -> DeclarationWarning' -- | private has no effect on open (import) public. (But -- the user might think so.) Range is the range of the open -- public or open import public declaration. The first -- KwRange is the range of the public keyword. The second -- KwRange is the range of the private keyword. OpenImportPrivate :: Range -> KwRange -> KwRange -> OpenOrImport -> DeclarationWarning' -- | abstract has no effect on open or import. -- (But the user might think so.) Range is the range of the -- open or import declaration. KwRange is the -- range of the abstract keyword. OpenImportAbstract :: Range -> KwRange -> OpenOrImport -> DeclarationWarning' PolarityPragmasButNotPostulates :: Set1 Name -> DeclarationWarning' -- | Pragma {-# NO_TERMINATION_CHECK #-} has been replaced by -- {-# TERMINATING #-} and {-# NON_TERMINATING #-}. PragmaNoTerminationCheck :: Range -> DeclarationWarning' -- | COMPILE pragmas are not allowed in safe mode. PragmaCompiled :: Range -> DeclarationWarning' -- | INJECTIVE pragma is unsafe. SafeFlagInjective :: Range -> DeclarationWarning' -- | NON_COVERING pragma is unsafe. SafeFlagNoCoverageCheck :: Range -> DeclarationWarning' -- | NO_POSITIVITY_CHECK pragma is unsafe. SafeFlagNoPositivityCheck :: Range -> DeclarationWarning' -- | NO_UNIVERSE_CHECK pragma is unsafe. SafeFlagNoUniverseCheck :: Range -> DeclarationWarning' -- | NON_TERMINATING pragma is unsafe. SafeFlagNonTerminating :: Range -> DeclarationWarning' -- | POLARITY pragma is unsafe. SafeFlagPolarity :: Range -> DeclarationWarning' -- | TERMINATING pragma is unsafe. SafeFlagTerminating :: Range -> DeclarationWarning' ShadowingInTelescope :: List1 (Name, List2 Range) -> DeclarationWarning' -- | Public mixfix identifiers without a fixity declaration. UnknownFixityInMixfixDecl :: Set1 Name -> DeclarationWarning' UnknownNamesInFixityDecl :: Set1 Name -> DeclarationWarning' UnknownNamesInPolarityPragmas :: Set1 Name -> DeclarationWarning' -- | abstract block with nothing that can (newly) be made -- abstract. UselessAbstract :: KwRange -> DeclarationWarning' -- | instance block with nothing that can (newly) become an -- instance. UselessInstance :: KwRange -> DeclarationWarning' -- | macro block with nothing that can (newly) be made macro. UselessMacro :: KwRange -> DeclarationWarning' -- | private block with nothing that can (newly) be made private. UselessPrivate :: KwRange -> DeclarationWarning' -- | An import that is applied to parameters by neither bound not -- opened. UselessImport :: Range -> DeclarationWarning' -- | open or import data OpenOrImport -- | open. OpenNotImport :: OpenOrImport -- | import or open import. ImportMayOpen :: OpenOrImport declarationWarningName :: DeclarationWarning -> WarningName declarationWarningName' :: DeclarationWarning' -> WarningName -- | Nicifier warnings turned into errors in --safe mode. unsafeDeclarationWarning :: DeclarationWarning -> Bool unsafeDeclarationWarning' :: DeclarationWarning' -> Bool -- | Pragmas not allowed in --safe mode produce an -- unsafeDeclarationWarning. unsafePragma :: CMaybe DeclarationWarning' m => Pragma -> m instance GHC.Internal.Enum.Bounded Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport instance GHC.Internal.Enum.Enum Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance GHC.Internal.Generics.Generic Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationException instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport module Agda.Syntax.Concrete.Definitions.Monad -- | Nicifier monad. Preserve the state when throwing an exception. newtype Nice a Nice :: ReaderT NiceEnv (ExceptT DeclarationException (State NiceState)) a -> Nice a [unNice] :: Nice a -> ReaderT NiceEnv (ExceptT DeclarationException (State NiceState)) a -- | Extension of the nicifier monad with state to process interleaved -- mutual blocks. type INice = StateT InterleavedState Nice -- | Run a Nicifier computation, return result and warnings (in -- chronological order). runNice :: NiceEnv -> Nice a -> (Either DeclarationException a, NiceWarnings) -- | Nicifier parameters. data NiceEnv NiceEnv :: Bool -> WhereClause_ -> NiceEnv -- | We are in a module declared --safe which is not a builtin -- module. [safeButNotBuiltin] :: NiceEnv -> Bool -- | Are we checking a where module? [checkingWhere] :: NiceEnv -> WhereClause_ -- | Nicifier state. data NiceState NiceState :: LoneSigs -> TerminationCheck -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> Catchall -> CoverageCheck -> NiceWarnings -> NameId -> NiceState -- | Lone type signatures that wait for their definition. [_loneSigs] :: NiceState -> LoneSigs -- | Termination checking pragma waiting for a definition. [_termChk] :: NiceState -> TerminationCheck -- | Positivity checking pragma waiting for a definition. [_posChk] :: NiceState -> PositivityCheck -- | Universe checking pragma waiting for a data/rec signature or -- definition. [_uniChk] :: NiceState -> UniverseCheck -- | ETA_EQUALITY pragma waiting for a record signature or -- definition. [_forceEta] :: NiceState -> ForceRecordEta -- | Catchall pragma waiting for a function clause. [_catchall] :: NiceState -> Catchall -- | Coverage pragma waiting for a definition. [_covChk] :: NiceState -> CoverageCheck -- | Stack of warnings. Head is last warning. [niceWarn] :: NiceState -> NiceWarnings -- | We distinguish different NoNames (anonymous definitions) by a -- unique NameId. [_nameId] :: NiceState -> NameId data LoneSig LoneSig :: Range -> Name -> DataRecOrFun -> LoneSig [loneSigRange] :: LoneSig -> Range -- | If isNoName, this name can have a different NameId than -- the key of LoneSigs pointing to it. [loneSigName] :: LoneSig -> Name [loneSigKind] :: LoneSig -> DataRecOrFun type LoneSigs = Map Name LoneSig type NiceWarnings = [DeclarationWarning] -- | Initial nicifier state. initNiceState :: NiceState lensNameId :: Lens' NiceState NameId nextNameId :: Nice NameId -- | Lens for field _loneSigs. loneSigs :: Lens' NiceState LoneSigs -- | Adding a lone signature to the state. Return the name (which is made -- unique if isNoName). addLoneSig :: Range -> Name -> DataRecOrFun -> Nice Name -- | Remove a lone signature from the state. removeLoneSig :: Name -> Nice () -- | Search for forward type signature. getSig :: Name -> Nice (Maybe DataRecOrFun) -- | Check that no lone signatures are left in the state. noLoneSigs :: Nice Bool forgetLoneSigs :: Nice () -- | Ensure that all forward declarations have been given a definition. checkLoneSigs :: LoneSigs -> Nice () -- | Ensure that all forward declarations have been given a definition, -- raising an error indicating *why* they would have had to have been -- defined. breakImplicitMutualBlock :: KwRange -> String -> Nice () -- | Get names of lone function signatures, plus their unique names. loneFuns :: LoneSigs -> [(Name, Arg Name)] -- | Create a LoneSigs map from an association list. loneSigsFromLoneNames :: [(Range, Name, DataRecOrFun)] -> LoneSigs -- | Lens for field _termChk. terminationCheckPragma :: Lens' NiceState TerminationCheck -- | Set terminationCheckPragma to given value for a local -- computation. withTerminationCheckPragma :: TerminationCheck -> Nice a -> Nice a -- | Lens for field _covChk. coverageCheckPragma :: Lens' NiceState CoverageCheck -- | Set coverageCheckPragma to given value for a local computation. withCoverageCheckPragma :: CoverageCheck -> Nice a -> Nice a -- | Lens for field _forceEta. etaEqualityPragma :: Lens' NiceState ForceRecordEta withEtaEqualityPragma :: ForceRecordEta -> Nice a -> Nice a -- | Lens for field _posChk. positivityCheckPragma :: Lens' NiceState PositivityCheck -- | Set positivityCheckPragma to given value for a local -- computation. withPositivityCheckPragma :: PositivityCheck -> Nice a -> Nice a -- | Lens for field _uniChk. universeCheckPragma :: Lens' NiceState UniverseCheck -- | Set universeCheckPragma to given value for a local computation. withUniverseCheckPragma :: UniverseCheck -> Nice a -> Nice a -- | Lens for field _catchall. catchallPragma :: Lens' NiceState Catchall -- | Get current catchall pragma, and reset it for the next clause. popCatchallPragma :: Nice Catchall -- | Set catchallPragma to given value for a local computation. withCatchallPragma :: Catchall -> Nice a -> Nice a -- | Add a new warning. niceWarning :: DeclarationWarning -> Nice () declarationException :: HasCallStack => DeclarationException' -> Nice a declarationWarning' :: DeclarationWarning' -> CallStack -> Nice () declarationWarning :: HasCallStack => DeclarationWarning' -> Nice () instance GHC.Internal.Base.Applicative Agda.Syntax.Concrete.Definitions.Monad.Nice instance GHC.Internal.Base.Functor Agda.Syntax.Concrete.Definitions.Monad.Nice instance Control.Monad.Error.Class.MonadError Agda.Syntax.Concrete.Definitions.Errors.DeclarationException Agda.Syntax.Concrete.Definitions.Monad.Nice instance GHC.Internal.Base.Monad Agda.Syntax.Concrete.Definitions.Monad.Nice instance Control.Monad.Reader.Class.MonadReader Agda.Syntax.Concrete.Definitions.Monad.NiceEnv Agda.Syntax.Concrete.Definitions.Monad.Nice instance Control.Monad.State.Class.MonadState Agda.Syntax.Concrete.Definitions.Monad.NiceState Agda.Syntax.Concrete.Definitions.Monad.Nice instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (Agda.Syntax.Concrete.Definitions.Monad.Nice a) instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.Monad.LoneSig -- | Preprocess Declarations, producing NiceDeclarations. -- -- module Agda.Syntax.Concrete.Definitions -- | The nice declarations. No fixity declarations and function definitions -- are contained in a single constructor instead of spread out between -- type signatures and clauses. The private, postulate, -- abstract and instance modifiers have been -- distributed to the individual declarations. -- -- Observe the order of components: -- -- Range Fixity' Access IsAbstract IsInstance TerminationCheck -- PositivityCheck -- -- further attributes -- -- (Q)Name -- -- content (Expr, Declaration ...) data NiceDeclaration -- | IsAbstract argument: We record whether a declaration was made -- in an abstract block. -- -- ArgInfo argument: Axioms and functions can be declared -- irrelevant. (Hiding should be NotHidden.) Axiom :: Range -> Access -> IsAbstract -> IsInstance -> ArgInfo -> Name -> Expr -> NiceDeclaration NiceField :: Range -> Access -> IsAbstract -> IsInstance -> TacticAttribute -> Name -> Arg Expr -> NiceDeclaration PrimitiveFunction :: Range -> Access -> IsAbstract -> Name -> Arg Expr -> NiceDeclaration NiceMutual :: KwRange -> TerminationCheck -> CoverageCheck -> PositivityCheck -> List1 NiceDeclaration -> NiceDeclaration NiceModule :: Range -> Access -> IsAbstract -> Erased -> QName -> Telescope -> [Declaration] -> NiceDeclaration NiceModuleMacro :: Range -> Access -> Erased -> Name -> ModuleApplication -> OpenShortHand -> ImportDirective -> NiceDeclaration NiceOpen :: KwRange -> QName -> ImportDirective -> NiceDeclaration NiceImport :: OpenShortHand -> KwRange -> QName -> Either AsName RawOpenArgs -> ImportDirective -> NiceDeclaration NicePragma :: Range -> Pragma -> NiceDeclaration NiceRecSig :: Range -> Erased -> Access -> IsAbstract -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> Name -> Parameters -> Expr -> NiceDeclaration NiceDataSig :: Range -> Erased -> Access -> IsAbstract -> PositivityCheck -> UniverseCheck -> Name -> Parameters -> Expr -> NiceDeclaration -- | An uncategorized function clause, could be a function clause without -- type signature or a pattern lhs (e.g. for irrefutable let). The -- Declaration is the actual FunClause. NiceFunClause :: Range -> Access -> IsAbstract -> TerminationCheck -> CoverageCheck -> Catchall -> Declaration -> NiceDeclaration FunSig :: Range -> Access -> IsAbstract -> IsInstance -> IsMacro -> ArgInfo -> TerminationCheck -> CoverageCheck -> Name -> Expr -> NiceDeclaration -- | Block of function clauses (we have seen the type signature before). -- The Declarations are the original declarations that were -- processed into this FunDef and are only used in -- notSoNiceDeclaration. Andreas, 2017-01-01: Because of issue -- #2372, we add IsInstance here. An alias should know that it is -- an instance. FunDef :: Range -> List1 Declaration -> IsAbstract -> IsInstance -> TerminationCheck -> CoverageCheck -> Name -> List1 Clause -> NiceDeclaration NiceDataDef :: Range -> Origin -> IsAbstract -> PositivityCheck -> UniverseCheck -> Name -> DefParameters -> [NiceConstructor] -> NiceDeclaration NiceLoneConstructor :: KwRange -> [NiceConstructor] -> NiceDeclaration -- | (Maybe Range) gives range of the 'pattern' declaration. NiceRecDef :: Range -> Origin -> IsAbstract -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> Name -> [RecordDirective] -> DefParameters -> [Declaration] -> NiceDeclaration NicePatternSyn :: Range -> Access -> Name -> [WithHiding Name] -> Pattern -> NiceDeclaration NiceGeneralize :: Range -> Access -> ArgInfo -> TacticAttribute -> Name -> Expr -> NiceDeclaration NiceUnquoteDecl :: Range -> Access -> IsAbstract -> IsInstance -> TerminationCheck -> CoverageCheck -> [Name] -> Expr -> NiceDeclaration NiceUnquoteDef :: Range -> Access -> IsAbstract -> TerminationCheck -> CoverageCheck -> [Name] -> Expr -> NiceDeclaration NiceUnquoteData :: Range -> Access -> IsAbstract -> PositivityCheck -> UniverseCheck -> Name -> [Name] -> Expr -> NiceDeclaration NiceOpaque :: KwRange -> [QName] -> [NiceDeclaration] -> NiceDeclaration -- | Only Axioms. type NiceConstructor = NiceTypeSignature -- | Only Axioms. type NiceTypeSignature = NiceDeclaration -- | One clause in a function definition. There is no guarantee that the -- LHS actually declares the Name. We will have to check -- that later. data Clause Clause :: Name -> Catchall -> ArgInfo -> LHS -> RHS -> WhereClause -> [Clause] -> Clause -- | Exception with internal source code callstack data DeclarationException DeclarationException :: CallStack -> DeclarationException' -> DeclarationException [deLocation] :: DeclarationException -> CallStack [deException] :: DeclarationException -> DeclarationException' data DeclarationWarning DeclarationWarning :: CallStack -> DeclarationWarning' -> DeclarationWarning [dwLocation] :: DeclarationWarning -> CallStack [dwWarning] :: DeclarationWarning -> DeclarationWarning' -- | Non-fatal errors encountered in the Nicifier. data DeclarationWarning' -- | The modality of the clause (second ArgInfo, range of the -- warning) is different from the modality of the type signature (first -- ArgInfo). DivergentModalityInClause :: ArgInfo -> ArgInfo -> DeclarationWarning' -- | Empty abstract block. EmptyAbstract :: KwRange -> DeclarationWarning' -- | Empty data _ where block. EmptyConstructor :: KwRange -> DeclarationWarning' -- | Empty field block. EmptyField :: KwRange -> DeclarationWarning' -- | Empty variable block. EmptyGeneralize :: KwRange -> DeclarationWarning' -- | Empty instance block EmptyInstance :: KwRange -> DeclarationWarning' -- | Empty macro block. EmptyMacro :: KwRange -> DeclarationWarning' -- | Empty mutual block. EmptyMutual :: KwRange -> DeclarationWarning' -- | Empty postulate block. EmptyPostulate :: KwRange -> DeclarationWarning' -- | Empty private block. EmptyPrivate :: KwRange -> DeclarationWarning' -- | Empty primitive block. EmptyPrimitive :: KwRange -> DeclarationWarning' -- | POLARITY pragma without any polarities. EmptyPolarityPragma :: Range -> DeclarationWarning' -- | A fixity declaration for a closed operator or syntax. FixityDeclarationForNonOperator :: Range -> Name -> DeclarationWarning' -- | A Hidden identifier in a variable declaration. Hiding -- has no effect there as generalized variables are always hidden (or -- instance variables). HiddenGeneralize :: Range -> DeclarationWarning' -- | A {-# CATCHALL #-} pragma that does not precede a function clause. InvalidCatchallPragma :: Range -> DeclarationWarning' -- | Invalid constructor block (not inside an interleaved mutual block) InvalidConstructorBlock :: Range -> DeclarationWarning' -- | A {-# NON_COVERING #-} pragma that does not apply to any function. InvalidCoverageCheckPragma :: Range -> DeclarationWarning' -- | An entry in a data or record definition parameter that is not allowed -- here. Such parameters can only be names with hiding. The first -- Text says what is wrong and thus ignored. The second -- Text may contain extra details or clarification. InvalidDataOrRecDefParameter :: Range -> DataOrRecord_ -> Text -> Text -> DeclarationWarning' -- | A {-# ETA_EQUALITY #-} pragma that does not apply to any record type. InvalidEtaEqualityPragma :: Range -> DeclarationWarning' -- | A {-# NO_POSITIVITY_CHECK #-} pragma that does not apply to any data -- or record type. InvalidNoPositivityCheckPragma :: Range -> DeclarationWarning' -- | A {-# NO_UNIVERSE_CHECK #-} pragma that does not apply to a data or -- record type. InvalidNoUniverseCheckPragma :: Range -> DeclarationWarning' -- | A {-# TERMINATING #-} and {-# NON_TERMINATING #-} pragma that does not -- apply to any function. InvalidTerminationCheckPragma :: Range -> DeclarationWarning' -- | A misplaced tactic attribute. InvalidTacticAttribute :: Range -> DeclarationWarning' -- | A misplaced rewrite attribute. InvalidRewriteAttribute :: Range -> DeclarationWarning' -- | A data definition without a data signature. MissingDataDeclaration :: Name -> DeclarationWarning' -- | Declarations (e.g. type signatures) without a definition. MissingDefinitions :: List1 (Name, Range) -> DeclarationWarning' NotAllowedInMutual :: Range -> String -> DeclarationWarning' -- | private has no effect on open (import) public. (But -- the user might think so.) Range is the range of the open -- public or open import public declaration. The first -- KwRange is the range of the public keyword. The second -- KwRange is the range of the private keyword. OpenImportPrivate :: Range -> KwRange -> KwRange -> OpenOrImport -> DeclarationWarning' -- | abstract has no effect on open or import. -- (But the user might think so.) Range is the range of the -- open or import declaration. KwRange is the -- range of the abstract keyword. OpenImportAbstract :: Range -> KwRange -> OpenOrImport -> DeclarationWarning' PolarityPragmasButNotPostulates :: Set1 Name -> DeclarationWarning' -- | Pragma {-# NO_TERMINATION_CHECK #-} has been replaced by -- {-# TERMINATING #-} and {-# NON_TERMINATING #-}. PragmaNoTerminationCheck :: Range -> DeclarationWarning' -- | COMPILE pragmas are not allowed in safe mode. PragmaCompiled :: Range -> DeclarationWarning' -- | INJECTIVE pragma is unsafe. SafeFlagInjective :: Range -> DeclarationWarning' -- | NON_COVERING pragma is unsafe. SafeFlagNoCoverageCheck :: Range -> DeclarationWarning' -- | NO_POSITIVITY_CHECK pragma is unsafe. SafeFlagNoPositivityCheck :: Range -> DeclarationWarning' -- | NO_UNIVERSE_CHECK pragma is unsafe. SafeFlagNoUniverseCheck :: Range -> DeclarationWarning' -- | NON_TERMINATING pragma is unsafe. SafeFlagNonTerminating :: Range -> DeclarationWarning' -- | POLARITY pragma is unsafe. SafeFlagPolarity :: Range -> DeclarationWarning' -- | TERMINATING pragma is unsafe. SafeFlagTerminating :: Range -> DeclarationWarning' ShadowingInTelescope :: List1 (Name, List2 Range) -> DeclarationWarning' -- | Public mixfix identifiers without a fixity declaration. UnknownFixityInMixfixDecl :: Set1 Name -> DeclarationWarning' UnknownNamesInFixityDecl :: Set1 Name -> DeclarationWarning' UnknownNamesInPolarityPragmas :: Set1 Name -> DeclarationWarning' -- | abstract block with nothing that can (newly) be made -- abstract. UselessAbstract :: KwRange -> DeclarationWarning' -- | instance block with nothing that can (newly) become an -- instance. UselessInstance :: KwRange -> DeclarationWarning' -- | macro block with nothing that can (newly) be made macro. UselessMacro :: KwRange -> DeclarationWarning' -- | private block with nothing that can (newly) be made private. UselessPrivate :: KwRange -> DeclarationWarning' -- | An import that is applied to parameters by neither bound not -- opened. UselessImport :: Range -> DeclarationWarning' -- | Nicifier warnings turned into errors in --safe mode. unsafeDeclarationWarning :: DeclarationWarning -> Bool -- | Nicifier monad. Preserve the state when throwing an exception. data Nice a -- | Nicifier parameters. data NiceEnv NiceEnv :: Bool -> WhereClause_ -> NiceEnv -- | We are in a module declared --safe which is not a builtin -- module. [safeButNotBuiltin] :: NiceEnv -> Bool -- | Are we checking a where module? [checkingWhere] :: NiceEnv -> WhereClause_ -- | Run a Nicifier computation, return result and warnings (in -- chronological order). runNice :: NiceEnv -> Nice a -> (Either DeclarationException a, NiceWarnings) -- | Main. Fixities (or more precisely syntax declarations) are needed when -- grouping function clauses. niceDeclarations :: Fixities -> [Declaration] -> Nice [NiceDeclaration] -- | (Approximately) convert a NiceDeclaration back to a list of -- Declarations. notSoNiceDeclarations :: NiceDeclaration -> List1 Declaration -- | Has the NiceDeclaration a field of type IsAbstract? niceHasAbstract :: NiceDeclaration -> Maybe IsAbstract -- | Termination measure is, for now, a variable name. type Measure = Name declarationWarningName :: DeclarationWarning -> WarningName instance GHC.Internal.Classes.Eq Agda.Syntax.Concrete.Definitions.DeclKind instance Agda.Syntax.Concrete.Definitions.MakeAbstract Agda.Syntax.Concrete.Definitions.Types.Clause instance Agda.Syntax.Concrete.Definitions.MakeAbstract Agda.Syntax.Common.IsAbstract instance Agda.Syntax.Concrete.Definitions.MakeAbstract a => Agda.Syntax.Concrete.Definitions.MakeAbstract [a] instance Agda.Syntax.Concrete.Definitions.MakeAbstract Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Concrete.Definitions.MakeAbstract a => Agda.Syntax.Concrete.Definitions.MakeAbstract (Agda.Utils.List1.List1 a) instance Agda.Syntax.Concrete.Definitions.MakeAbstract Agda.Syntax.Concrete.WhereClause instance Agda.Syntax.Concrete.Definitions.MakeMacro a => Agda.Syntax.Concrete.Definitions.MakeMacro [a] instance Agda.Syntax.Concrete.Definitions.MakeMacro Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Concrete.Definitions.MakePrivate Agda.Syntax.Common.Access instance Agda.Syntax.Concrete.Definitions.MakePrivate Agda.Syntax.Concrete.Definitions.Types.Clause instance Agda.Syntax.Concrete.Definitions.MakePrivate a => Agda.Syntax.Concrete.Definitions.MakePrivate [a] instance Agda.Syntax.Concrete.Definitions.MakePrivate Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Concrete.Definitions.MakePrivate a => Agda.Syntax.Concrete.Definitions.MakePrivate (Agda.Utils.List1.List1 a) instance Agda.Syntax.Concrete.Definitions.MakePrivate Agda.Syntax.Concrete.WhereClause instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Definitions.DeclKind module Agda.Syntax.Concrete.Attribute -- | An attribute is a modifier for ArgInfo. data Attribute RelevanceAttribute :: Relevance -> Attribute QuantityAttribute :: Quantity -> Attribute TacticAttribute :: Ranged Expr -> Attribute CohesionAttribute :: Cohesion -> Attribute PolarityAttribute :: PolarityModality -> Attribute LockAttribute :: Lock -> Attribute RewriteAttribute :: RewriteAnn -> Attribute -- | Parsed attribute. data Attr Attr :: Range -> String -> Attribute -> Attr -- | Range includes the @. [attrRange] :: Attr -> Range -- | Concrete, user written attribute for error reporting, not including -- the "@". [attrName] :: Attr -> String -- | Parsed attribute. [theAttr] :: Attr -> Attribute -- | (Conjunctive constraint.) type LensAttribute a = (LensRelevance a, LensQuantity a, LensCohesion a, LensModalPolarity a, LensLock a, LensRewriteAnn a) -- | Modifiers for Relevance. relevanceAttributeTable :: [(String, Relevance)] -- | Modifiers for Quantity. quantityAttributeTable :: [(String, Quantity)] cohesionAttributeTable :: [(String, Cohesion)] -- | Information about attributes (attribute, range, printed -- representation). -- -- This information is returned by the parser. Code that calls the parser -- should, if appropriate, complain if support for the given attributes -- has not been enabled. This can be taken care of by -- checkAttributes, which should not be called until after pragma -- options have been set. type Attributes = [Attr] -- | Modifiers for Polarity. polarityAttributeTable :: [(String, PolarityModality)] -- | Modifiers for Lock. lockAttributeTable :: [(String, Lock)] -- | Modifiers for RewriteAnn I don't think we ever actually hit -- this because rewrite is a keyword Of course, we might want to -- add aliases rewriteAttributeTable :: [(String, RewriteAnn)] -- | Concrete syntax for all attributes. attributesMap :: Map String Attribute -- | Parsing a string into an attribute. stringToAttribute :: String -> Maybe Attribute -- | Parsing an expression into an attribute. exprToAttribute :: Range -> Expr -> Maybe Attribute -- | Setting an attribute (in e.g. an Arg). Overwrites previous -- value. setAttribute :: LensAttribute a => Attribute -> a -> a -- | Setting some attributes in left-to-right order. Blindly overwrites -- previous settings. setAttributes :: LensAttribute a => [Attribute] -> a -> a -- | Setting Relevance if unset. setPristineRelevance :: LensRelevance a => Relevance -> a -> Maybe a -- | Setting Quantity if unset. setPristineQuantity :: LensQuantity a => Quantity -> a -> Maybe a -- | Setting Cohesion if unset. setPristineCohesion :: LensCohesion a => Cohesion -> a -> Maybe a -- | Setting ModalPolarity if unset. setPristinePolarity :: LensModalPolarity a => PolarityModality -> a -> Maybe a -- | Setting Lock if unset. setPristineLock :: LensLock a => Lock -> a -> Maybe a -- | Setting RewriteAnn if unset. setPristineRewriteAnn :: LensRewriteAnn a => RewriteAnn -> a -> Maybe a -- | Setting an unset attribute (to e.g. an Arg). setPristineAttribute :: LensAttribute a => Attribute -> a -> Maybe a -- | Setting a list of unset attributes. setPristineAttributes :: LensAttribute a => [Attribute] -> a -> Maybe a isRelevanceAttribute :: Attribute -> Maybe Relevance isQuantityAttribute :: Attribute -> Maybe Quantity isTacticAttribute :: Attribute -> TacticAttribute isRewriteAttribute :: Attribute -> Maybe RewriteAnn relevanceAttributes :: [Attribute] -> [Attribute] quantityAttributes :: [Attribute] -> [Attribute] tacticAttributes :: [Attribute] -> [Attribute] rewAttributes :: [Attribute] -> [Attribute] instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Attribute.Attr instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Attribute.Attribute instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Attribute.Attr instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Attribute.Attribute instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Attribute.Attr instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Attribute.Attribute instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Attribute.Attr instance GHC.Internal.Show.Show Agda.Syntax.Concrete.Attribute.Attribute module Agda.Syntax.Parser.Monad data Parser a -- | The result of parsing something. data ParseResult a ParseOk :: ParseState -> a -> ParseResult a ParseFailed :: ParseError -> ParseResult a -- | The parser state. Contains everything the parser and the lexer could -- ever need. data ParseState PState :: SrcFile -> PositionWithoutFile -> PositionWithoutFile -> String -> Char -> String -> LayoutContext -> LayoutStatus -> Keyword -> [LexState] -> ParseFlags -> [ParseWarning] -> [OpenBracket] -> Attributes -> ParseState [parseSrcFile] :: ParseState -> SrcFile -- | position at current input location [parsePos] :: ParseState -> PositionWithoutFile -- | position of last token [parseLastPos] :: ParseState -> PositionWithoutFile -- | the current input [parseInp] :: ParseState -> String -- | the character before the input [parsePrevChar] :: ParseState -> Char -- | the previous token [parsePrevToken] :: ParseState -> String -- | the stack of layout blocks [parseLayout] :: ParseState -> LayoutContext -- | the status of the coming layout block [parseLayStatus] :: ParseState -> LayoutStatus -- | the keyword for the coming layout block [parseLayKw] :: ParseState -> Keyword -- | the state of the lexer (states can be nested so we need a stack) [parseLexState] :: ParseState -> [LexState] -- | parametrization of the parser [parseFlags] :: ParseState -> ParseFlags -- | In reverse order. [parseWarnings] :: ParseState -> [ParseWarning] -- | stack of open unicode/ASCII brackets [parseBrackets] :: ParseState -> [OpenBracket] -- | Every encountered attribute. [parseAttributes] :: ParseState -> Attributes -- | Parse errors: what you get if parsing fails. data ParseError -- | Errors that arise at a specific position in the file ParseError :: Position -> String -> String -> String -> ParseError -- | Where the error occurred. [errPos] :: ParseError -> Position -- | The remaining input. [errInput] :: ParseError -> String -- | The previous token. [errPrevToken] :: ParseError -> String -- | Hopefully an explanation of what happened. [errMsg] :: ParseError -> String -- | Parse errors that concern a range in a file. OverlappingTokensError :: Range -> ParseError -- | The range of the bigger overlapping token [errRange] :: ParseError -> Range -- | Parse errors that concern a whole file. InvalidExtensionError :: RangeFile -> [String] -> ParseError -- | The file which the error concerns. [errPath] :: ParseError -> RangeFile [errValidExts] :: ParseError -> [String] ReadFileError :: RangeFile -> IOError -> ParseError -- | The file which the error concerns. [errPath] :: ParseError -> RangeFile [errIOError] :: ParseError -> IOError -- | Warnings for parsing. data ParseWarning -- | Parse errors that concern a range in a file. OverlappingTokensWarning :: Range' SrcFile -> ParseWarning -- | The range of the bigger overlapping token. [warnRange] :: ParseWarning -> Range' SrcFile -- | The String is the error message. MisplacedAttributes :: Range -> String -> ParseWarning -- | Unknown polarity, ignored. UnknownPolarity :: Range -> String -> ParseWarning -- | Unknown attribute, ignored. The Range includes the "@", the -- String not. UnknownAttribute :: Range -> String -> ParseWarning -- | Unsupported attribute. UnsupportedAttribute :: Range -> Maybe String -> ParseWarning -- | Multiple attributes. MultipleAttributes :: Range -> Maybe String -> ParseWarning -- | The closing bracket (at the Range) was closed with a -- unicode-ness that doesn't match that of the OpenBracket. MismatchedBrackets :: Range -> OpenBracket -> ParseWarning -- | For context sensitive lexing alex provides what is called start -- codes in the Alex documentation. It is really an integer -- representing the state of the lexer, so we call it LexState -- instead. type LexState = Int -- | Information about an opening unicode-able bracket necessary for -- correctly parsing its closing delimiter. data OpenBracket -- | An opening idiom bracket. OpenIdiomBracket :: Bool -> Interval -> OpenBracket -- | True if the user wrote ⦇. [openBracketUnicode] :: OpenBracket -> Bool -- | Position of the opening bracket. [openBracketInterval] :: OpenBracket -> Interval -- | An opening double brace. OpenDoubleBrace :: Bool -> Interval -> OpenBracket -- | True if the user wrote ⦇. [openBracketUnicode] :: OpenBracket -> Bool -- | Position of the opening bracket. [openBracketInterval] :: OpenBracket -> Interval -- | We need to keep track of the context to do layout. The context -- specifies the indentation columns of the open layout blocks. See -- Agda.Syntax.Parser.Layout for more informaton. data LayoutBlock -- | Layout at specified Column, introduced by Keyword. Layout :: Keyword -> LayoutStatus -> Column -> LayoutBlock -- | The stack of layout blocks. -- -- When we encounter a layout keyword, we push a Tentative block -- with noColumn. This is replaced by aproper column once we -- reach the next token. type LayoutContext = [LayoutBlock] -- | Status of a layout column (see #1145). A layout column is -- Tentative until we encounter a new line. This allows stacking -- of layout keywords. -- -- Inside a LayoutContext the sequence of Confirmed -- columns needs to be strictly increasing. 'Tentative columns between -- Confirmed columns need to be strictly increasing as well. data LayoutStatus -- | The token defining the layout column was on the same line as the -- layout keyword and we have not seen a new line yet. Tentative :: LayoutStatus -- | We have seen a new line since the layout keyword and the layout column -- has not been superseded by a smaller column. Confirmed :: LayoutStatus -- | A (layout) column. type Column = Word32 -- | Parser flags. data ParseFlags ParseFlags :: Bool -> ParseFlags -- | Should comment tokens be returned by the lexer? [parseKeepComments] :: ParseFlags -> Bool -- | Constructs the initial state of the parser. The string argument is the -- input string, the file path is only there because it's part of a -- position. initState :: Maybe RangeFile -> ParseFlags -> String -> [LexState] -> ParseState -- | The default flags. defaultParseFlags :: ParseFlags -- | The most general way of parsing a string. The -- Agda.Syntax.Parser will define more specialised functions that -- supply the ParseFlags and the LexState. parse :: ParseFlags -> [LexState] -> Parser a -> String -> ParseResult a -- | The even more general way of parsing a string. parsePosString :: Position -> ParseFlags -> [LexState] -> Parser a -> String -> ParseResult a -- | Parses a string as if it were the contents of the given file Useful -- for integrating preprocessors. parseFromSrc :: ParseFlags -> [LexState] -> Parser a -> SrcFile -> String -> ParseResult a setParsePos :: PositionWithoutFile -> Parser () setLastPos :: PositionWithoutFile -> Parser () -- | The parse interval is between the last position and the current -- position. getParseInterval :: Parser Interval setPrevToken :: String -> Parser () getParseFlags :: Parser ParseFlags getLexState :: Parser [LexState] pushLexState :: LexState -> Parser () popLexState :: Parser () -- | Return the current layout block. topBlock :: Parser (Maybe LayoutBlock) popBlock :: Parser () pushBlock :: LayoutBlock -> Parser () getContext :: MonadState ParseState m => m LayoutContext setContext :: LayoutContext -> Parser () modifyContext :: (LayoutContext -> LayoutContext) -> Parser () -- | When we see a layout keyword, by default we expect a Tentative -- block. resetLayoutStatus :: Parser () -- | Push the OpenBracket state corresponding to an opening token. openBracket :: Token -> Parser Range -- | Pop an OpenBracket from the parser state, and generate the -- MismatchedBrackets warning if the given Token does not -- match what was expected. closeBracket :: Token -> Parser Range -- | Records a warning. parseWarning :: ParseWarning -> Parser () parseWarningName :: ParseWarning -> WarningName -- | Throw a parse error at the current position. parseError :: String -> Parser a -- | Fake a parse error at the specified position. Used, for instance, when -- lexing nested comments, which when failing will always fail at the end -- of the file. A more informative position is the beginning of the -- failing comment. parseErrorAt :: PositionWithoutFile -> String -> Parser a -- | Use parseErrorAt or parseError as appropriate. parseError' :: Maybe PositionWithoutFile -> String -> Parser a -- | Report a parse error at the beginning of the given Range. parseErrorRange :: HasRange r => r -> String -> Parser a -- | For lexical errors we want to report the current position as the site -- of the error, whereas for parse errors the previous position is the -- one we're interested in (since this will be the position of the token -- we just lexed). This function does parseErrorAt the current -- position. lexError :: String -> Parser a instance GHC.Internal.Base.Applicative Agda.Syntax.Parser.Monad.Parser instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Monad.LayoutStatus instance GHC.Internal.Classes.Eq Agda.Syntax.Parser.Monad.OpenBracket instance GHC.Internal.Base.Functor Agda.Syntax.Parser.Monad.Parser instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Monad.ParseError instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Monad.ParseWarning instance Agda.Syntax.Position.KillRange Agda.Syntax.Parser.Monad.ParseError instance Control.Monad.Error.Class.MonadError Agda.Syntax.Parser.Monad.ParseError Agda.Syntax.Parser.Monad.Parser instance GHC.Internal.Base.Monad Agda.Syntax.Parser.Monad.Parser instance Control.Monad.State.Class.MonadState Agda.Syntax.Parser.Monad.ParseState Agda.Syntax.Parser.Monad.Parser instance Control.DeepSeq.NFData Agda.Syntax.Parser.Monad.OpenBracket instance Control.DeepSeq.NFData Agda.Syntax.Parser.Monad.ParseError instance Control.DeepSeq.NFData Agda.Syntax.Parser.Monad.ParseWarning instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Parser.Monad.ParseError instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Parser.Monad.ParseWarning instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.LayoutBlock instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.LayoutStatus instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.OpenBracket instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.ParseError instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.ParseFlags instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Parser.Monad.ParseResult a) instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.ParseState instance GHC.Internal.Show.Show Agda.Syntax.Parser.Monad.ParseWarning -- | This module defines the things required by Alex and some other Alex -- related things. module Agda.Syntax.Parser.Alex -- | This is what the lexer manipulates. data AlexInput AlexInput :: SrcFile -> PositionWithoutFile -> String -> Char -> AlexInput -- | File. [lexSrcFile] :: AlexInput -> SrcFile -- | Current position. [lexPos] :: AlexInput -> PositionWithoutFile -- | Current input. [lexInput] :: AlexInput -> String -- | Previously read character. [lexPrevChar] :: AlexInput -> Char -- | A lens for lexInput. lensLexInput :: Lens' AlexInput String -- | Get the previously lexed character. Same as lexPrevChar. Alex -- needs this to be defined to handle "patterns with a left-context". alexInputPrevChar :: AlexInput -> Char -- | Returns the next character, and updates the AlexInput value. -- -- This function is not suitable for use by Alex 2, because it can return -- non-ASCII characters. alexGetChar :: AlexInput -> Maybe (Char, AlexInput) -- | Returns the next byte, and updates the AlexInput value. -- -- A trick is used to handle the fact that there are more than 256 -- Unicode code points. The function translates characters to bytes in -- the following way: -- -- -- -- Note that it is important that there are no keywords containing 'z', -- '+', ' ' or '\1'. -- -- This function is used by Alex (version 3). alexGetByte :: AlexInput -> Maybe (Word8, AlexInput) -- | In the lexer, regular expressions are associated with lex actions -- whose task is to construct the tokens. newtype LexAction r LexAction :: (PreviousInput -> CurrentInput -> TokenLength -> Parser r) -> LexAction r [runLexAction] :: LexAction r -> PreviousInput -> CurrentInput -> TokenLength -> Parser r -- | Sometimes regular expressions aren't enough. Alex provides a way to do -- arbitrary computations to see if the input matches. This is done with -- a lex predicate. type LexPredicate = ([LexState], ParseFlags) -> PreviousInput -> TokenLength -> CurrentInput -> Bool -- | Conjunction of LexPredicates. (.&&.) :: LexPredicate -> LexPredicate -> LexPredicate -- | Disjunction of LexPredicates. (.||.) :: LexPredicate -> LexPredicate -> LexPredicate -- | Negation of LexPredicates. not' :: LexPredicate -> LexPredicate type PreviousInput = AlexInput type CurrentInput = AlexInput type TokenLength = Int getLexInput :: Parser AlexInput setLexInput :: AlexInput -> Parser () instance GHC.Internal.Base.Applicative Agda.Syntax.Parser.Alex.LexAction instance GHC.Internal.Base.Functor Agda.Syntax.Parser.Alex.LexAction instance GHC.Internal.Base.Monad Agda.Syntax.Parser.Alex.LexAction instance Control.Monad.State.Class.MonadState Agda.Syntax.Parser.Monad.ParseState Agda.Syntax.Parser.Alex.LexAction -- | When lexing by hand (for instance string literals) we need to do some -- looking ahead. The LookAhead monad keeps track of the position -- we are currently looking at, and provides facilities to synchronise -- the look-ahead position with the actual position of the Parser -- monad (see sync and rollback). module Agda.Syntax.Parser.LookAhead -- | The LookAhead monad is basically a state monad keeping with an extra -- AlexInput, wrapped around the Parser monad. data LookAhead a -- | Run a LookAhead computation. The first argument is the error -- function. runLookAhead :: (forall b. () => String -> LookAhead b) -> LookAhead a -> Parser a -- | Throw an error message according to the supplied method. lookAheadError :: String -> LookAhead a -- | Get the current look-ahead position. getInput :: LookAhead AlexInput -- | Set the look-ahead position. setInput :: AlexInput -> LookAhead () -- | Lift a computation in the Parser monad to the LookAhead -- monad. liftP :: Parser a -> LookAhead a -- | Look at the next character. Fails if there are no more characters. nextChar :: LookAhead Char -- | Consume the next character. Does nextChar followed by -- sync. eatNextChar :: LookAhead Char -- | Consume all the characters up to the current look-ahead position. sync :: LookAhead () -- | Undo look-ahead. Restores the input from the ParseState. rollback :: LookAhead () -- | Do a case on the current input string. If any of the given strings -- match we move past it and execute the corresponding action. If no -- string matches, we execute a default action, advancing the input one -- character. This function only affects the look-ahead position. match :: [(String, LookAhead a)] -> LookAhead a -> LookAhead a -- | Same as match but takes the initial character from the first -- argument instead of reading it from the input. Consequently, in the -- default case the input is not advanced. match' :: Char -> [(String, LookAhead a)] -> LookAhead a -> LookAhead a instance GHC.Internal.Base.Applicative Agda.Syntax.Parser.LookAhead.LookAhead instance GHC.Internal.Base.Functor Agda.Syntax.Parser.LookAhead.LookAhead instance GHC.Internal.Base.Monad Agda.Syntax.Parser.LookAhead.LookAhead -- | The code to lex string and character literals. Basically the same code -- as in GHC. module Agda.Syntax.Parser.StringLiterals -- | Lex a string literal. Assumes that a double quote has been lexed. litString :: LexAction Token -- | Lex a character literal. Assumes that a single quote has been lexed. A -- character literal is lexed in exactly the same way as a string -- literal. Only before returning the token do we check that the lexed -- string is of length 1. This is maybe not the most efficient way of -- doing things, but on the other hand it will only be inefficient if -- there is a lexical error. litChar :: LexAction Token -- | This module defines the lex action to lex nested comments. As is -- well-known this cannot be done by regular expressions (which, -- incidently, is probably the reason why C-comments don't nest). -- -- When scanning nested comments we simply keep track of the nesting -- level, counting up for open comments and down for close -- comments. module Agda.Syntax.Parser.Comments -- | Should comment tokens be output? keepComments :: LexPredicate -- | Should comment tokens be output? keepCommentsM :: Parser Bool -- | Manually lexing a block comment. Assumes an open comment has -- been lexed. In the end the comment is discarded and lexToken is -- called to lex a real token. nestedComment :: LexAction Token -- | Lex a hole ({! ... !}). Holes can be nested. Returns -- TokSymbol SymQuestionMark. hole :: LexAction Token -- | Skip a block of text enclosed by the given open and close strings. -- Assumes the first open string has been consumed. Open-close pairs may -- be nested. skipBlock :: String -> String -> LookAhead () -- | The lexer is generated by Alex (http://www.haskell.org/alex) -- and is an adaptation of GHC's lexer. The main lexing function -- lexer is called by the Agda.Syntax.Parser.Parser to get -- the next token from the input. module Agda.Syntax.Parser.Lexer -- | Return the next token. This is the function used by Happy in the -- parser. -- --
--   lexer k = lexToken >>= k
--   
lexer :: (Token -> Parser a) -> Parser a -- | This is the initial state for parsing a regular, non-literate file. normal :: LexState code :: Int -- | The layout state. Entered when we see a layout keyword -- (withLayout) and exited at the next token -- (newLayoutBlock). layout :: LexState -- | We enter this state from newLayoutBlock when the token -- following a layout keyword is to the left of (or at the same column -- as) the current layout context. Example: -- --
--   data Empty : Set where
--   foo : Empty -> Nat
--   
-- -- Here the second line is not part of the where clause since it -- is has the same indentation as the data definition. What we -- have to do is insert an empty layout block {} after the -- where. The only thing that can happen in this state is that -- emptyLayout is executed, generating the closing brace. The open -- brace is generated when entering by newLayoutBlock. empty_layout :: LexState -- | This state is entered at the beginning of each line. You can't lex -- anything in this state, and to exit you have to check the layout rule. -- Done with offsideRule. bol :: LexState -- | This state can only be entered by the parser. In this state you can -- only lex the keywords using, hiding, -- renaming and to. Moreover they are only keywords in -- this particular state. The lexer will never enter this state by -- itself, that has to be done in the parser. imp_dir :: LexState data AlexReturn a AlexEOF :: AlexReturn a AlexError :: AlexInput -> AlexReturn a AlexSkip :: AlexInput -> Int -> AlexReturn a AlexToken :: AlexInput -> Int -> a -> AlexReturn a -- | This is the main lexing function generated by Alex. alexScanUser :: ([LexState], ParseFlags) -> AlexInput -> Int -> AlexReturn (LexAction Token) -- | This module contains the building blocks used to construct the lexer. module Agda.Syntax.Parser.LexActions -- | Scan the input to find the next token. Calls alexScanUser. This -- is the main lexing function where all the work happens. The function -- lexer, used by the parser is the continuation version of this -- function. lexToken :: Parser Token -- | The most general way of parsing a token. token :: (String -> Parser tok) -> LexAction tok -- | Parse a token from an Interval and the lexed string. withInterval :: ((Interval, String) -> tok) -> LexAction tok -- | Like withInterval, but applies a function to the string. withInterval' :: (String -> a) -> ((Interval, a) -> tok) -> LexAction tok -- | Return a token without looking at the lexed string. withInterval_ :: (Interval -> r) -> LexAction r -- | Executed for layout keywords. Enters the layout state and -- performs the given action. withLayout :: Keyword -> LexAction r -> LexAction r -- | Prepend some parser manipulation to an action. andThen :: Parser () -> LexAction r -> LexAction r infixr 1 `andThen` -- | Throw away the current lexeme. skip :: LexAction Token -- | Enter a new state without consuming any input. begin :: LexState -> LexAction Token -- | Exit the current state without consuming any input. end :: LexAction Token -- | Enter a new state and perform the given action. beginWith :: LexState -> LexAction a -> LexAction a -- | Exit the current state and perform the given action. endWith :: LexAction a -> LexAction a -- | Enter a new state throwing away the current lexeme. begin_ :: LexState -> LexAction Token -- | Exit the current state throwing away the current lexeme. end_ :: LexAction Token -- | For lexical errors we want to report the current position as the site -- of the error, whereas for parse errors the previous position is the -- one we're interested in (since this will be the position of the token -- we just lexed). This function does parseErrorAt the current -- position. lexError :: String -> Parser a -- | Parse a Keyword token, triggers layout for -- layoutKeywords. keyword :: Keyword -> LexAction Token -- | Parse a Symbol token. symbol :: Symbol -> LexAction Token -- | Parse a potentially-qualified token. This action is responsible for -- lexing both identifiers (which do not always have a qualifier, in -- which case a TokId is returned) *and* "qualified keywords", -- like qualified do. -- -- This action may thus modify the layout state of the parser, since -- qualified do is a layout "keyword". -- -- Examples: Foo.Bar.f, Foo.do. qualifiedToken :: LexAction Token literal :: Read a => (a -> Literal) -> LexAction Token -- | Parse a literal. literal' :: (String -> a) -> (a -> Literal) -> LexAction Token integer :: String -> Integer -- | True when the given character is the next character of the input -- string. followedBy :: Char -> LexPredicate -- | True if we are at the end of the file. eof :: LexPredicate -- | True if the given state appears somewhere on the state stack inState :: LexState -> LexPredicate -- | This module contains the lex actions that handle the layout rules. The -- way it works is that the Parser monad keeps track of a stack of -- LayoutContexts specifying the indentation of the layout blocks -- in scope. For instance, consider the following incomplete (Haskell) -- program: -- --
--   f x = x'
--     where
--       x' = do y <- foo x; bar ...
--   
-- -- At the ... the layout context would be -- --
--   [Layout 12, Layout 4, Layout 0]
--   
-- -- The closest layout block is the one following do which is -- started by token y at column 12. The second closest block is -- the where clause started by the x' token which has -- indentation 4. Finally, there is a top-level layout block with -- indentation 0. -- -- In April 2021 we changed layout handling in the lexer to allow -- stacking of layout keywords on the same line, e.g.: -- --
--   private module M where
--      postulate A : Set
--                private
--                  B : Set
--   
-- -- The layout columns in the layout context (stack of layout blocks) can -- have LayoutStatus either Tentative or Confirmed. -- New layout columns following a layout keyword are tentative until we -- see a new line. E.g. -- -- -- -- In contrast, -- -- -- -- A new layout column has to be strictly above the last confirmed -- column only. E.g., when encountering postulate at column 2 -- after where, the confirmed column is still 0, so this is a -- valid start of the block following where. -- -- The column 8 of the private block never enters the -- Confirmed status but remains Tentative. Also, this block -- can never get more than the one declaration it has -- (module...), because when the module block closes -- due to a column < 2, it closes as well. One could say that -- tentative blocks buried under confirmed blocks are passive, the only -- wait for their closing. -- -- To implement the process of block confirmation (function -- confirmLayout), the lexer has to act on newline characters -- (except for those in a block comment). -- -- -- -- In order to implement confirmedLayoutComing we have a -- LayoutStatus flag in the parse state (field -- stateLayStatus). By default, for a new layout block, the -- status is Tentative (unless we saw a newline). -- -- New layout blocks are created as follows. When a layout keyword is -- encountered, we enter lexer state layout via function -- withLayout. When we exit the layout state via -- newLayoutBlock with a token that marks the new layout column, -- we push a new LayoutBlock onto the LayoutContext using -- the given column and the current parseLayStatus which is then -- reset to Tentative. -- -- The new block is actually only pushed if the column is above the last -- confirmed layout column (confirmedLayoutColumn). If this -- check fails, we instead enter the empty_layout state. This -- state produces the closing brace and is immediately left for -- bol (beginning of line). -- -- (Remark: In bol we might confirm some tentative top blocks, but -- this is irrelevant, since they will be closed immediately, given that -- the current token is left of the confirmed column, and tentative -- columns above it must be to the right of this column.) -- -- The offsideRule (state bol) is unchanged. It checks how -- the first token on a new line relates to the top layout column, be it -- tentative or confirmed. (Since we are on a new line, Tentative -- can only happen when we popped some Confirmed columns and -- continue popping the top Tentative columns here.) While the -- token is to the left of the layout column, we keep closing blocks. module Agda.Syntax.Parser.Layout -- | Executed for layout keywords. Enters the layout state and -- performs the given action. withLayout :: Keyword -> LexAction r -> LexAction r -- | Executed for the first token in each line (see bol), except -- when the last token was a layout keyword. -- -- Checks the position of the token relative to the current layout -- context. If the token is -- -- offsideRule :: LexAction Token -- | Start a new layout block. This is how to get out of the layout -- state. There are two possibilities: -- -- -- -- In the first case everything is fine and we enter a new layout block -- at the column of the current token. In the second case we have an -- empty layout block so we enter the empty_layout state. In both -- cases we return a virtual open brace without consuming any input. -- -- Entering a new state when we know we want to generate a virtual -- {} may seem a bit roundabout. The thing is that we can only -- generate one token at a time, so the way to generate two tokens is to -- generate the first one and then enter a state in which the only thing -- you can do is generate the second one. newLayoutBlock :: LexAction Token -- | This action is only executed from the empty_layout state. It -- will exit this state, enter the bol state, and return a virtual -- close brace (closing the empty layout block started by -- newLayoutBlock). emptyLayout :: LexAction Token -- | At a new line, we confirm either existing tentative layout columns, -- or, if the last token was a layout keyword, the expected new layout -- column. confirmLayout :: Parser () -- | Utility functions used in the Happy parser. module Agda.Syntax.Parser.Helpers -- | Insert a top-level module if there is none. Also fix-up for the case -- the declarations in the top-level module are not indented (this is -- allowed as a special case). figureOutTopLevelModule :: [Declaration] -> Module -- | Is the given declaration a module definition? isModule :: Declaration -> Bool -- | Create a name from a string. The boolean indicates whether a part of -- the name can be token constructor. mkName' :: Bool -> (Interval, String) -> Parser Name -- | Create a name from a string. The boolean indicates whether a part of -- the name can be token constructor. mkValidName :: Bool -> Range -> String -> Either String Name -- | Create a name from a string mkName :: (Interval, String) -> Parser Name -- | Create a qualified name from a list of strings mkQName :: [(Interval, String)] -> Parser QName mkDomainFree_ :: (NamedArg Binder -> NamedArg Binder) -> Maybe Pattern -> Name -> NamedArg Binder mkRString :: (Interval, String) -> RString mkRText :: (Interval, String) -> Ranged Text -- | Create a qualified name from a string (used in pragmas). Range of each -- name component is range of whole string. TODO: precise ranges! pragmaQName :: (Interval, String) -> Parser QName mkNamedArg :: Maybe QName -> Either QName Range -> Parser (NamedArg BoundName) -- | Polarity parser. parsePolarity :: (Interval, String) -> Parser (Ranged Occurrence) recoverLayout :: [(Interval, String)] -> String ensureUnqual :: QName -> Parser Name -- | Result of parsing LamBinds. data LamBinds' a LamBinds :: a -> Maybe Hiding -> LamBinds' a -- | A number of domain-free or typed bindings or record patterns. [lamBindings] :: LamBinds' a -> a -- | Followed by possibly a final absurd pattern. [absurdBinding] :: LamBinds' a -> Maybe Hiding type LamBinds = LamBinds' [LamBinding] mkAbsurdBinding :: Hiding -> LamBinds mkLamBinds :: a -> LamBinds' a -- | Build a forall pi (forall x y z -> ...) forallPi :: List1 LamBinding -> Expr -> Expr -- | Converts lambda bindings to typed bindings. addType :: LamBinding -> TypedBinding -- | Returns the value of the first erasure attribute, if any, or else the -- default value of type Erased. -- -- Raises warnings for all attributes except for erasure attributes, and -- for multiple erasure attributes. onlyErased :: [Attr] -> Parser Erased -- | Constructs extended lambdas. extLam :: Range -> [Attr] -> List1 LamClause -> Parser Expr -- | Constructs extended or absurd lambdas. extOrAbsLam :: Range -> [Attr] -> Either ([LamBinding], Hiding) (List1 Expr) -> Parser Expr -- | Interpret an expression as a list of names and (not parsed yet) -- as-patterns exprAsNamesAndPatterns :: Expr -> Maybe (List1 (Name, Maybe Expr)) exprAsNameAndPattern :: Expr -> Maybe (Name, Maybe Expr) exprAsNameOrHiddenNames :: Expr -> Maybe (List1 (NamedArg (Name, Maybe Expr))) boundNamesOrAbsurd :: List1 Expr -> Parser (Either (List1 (NamedArg Binder)) (List1 Expr)) -- | Match a pattern-matching "assignment" statement p <- e exprToAssignment :: Expr -> Parser (Maybe (Pattern, Range, Expr)) -- | Build a with-block buildWithBlock :: [Either RewriteEqn (List1 (Named Name Expr))] -> Parser ([RewriteEqn], [Named Name Expr]) -- | Build a with-statement buildWithStmt :: List1 (Named Name Expr) -> Parser [Either RewriteEqn (List1 (Named Name Expr))] buildUsingStmt :: List1 Expr -> Parser RewriteEqn buildSingleWithStmt :: Named Name Expr -> Parser (Either (Named Name (Pattern, Expr)) (Named Name Expr)) -- | Build a do-statement defaultBuildDoStmt :: Expr -> [LamClause] -> Parser DoStmt buildDoStmt :: Expr -> [LamClause] -> Parser DoStmt -- | Turn an expression into a left hand side. exprToLHS :: Expr -> Parser ([RewriteEqn] -> [WithExpr] -> LHS) -- | Turn an expression into a pattern. Fails if the expression is not a -- valid pattern. exprToPattern :: Expr -> Parser Pattern -- | Turn an expression into a name. Fails if the expression is not a valid -- identifier. exprToName :: Expr -> Parser Name -- | When given expression is e1 = e2, turn it into a named -- expression. Call this inside an implicit argument {e} or -- {{e}}, where an equality must be a named argument (rather -- than a cubical partial match). maybeNamed :: Expr -> Parser (Named_ Expr) patternSynArgs :: [NamedArg Binder] -> Parser [WithHiding Name] mkLamClause :: Catchall -> [Expr] -> RHS -> Parser LamClause mkAbsurdLamClause :: Catchall -> List1 Expr -> Parser LamClause data RHSOrTypeSigs JustRHS :: RHS -> RHSOrTypeSigs TypeSigsRHS :: Expr -> RHSOrTypeSigs patternToNames :: Pattern -> Parser (List1 (Arg Name)) -- | Interpret leading dot as irrelevance patternToArgPattern :: Pattern -> Arg Pattern funClauseOrTypeSigs :: [Attr] -> ([RewriteEqn] -> [WithExpr] -> LHS) -> [Either RewriteEqn (List1 (Named Name Expr))] -> RHSOrTypeSigs -> WhereClause -> Parser (List1 Declaration) typeSig :: ArgInfo -> TacticAttribute -> Name -> Expr -> Declaration makeIrrelevant :: (HasRange a, LensRelevance b) => a -> b -> b makeShapeIrrelevant :: (HasRange a, LensRelevance b) => a -> b -> b defaultIrrelevantArg :: HasRange a => a -> b -> Arg b defaultShapeIrrelevantArg :: HasRange a => a -> b -> Arg b makeIrrelevantM :: (HasRange a, LensRelevance b) => a -> b -> Parser b makeShapeIrrelevantM :: (HasRange a, LensRelevance b) => a -> b -> Parser b assertPristineRelevance :: (HasRange a, LensRelevance b) => a -> b -> Parser () -- | Parse an attribute. toAttribute :: Range -> Expr -> Parser (Maybe Attr) -- | Updates parseAttributes and returns an @rewrite attribute rewAttribute :: Range -> Parser (Maybe Attr) -- | Updates parseAttributes and returns the attribute theAttribute :: Attr -> Parser Attr -- | Apply an attribute to thing (usually Arg). This will fail if -- one of the attributes is already set in the thing to something else -- than the default value. applyAttr :: LensAttribute a => Attr -> a -> Parser a -- | Apply attributes to thing (usually Arg). Expects a reversed -- list of attributes. This will fail if one of the attributes is already -- set in the thing to something else than the default value. applyAttrsDropTactic :: LensAttribute a => [Attr] -> a -> Parser a -- | Apply attributes to thing (usually Arg). Expects a reversed -- list of attributes. This will fail if one of the attributes is already -- set in the thing to something else than the default value. applyAttrs :: LensAttribute a => [Attr] -> a -> Parser a applyAttrs1 :: LensAttribute a => List1 Attr -> a -> Parser a -- | Set the tactic attribute of a binder setTacticAttr :: [Attr] -> NamedArg Binder -> NamedArg Binder -- | Get the tactic attribute if present. getTacticAttr :: [Attr] -> TacticAttribute -- | Check if tactic attribute is present. haveTacticAttr :: [Attr] -> Maybe (Ranged Expr) haveRewAttr :: [Attr] -> Maybe RewriteAnn -- | Report a parse error if two attributes in the list are of the same -- kind, thus, present conflicting information. checkForUniqueAttribute :: (Attribute -> Bool) -> [Attr] -> Parser () -- | Report an attribute as conflicting (e.g., with an already set value). errorConflictingAttribute :: Attr -> Parser a -- | Report attributes as conflicting (e.g., with each other). -- Precondition: List not emtpy. errorConflictingAttributes :: [Attr] -> Parser a prettyAttr :: Attr -> String -- | Apply some attributes to some binders. applyAttributes :: Functor f => [Attr] -> ArgInfo -> f (NamedArg Binder) -> Parser (f (NamedArg Binder)) -- | Turn a QualifiedToken into a properly qualified name, and the -- range of its keyword. If the qualified token is an opening bracket, -- this also calls openBracket. unqualifyToken :: QualifiedToken -> Parser (QName, Range) -- | Close a double brace from a pair of single closing braces. -- -- This implements the rule described in the grammar that the braces must -- be adjacent, and additionally acts as closeBracket, generating -- the proper error if the opening braces were Unicode. closeTwoBraces :: Interval -> Interval -> Parser Range instance GHC.Internal.Base.Functor Agda.Syntax.Parser.Helpers.LamBinds' instance GHC.Internal.Show.Show Agda.Syntax.Parser.Helpers.RHSOrTypeSigs -- | The parser is generated by Happy -- (http://www.haskell.org/happy). - - Ideally, ranges should be -- as precise as possible, to get messages that - emphasize precisely the -- faulting term(s) upon error. - - However, interactive highlighting is -- only applied at the end of each - mutual block, keywords are only -- highlighted once (see - Decl). So if the ranges of two -- declarations - interleave, one must ensure that keyword ranges are not -- included in - the intersection. (Otherwise they are uncolored by the -- interactive - highlighting.) - module Agda.Syntax.Parser.Parser -- | Parse a module. moduleParser :: Parser Module moduleNameParser :: Parser QName -- | Parse an expression. Could be used in interactions. exprParser :: Parser Expr -- | Parse an expression followed by a where clause. Could be used in -- interactions. exprWhereParser :: Parser ExprWhere -- | Parse the token stream. Used by the TeX compiler. tokensParser :: Parser [Token] holeContentParser :: Parser (HoleContent' () Name Pattern Expr) instance GHC.Internal.Show.Show Agda.Syntax.Parser.Parser.HappyAction module Agda.Syntax.Parser -- | Wrapped Parser type. data Parser a -- | Parse without top-level layout. parse :: Parser a -> String -> PM (a, Attributes) parsePosString :: Parser a -> Position -> String -> PM (a, Attributes) -- | Calls parsePosString with Position extracted from the -- Range. parseRangeString :: Parser a -> Range -> String -> PM (a, Attributes) -- | Parse a file. -- -- The Bool parameter controls whether only ```agda -- blocks are treated as Agda code in Markdown/Typst files. When -- True, only blocks marked ```agda are considered -- code. When False, both ``` and ```agda -- blocks are code (default). parseFile :: Bool -> Parser a -> RangeFile -> String -> PM ((a, Attributes), FileType) -- | Parses a module. moduleParser :: Parser Module -- | Parses a module name. moduleNameParser :: Parser QName -- | Extensions supported by parseFile. agdaFileExtensions :: [String] -- | Parses an expression. exprParser :: Parser Expr -- | Parses an expression followed by a where clause. exprWhereParser :: Parser ExprWhere -- | Parses an expression or some other content of an interaction hole. holeContentParser :: Parser HoleContent -- | Gives the parsed token stream (including comments). tokensParser :: Parser [Token] -- | Returns the contents of the given file. readFilePM :: RangeFile -> PM Text -- | Parse errors: what you get if parsing fails. data ParseError -- | Errors that arise at a specific position in the file ParseError :: Position -> String -> String -> String -> ParseError -- | Where the error occurred. [errPos] :: ParseError -> Position -- | The remaining input. [errInput] :: ParseError -> String -- | The previous token. [errPrevToken] :: ParseError -> String -- | Hopefully an explanation of what happened. [errMsg] :: ParseError -> String -- | Parse errors that concern a range in a file. OverlappingTokensError :: Range -> ParseError -- | The range of the bigger overlapping token [errRange] :: ParseError -> Range -- | Parse errors that concern a whole file. InvalidExtensionError :: RangeFile -> [String] -> ParseError -- | The file which the error concerns. [errPath] :: ParseError -> RangeFile [errValidExts] :: ParseError -> [String] ReadFileError :: RangeFile -> IOError -> ParseError -- | The file which the error concerns. [errPath] :: ParseError -> RangeFile [errIOError] :: ParseError -> IOError -- | Warnings for parsing. data ParseWarning -- | Parse errors that concern a range in a file. OverlappingTokensWarning :: Range' SrcFile -> ParseWarning -- | The range of the bigger overlapping token. [warnRange] :: ParseWarning -> Range' SrcFile -- | The String is the error message. MisplacedAttributes :: Range -> String -> ParseWarning -- | Unknown polarity, ignored. UnknownPolarity :: Range -> String -> ParseWarning -- | Unknown attribute, ignored. The Range includes the "@", the -- String not. UnknownAttribute :: Range -> String -> ParseWarning -- | Unsupported attribute. UnsupportedAttribute :: Range -> Maybe String -> ParseWarning -- | Multiple attributes. MultipleAttributes :: Range -> Maybe String -> ParseWarning -- | The closing bracket (at the Range) was closed with a -- unicode-ness that doesn't match that of the OpenBracket. MismatchedBrackets :: Range -> OpenBracket -> ParseWarning -- | A monad for handling parse errors and warnings. newtype PM a PM :: ExceptT ParseError (StateT [ParseWarning] IO) a -> PM a [unPM] :: PM a -> ExceptT ParseError (StateT [ParseWarning] IO) a -- | Run a PM computation, returning a list of warnings in -- first-to-last order and either a parse error or the parsed thing. runPMIO :: MonadIO m => PM a -> m (Either ParseError a, [ParseWarning]) instance GHC.Internal.Base.Applicative Agda.Syntax.Parser.PM instance GHC.Internal.Base.Functor Agda.Syntax.Parser.PM instance Control.Monad.Error.Class.MonadError Agda.Syntax.Parser.Monad.ParseError Agda.Syntax.Parser.PM instance GHC.Internal.Control.Monad.IO.Class.MonadIO Agda.Syntax.Parser.PM instance GHC.Internal.Base.Monad Agda.Syntax.Parser.PM instance Control.Monad.State.Class.MonadState [Agda.Syntax.Parser.Monad.ParseWarning] Agda.Syntax.Parser.PM -- | The abstract syntax. This is what you get after desugaring and scope -- analysis of the concrete syntax. The type checker works on abstract -- syntax, producing internal syntax (Agda.Syntax.Internal). module Agda.Syntax.Abstract -- | Pattern synonym for regular Def. pattern Def :: QName -> Expr app :: Expr -> [NamedArg Expr] -> Expr -- | The name defined by the given axiom. -- -- Precondition: The declaration has to be a (scoped) Axiom. axiomName :: Declaration -> QName -- | The clause spine corresponding to a clause. clauseSpine :: Clause -> ClauseSpine -- | The declaration spine corresponding to a declaration. declarationSpine :: Declaration -> DeclarationSpine extractPattern :: Binder' a -> Maybe (Pattern, a) -- | Smart constructor for Generalized. generalized :: Set QName -> Type -> Type insertImplicitPatSynArgs :: HasRange a => (Hiding -> Range -> a) -> Range -> [WithHiding Name] -> [NamedArg a] -> Maybe ([(Name, a)], [WithHiding Name]) insertedBinder :: a -> Binder' a insertedBinder_ :: Name -> Binder lambdaLiftExpr :: [WithHiding Name] -> Expr -> Expr mkBindName :: Name -> BindName mkBinder :: a -> Binder' a mkBinder_ :: Name -> Binder mkDomainFree :: NamedArg Binder -> LamBinding mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr mkPi :: ExprInfo -> Telescope -> Type -> Type mkTBind :: Range -> List1 (NamedArg Binder) -> Type -> TypedBinding mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding noDataDefParams :: DataDefParams noWhereDecls :: WhereDeclarations -- | Size of the range of the renaming. renamingSize :: Ren a -> Int -- | The right-hand side spine corresponding to a right-hand side. rhsSpine :: RHS -> RHSSpine -- | The spine corresponding to a WhereDeclarations value. whereDeclarationsSpine :: WhereDeclarations -> WhereDeclarationsSpine -- | Are we in an abstract block? -- -- In that case some definition is abstract. class AnyAbstract a anyAbstract :: AnyAbstract a => a -> Bool ($dmanyAbstract) :: forall (t :: Type -> Type) b. (AnyAbstract a, Foldable t, AnyAbstract b, t b ~ a) => a -> Bool type Args = [NamedArg Expr] -- | Record field assignment f = e. type Assign = FieldAssignment' Expr type Assigns = [Assign] -- | A name in a binding position: we also compare the nameConcrete when -- comparing the binders for equality. -- -- With --caching on we compare abstract syntax to determine if -- we can reuse previous typechecking results: during that comparison two -- names can have the same nameId but be semantically different, e.g. in -- {_ : A} -> .. vs. {r : A} -> ... newtype BindName BindName :: Name -> BindName [unBind] :: BindName -> Name type Binder = Binder' BindName data Binder' a Binder :: Maybe Pattern -> BinderNameOrigin -> a -> Binder' a [binderPattern] :: Binder' a -> Maybe Pattern [binderNameOrigin] :: Binder' a -> BinderNameOrigin [binderName] :: Binder' a -> a type Clause = Clause' LHS -- | We could throw away where clauses at this point and translate -- them to let. It's not obvious how to remember that the -- let was really a where clause though, so for the -- time being we keep it here. data Clause' lhs Clause :: lhs -> [ProblemEq] -> RHS -> WhereDeclarations -> Catchall -> Clause' lhs [clauseLHS] :: Clause' lhs -> lhs -- | Only in with-clauses where we inherit some already checked patterns -- from the parent. These live in the context of the parent clause -- left-hand side. [clauseStrippedPats] :: Clause' lhs -> [ProblemEq] [clauseRHS] :: Clause' lhs -> RHS [clauseWhereDecls] :: Clause' lhs -> WhereDeclarations [clauseCatchall] :: Clause' lhs -> Catchall -- | Clause spines. data ClauseSpine ClauseS :: RHSSpine -> WhereDeclarationsSpine -> ClauseSpine type Constructor = TypeSignature data DataDefParams DataDefParams :: Set Name -> [LamBinding] -> DataDefParams -- | We don't yet know the position of generalized parameters from the data -- sig, so we keep these in a set on the side. [dataDefGeneralizedParams] :: DataDefParams -> Set Name [dataDefParams] :: DataDefParams -> [LamBinding] data Declaration -- | Type signature (can be irrelevant, but not hidden). -- -- The fourth argument contains an optional assignment of polarities to -- arguments. Axiom :: KindOfName -> DefInfo -> ArgInfo -> Maybe PragmaPolarities -> QName -> Type -> Declaration -- | The first argument is the (possibly empty) set of generalizable -- variables used in the type. Generalize :: Set QName -> DefInfo -> ArgInfo -> QName -> Type -> Declaration -- | record field Field :: DefInfo -> QName -> Arg Type -> Declaration -- | primitive function Primitive :: DefInfo -> QName -> Arg Type -> Declaration -- | a bunch of mutually recursive definitions Mutual :: MutualInfo -> List1 Declaration -> Declaration Section :: Range -> Erased -> ModuleName -> GeneralizeTelescope -> [Declaration] -> Declaration -- | The ImportDirective is for highlighting purposes. Apply :: ModuleInfo -> Erased -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> ImportDirective -> Declaration -- | The ImportDirective is for highlighting purposes. Import :: ModuleInfo -> ModuleName -> ImportDirective -> Declaration Pragma :: Range -> Pragma -> Declaration Open :: ModuleInfo -> ModuleName -> ImportDirective -> Declaration -- | sequence of function clauses FunDef :: DefInfo -> QName -> List1 Clause -> Declaration -- | lone data signature DataSig :: DefInfo -> Erased -> QName -> GeneralizeTelescope -> Type -> Declaration DataDef :: DefInfo -> QName -> PositivityCheck -> UniverseCheck -> DataDefParams -> [Constructor] -> Declaration -- | lone record signature RecSig :: DefInfo -> Erased -> QName -> GeneralizeTelescope -> Type -> Declaration -- | The Type gives the constructor type telescope, (x1 : -- A1)..(xn : An) -> Dummy, and the optional name is the -- constructor's name. The optional Range is for the -- pattern attribute. RecDef :: DefInfo -> QName -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> RecordDirectives -> DataDefParams -> Type -> [Declaration] -> Declaration -- | Only for highlighting purposes PatternSynDef :: QName -> [WithHiding BindName] -> Pattern' Void -> Declaration UnquoteDecl :: MutualInfo -> [DefInfo] -> [QName] -> Expr -> Declaration UnquoteDef :: [DefInfo] -> [QName] -> Expr -> Declaration UnquoteData :: [DefInfo] -> QName -> UniverseCheck -> [DefInfo] -> [QName] -> Expr -> Declaration -- | scope annotation ScopedDecl :: ScopeInfo -> List1 Declaration -> Declaration -- | Only for highlighting the unfolded names UnfoldingDecl :: Range -> [QName] -> Declaration -- | Declaration spines. Used in debugging to make it easy to see where -- constructors such as ScopedDecl and Mutual are placed. data DeclarationSpine AxiomS :: DeclarationSpine GeneralizeS :: DeclarationSpine FieldS :: DeclarationSpine PrimitiveS :: DeclarationSpine MutualS :: List1 DeclarationSpine -> DeclarationSpine SectionS :: [DeclarationSpine] -> DeclarationSpine ApplyS :: DeclarationSpine ImportS :: DeclarationSpine PragmaS :: DeclarationSpine OpenS :: DeclarationSpine FunDefS :: List1 ClauseSpine -> DeclarationSpine DataSigS :: DeclarationSpine DataDefS :: DeclarationSpine RecSigS :: DeclarationSpine RecDefS :: [DeclarationSpine] -> DeclarationSpine PatternSynDefS :: DeclarationSpine UnquoteDeclS :: DeclarationSpine UnquoteDefS :: DeclarationSpine UnquoteDataS :: DeclarationSpine ScopedDeclS :: List1 DeclarationSpine -> DeclarationSpine UnfoldingDeclS :: DeclarationSpine type DefInfo = DefInfo' Expr -- | Expressions after scope checking (operators parsed, names resolved). data Expr -- | Bound variable. Var :: Name -> Expr -- | Constant: axiom, function, data or record type, with a possible -- suffix. Def' :: QName -> Suffix -> Expr -- | Projection (overloaded). Proj :: ProjOrigin -> AmbiguousQName -> Expr -- | Constructor (overloaded). Con :: AmbiguousQName -> Expr -- | Pattern synonym. PatternSyn :: AmbiguousQName -> Expr -- | Macro. Macro :: QName -> Expr -- | Literal. Lit :: ExprInfo -> Literal -> Expr -- | Meta variable for interaction. The InteractionId is usually -- identical with the metaNumber of MetaInfo. However, if -- you want to print an interaction meta as just ? instead of -- ?n, you should set the metaNumber to Nothing -- while keeping the InteractionId. QuestionMark :: MetaInfo -> InteractionId -> Expr -- | Meta variable for hidden argument (must be inferred locally). Underscore :: MetaInfo -> Expr -- | .e, for postfix projection. Dot :: ExprInfo -> Expr -> Expr -- | Ordinary (binary) application. App :: AppInfo -> Expr -> NamedArg Expr -> Expr -- | With application. WithApp :: ExprInfo -> Expr -> List1 Expr -> Expr -- | λ bs → e. Lam :: ExprInfo -> LamBinding -> Expr -> Expr -- | λ() or λ{}. AbsurdLam :: ExprInfo -> Hiding -> Expr ExtendedLam :: ExprInfo -> DefInfo -> Erased -> QName -> List1 Clause -> Expr -- | Dependent function space Γ → A. Pi :: ExprInfo -> Telescope1 -> Type -> Expr -- | Like a Pi, but the ordering is not known Generalized :: Set1 QName -> Type -> Expr -- | Non-dependent function space. Fun :: ExprInfo -> Arg Type -> Type -> Expr -- | let bs in e. Let :: ExprInfo -> List1 LetBinding -> Expr -> Expr -- | Record construction. The KwRange is for the record -- kewyword. Rec :: KwRange -> ExprInfo -> RecordAssigns -> Expr -- | Record update. The KwRange is for the record kewyword. RecUpdate :: KwRange -> ExprInfo -> Expr -> Assigns -> Expr -- | Quote an identifier QName. Quote :: ExprInfo -> Expr -- | Quote a term. QuoteTerm :: ExprInfo -> Expr -- | The splicing construct: unquote ... Unquote :: ExprInfo -> Expr -- | Scope annotation. ScopedExpr :: ScopeInfo -> Expr -> Expr -- | For remembering the module name of a qualified do block. Qualified :: ModuleName -> Expr -> Expr -- | For printing annotated terms produced by the type checker. Highlighted :: Aspects -> Expr -> Expr -- | For printing DontCare from Agda.Syntax.Internal. DontCare :: Expr -> Expr type Field = TypeSignature data GeneralizeTelescope GeneralizeTel :: Map QName Name -> Telescope -> GeneralizeTelescope -- | Maps generalize variables to the corresponding bound variable (to be -- introduced by the generalisation). [generalizeTelVars] :: GeneralizeTelescope -> Map QName Name [generalizeTel] :: GeneralizeTelescope -> Telescope type HoleContent = HoleContent' () BindName Pattern Expr type ImportDirective = ImportDirective' QName ModuleName type ImportedName = ImportedName' QName ModuleName -- | The lhs of a clause in focused (projection-application) view -- (outside-in). Projection patters are represented as LHSProjs. data LHS LHS :: LHSInfo -> LHSCore -> LHS -- | Range. [lhsInfo] :: LHS -> LHSInfo -- | Copatterns. [lhsCore] :: LHS -> LHSCore type LHSCore = LHSCore' Expr -- | The lhs in projection-application and with-pattern view. Parameterised -- over the type e of dot patterns. data LHSCore' e -- | The head applied to ordinary patterns. LHSHead :: QName -> [NamedArg (Pattern' e)] -> LHSCore' e -- | Head f. [lhsDefName] :: LHSCore' e -> QName -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] -- | Projection. LHSProj :: AmbiguousQName -> NamedArg (LHSCore' e) -> [NamedArg (Pattern' e)] -> LHSCore' e -- | Record projection identifier. [lhsDestructor] :: LHSCore' e -> AmbiguousQName -- | Main argument of projection. [lhsFocus] :: LHSCore' e -> NamedArg (LHSCore' e) -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] -- | With patterns. LHSWith :: LHSCore' e -> List1 (Arg (Pattern' e)) -> [NamedArg (Pattern' e)] -> LHSCore' e -- | E.g. the LHSHead. [lhsHead] :: LHSCore' e -> LHSCore' e -- | Applied to with patterns | p1 | ... | pn. These patterns are -- not prefixed with WithP! [lhsWithPatterns] :: LHSCore' e -> List1 (Arg (Pattern' e)) -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] -- | A lambda binding is either domain free or typed. data LamBinding -- | . x or {x} or .x or {x = y} or -- x@p or (p) DomainFree :: TacticAttribute -> NamedArg Binder -> LamBinding -- | . (xs:e) or {xs:e} or (let Ds) DomainFull :: TypedBinding -> LamBinding -- | Bindings that are valid in a let. data LetBinding -- |
--   LetBind info rel name type defn
--   
LetBind :: LetInfo -> ArgInfo -> BindName -> Type -> Expr -> LetBinding -- | Function declarations in a let with no matching body. LetAxiom :: LetInfo -> ArgInfo -> BindName -> Type -> LetBinding -- | Irrefutable pattern binding. LetPatBind :: LetInfo -> ArgInfo -> Pattern -> Expr -> LetBinding -- | LetApply mi newM (oldM args) renamings dir. The -- ImportDirective is for highlighting purposes. LetApply :: ModuleInfo -> Erased -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> ImportDirective -> LetBinding -- | only for highlighting and abstractToConcrete LetOpen :: ModuleInfo -> ModuleName -> ImportDirective -> LetBinding data ModuleApplication -- | tel. M args: applies M to args and -- abstracts tel. SectionApp :: Telescope -> ModuleName -> [NamedArg Expr] -> ModuleApplication -- |
--   M {{...}}
--   
RecordModuleInstance :: ModuleName -> ModuleApplication type NAPs e = [NamedArg Pattern' e] type NAPs1 e = List1 NamedArg Pattern' e -- | Turn a name into an expression. class NameToExpr a nameToExpr :: NameToExpr a => a -> Expr type Pattern = Pattern' Expr -- | Parameterised over the type of dot patterns. data Pattern' e VarP :: BindName -> Pattern' e ConP :: ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e -- | Destructor pattern d. ProjP :: PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e -- | Defined pattern: function definition f ps. It is also abused -- to convert destructor patterns into concrete syntax thus, we put -- AmbiguousQName here as well. DefP :: PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e -- | Underscore pattern entered by user. Or generated at type checking for -- implicit arguments. WildP :: PatInfo -> Pattern' e AsP :: PatInfo -> BindName -> Pattern' e -> Pattern' e -- | Dot pattern .e DotP :: PatInfo -> e -> Pattern' e AbsurdP :: PatInfo -> Pattern' e LitP :: PatInfo -> Literal -> Pattern' e PatternSynP :: PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e RecP :: KwRange -> ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e EqualP :: PatInfo -> List1 (e, e) -> Pattern' e -- | | p, for with-patterns. WithP :: PatInfo -> Pattern' e -> Pattern' e -- | The definition of a pattern synonym (excluding its name). data PatternSynDefn PatternSynDefn :: [WithHiding Name] -> Pattern' Void -> PatternSynDefn -- | The parameters of the pattern synonym. [patSynParams] :: PatternSynDefn -> [WithHiding Name] -- | The definiting pattern of the pattern synonym. [patSynPat] :: PatternSynDefn -> Pattern' Void type PatternSynDefns = Map QName PatternSynDefn type Patterns = [NamedArg Pattern] data Pragma OptionsPragma :: [String] -> Pragma -- | ResolvedName is not UnknownName. Name can be ambiguous -- e.g. for built-in constructors. BuiltinPragma :: RString -> ResolvedName -> Pragma -- | Builtins that do not come with a definition, but declare a name for an -- Agda concept. BuiltinNoDefPragma :: RString -> KindOfName -> QName -> Pragma -- | Range is range of REWRITE keyword. RewritePragma :: Range -> [QName] -> Pragma CompilePragma :: Ranged BackendName -> QName -> String -> Pragma ForeignPragma :: Ranged BackendName -> String -> Pragma StaticPragma :: QName -> Pragma InjectivePragma :: QName -> Pragma InjectiveForInferencePragma :: QName -> Pragma InlinePragma :: Bool -> QName -> Pragma -- | Mark the definition as not being projection-like NotProjectionLikePragma :: QName -> Pragma -- | If the definition is an instance, set its overlap mode. OverlapPragma :: QName -> OverlapMode -> Pragma DisplayPragma :: QName -> [NamedArg Pattern] -> Expr -> Pragma -- | A user pattern together with an internal term that it should be equal -- to after splitting is complete. Special cases: * User pattern is a -- variable but internal term isn't: this will be turned into an as -- pattern. * User pattern is a dot pattern: this pattern won't trigger -- any splitting but will be checked for equality after all splitting is -- complete and as patterns have been bound. * User pattern is an absurd -- pattern: emptiness of the type will be checked after splitting is -- complete. * User pattern is an annotated wildcard: type annotation -- will be checked after splitting is complete. data ProblemEq ProblemEq :: Pattern -> Term -> Dom Type -> ProblemEq [problemInPat] :: ProblemEq -> Pattern [problemInst] :: ProblemEq -> Term [problemType] :: ProblemEq -> Dom Type data RHS RHS :: Expr -> Maybe Expr -> RHS [rhsExpr] :: RHS -> Expr -- | We store the original concrete expression in case we have to reproduce -- it during interactive case splitting. Nothing for internally -- generated rhss. [rhsConcrete] :: RHS -> Maybe Expr AbsurdRHS :: RHS -- | The QName is the name of the with function. WithRHS :: QName -> List1 WithExpr -> List1 Clause -> RHS RewriteRHS :: [RewriteEqn] -> [ProblemEq] -> RHS -> WhereDeclarations -> RHS -- | The QNames are the names of the generated with functions, one -- for each Expr. [rewriteExprs] :: RHS -> [RewriteEqn] -- | The patterns stripped by with-desugaring. These are only present if -- this rewrite follows a with. [rewriteStrippedPats] :: RHS -> [ProblemEq] -- | The RHS should not be another RewriteRHS. [rewriteRHS] :: RHS -> RHS -- | The where clauses are attached to the RewriteRHS by [rewriteWhereDecls] :: RHS -> WhereDeclarations -- | Right-hand side spines. data RHSSpine RHSS :: RHSSpine AbsurdRHSS :: RHSSpine WithRHSS :: List1 ClauseSpine -> RHSSpine RewriteRHSS :: RHSSpine -> WhereDeclarationsSpine -> RHSSpine type RecordAssign = Either Assign ModuleName type RecordAssigns = [RecordAssign] -- | How did we get our hands on the QName for the constructor of -- this record? data RecordConName -- | The user wrote it. NamedRecCon :: QName -> RecordConName [recordConName] :: RecordConName -> QName -- | We made it up. FreshRecCon :: QName -> RecordConName [recordConName] :: RecordConName -> QName type RecordDirectives = RecordDirectives' RecordConName -- | Renaming (generic). type Ren a = Map a List1 a type Renaming = Renaming' QName ModuleName type RewriteEqn = RewriteEqn' QName BindName Pattern Expr -- | Information created by the scope checker necessary for type-checking a -- module copy. data ScopeCopyInfo ScopeCopyInfo :: Ren ModuleName -> Ren QName -> ScopeCopyInfo -- | Associates to each (original) module name the list of copies that -- should be created. [renModules] :: ScopeCopyInfo -> Ren ModuleName -- | Same as for renModules, but for definitions. [renNames] :: ScopeCopyInfo -> Ren QName type SpineClause = Clause' SpineLHS -- | The lhs of a clause in spine view (inside-out). Projection patterns -- are contained in spLhsPats, represented as ProjP d. data SpineLHS SpineLHS :: LHSInfo -> QName -> [NamedArg Pattern] -> SpineLHS -- | Range. [spLhsInfo] :: SpineLHS -> LHSInfo -- | Name of function we are defining. [spLhsDefName] :: SpineLHS -> QName -- | Elimination by pattern, projections, with-patterns. [spLhsPats] :: SpineLHS -> [NamedArg Pattern] class SubstExpr a substExpr :: SubstExpr a => [(Name, Expr)] -> a -> a ($dmsubstExpr) :: forall (t :: Type -> Type) b. (SubstExpr a, Functor t, SubstExpr b, t b ~ a) => [(Name, Expr)] -> a -> a type TacticAttribute = TacticAttribute' Expr type Telescope = [TypedBinding] type Telescope1 = List1 TypedBinding -- | Types are just expressions. Use this type synonym for hinting that an -- expression should be a type. type Type = Expr -- | Only Axioms. type TypeSignature = Declaration -- | A typed binding. Appears in dependent function spaces, typed lambdas, -- and telescopes. It might be tempting to simplify this to only bind a -- single name at a time, and translate, say, (x y : A) to -- (x : A)(y : A) before type-checking. However, this would be -- slightly problematic: -- --
    --
  1. We would have to typecheck the type A several times.
  2. --
  3. If A contains a meta variable or hole, it would be -- duplicated by such a translation.
  4. --
-- -- While 1. is only slightly inefficient, 2. would be an outright bug. -- Duplicating A could not be done naively, we would have to -- make sure that the metas of the copy are aliases of the metas of the -- original. data TypedBinding -- | As in telescope (x y z : A) or type (x y z : A) -> -- B. TBind :: Range -> TypedBindingInfo -> List1 (NamedArg Binder) -> Type -> TypedBinding -- | E.g. (let x = e) or (let open M). TLet :: Range -> List1 LetBinding -> TypedBinding -- | Extra information that is attached to a typed binding, that plays a -- role during type checking but strictly speaking is not part of the -- name : type" relation which a makes up a binding. data TypedBindingInfo TypedBindingInfo :: TacticAttribute -> Bool -> TypedBindingInfo -- | Does this binding have a tactic annotation? [tbTacticAttr] :: TypedBindingInfo -> TacticAttribute -- | Does this binding correspond to a Partial binder, rather than to a Pi -- binder? Must be present here to be reflected into abstract syntax -- later (and to be printed to the user later). [tbFinite] :: TypedBindingInfo -> Bool data WhereDeclarations WhereDecls :: Maybe ModuleName -> Bool -> Maybe Declaration -> WhereDeclarations [whereModule] :: WhereDeclarations -> Maybe ModuleName -- | is it an ordinary unnamed where? [whereAnywhere] :: WhereDeclarations -> Bool -- | The declaration is a Section. [whereDecls] :: WhereDeclarations -> Maybe Declaration -- | Spines corresponding to WhereDeclarations values. data WhereDeclarationsSpine WhereDeclsS :: Maybe DeclarationSpine -> WhereDeclarationsSpine type WithExpr = WithExpr' Expr type WithExpr' e = Named BindName Arg e instance Agda.Syntax.Abstract.AnyAbstract Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Abstract.AnyAbstract a => Agda.Syntax.Abstract.AnyAbstract [a] instance Agda.Syntax.Abstract.AnyAbstract a => Agda.Syntax.Abstract.AnyAbstract (Agda.Utils.List1.List1 a) instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.BindName instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Abstract.Binder' a) instance GHC.Internal.Classes.Eq lhs => GHC.Internal.Classes.Eq (Agda.Syntax.Abstract.Clause' lhs) instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.DataDefParams instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Declaration instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Expr instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.GeneralizeTelescope instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.LHS instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Abstract.LHSCore' e) instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.LamBinding instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.LetBinding instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.ModuleApplication instance GHC.Internal.Classes.Eq e => GHC.Internal.Classes.Eq (Agda.Syntax.Abstract.Pattern' e) instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.Pragma instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.ProblemEq instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.RHS instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.RecordConName instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.SpineLHS instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.TypedBinding instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.TypedBindingInfo instance GHC.Internal.Classes.Eq Agda.Syntax.Abstract.WhereDeclarations instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Abstract.Binder' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Abstract.Clause' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Abstract.LHSCore' instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Abstract.Pattern' instance GHC.Internal.Base.Functor Agda.Syntax.Abstract.Binder' instance GHC.Internal.Base.Functor Agda.Syntax.Abstract.Clause' instance GHC.Internal.Base.Functor Agda.Syntax.Abstract.LHSCore' instance GHC.Internal.Base.Functor Agda.Syntax.Abstract.Pattern' instance GHC.Internal.Generics.Generic (Agda.Syntax.Abstract.Binder' a) instance GHC.Internal.Generics.Generic (Agda.Syntax.Abstract.Clause' lhs) instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.DataDefParams instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Declaration instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Expr instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.GeneralizeTelescope instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.LHS instance GHC.Internal.Generics.Generic (Agda.Syntax.Abstract.LHSCore' e) instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.LamBinding instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.LetBinding instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.ModuleApplication instance GHC.Internal.Generics.Generic (Agda.Syntax.Abstract.Pattern' e) instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.PatternSynDefn instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.Pragma instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.ProblemEq instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.RHS instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.RecordConName instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.SpineLHS instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.TypedBinding instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.TypedBindingInfo instance GHC.Internal.Generics.Generic Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.Binder' a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.Clause' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Expr instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.LHS instance Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.LHSCore' e) instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.RHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Abstract.Name.IsProjP Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.Name.IsProjP (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.Binder' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.Clause' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.DataDefParams instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Expr instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.GeneralizeTelescope instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.LHS instance Agda.Syntax.Position.KillRange e => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.LHSCore' e) instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Position.KillRange e => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.PatternSynDefn instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.ProblemEq instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.RHS instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.RecordConName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.ScopeCopyInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.Suffix instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.TypedBindingInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Common.LensHiding Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Common.LensHiding Agda.Syntax.Abstract.TypedBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.BindName instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Abstract.Binder' a) instance Control.DeepSeq.NFData lhs => Control.DeepSeq.NFData (Agda.Syntax.Abstract.Clause' lhs) instance Control.DeepSeq.NFData Agda.Syntax.Abstract.DataDefParams instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Declaration instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Expr instance Control.DeepSeq.NFData Agda.Syntax.Abstract.GeneralizeTelescope instance Control.DeepSeq.NFData Agda.Syntax.Abstract.LHS instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Abstract.LHSCore' e) instance Control.DeepSeq.NFData Agda.Syntax.Abstract.LamBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.LetBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.ModuleApplication instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Abstract.Pattern' e) instance Control.DeepSeq.NFData Agda.Syntax.Abstract.PatternSynDefn instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Pragma instance Control.DeepSeq.NFData Agda.Syntax.Abstract.ProblemEq instance Control.DeepSeq.NFData Agda.Syntax.Abstract.RHS instance Control.DeepSeq.NFData Agda.Syntax.Abstract.RecordConName instance Control.DeepSeq.NFData Agda.Syntax.Abstract.ScopeCopyInfo instance Control.DeepSeq.NFData Agda.Syntax.Abstract.SpineLHS instance Control.DeepSeq.NFData Agda.Syntax.Abstract.TypedBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.TypedBindingInfo instance Control.DeepSeq.NFData Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Abstract.NameToExpr Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Abstract.NameToExpr Agda.Syntax.Scope.Base.ResolvedName instance Agda.Utils.Null.Null Agda.Syntax.Abstract.TypedBindingInfo instance Agda.Utils.Null.Null Agda.Syntax.Abstract.WhereDeclarations instance GHC.Internal.Classes.Ord Agda.Syntax.Abstract.BindName instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Abstract.ScopeCopyInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.SetRange (Agda.Syntax.Abstract.Pattern' a) instance GHC.Internal.Show.Show Agda.Syntax.Abstract.BindName instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Abstract.Binder' a) instance GHC.Internal.Show.Show lhs => GHC.Internal.Show.Show (Agda.Syntax.Abstract.Clause' lhs) instance GHC.Internal.Show.Show Agda.Syntax.Abstract.ClauseSpine instance GHC.Internal.Show.Show Agda.Syntax.Abstract.DataDefParams instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Declaration instance GHC.Internal.Show.Show Agda.Syntax.Abstract.DeclarationSpine instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Expr instance GHC.Internal.Show.Show Agda.Syntax.Abstract.GeneralizeTelescope instance GHC.Internal.Show.Show Agda.Syntax.Abstract.LHS instance GHC.Internal.Show.Show e => GHC.Internal.Show.Show (Agda.Syntax.Abstract.LHSCore' e) instance GHC.Internal.Show.Show Agda.Syntax.Abstract.LamBinding instance GHC.Internal.Show.Show Agda.Syntax.Abstract.LetBinding instance GHC.Internal.Show.Show Agda.Syntax.Abstract.ModuleApplication instance GHC.Internal.Show.Show e => GHC.Internal.Show.Show (Agda.Syntax.Abstract.Pattern' e) instance GHC.Internal.Show.Show Agda.Syntax.Abstract.PatternSynDefn instance GHC.Internal.Show.Show Agda.Syntax.Abstract.Pragma instance GHC.Internal.Show.Show Agda.Syntax.Abstract.ProblemEq instance GHC.Internal.Show.Show Agda.Syntax.Abstract.RHS instance GHC.Internal.Show.Show Agda.Syntax.Abstract.RHSSpine instance GHC.Internal.Show.Show Agda.Syntax.Abstract.RecordConName instance GHC.Internal.Show.Show Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Internal.Show.Show Agda.Syntax.Abstract.SpineLHS instance GHC.Internal.Show.Show Agda.Syntax.Abstract.TypedBinding instance GHC.Internal.Show.Show Agda.Syntax.Abstract.TypedBindingInfo instance GHC.Internal.Show.Show Agda.Syntax.Abstract.WhereDeclarations instance GHC.Internal.Show.Show Agda.Syntax.Abstract.WhereDeclarationsSpine instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr (Agda.Syntax.Common.Arg a) instance (Agda.Syntax.Abstract.SubstExpr a, Agda.Syntax.Abstract.SubstExpr b) => Agda.Syntax.Abstract.SubstExpr (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Abstract.SubstExpr Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr [a] instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Abstract.SubstExpr Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.SubstExpr Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr (Agda.Utils.List1.List1 a) instance (Agda.Syntax.Abstract.SubstExpr a, Agda.Syntax.Abstract.SubstExpr b) => Agda.Syntax.Abstract.SubstExpr (a, b) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Abstract.Binder' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Abstract.Clause' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Abstract.LHSCore' instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Abstract.Pattern' instance Agda.Syntax.Common.Underscore Agda.Syntax.Abstract.Expr module Agda.Syntax.Abstract.Views -- | An Expr viewed as application. data AppView' arg Application :: Expr -> [NamedArg arg] -> AppView' arg type AppView = AppView' Expr -- | Gather applications to expose head and spine. -- -- Note: -- --
    --
  1. Everything is an application, possibly of itself to 0 -- arguments.
  2. --
  3. If the returned head is a projection originating from a post-fix -- projection, the ArgInfo of the first argument might be -- incorrect. (See issue #8300.) For instance x .f is valid -- postfix syntax for f {{x}}, but appView turns the -- former into f x. The correct f {{x}} is produced by -- appViewM.
  4. --
appView :: Expr -> AppView appView' :: Expr -> AppView' (AppInfo, Expr) maybeProjTurnPostfix :: Expr -> Maybe (AmbiguousQName, Expr) unAppView :: AppView -> Expr -- | Collects plain lambdas. data LamView LamView :: [LamBinding] -> Expr -> LamView lamView :: Expr -> LamView -- | Collect A.Pis. data PiView PiView :: [(ExprInfo, Telescope1)] -> Type -> PiView piView :: Expr -> PiView unPiView :: PiView -> Expr -- | Gather top-level AsPatterns to expose underlying pattern. asView :: Pattern -> ([Name], Pattern) -- | Remove top ScopedExpr wrappers. unScope :: Expr -> Expr -- | Remove ScopedExpr wrappers everywhere. -- -- NB: Unless the implementation of ExprLike for clauses has been -- finished, this does not work for clauses yet. deepUnscope :: ExprLike a => a -> a class DeepUnscopeDecls (t :: Type -> Type) deepUnscopeDecls :: DeepUnscopeDecls t => t Declaration -> t Declaration deepUnscopeDecl :: Declaration -> List1 Declaration type RecurseExprFn (m :: Type -> Type) a = Applicative m => Expr -> m Expr -> m Expr -> a -> m a type RecurseExprRecFn (m :: Type -> Type) = forall a. ExprLike a => a -> m a type FoldExprFn m a = Monoid m => Expr -> m -> a -> m type FoldExprRecFn m = forall a. ExprLike a => a -> m type TraverseExprFn (m :: Type -> Type) a = Monad m => Expr -> m Expr -> a -> m a type TraverseExprRecFn (m :: Type -> Type) = forall a. ExprLike a => a -> m a -- | Apply an expression rewriting to every subexpression, inside-out. See -- Agda.Syntax.Internal.Generic. class ExprLike a -- | The first expression is pre-traversal, the second one post-traversal. recurseExpr :: ExprLike a => RecurseExprFn m a ($dmrecurseExpr) :: forall (f :: Type -> Type) a' m. (ExprLike a, Traversable f, ExprLike a', a ~ f a', Applicative m) => (Expr -> m Expr -> m Expr) -> a -> m a foldExpr :: ExprLike a => FoldExprFn m a traverseExpr :: ExprLike a => TraverseExprFn m a mapExpr :: ExprLike a => (Expr -> Expr) -> a -> a type KName = WithKind QName -- | Extracts "all" names which are declared in a Declaration. -- -- Includes: local modules and where clauses. Excludes: open -- public, let, with function names, extended -- lambdas. class DeclaredNames a declaredNames :: (DeclaredNames a, Collection KName m) => a -> m ($dmdeclaredNames) :: forall (t :: Type -> Type) b m. (DeclaredNames a, Foldable t, DeclaredNames b, t b ~ a, Collection KName m) => a -> m instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Clause instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Declaration instance (Agda.Syntax.Abstract.Views.DeclaredNames a, Agda.Syntax.Abstract.Views.DeclaredNames b) => Agda.Syntax.Abstract.Views.DeclaredNames (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames [a] instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (Agda.Utils.List1.List1 a) instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Pragma instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.RHS instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.RecordDirectives instance (Agda.Syntax.Abstract.Views.DeclaredNames a, Agda.Syntax.Abstract.Views.DeclaredNames b) => Agda.Syntax.Abstract.Views.DeclaredNames (a, b) instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Views.KName instance Agda.Syntax.Abstract.Views.DeepUnscopeDecls [] instance Agda.Syntax.Abstract.Views.DeepUnscopeDecls Agda.Utils.List1.List1 instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.BindName instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Abstract.Clause' a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.DataDefParams instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Declaration instance (Agda.Syntax.Abstract.Views.ExprLike a, Agda.Syntax.Abstract.Views.ExprLike b) => Agda.Syntax.Abstract.Views.ExprLike (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.GeneralizeTelescope instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.LHS instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Abstract.LHSCore' a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike [a] instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.Named x a) instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Utils.List1.List1 a) instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Abstract.Pattern' a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Pragma instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.RHS instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.Ranged a) instance (Agda.Syntax.Abstract.Views.ExprLike qn, Agda.Syntax.Abstract.Views.ExprLike p, Agda.Syntax.Abstract.Views.ExprLike e) => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Concrete.TacticAttribute' a) instance (Agda.Syntax.Abstract.Views.ExprLike a, Agda.Syntax.Abstract.Views.ExprLike b) => Agda.Syntax.Abstract.Views.ExprLike (a, b) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.TypedBindingInfo instance Agda.Syntax.Abstract.Views.ExprLike GHC.Internal.Base.Void instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.WithHiding a) instance GHC.Internal.Base.Functor Agda.Syntax.Abstract.Views.AppView' module Agda.Syntax.Abstract.UsedNames -- | All names used in an abstract expression. This is used when rendering -- clauses to figure out which (implicit) pattern variables must be -- preserved. For example, the for f : Nat → Nat, the clause -- f {n} = 0 can be printed as f = 0 (dropping the -- n), but f {n} = n must preserve the n. allUsedNames :: Expr -> Set Name allBoundNames :: BoundAndUsed a => a -> Set Name instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed a => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.BindName instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed name => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Abstract.Binder' name) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.UsedNames.BoundAndUsedNames instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed lhs => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Abstract.Clause' lhs) instance (Agda.Syntax.Abstract.UsedNames.BoundAndUsed a, Agda.Syntax.Abstract.UsedNames.BoundAndUsed b) => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed e => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Concrete.FieldAssignment' e) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.LHS instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed e => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Abstract.LHSCore' e) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed a => Agda.Syntax.Abstract.UsedNames.BoundAndUsed [a] instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed a => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed a => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed a => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Utils.List1.List1 a) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed e => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.RHS instance (Agda.Syntax.Abstract.UsedNames.BoundAndUsed x, Agda.Syntax.Abstract.UsedNames.BoundAndUsed p, Agda.Syntax.Abstract.UsedNames.BoundAndUsed e) => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (Agda.Syntax.Common.RewriteEqn' q x p e) instance (Agda.Syntax.Abstract.UsedNames.BoundAndUsed a, Agda.Syntax.Abstract.UsedNames.BoundAndUsed b) => Agda.Syntax.Abstract.UsedNames.BoundAndUsed (a, b) instance Agda.Syntax.Abstract.UsedNames.BoundAndUsed Agda.Syntax.Abstract.TypedBinding instance GHC.Internal.Base.Monoid Agda.Syntax.Abstract.UsedNames.BoundAndUsedNames instance GHC.Internal.Base.Semigroup Agda.Syntax.Abstract.UsedNames.BoundAndUsedNames -- | Pattern synonym utilities: folding pattern synonym definitions for -- printing and merging pattern synonym definitions to handle overloaded -- pattern synonyms. module Agda.Syntax.Abstract.PatternSynonyms -- | Match an expression against a pattern synonym. matchPatternSyn :: PatternSynDefn -> Expr -> Maybe [WithHiding Expr] -- | Match a pattern against a pattern synonym. matchPatternSynP :: PatternSynDefn -> Pattern' e -> Maybe [WithHiding (Pattern' e)] -- | Merge a list of pattern synonym definitions. Fails unless all -- definitions have the same shape (i.e. equal up to renaming of -- variables and constructor names). mergePatternSynDefs :: List1 PatternSynDefn -> Maybe PatternSynDefn -- | Auxiliary functions to handle patterns in the abstract syntax. -- -- Generic and specific traversals. module Agda.Syntax.Abstract.Pattern type NAP = NamedArg Pattern class MapNamedArgPattern a mapNamedArgPattern :: MapNamedArgPattern a => (NAP -> NAP) -> a -> a ($dmmapNamedArgPattern) :: forall (f :: Type -> Type) a'. (MapNamedArgPattern a, Functor f, MapNamedArgPattern a', a ~ f a') => (NAP -> NAP) -> a -> a -- | Generic pattern traversal. class APatternLike p where { type ADotT p; } -- | Fold pattern. foldrAPattern :: (APatternLike p, Monoid m) => (Pattern' (ADotT p) -> m -> m) -> p -> m ($dmfoldrAPattern) :: forall m (f :: Type -> Type) b. (APatternLike p, Monoid m, Foldable f, APatternLike b, ADotT p ~ ADotT b, f b ~ p) => (Pattern' (ADotT p) -> m -> m) -> p -> m -- | Traverse pattern. traverseAPatternM :: (APatternLike p, Monad m) => (Pattern' (ADotT p) -> m (Pattern' (ADotT p))) -> (Pattern' (ADotT p) -> m (Pattern' (ADotT p))) -> p -> m p ($dmtraverseAPatternM) :: forall (f :: Type -> Type) q m. (APatternLike p, Traversable f, APatternLike q, ADotT p ~ ADotT q, f q ~ p, Monad m) => (Pattern' (ADotT p) -> m (Pattern' (ADotT p))) -> (Pattern' (ADotT p) -> m (Pattern' (ADotT p))) -> p -> m p -- | Compute from each subpattern a value and collect them all in a monoid. foldAPattern :: (APatternLike p, Monoid m) => (Pattern' (ADotT p) -> m) -> p -> m -- | Traverse pattern(s) with a modification before the recursive descent. preTraverseAPatternM :: (APatternLike p, Monad m) => (Pattern' (ADotT p) -> m (Pattern' (ADotT p))) -> p -> m p -- | Traverse pattern(s) with a modification after the recursive descent. postTraverseAPatternM :: (APatternLike p, Monad m) => (Pattern' (ADotT p) -> m (Pattern' (ADotT p))) -> p -> m p -- | Map pattern(s) with a modification after the recursive descent. mapAPattern :: APatternLike p => (Pattern' (ADotT p) -> Pattern' (ADotT p)) -> p -> p -- | Collect pattern variables in left-to-right textual order. patternVars :: APatternLike p => p -> [Name] -- | Check if a pattern contains a specific (sub)pattern. containsAPattern :: APatternLike p => (Pattern' (ADotT p) -> Bool) -> p -> Bool -- | Check if a pattern contains an absurd pattern. For instance, suc -- (), does so. -- -- Precondition: contains no pattern synonyms. containsAbsurdPattern :: APatternLike p => p -> Bool -- | Check if a pattern contains an @-pattern. containsAsPattern :: APatternLike p => p -> Bool -- | Check if any user-written pattern variables occur more than once, and -- throw the given error if they do. checkPatternLinearity :: (Monad m, APatternLike p) => p -> (List1 Name -> m ()) -> m () -- | Pattern substitution. -- -- For the embedded expression, the given pattern substitution is turned -- into an expression substitution. substPattern :: [(Name, Pattern)] -> Pattern -> Pattern -- | Pattern substitution, parametrized by substitution function for -- embedded expressions. substPattern' :: (e -> e) -> [(Name, Pattern' e)] -> Pattern' e -> Pattern' e -- | Convert a pattern to an expression. -- -- Does not support all cases of patterns. Result has no Range -- info, except in identifiers. -- -- This function is only used in expanding pattern synonyms and in -- Agda.Syntax.Translation.InternalToAbstract, so we can cut some -- corners. patternToExpr :: Pattern -> Expr -- | Converting a pattern to an expression. -- -- The Hiding context is remembered to create instance metas when -- translating absurd patterns in instance position. class PatternToExpr p e patToExpr :: PatternToExpr p e => p -> Reader Hiding e ($dmpatToExpr) :: forall (t :: Type -> Type) p' e'. (PatternToExpr p e, Traversable t, PatternToExpr p' e', p ~ t p', e ~ t e') => p -> Reader Hiding e -- | Make sure that there are no dot or equality patterns (called on -- pattern synonyms). Also disallows annotated patterns. noDotOrEqPattern :: Monad m => m (Pattern' Void) -> Pattern' e -> m (Pattern' Void) -- | Split patterns into (patterns, trailing with-patterns). splitOffTrailingWithPatterns :: Patterns -> (Patterns, Patterns) -- | Get the tail of with-patterns of a pattern spine. trailingWithPatterns :: Patterns -> Patterns -- | The next patterns are ... -- -- (This view discards PatInfo.) data LHSPatternView e -- | Application patterns (non-empty list). LHSAppP :: NAPs1 e -> LHSPatternView e -- | A projection pattern. Is also stored unmodified here. LHSProjP :: ProjOrigin -> AmbiguousQName -> NamedArg (Pattern' e) -> LHSPatternView e -- | With patterns (non-empty list). These patterns are not prefixed with -- WithP. LHSWithP :: List1 (Pattern' e) -> LHSPatternView e -- | Construct the LHSPatternView of the given list (if not empty). -- -- Return the view and the remaining patterns. lhsPatternView :: NAPs e -> Maybe (LHSPatternView e, NAPs e) -- | Convert a focused lhs to spine view and back. class LHSToSpine a b lhsToSpine :: LHSToSpine a b => a -> b spineToLhs :: LHSToSpine a b => b -> a lhsCoreToSpine :: LHSCore' e -> QNamed [NamedArg (Pattern' e)] spineToLhsCore :: IsProjP e => QNamed [NamedArg (Pattern' e)] -> LHSCore' e -- | Add applicative patterns (non-projection / non-with patterns) to the -- right. lhsCoreApp :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e -- | Add with-patterns to the right. lhsCoreWith :: LHSCore' e -> List1 (Arg (Pattern' e)) -> LHSCore' e lhsCoreAddChunk :: LHSCore' e -> LHSPatternView e -> LHSCore' e -- | Add projection, with, and applicative patterns to the right. lhsCoreAddSpine :: IsProjP e => LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e -- | Used for checking pattern linearity. lhsCoreAllPatterns :: LHSCore' e -> [Pattern' e] -- | Used in 'AbstractToConcrete'. Returns a DefP. lhsCoreToPattern :: LHSCore -> Pattern mapLHSHead :: (QName -> [NamedArg Pattern] -> LHSCore) -> LHSCore -> LHSCore instance Agda.Syntax.Abstract.Pattern.APatternLike a => Agda.Syntax.Abstract.Pattern.APatternLike (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.Pattern.APatternLike a => Agda.Syntax.Abstract.Pattern.APatternLike (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Abstract.Pattern.APatternLike a => Agda.Syntax.Abstract.Pattern.APatternLike [a] instance Agda.Syntax.Abstract.Pattern.APatternLike a => Agda.Syntax.Abstract.Pattern.APatternLike (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Abstract.Pattern.APatternLike a => Agda.Syntax.Abstract.Pattern.APatternLike (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Abstract.Pattern.APatternLike (Agda.Syntax.Abstract.Pattern' a) instance (Agda.Syntax.Abstract.Pattern.APatternLike a, Agda.Syntax.Abstract.Pattern.APatternLike b, Agda.Syntax.Abstract.Pattern.ADotT a GHC.Internal.Types.~ Agda.Syntax.Abstract.Pattern.ADotT b) => Agda.Syntax.Abstract.Pattern.APatternLike (a, b) instance Agda.Syntax.Concrete.Pattern.IsWithP (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Abstract.Pattern.LHSToSpine Agda.Syntax.Abstract.Clause Agda.Syntax.Abstract.SpineClause instance Agda.Syntax.Abstract.Pattern.LHSToSpine Agda.Syntax.Abstract.LHS Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Abstract.Pattern.LHSToSpine a b => Agda.Syntax.Abstract.Pattern.LHSToSpine [a] [b] instance Agda.Syntax.Abstract.Pattern.MapNamedArgPattern Agda.Syntax.Abstract.Pattern.NAP instance Agda.Syntax.Abstract.Pattern.MapNamedArgPattern a => Agda.Syntax.Abstract.Pattern.MapNamedArgPattern (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Abstract.Pattern.MapNamedArgPattern a => Agda.Syntax.Abstract.Pattern.MapNamedArgPattern [a] instance Agda.Syntax.Abstract.Pattern.MapNamedArgPattern a => Agda.Syntax.Abstract.Pattern.MapNamedArgPattern (GHC.Internal.Maybe.Maybe a) instance (Agda.Syntax.Abstract.Pattern.MapNamedArgPattern a, Agda.Syntax.Abstract.Pattern.MapNamedArgPattern b) => Agda.Syntax.Abstract.Pattern.MapNamedArgPattern (a, b) instance Agda.Syntax.Abstract.Pattern.PatternToExpr p e => Agda.Syntax.Abstract.Pattern.PatternToExpr (Agda.Syntax.Common.Arg p) (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Abstract.Pattern.PatternToExpr p e => Agda.Syntax.Abstract.Pattern.PatternToExpr (Agda.Syntax.Concrete.FieldAssignment' p) (Agda.Syntax.Concrete.FieldAssignment' e) instance Agda.Syntax.Abstract.Pattern.PatternToExpr p e => Agda.Syntax.Abstract.Pattern.PatternToExpr [p] [e] instance Agda.Syntax.Abstract.Pattern.PatternToExpr p e => Agda.Syntax.Abstract.Pattern.PatternToExpr (Agda.Syntax.Common.Named n p) (Agda.Syntax.Common.Named n e) instance Agda.Syntax.Abstract.Pattern.PatternToExpr Agda.Syntax.Abstract.Pattern Agda.Syntax.Abstract.Expr instance GHC.Internal.Show.Show e => GHC.Internal.Show.Show (Agda.Syntax.Abstract.Pattern.LHSPatternView e) module Agda.Interaction.Base -- | Auxiliary state of an interactive computation. data CommandState CommandState :: [InteractionId] -> Maybe CurrentFile -> Maybe AbsolutePath -> CommandLineOptions -> OldInteractionScopes -> CommandQueue -> CommandState -- | The interaction points of the buffer, in the order in which they -- appear in the buffer. The interaction points are recorded in -- theTCState, but when new interaction points are added by give -- or refine Agda does not ensure that the ranges of later interaction -- points are updated. -- -- For example, consider a term cons ?0 ?1 with some ranges -- r0 r1 for the two interaction points. We refine -- ?0 := cons ?2 ?3. The new interaction points will get ranges -- r2 = r3 = r0. We cannot do much better than that, as they are -- constrained by r0 ≤ r2 ≤ r3 < r1. At this point -- (Range,InteractionId) still orders the IPs -- correctly. Now we refine ?2 := cons ?4 ?5 with r4 = r5 = -- r2; this breaks the order maintained by -- (Range,InteractionId)@. -- -- So we need some other structure to remember the correct order of IPs. -- The list theInteractionPoints serves this purpose. -- -- Alternatively, we could maintain for entries in -- InteractionPoints a path p : Genesis = [Int] into -- their genesis tree. E.g. for ?2 we would have p2 = -- [0] (the first child of ?0) and p3 = [1] (the -- second child of ?0). Then p4 = [0,0] and p5 = -- [0,1]. The order (Range,Genesis) would -- be correct then. [theInteractionPoints] :: CommandState -> [InteractionId] -- | The file which the state applies to. Only stored if the module was -- successfully type checked (potentially with warnings). [theCurrentFile] :: CommandState -> Maybe CurrentFile -- | The path supplied by the current interaction command. Unlike -- theCurrentFile, this is available while a file is being loaded, -- even if loading fails. [theCurrentFilePath] :: CommandState -> Maybe AbsolutePath -- | Reset the options on each reload to these. [optionsOnReload] :: CommandState -> CommandLineOptions -- | We remember (the scope of) old interaction points to make it possible -- to parse and compute highlighting information for the expression that -- it got replaced by. [oldInteractionScopes] :: CommandState -> OldInteractionScopes -- | The command queue. -- -- This queue should only be manipulated by -- initialiseCommandQueue and maybeAbort. [commandQueue] :: CommandState -> CommandQueue type OldInteractionScopes = Map InteractionId ScopeInfo -- | Initial auxiliary interaction state initCommandState :: CommandQueue -> CommandState -- | Information about the current main module. data CurrentFile CurrentFile :: AbsolutePath -> TopLevelModuleName -> [String] -> ClockTime -> CurrentFile -- | The file currently loaded into interaction. [currentFilePath] :: CurrentFile -> AbsolutePath -- | The top-level module name of the currently loaded file. [currentFileModule] :: CurrentFile -> TopLevelModuleName -- | The arguments to Agda used for loading the file. [currentFileArgs] :: CurrentFile -> [String] -- | The modification time stamp of the file when it was loaded. [currentFileStamp] :: CurrentFile -> ClockTime type CommandM' = StateT CommandState -- | A generalised command type. data Command' a -- | A command. Command :: a -> Command' a -- | Stop processing commands. Done :: Command' a -- | An error message for a command that could not be parsed. Error :: String -> Command' a -- | IOTCM commands. type Command = Command' IOTCM -- | IOTCM commands. -- -- The commands are obtained by applying the functions to the current -- top-level module name, if any. Note that the top-level module name is -- not used by independent commands. For other commands the top-level -- module name should be known. type IOTCM = Maybe TopLevelModuleName -> IOTCM' Range -- | Command queues. data CommandQueue CommandQueue :: TChan (Integer, Command) -> TVar (Maybe Integer) -> CommandQueue -- | Commands that should be processed, in the order in which they should -- be processed. Each command is associated with a number, and the -- numbers are strictly increasing. Abort commands are not put on this -- queue. [commands] :: CommandQueue -> TChan (Integer, Command) -- | When this variable is set to Just n an attempt is made to -- abort all commands with a command number that is at most n. [abort] :: CommandQueue -> TVar (Maybe Integer) -- | An interactive computation. type Interaction = Interaction' Range data Interaction' range -- | cmd_load m argv loads the module in file m, using -- argv as the command-line options. Cmd_load :: FilePath -> [String] -> Interaction' range -- | Show constraints on goals. Cmd_constraints :: Rewrite -> Interaction' range -- | Show unsolved metas. If there are no unsolved metas but unsolved -- constraints show those instead. Cmd_metas :: Rewrite -> Interaction' range -- | Load a file and fail if there are any unsolved meta-variables. By -- default no output is generated if the command is successful. (This -- command was previously used in Agda's installation script (Setup.hs)). Cmd_load_no_metas :: FilePath -> Interaction' range -- | Shows all the top-level names in the given module, along with their -- types. Uses the top-level scope. Cmd_show_module_contents_toplevel :: Rewrite -> String -> Interaction' range -- | Shows all the top-level names in scope which mention all the given -- identifiers in their type. Cmd_search_about_toplevel :: Rewrite -> String -> Interaction' range -- | Solve (all goals / the goal at point) whose values are determined by -- the constraints. Cmd_solveAll :: Rewrite -> Interaction' range Cmd_solveOne :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Solve (all goals / the goal at point) by using Mimer proof search. Cmd_autoOne :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_autoAll :: Rewrite -> Interaction' range -- | Parse the given expression (as if it were defined at the top-level of -- the current module) and infer its type. Cmd_infer_toplevel :: Rewrite -> String -> Interaction' range -- | Parse and type check the given expression (as if it were defined at -- the top-level of the current module) and normalise it. Cmd_compute_toplevel :: ComputeMode -> String -> Interaction' range -- | cmd_compile b m argv compiles the module in file m -- using the backend b, using argv as the command-line -- options. Cmd_compile :: CompilerBackend -> FilePath -> [String] -> Interaction' range -- | Custom top-level command for backends. Cmd_backend_top :: CompilerBackend -> String -> Interaction' range -- | Custom hole-level command for backends. Cmd_backend_hole :: InteractionId -> range -> String -> CompilerBackend -> String -> Interaction' range -- | cmd_load_highlighting_info source loads syntax highlighting -- information for the module in source, and asks Emacs to apply -- highlighting info from this file. -- -- If the module does not exist, or its module name is malformed or -- cannot be determined, or the module has not already been visited, or -- the cached info is out of date, then no highlighting information is -- printed. -- -- This command is used to load syntax highlighting information when a -- new file is opened, and it would probably be annoying if jumping to -- the definition of an identifier reset the proof state, so this command -- tries not to do that. One result of this is that the command uses the -- current include directories, whatever they happen to be. Cmd_load_highlighting_info :: FilePath -> Interaction' range -- | Tells Agda to compute token-based highlighting information for the -- file. -- -- This command works even if the file's module name does not match its -- location in the file system, or if the file is not scope-correct. -- Furthermore no file names are put in the generated output. Thus it is -- fine to put source code into a temporary file before calling this -- command. However, the file extension should be correct. -- -- If the second argument is Remove, then the (presumably -- temporary) file is removed after it has been read. Cmd_tokenHighlighting :: FilePath -> Remove -> Interaction' range -- | Tells Agda to compute highlighting information for the expression just -- spliced into an interaction point. Cmd_highlight :: InteractionId -> range -> String -> Interaction' range -- | Tells Agda whether or not to show implicit arguments. ShowImplicitArgs :: Bool -> Interaction' range -- | Toggle display of implicit arguments. ToggleImplicitArgs :: Interaction' range -- | Tells Agda whether or not to show irrelevant arguments. ShowIrrelevantArgs :: Bool -> Interaction' range -- | Toggle display of irrelevant arguments. ToggleIrrelevantArgs :: Interaction' range -- | Goal commands -- -- If the range is noRange, then the string comes from the -- minibuffer rather than the goal. Cmd_give :: UseForce -> InteractionId -> range -> String -> Interaction' range Cmd_refine :: InteractionId -> range -> String -> Interaction' range Cmd_intro :: Bool -> InteractionId -> range -> String -> Interaction' range Cmd_refine_or_intro :: Bool -> InteractionId -> range -> String -> Interaction' range Cmd_context :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_helper_function :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_infer :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_goal_type :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Grabs the current goal's type and checks the expression in the hole -- against it. Returns the elaborated term. Cmd_elaborate_give :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Displays the current goal and context. Cmd_goal_type_context :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Displays the current goal and context and infers the type of an -- expression. Cmd_goal_type_context_infer :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Grabs the current goal's type and checks the expression in the hole -- against it. Cmd_goal_type_context_check :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Shows all the top-level names in the given module, along with their -- types. Uses the scope of the given goal. Cmd_show_module_contents :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_make_case :: InteractionId -> range -> String -> Interaction' range Cmd_compute :: ComputeMode -> InteractionId -> range -> String -> Interaction' range Cmd_why_in_scope :: InteractionId -> range -> String -> Interaction' range Cmd_why_in_scope_toplevel :: String -> Interaction' range -- | Displays version of the running Agda Cmd_show_version :: Interaction' range -- | Abort the current computation. -- -- Does nothing if no computation is in progress. Cmd_abort :: Interaction' range -- | Exit the program. Cmd_exit :: Interaction' range data IOTCM' range IOTCM :: FilePath -> HighlightingLevel -> HighlightingMethod -> Interaction' range -> IOTCM' range -- | Used to indicate whether something should be removed or not. data Remove Remove :: Remove Keep :: Remove -- | An IOTCM parser. -- -- If the parse fails, then an error message is returned. parseIOTCM :: String -> Either String IOTCM -- | The Parse monad. StateT state holds the remaining input. type Parse a = ExceptT String StateT String Identity a -- | Converter from the type of reads to Parse The first -- paramter is part of the error message in case the parse fails. readsToParse :: String -> (String -> Maybe (a, String)) -> Parse a parseToReadsPrec :: Parse a -> Int -> String -> [(a, String)] -- | Demand an exact string. exact :: String -> Parse () readParse :: Read a => Parse a parens' :: Parse a -> Parse a -- | Available backends. data CompilerBackend LaTeX :: CompilerBackend QuickLaTeX :: CompilerBackend OtherBackend :: BackendName -> CompilerBackend -- | Ordered ascendingly by degree of normalization. data Rewrite AsIs :: Rewrite Instantiated :: Rewrite HeadNormal :: Rewrite Simplified :: Rewrite Normalised :: Rewrite -- | Modifier for the interactive computation command, specifying the mode -- of computation and result display. data ComputeMode -- | Fully normalise. DefaultCompute :: ComputeMode -- | reduce to weak head normal form. HeadCompute :: ComputeMode -- | normalise, unfolding even abstract and -- NON_TERMINATING definitions. IgnoreAbstract :: ComputeMode -- | normalise to a string literal and wrap it in a show. UseShowInstance :: ComputeMode data UseForce -- | Ignore additional checks, like termination/positivity... WithForce :: UseForce -- | Don't ignore any checks. WithoutForce :: UseForce data OutputForm_boot tcErr a b OutputForm :: Range -> [ProblemId] -> Blocker -> OutputConstraint_boot tcErr a b -> OutputForm_boot tcErr a b data OutputConstraint_boot tcErr a b OfType :: b -> a -> OutputConstraint_boot tcErr a b CmpInType :: Comparison -> a -> b -> b -> OutputConstraint_boot tcErr a b CmpElim :: [Polarity] -> a -> [b] -> [b] -> OutputConstraint_boot tcErr a b JustType :: b -> OutputConstraint_boot tcErr a b CmpTypes :: Comparison -> b -> b -> OutputConstraint_boot tcErr a b CmpLevels :: Comparison -> b -> b -> OutputConstraint_boot tcErr a b CmpTeles :: Comparison -> b -> b -> OutputConstraint_boot tcErr a b JustSort :: b -> OutputConstraint_boot tcErr a b CmpSorts :: Comparison -> b -> b -> OutputConstraint_boot tcErr a b Assign :: b -> a -> OutputConstraint_boot tcErr a b TypedAssign :: b -> a -> a -> OutputConstraint_boot tcErr a b PostponedCheckArgs :: b -> [a] -> a -> a -> OutputConstraint_boot tcErr a b IsEmptyType :: a -> OutputConstraint_boot tcErr a b SizeLtSat :: a -> OutputConstraint_boot tcErr a b FindInstanceOF :: b -> a -> [(a, a, a)] -> OutputConstraint_boot tcErr a b ResolveInstanceOF :: QName -> OutputConstraint_boot tcErr a b PTSInstance :: b -> b -> OutputConstraint_boot tcErr a b PostponedCheckFunDef :: QName -> a -> tcErr -> OutputConstraint_boot tcErr a b CheckLock :: b -> b -> OutputConstraint_boot tcErr a b DataSort :: QName -> b -> OutputConstraint_boot tcErr a b UsableAtMod :: Modality -> b -> OutputConstraint_boot tcErr a b -- | A subset of OutputConstraint. data OutputConstraint' a b OfType' :: b -> a -> OutputConstraint' a b [ofName] :: OutputConstraint' a b -> b [ofExpr] :: OutputConstraint' a b -> a data OutputContextEntry name ty val ContextVar :: name -> ty -> OutputContextEntry name ty val ContextLet :: name -> ty -> val -> OutputContextEntry name ty val instance GHC.Internal.Classes.Eq Agda.Interaction.Base.CompilerBackend instance GHC.Internal.Classes.Eq Agda.Interaction.Base.ComputeMode instance GHC.Internal.Classes.Eq Agda.Interaction.Base.Rewrite instance GHC.Internal.Classes.Eq Agda.Interaction.Base.UseForce instance GHC.Internal.Data.Foldable.Foldable Agda.Interaction.Base.IOTCM' instance GHC.Internal.Data.Foldable.Foldable Agda.Interaction.Base.Interaction' instance GHC.Internal.Base.Functor Agda.Interaction.Base.IOTCM' instance GHC.Internal.Base.Functor Agda.Interaction.Base.Interaction' instance GHC.Internal.Base.Functor (Agda.Interaction.Base.OutputConstraint_boot tcErr a) instance GHC.Internal.Base.Functor (Agda.Interaction.Base.OutputForm_boot tcErr a) instance GHC.Internal.Classes.Ord Agda.Interaction.Base.Rewrite instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.Base.CompilerBackend instance GHC.Internal.Read.Read Agda.Utils.FileName.AbsolutePath instance GHC.Internal.Read.Read Agda.Interaction.Base.CompilerBackend instance GHC.Internal.Read.Read Agda.Interaction.Base.ComputeMode instance GHC.Internal.Read.Read range => GHC.Internal.Read.Read (Agda.Interaction.Base.IOTCM' range) instance GHC.Internal.Read.Read range => GHC.Internal.Read.Read (Agda.Interaction.Base.Interaction' range) instance GHC.Internal.Read.Read Agda.Syntax.Common.InteractionId instance GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Agda.Syntax.Position.Interval' a) instance GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Agda.Syntax.Position.Position' a) instance GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Agda.Syntax.Position.Range' a) instance GHC.Internal.Read.Read Agda.Syntax.Position.RangeFile instance GHC.Internal.Read.Read Agda.Interaction.Base.Remove instance GHC.Internal.Read.Read Agda.Interaction.Base.Rewrite instance GHC.Internal.Read.Read Agda.Interaction.Base.UseForce instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Interaction.Base.Command' a) instance GHC.Internal.Show.Show Agda.Interaction.Base.CompilerBackend instance GHC.Internal.Show.Show Agda.Interaction.Base.ComputeMode instance GHC.Internal.Show.Show Agda.Interaction.Base.CurrentFile instance GHC.Internal.Show.Show range => GHC.Internal.Show.Show (Agda.Interaction.Base.IOTCM' range) instance GHC.Internal.Show.Show range => GHC.Internal.Show.Show (Agda.Interaction.Base.Interaction' range) instance GHC.Internal.Show.Show Agda.Interaction.Base.Remove instance GHC.Internal.Show.Show Agda.Interaction.Base.Rewrite instance GHC.Internal.Show.Show Agda.Interaction.Base.UseForce instance GHC.Internal.Data.Traversable.Traversable Agda.Interaction.Base.IOTCM' instance GHC.Internal.Data.Traversable.Traversable Agda.Interaction.Base.Interaction' -- | Data type for all interactive responses module Agda.Interaction.Response.Base -- | Responses for any interactive interface -- -- Note that the response is given in pieces and incrementally, so the -- user can have timely response even during long computations. data Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | Target file, or Nothing for the current buffer. Resp_HighlightingInfo :: HighlightingInfo -> RemoveTokenBasedHighlighting -> HighlightingMethod -> ModuleToSource -> Maybe FilePath -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_Status :: Status -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_JumpToError :: FilePath -> Word32 -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_InteractionPoints :: [InteractionId] -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_GiveAction :: InteractionId -> GiveResult -> Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | Response is list of printed clauses. Resp_MakeCase :: InteractionId -> MakeCaseVariant -> [String] -> Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | Solution for one or more meta-variables. Resp_SolveAll :: [(InteractionId, Expr)] -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_Mimer :: InteractionId -> Maybe String -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_DisplayInfo :: DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors -> Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | The integer is the message's debug level. The DocTree usually -- does not contain a final newline. Resp_RunningInfo :: Int -> DocTree -> Response_boot tcErr tcWarning warningsAndNonFatalErrors Resp_ClearRunningInfo :: Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | Clear highlighting of the given kind. Resp_ClearHighlighting :: TokenBased -> Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | A command sent when an abort command has completed successfully. Resp_DoneAborting :: Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | A command sent when an exit command is about to be completed. Resp_DoneExiting :: Response_boot tcErr tcWarning warningsAndNonFatalErrors -- | Should token-based highlighting be removed in conjunction with the -- application of new highlighting (in order to reduce the risk of -- flicker)? data RemoveTokenBasedHighlighting -- | Yes, remove all token-based highlighting from the file. RemoveHighlighting :: RemoveTokenBasedHighlighting -- | No. KeepHighlighting :: RemoveTokenBasedHighlighting -- | There are two kinds of "make case" commands. data MakeCaseVariant Function :: MakeCaseVariant ExtendedLambda :: MakeCaseVariant -- | Info to display at the end of an interactive command data DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_CompilationOk :: CompilerBackend -> warningsAndNonFatalErrors -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_Constraints :: [OutputForm_boot tcErr Expr Expr] -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_AllGoalsWarnings :: Goals_boot tcErr -> warningsAndNonFatalErrors -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_Time :: CPUTime -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors -- | When an error message is displayed this constructor should be used, if -- appropriate. Info_Error :: Info_Error_boot tcErr tcWarning -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_Intro_NotFound :: DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_Intro_ConstructorUnknown :: [String] -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors -- | Info_Auto denotes either an error or a success (when -- Resp_GiveAction is present) TODO: split these into separate -- constructors Info_Auto :: String -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_ModuleContents :: [Name] -> Telescope -> [(Name, Type)] -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_SearchAbout :: [(Name, Type)] -> String -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_WhyInScope :: WhyInScopeData -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_NormalForm :: CommandState -> ComputeMode -> Maybe CPUTime -> Expr -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_InferredType :: CommandState -> Maybe CPUTime -> Expr -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_Context :: InteractionId -> [ResponseContextEntry] -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_Version :: DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors Info_GoalSpecific :: InteractionId -> GoalDisplayInfo_boot tcErr -> DisplayInfo_boot tcErr tcWarning warningsAndNonFatalErrors data GoalDisplayInfo_boot tcErr Goal_HelperFunction :: OutputConstraint' Expr Name -> GoalDisplayInfo_boot tcErr Goal_NormalForm :: ComputeMode -> Expr -> GoalDisplayInfo_boot tcErr Goal_GoalType :: Rewrite -> GoalTypeAux -> [ResponseContextEntry] -> [IPFace' Expr] -> [OutputForm_boot tcErr Expr Expr] -> GoalDisplayInfo_boot tcErr Goal_CurrentGoal :: Rewrite -> GoalDisplayInfo_boot tcErr Goal_InferredType :: Expr -> GoalDisplayInfo_boot tcErr -- | Goals & Warnings type Goals_boot tcErr = ([OutputConstraint_boot tcErr Expr InteractionId], [OutputConstraint_boot tcErr Expr NamedMeta]) -- | Errors that goes into Info_Error -- -- When an error message is displayed this constructor should be used, if -- appropriate. data Info_Error_boot tcErr tcWarning Info_GenericError :: tcErr -> Info_Error_boot tcErr tcWarning Info_CompilationError :: Set tcWarning -> Info_Error_boot tcErr tcWarning Info_HighlightingParseError :: InteractionId -> Info_Error_boot tcErr tcWarning Info_HighlightingScopeCheckError :: InteractionId -> Info_Error_boot tcErr tcWarning -- | Auxiliary information that comes with Goal Type data GoalTypeAux GoalOnly :: GoalTypeAux GoalAndHave :: Expr -> [IPFace' Expr] -> GoalTypeAux GoalAndElaboration :: Expr -> GoalTypeAux -- | Entry in context. data ResponseContextEntry ResponseContextEntry :: Name -> Name -> Arg Expr -> Maybe Expr -> NameInScope -> ResponseContextEntry -- | The original concrete name. [respOrigName] :: ResponseContextEntry -> Name -- | The name reified from abstract syntax. [respReifName] :: ResponseContextEntry -> Name -- | The type. [respType] :: ResponseContextEntry -> Arg Expr -- | The value (if it is a let-bound variable) [respLetValue] :: ResponseContextEntry -> Maybe Expr -- | Whether the respReifName is in scope. [respInScope] :: ResponseContextEntry -> NameInScope -- | Status information. data Status Status :: Bool -> Bool -> Bool -> Status -- | Are implicit arguments displayed? [sShowImplicitArguments] :: Status -> Bool -- | Are irrelevant arguments displayed? [sShowIrrelevantArguments] :: Status -> Bool -- | Has the module been successfully type checked? [sChecked] :: Status -> Bool -- | Give action result -- -- Comment derived from agda2-mode.el -- -- If GiveResult is 'Give_String s', then the goal is replaced by -- s, and otherwise the text inside the goal is retained -- (parenthesised if GiveResult is Give_Paren). data GiveResult Give_String :: String -> GiveResult Give_Paren :: GiveResult Give_NoParen :: GiveResult module Agda.Compiler.Backend.Base type BackendVersion = Text data Backend_boot definition (tcm :: Type -> Type) [Backend] :: forall opts definition (tcm :: Type -> Type) env menv mod def. NFData opts => Backend'_boot definition tcm opts env menv mod def -> Backend_boot definition tcm data Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def Backend' :: BackendName -> Maybe BackendVersion -> opts -> [OptDescr (Flag opts)] -> (opts -> Bool) -> (opts -> tcm env) -> (env -> IsMain -> Map TopLevelModuleName mod -> tcm ()) -> (env -> IsMain -> TopLevelModuleName -> Maybe FilePath -> tcm (Recompile menv mod)) -> (env -> menv -> IsMain -> TopLevelModuleName -> [def] -> tcm mod) -> (env -> menv -> IsMain -> definition -> tcm def) -> Bool -> (QName -> tcm Bool) -> Maybe (BackendCommandTop tcm) -> Maybe (BackendCommandHole tcm) -> Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -- | the name of the backend [backendName] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> BackendName -- | Optional version information to be printed with --version. [backendVersion] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> Maybe BackendVersion -- | Default options [options] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> opts -- | Backend-specific command-line flags. Should at minimum contain a flag -- to enable the backend. [commandLineFlags] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> [OptDescr (Flag opts)] -- | Unless the backend has been enabled, runAgda will fall back -- to vanilla Agda behaviour. [isEnabled] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> opts -> Bool -- | Called after type checking completes, but before compilation starts. [preCompile] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> opts -> tcm env -- | Called after module compilation has completed. The IsMain -- argument is NotMain if the --no-main flag is -- present. [postCompile] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> env -> IsMain -> Map TopLevelModuleName mod -> tcm () -- | Called before compilation of each module. Gets the path to the -- .agdai file to allow up-to-date checking of previously -- written compilation results. Should return Skip m if -- compilation is not required. Will be Nothing if only scope -- checking. [preModule] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> env -> IsMain -> TopLevelModuleName -> Maybe FilePath -> tcm (Recompile menv mod) -- | Called after all definitions of a module have been compiled. [postModule] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> env -> menv -> IsMain -> TopLevelModuleName -> [def] -> tcm mod -- | Compile a single definition. [compileDef] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> env -> menv -> IsMain -> definition -> tcm def -- | True if the backend works if --only-scope-checking is used. [scopeCheckingSuffices] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> Bool -- | The treeless compiler may ask the Backend if elements of the given -- type maybe possibly erased. The answer should be False if the -- compilation of the type is used by a third party, e.g. in a FFI -- binding. [mayEraseType] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> QName -> tcm Bool -- | Backend-specific top-level interactive command. [backendInteractTop] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> Maybe (BackendCommandTop tcm) -- | Backend-specific hole-level interactive command. [backendInteractHole] :: Backend'_boot definition (tcm :: Type -> Type) opts env menv mod def -> Maybe (BackendCommandHole tcm) data Recompile menv mod Recompile :: menv -> Recompile menv mod Skip :: mod -> Recompile menv mod -- | For the sake of flexibility, we parametrize interactive commands with -- an arbitrary string payload, e.g. to allow extra user input, or have -- backends provide multiple commands with a single record field. type CommandPayload = String -- | The type of top-level backend interactive commmands. type BackendCommandTop (tcm :: Type -> Type) = CommandPayload -> CommandM' tcm () -- | The type of top-level backend interactive commmands. type BackendCommandHole (tcm :: Type -> Type) = CommandPayload -> InteractionId -> Range -> String -> CommandM' tcm () instance GHC.Internal.Generics.Generic (Agda.Compiler.Backend.Base.Backend'_boot definition tcm opts env menv mod def) instance Control.DeepSeq.NFData opts => Control.DeepSeq.NFData (Agda.Compiler.Backend.Base.Backend'_boot definition tcm opts env menv mod def) instance Control.DeepSeq.NFData (Agda.Compiler.Backend.Base.Backend_boot definition tcm) module Agda.TypeChecking.Monad.Base pattern Axiom :: Bool -> Defn pattern Constructor :: Int -> Int -> ConHead -> QName -> IsAbstract -> IsPathCons -> CompKit -> Maybe [QName] -> [IsForced] -> Maybe [Bool] -> Bool -> Bool -> Defn pattern DDot :: Term -> DisplayTerm pattern DTerm :: Term -> DisplayTerm pattern DataOrRecSig :: Int -> DataOrRecord_ -> Defn pattern Datatype :: Nat -> Nat -> Maybe Term -> [QName] -> Sort -> Maybe [QName] -> PositivityCheck -> IsAbstract -> IsHIT -> Maybe QName -> Maybe QName -> Defn pattern Function :: [Clause] -> Maybe CompiledClauses -> Maybe SplitTree -> Maybe Compiled -> [Clause] -> FunctionInverse -> Maybe [QName] -> Either ProjectionLikenessMissing Projection -> SmallSet FunctionFlag -> Maybe Bool -> Maybe ExtLamInfo -> IsWithFunction QName -> Maybe QName -> IsOpaque -> Defn pattern Primitive :: IsAbstract -> PrimitiveId -> [Clause] -> FunctionInverse -> Maybe CompiledClauses -> IsOpaque -> Defn pattern PrimitiveSort :: BuiltinSort -> Sort -> Defn pattern Record :: Nat -> Maybe Term -> ConHead -> Bool -> [Dom QName] -> Telescope -> Maybe [QName] -> PositivityCheck -> EtaEquality -> PatternOrCopattern -> Maybe Induction -> Maybe Bool -> IsAbstract -> CompKit -> Defn pattern ReduceM :: (ReduceEnv -> a) -> ReduceM a pattern SortProp :: BuiltinSort pattern SortPropOmega :: BuiltinSort pattern SortSet :: BuiltinSort pattern SortSetOmega :: BuiltinSort pattern SortStrictSet :: BuiltinSort pattern SortStrictSetOmega :: BuiltinSort pattern TCM :: (IORef TCState -> TCEnv -> m a) -> TCMT m a _mvInfo :: Lens' MetaVariable MetaInfo _recEtaEquality :: RecordData -> HasEta aDefToMode :: IsAbstract -> AbstractMode aModeToDef :: AbstractMode -> Maybe IsAbstract -- | Name of absurdLambda definitions. absurdLambdaName :: String -- | Not quite all reductions (skip non-terminating reductions) allReductions :: AllowedReductions -- | Local or global rewriting is enabled anyRewritingOption :: HasOptions m => m Bool apReduce :: ReduceM (a -> b) -> ReduceM a -> ReduceM b apTCMT :: forall (m :: Type -> Type) a b. Applicative m => TCMT m (a -> b) -> TCMT m a -> TCMT m b askR :: ReduceM ReduceEnv asksTC :: MonadTCEnv m => (TCEnv -> a) -> m a axiomConstTransp :: Defn -> Bool beforeReduce :: ReduceM a -> ReduceM b -> ReduceM a bindReduce :: ReduceM a -> (a -> ReduceM b) -> ReduceM b bindTCMT :: forall (m :: Type -> Type) a b. Monad m => TCMT m a -> (a -> TCMT m b) -> TCMT m b buildClosure :: (MonadTCEnv m, ReadTCState m) => a -> m (Closure a) -- | Preserve the state of the failing computation. catchError_ :: TCM a -> (TCErr -> TCM a) -> TCM a -- | Extract the QName from the ClashingName. clashingQName :: ClashingName -> QName conAbstr :: Defn -> IsAbstract conArity :: Defn -> Int conComp :: Defn -> CompKit conData :: Defn -> QName conErased :: Defn -> Maybe [Bool] conErasure :: Defn -> Bool conForced :: Defn -> [IsForced] conInline :: Defn -> Bool conPars :: Defn -> Int conPathCons :: Defn -> IsPathCons conProj :: Defn -> Maybe [QName] conSrcCon :: Defn -> ConHead constTranspAxiom :: Defn cubicalCompatibleOption :: HasOptions m => m Bool cubicalOption :: HasOptions m => m (Maybe Cubical) -- | The current modality. Note that the returned cohesion component is -- always unitCohesion. currentModality :: MonadTCEnv m => m Modality dataAbstr :: Defn -> IsAbstract dataClause :: Defn -> Maybe Term dataCons :: Defn -> [QName] dataHIT :: Defn -> IsHIT dataIxs :: Defn -> Nat dataMutual :: Defn -> Maybe [QName] dataPars :: Defn -> Nat dataPositivityCheck :: Defn -> PositivityCheck dataSort :: Defn -> Sort dataTransp :: Defn -> Maybe QName dataTranspIx :: Defn -> Maybe QName datarecKind :: Defn -> DataOrRecord_ datarecPars :: Defn -> Int defAbstract :: Definition -> IsAbstract defClauses :: Definition -> [Clause] defCompiled :: Definition -> Maybe CompiledClauses defCompilerPragmas :: BackendName -> Definition -> [CompilerPragma] defConstructors :: Defn -> [QName] -- | The definition of a data or record type copy (created by a module -- application), if the given definition is such a copy. defCopyClause :: Definition -> Maybe Term -- | How a constant is defined: either it is a data or record type copy, -- defined by a term (defCopyClause), or it is defined by clauses -- (defClauses), possibly with a compiled form -- (defCompiled). Never both. defCopyOrClauses :: Definition -> Either Term ([Clause], Maybe CompiledClauses) defForced :: Definition -> [IsForced] defInverse :: Definition -> FunctionInverse defIsDataOrRecord :: Defn -> Bool defIsRecord :: Defn -> Bool -- | Has the definition failed the termination checker? defNonterminating :: Definition -> Bool defOpaque :: Definition -> IsOpaque defParameters :: Definition -> Maybe Nat -- | Has the definition not termination checked or did the check fail? defTerminationUnconfirmed :: Definition -> Bool defaultAxiom :: Defn -- | Create a definition with sensible defaults. defaultDefn :: ArgInfo -> QName -> Type -> Language -> Defn -> Definition -- | By default, we have no display form. defaultDisplayForm :: QName -> [LocalDisplayForm] -- | The default InteractionOutputCallback function prints certain -- things to stdout (other things generate internal errors). defaultInteractionOutputCallback :: InteractionOutputCallback defaultUnquoteFlags :: UnquoteFlags -- | Turn a Comparison function into a CompareDirection -- function. -- -- Property: dirToCmp f (fromCmp cmp) = f cmp dirToCmp :: (Comparison -> a -> a -> c) -> CompareDirection -> a -> a -> c eAbstractMode :: Lens' TCEnv AbstractMode eActiveBackendName :: Lens' TCEnv (Maybe BackendName) eActiveProblems :: Lens' TCEnv (Set ProblemId) eAllowedReductions :: Lens' TCEnv AllowedReductions eAnonymousModules :: Lens' TCEnv [(ModuleName, Nat)] eAppDef :: Lens' TCEnv (Maybe QName) eAssignMetas :: Lens' TCEnv Bool eCall :: Lens' TCEnv (Maybe (Closure Call)) eCallByNeed :: Lens' TCEnv Bool eChasePrefix :: Lens' TCEnv (Maybe String) eCheckingWhere :: Lens' TCEnv WhereClause_ eCheckpoints :: Lens' TCEnv (Map CheckpointId Substitution) eClause :: Lens' TCEnv IPClause eCompareBlocked :: Lens' TCEnv Bool eConflComputingOverlap :: Lens' TCEnv Bool eContext :: Lens' TCEnv Context eCoverageCheck :: Lens' TCEnv CoverageCheck eCurrentCheckpoint :: Lens' TCEnv CheckpointId eCurrentModule :: Lens' TCEnv ModuleName eCurrentOpaqueId :: Lens' TCEnv (Maybe OpaqueId) eCurrentPath :: Lens' TCEnv (Maybe FileId) eCurrentlyElaborating :: Lens' TCEnv Bool eDisplayFormsEnabled :: Lens' TCEnv Bool eExpandLast :: Lens' TCEnv ExpandHidden eExpandLastBool :: Lens' TCEnv Bool eFoldLetBindings :: Lens' TCEnv Bool eGeneralizeMetas :: Lens' TCEnv DoGeneralize eGeneralizedVars :: Lens' TCEnv (Map QName GeneralizedValue) eHardCompileTimeMode :: Lens' TCEnv Bool eHighlightingLevel :: Lens' TCEnv HighlightingLevel eHighlightingMethod :: Lens' TCEnv HighlightingMethod eHighlightingRange :: Lens' TCEnv Range eImplPrimitiveImporting :: Lens' TCEnv Bool eImportStack :: Lens' TCEnv [TopLevelModuleName] eInjectivityDepth :: Lens' TCEnv Int eInsideDotPattern :: Lens' TCEnv Bool eInstanceDepth :: Lens' TCEnv Int eIsDebugPrinting :: Lens' TCEnv Bool eLetBindings :: Lens' TCEnv LetBindings eLocalRewriteRules :: Lens' TCEnv LocalRewriteRuleMap eMakeCase :: Lens' TCEnv Bool eMutualBlock :: Lens' TCEnv (Maybe MutualId) ePrintDomainFreePi :: Lens' TCEnv Bool ePrintMetasBare :: Lens' TCEnv Bool ePrintingPatternLambdas :: Lens' TCEnv [QName] ePureConversion :: Lens' TCEnv Bool eQuantity :: Lens' TCEnv Quantity -- | Note that this lens does not satisfy all lens laws: If hard -- compile-time mode is enabled, then quantities other than zero are -- replaced by __IMPOSSIBLE__. eQuantityZeroHardCompile :: Lens' TCEnv Quantity eRange :: Lens' TCEnv Range eReconstructed :: Lens' TCEnv Bool eReduceDefs :: Lens' TCEnv ReduceDefs eReduceDefsPair :: Lens' TCEnv (Bool, [QName]) eRelevance :: Lens' TCEnv Relevance eSimplification :: Lens' TCEnv Simplification eSolvingConstraints :: Lens' TCEnv Bool eSplitOnStrict :: Lens' TCEnv Bool eSyntacticEqualityFuel :: Lens' TCEnv (Maybe Int) eTerminationCheck :: Lens' TCEnv (TerminationCheck ()) eUnquoteFlags :: Lens' TCEnv UnquoteFlags eUnquoteNormalise :: Lens' TCEnv Bool eUnquoteProblem :: Lens' TCEnv (Maybe ProblemId) eWorkingOnTypes :: Lens' TCEnv Bool emptyCompKit :: CompKit emptyFunction :: HasOptions m => m Defn -- | A template for creating Function definitions, with sensible -- defaults. emptyFunctionData :: HasOptions m => m FunctionData emptyFunctionData_ :: Bool -> FunctionData emptyFunction_ :: Bool -> Defn emptySignature :: Signature enableCaching :: HasOptions m => m Bool -- | Are we allowed to assign metas? envAssignMetas :: Lens' Flags64 Bool -- | Use call-by-need evaluation for reductions. envCallByNeed :: Lens' Flags64 Bool -- | When True, the conversion checker will consider all term -- constructors as injective, including blocked function applications and -- metas. Warning: this should only be used when not assigning any metas -- (e.g. when envAssignMetas is False or when running -- pureEqualTerms) or else we get non-unique meta solutions. envCompareBlocked :: Lens' Flags64 Bool -- | Are we currently computing the overlap between two rewrite rules for -- the purpose of confluence checking? envConflComputingOverlap :: Lens' Flags64 Bool -- | Are we currently in the process of executing an elaborate-and-give -- interactive command? envCurrentlyElaborating :: Lens' Flags64 Bool -- | Sometimes we want to disable display forms. envDisplayFormsEnabled :: Lens' Flags64 Bool -- | Fold let-bindings when printing terms (default: True) envFoldLetBindings :: Lens' Flags64 Bool -- | Is the "hard" compile-time mode enabled? In this mode the quantity -- component of the environment is always zero, and every new definition -- is treated as erased. envHardCompileTimeMode :: Lens' Flags64 Bool -- | Are we doing implicit importing of primitive modules? envImplPrimitiveImporting :: Lens' Flags64 Bool -- | Used by the scope checker to make sure that certain forms of -- expressions are not used inside dot patterns: extended lambdas and -- let-expressions. envInsideDotPattern :: Lens' Flags64 Bool envIsDebugPrinting :: Lens' Flags64 Bool -- | are we inside a make-case (if so, ignore forcing analysis in unifier) envMakeCase :: Lens' Flags64 Bool -- | When True, types will be omitted from printed pi types if -- they can be inferred. envPrintDomainFreePi :: Lens' Flags64 Bool -- | When True, throw away meta numbers and meta elims. This is -- used for reifying terms for feeding into the user's source code, e.g., -- for the interaction tactics solveAll. envPrintMetasBare :: Lens' Flags64 Bool -- | Are we doing pure conversion? envPureConversion :: Lens' Flags64 Bool envReconstructed :: Lens' Flags64 Bool -- | Are we currently in the process of solving active constraints? envSolvingConstraints :: Lens' Flags64 Bool -- | Are we currently case-splitting on a strict datatype (i.e. in SSet)? -- If yes, the pattern-matching unifier will solve reflexive equations -- even --without-K. envSplitOnStrict :: Lens' Flags64 Bool -- | Are we working on types? Turned on by workOnTypes. envWorkingOnTypes :: Lens' Flags64 Bool execError :: (HasCallStack, MonadTCError m) => ExecError -> m a -- | Base name for extended lambda patterns extendedLambdaName :: String -- | Execute a finalizer even when an exception is thrown. Does not catch -- any errors. In case both the regular computation and the finalizer -- throw an exception, the one of the finalizer is propagated. finally_ :: TCM a -> TCM b -> TCM a -- | Flip the direction of comparison. flipCmp :: CompareDirection -> CompareDirection fmapReduce :: (a -> b) -> ReduceM a -> ReduceM b fmapTCMT :: forall (m :: Type -> Type) a b. Functor m => (a -> b) -> TCMT m a -> TCMT m b -- | Runs the computation in a separate thread, with a copy of the -- TCState of the calling thread. -- -- Modifications of the TCState performed by the detached -- computation (e.g. creation of metas) are invisible to the parent -- thread, and to any of its siblings. They will be "discarded" when the -- thread finishes. It is thus important to ensure that any results -- returned out-of-band by the child thread are valid in an arbitrary TC -- state. -- -- The detached thread has read-write, synchronised access to the -- SessionState. forkTCM :: TCM () -> TCM () freshName :: MonadFresh NameId m => Range -> String -> m Name freshNoName :: MonadFresh NameId m => Range -> m Name freshNoName_ :: MonadFresh NameId m => m Name freshRecordName :: MonadFresh NameId m => m Name -- | Embed Comparison into CompareDirection. fromCmp :: Comparison -> CompareDirection fromReduceDefs :: ReduceDefs -> (Bool, [QName]) -- | Toggle the FunAbstract flag. funAbstr :: Lens' Defn IsAbstract -- | Toggle the FunAbstract flag. funAbstr_ :: Lens' FunctionData IsAbstract -- | Toggle the FunAbstract flag. funAbstract :: Lens' Defn Bool -- | Toggle the FunAbstract flag. funAbstract_ :: Lens' FunctionData Bool funClauses :: Defn -> [Clause] funCompiled :: Defn -> Maybe CompiledClauses funCovering :: Defn -> [Clause] -- | Toggle the FunErasure flag. funErasure :: Lens' Defn Bool funExtLam :: Defn -> Maybe ExtLamInfo -- | Toggle the FunFirstOrder flag. funFirstOrder :: Lens' Defn Bool funFlag :: FunctionFlag -> Lens' Defn Bool funFlag_ :: FunctionFlag -> Lens' FunctionData Bool funFlags :: Defn -> SmallSet FunctionFlag funInline :: Lens' Defn Bool funInv :: Defn -> FunctionInverse funIsKanOp :: Defn -> Maybe QName funMacro :: Lens' Defn Bool funMacro_ :: Lens' FunctionData Bool funMutual :: Defn -> Maybe [QName] funOpaque :: Defn -> IsOpaque -- | Toggle the FunProj flag. funProj :: Lens' Defn Bool -- | Toggle the FunProj flag. funProj_ :: Lens' FunctionData Bool funProjection :: Defn -> Either ProjectionLikenessMissing Projection funSplitTree :: Defn -> Maybe SplitTree funStatic :: Lens' Defn Bool funTerminates :: Defn -> Maybe Bool funTreeless :: Defn -> Maybe Compiled funWith :: Defn -> IsWithFunction QName -- | Name for the record constructor for the generalized variables. generalizeConstructorName :: String -- | Name for telescope (record) of generalized variables. generalizeRecordName :: String -- | Base name for generalized variable projections. generalizedFieldName :: String getFlag :: Int -> Flags64 -> Bool -- | Check whether we have a generalized variable field. getGeneralizedFieldName :: QName -> Maybe String getMetaEnv :: MetaVariable -> TCEnv getMetaInfo :: MetaVariable -> Closure Range getMetaScope :: MetaVariable -> ScopeInfo getMetaSig :: MetaVariable -> Signature getPartialDefs :: ReadTCState m => m (Set QName) getUserWarnings :: ReadTCState m => m UserWarnings getsTC :: ReadTCState m => (TCState -> a) -> m a ghcBackendName :: BackendName grHasProjectionPattern :: GlobalRewriteRule -> Bool guardednessOption :: HasOptions m => m Bool highMetaPriority :: MetaPriority -- | Combines the source hash and the (full) hashes of the imported -- modules. iFullHash :: Interface -> Hash -- | Choose between behavior in pure conversion and impure conversion. The -- first branch is the impure case. ifImpureConv :: TCM a -> TCM a -> TCM a -- | ifTopLevelAndHighlightingLevelIs l m runs m when -- we're type-checking the top-level module (or before we've started -- doing this) and the highlighting level is at least l. ifTopLevelAndHighlightingLevelIs :: MonadTCEnv tcm => HighlightingLevel -> tcm () -> tcm () -- | ifTopLevelAndHighlightingLevelIs l b m runs m when -- we're type-checking the top-level module (or before we've started -- doing this) and either the highlighting level is at least -- l or b is True. ifTopLevelAndHighlightingLevelIsOr :: MonadTCEnv tcm => HighlightingLevel -> Bool -> tcm () -> tcm () illegalRewriteWarningName :: IllegalRewriteRuleReason -> WarningName initColdEnv :: ColdEnv initEnv :: TCEnv initEnvFlags :: Flags64 -- | Empty session state. initFileDict :: AbsolutePath -> FileDictWithBuiltins initModalEnv :: ModalEnv -- | Empty persistent state. initPersistentStateFromSessionState :: Atomic SessionState -> PersistentTCState initPostColdState :: PostColdState initPostFlags :: Flags64 initPostMetaState :: PostMetaState initPostNamesCheckpoints :: PostNamesCheckpoints initPostScopeState :: PostScopeState -- | Empty state of type checker. initPreScopeState :: PreScopeState initSessionState :: AbsolutePath -> SessionState initState :: AbsolutePath -> IO TCState initStateFromPersistentState :: PersistentTCState -> TCState initStateFromSessionState :: Atomic SessionState -> TCState initStateIO :: IO TCState initTCContext :: TCContext -- | An initial MetaId. initialMetaId :: MetaId -- | A lens for the iSignature field of the Interface type. intSignature :: Lens' Interface Signature interactionError :: (HasCallStack, MonadTCError m) => InteractionError -> m a internalError :: (HasCallStack, MonadTCError m) => String -> m a -- | Check whether we have an definition from an absurd lambda. isAbsurdLambdaName :: QName -> Bool isCopatternLHS :: Foldable f => f Clause -> Bool isDontExpandLast :: ExpandHidden -> Bool -- | Checking whether we are dealing with a function yet to be defined. isEmptyFunction :: Defn -> Bool isExpandLast :: ExpandHidden -> Bool isExtendedLambda :: Defn -> Bool -- | Check whether we have an definition from an extended lambda. isExtendedLambdaName :: QName -> Bool isLocalRewrite :: RewriteSource -> Bool isMacro :: Defn -> Bool isReconstructed :: MonadTCEnv m => m Bool -- | Should warnings of that type be serialized? -- -- Only when changes in the source code can silence or influence the -- warning. isSourceCodeWarning :: WarningName -> Bool isWithFunction :: Defn -> Bool itableCounts :: Lens' InstanceTable (Map QName Int) itableTree :: Lens' InstanceTable (DiscrimTree QName) jsBackendName :: BackendName lensAreWeCaching :: Lens' PostScopeState Bool lensAwakeConstraints :: Lens' PostScopeState Constraints lensBackends :: Lens' SessionState [Backend] lensBuiltinModuleIds :: Lens' SessionState BuiltinModuleIds lensConcreteNames :: Lens' PostScopeState ConcreteNames lensConsideringInstance :: Lens' PostScopeState Bool lensConstructor :: Lens' Defn ConstructorData lensCopiedNames :: Lens' PreScopeState (HashMap QName QName) lensCurrentModule :: Lens' PostScopeState (Maybe (Pair ModuleName TopLevelModuleName)) lensDataOrRecSig :: Lens' Defn DataOrRecSigData lensDirty :: Lens' PostScopeState Bool lensDisambiguatedNames :: Lens' PostScopeState DisambiguatedNames lensFileDict :: Lens' SessionState FileDictWithBuiltins lensFileDictBuilder :: Lens' SessionState FileDictBuilder lensForeignCode :: Lens' PostScopeState BackendForeignCode lensFreshCheckpointId :: Lens' PostScopeState CheckpointId lensFreshInt :: Lens' PostScopeState Int lensFreshInteractionId :: Lens' PreScopeState InteractionId lensFreshMetaId :: Lens' PostScopeState MetaId lensFreshMutualId :: Lens' PostScopeState MutualId lensFreshNameId :: Lens' PostScopeState NameId lensFreshOpaqueId :: Lens' PostScopeState OpaqueId lensFreshProblemId :: Lens' PostScopeState ProblemId lensFunction :: Lens' Defn FunctionData lensGeneralizedVars :: Lens' PreScopeState (Maybe (Set QName)) lensImportedBuiltins :: Lens' PreScopeState BuiltinThings lensImportedDisplayForms :: Lens' PreScopeState DisplayForms lensImportedMetaStore :: Lens' PreScopeState RemoteMetaStore lensImportedModules :: Lens' PreScopeState ImportedModules lensImportedModulesTransitive :: Lens' PreScopeState ImportedModules lensImportedPartialDefs :: Lens' PreScopeState (Set QName) lensImportedUserWarnings :: Lens' PreScopeState UserWarnings lensImports :: Lens' PreScopeState Signature lensImportsDisplayForms :: Lens' PostScopeState DisplayForms lensInstanceHack :: Lens' PostScopeState Bool -- | Should we instantiate away blocking metas? This can produce ill-typed -- terms but they are often more readable. See issue #3606. Best set to -- True only for calls to pretty*/reify to limit unwanted reductions. -- -- Is this a context where we should always try every possible instance -- candidate? Used to support "inert improvement", see -- shouldBlockOverlap in InstanceArguments. lensInstantiateBlocking :: Lens' PostScopeState Bool lensInteractionOutputCallback :: Lens' SessionState InteractionOutputCallback lensInteractionPoints :: Lens' PostScopeState InteractionPoints lensLibCache :: Lens' PreScopeState LibCache lensLoadedFileCache :: Lens' PersistentTCState (Maybe LoadedFileCache) lensLocalBuiltins :: Lens' PostScopeState BuiltinThings lensLocalPartialDefs :: Lens' PostScopeState (Set QName) lensLocalUserWarnings :: Lens' PreScopeState UserWarnings lensModuleCheckpoints :: Lens' PostScopeState ModuleCheckpoints lensModuleToSource :: Lens' SessionState ModuleToSource lensModuleToSourceId :: Lens' SessionState ModuleToSourceId lensMutualBlocks :: Lens' PostScopeState MutualBlocks lensNameCopies :: Lens' PreScopeState (HashMap QName (HashSet QName)) lensOccursCheckDefs :: Lens' PostScopeState (Set QName) lensOpaqueBlocks :: Lens' PostScopeState (Map OpaqueId OpaqueBlock) lensOpaqueIds :: Lens' PostScopeState (Map QName OpaqueId) lensOpenMetaStore :: Lens' PostScopeState LocalMetaStore lensPatternSynImports :: Lens' PreScopeState PatternSynDefns lensPatternSyns :: Lens' PreScopeState PatternSynDefns lensPersistentSession :: Lens' PersistentTCState (Atomic SessionState) lensPersistentState :: Lens' TCState PersistentTCState lensPostScopeState :: Lens' TCState PostScopeState lensPostponeInstanceSearch :: Lens' PostScopeState Bool lensPreFileId :: Lens' PreScopeState (Maybe FileId) lensPreScopeState :: Lens' TCState PreScopeState lensPreTokens :: Lens' PreScopeState HighlightingInfo lensPrimitiveLibDir :: Lens' SessionState PrimitiveLibDir lensRecEta :: Lens' RecordData EtaEquality lensRecTel :: Lens' RecordData Telescope lensRecord :: Lens' Defn RecordData lensScope :: Lens' PreScopeState ScopeInfo lensSignature :: Lens' PostScopeState Signature lensSleepingConstraints :: Lens' PostScopeState Constraints lensSolvedMetaStore :: Lens' PostScopeState LocalMetaStore lensStatistics :: Lens' PostScopeState Statistics lensSyntaxInfo :: Lens' PostScopeState HighlightingInfo lensTCWarnings :: Lens' PostScopeState (Set TCWarning) lensTemporaryInstances :: Lens' PostScopeState (Set QName) lensTheDef :: Lens' Definition Defn lensTopLevelModuleNames :: Lens' PersistentTCState (BiMap RawTopLevelModuleName ModuleNameHash) lensUnusedImportsState :: Lens' PreScopeState UnusedImportsState lensVisitedModules :: Lens' PreScopeState VisitedModules lensWarningOnImport :: Lens' PreScopeState (Maybe Text) localR :: (ReduceEnv -> ReduceEnv) -> ReduceM a -> ReduceM a localRewritingOption :: HasOptions m => m Bool locallyReconstructed :: MonadTCEnv m => m a -> m a locallyReduceAllDefs :: MonadTCEnv m => m a -> m a locallyReduceDefs :: MonadTCEnv m => ReduceDefs -> m a -> m a -- | Modify the lens-indicated part of the TCEnv in a -- subcomputation. locallyTC :: MonadTCEnv m => Lens' TCEnv a -> (a -> a) -> m b -> m b -- | Utility function for 1-arg constructed type errors. Note that the -- HasCallStack constraint is on the *resulting* function. locatedTypeError :: MonadTCError m => (a -> TypeError) -> HasCallStack => a -> m b lowMetaPriority :: MetaPriority lrewsDefHeaded :: Lens' LocalRewriteRuleMap (HashMap QName [Open RewriteRule]) lrewsVarHeaded :: Lens' LocalRewriteRuleMap (IntMap [Open RewriteRule]) mapRedEnv :: (TCEnv -> TCEnv) -> ReduceEnv -> ReduceEnv mapRedEnvSt :: (TCEnv -> TCEnv) -> (TCState -> TCState) -> ReduceEnv -> ReduceEnv mapRedSt :: (TCState -> TCState) -> ReduceEnv -> ReduceEnv mapTCMT :: (forall a1. () => m a1 -> n a1) -> TCMT m a -> TCMT n a metaFrozen :: Lens' MetaVariable Frozen mkEnvFlag :: Int -> Lens' TCEnv Bool mkFlag :: Int -> Lens' Flags64 Bool -- | Dirty when a constraint is added, used to prevent pointer update. -- Currently unused. mkPostFlag :: Int -> Lens' PostScopeState Bool -- | Like stateSessionLens, but the modification function can not -- return an extra result. modifySession :: ModifySession m => Lens' SessionState a -> (a -> a) -> m () modifySystem :: (System -> System) -> ExtLamInfo -> ExtLamInfo -- | A variant of modifyTC in which the computation is strict in the -- new state. modifyTC' :: MonadTCState m => (TCState -> TCState) -> m () -- | Modify the part of the TCState focused on by the lens. modifyTCLens :: MonadTCState m => Lens' TCState a -> (a -> a) -> m () -- | Modify the part of the TCState focused on by the lens -- (strictly). modifyTCLens' :: MonadTCState m => Lens' TCState a -> (a -> a) -> m () -- | Modify a part of the state monadically. -- -- This is an instance of %==. modifyTCLensM :: (MonadTCState m, ReadTCState m) => Lens' TCState a -> (a -> m a) -> m () nextFresh :: HasFresh i => TCState -> (i, TCState) noCompiledRep :: CompiledRepresentation normalMetaPriority :: MetaPriority notReduced :: a -> MaybeReduced a onLetBindingType :: (Dom Type -> Dom Type) -> LetBinding -> LetBinding onReduceEnv :: (ReduceEnv -> ReduceEnv) -> ReduceM a -> ReduceM a -- | Base name for patterns in telescopes patternInTeleName :: String primAbstr :: Defn -> IsAbstract primClauses :: Defn -> [Clause] primCompiled :: Defn -> Maybe CompiledClauses primFun :: QName -> Arity -> ([Arg Term] -> ReduceM (Reduced MaybeReducedArgs Term)) -> PrimFun primInv :: Defn -> FunctionInverse primName :: Defn -> PrimitiveId primOpaque :: Defn -> IsOpaque primSortName :: Defn -> BuiltinSort primSortSort :: Defn -> Sort -- | The info of the principal (record) argument. projArgInfo :: Projection -> ArgInfo -- | Building the projection function (which drops the parameters). projDropPars :: Projection -> ProjOrigin -> Term pureTCM :: forall (m :: Type -> Type) a. MonadIO m => (TCState -> TCEnv -> a) -> TCMT m a reallyAllReductions :: AllowedReductions recAbstr :: Defn -> IsAbstract recClause :: Defn -> Maybe Term recComp :: Defn -> CompKit recCon :: Defn -> QName recConHead :: Defn -> ConHead recEtaEquality :: Defn -> HasEta recEtaEquality' :: Defn -> EtaEquality recFields :: Defn -> [Dom QName] recInduction :: Defn -> Maybe Induction recMutual :: Defn -> Maybe [QName] recNamedCon :: Defn -> Bool recPars :: Defn -> Nat recPatternMatching :: Defn -> PatternOrCopattern recPositivityCheck :: Defn -> PositivityCheck -- | Is the record type recursive? recRecursive :: Defn -> Bool recRecursive_ :: RecordData -> Bool recTel :: Defn -> Telescope recTerminates :: Defn -> Maybe Bool recordFieldWarningToError :: RecordFieldWarning -> TypeError -- | Conceptually: redBind m f k = either (return . Left . f) k -- =<< m redBind :: ReduceM (Reduced a a') -> (a -> ReduceM b) -> (a' -> ReduceM (Reduced b b')) -> ReduceM (Reduced b b') redReturn :: a -> ReduceM (Reduced a' a) reduceAllDefs :: ReduceDefs reduceEnv :: Lens' ReduceEnv TCEnv reduceSt :: Lens' ReduceEnv TCState reduced :: Blocked (Arg Term) -> MaybeReduced (Arg Term) returnTCMT :: forall (m :: Type -> Type) a. Applicative m => a -> TCMT m a rewritingOption :: HasOptions m => m Bool runBlocked :: BlockT m a -> m (Either Blocker a) runReduceM :: ReduceM a -> TCM a -- | runSafeTCM runs a safe TCM action (a TCM action -- which cannot fail, except that it might raise IOExceptions) in -- the initial environment. runSafeTCM :: TCM a -> TCState -> IO (a, TCState) -- | Running the type checking monad (most general form). runTCM :: MonadIO m => TCEnv -> TCState -> TCMT m a -> m (a, TCState) -- | Running the type checking monad on toplevel (with initial state). runTCMTop :: TCM a -> IO (Either TCErr a) runTCMTop' :: MonadIO m => TCMT m a -> m a secTelescope :: Lens' Section Telescope -- | Make sure we do not overwrite a user specification. setEtaEquality :: EtaEquality -> EtaEquality -> EtaEquality setFlag :: Int -> Bool -> Flags64 -> Flags64 -- | Like modifySession, but with a constant new value. -- -- If the computation of the new value depends on a previous -- useSession, this function is prone to suffering from -- time-of-check vs. time-of-use issues. Prefer the -- stateSessionLensM family of functions instead. setSession :: ModifySession m => Lens' SessionState a -> a -> m () -- | Overwrite the part of the TCState focused on by the lens. setTCLens :: MonadTCState m => Lens' TCState a -> a -> m () infix 4 `setTCLens` -- | Overwrite the part of the TCState focused on by the lens -- (strictly). setTCLens' :: MonadTCState m => Lens' TCState a -> a -> m () shouldReduceDef :: MonadTCEnv m => QName -> m Bool sigDefinitions :: Lens' Signature Definitions sigInstances :: Lens' Signature InstanceTable sigRewriteRules :: Lens' Signature GlobalRewriteRuleMap sigSections :: Lens' Signature Sections sizedTypesOption :: HasOptions m => m Bool -- | Get the file name of a SourceFile. srcFilePath :: MonadFileId m => SourceFile -> m AbsolutePath -- | Get make a SourceFile from a file name. srcFromPath :: MonadFileId m => AbsolutePath -> m SourceFile -- | use areWeCaching from the Caching module instead. stAreWeCaching :: Lens' TCState Bool stAwakeConstraints :: Lens' TCState Constraints stBuiltinThings :: TCState -> BuiltinThings stConcreteNames :: Lens' TCState ConcreteNames stConsideringInstance :: Lens' TCState Bool stCopiedNames :: Lens' TCState (HashMap QName QName) stCurrentModule :: Lens' TCState (Maybe (Pair ModuleName TopLevelModuleName)) stDirty :: Lens' TCState Bool stDisambiguatedNames :: Lens' TCState DisambiguatedNames stFileId :: Lens' TCState (Maybe FileId) stForeignCode :: Lens' TCState BackendForeignCode stFreshCheckpointId :: Lens' TCState CheckpointId stFreshInt :: Lens' TCState Int stFreshInteractionId :: Lens' TCState InteractionId stFreshMetaId :: Lens' TCState MetaId stFreshMutualId :: Lens' TCState MutualId stFreshNameId :: Lens' TCState NameId stFreshOpaqueId :: Lens' TCState OpaqueId stFreshProblemId :: Lens' TCState ProblemId stGeneralizedVars :: Lens' TCState (Maybe (Set QName)) stImportedBuiltins :: Lens' TCState BuiltinThings stImportedDisplayForms :: Lens' TCState DisplayForms stImportedMetaStore :: Lens' TCState RemoteMetaStore stImportedModules :: Lens' TCState ImportedModules stImportedModulesAndTransitive :: Lens' TCState (ImportedModules, ImportedModules) stImportedModulesTransitive :: Lens' TCState ImportedModules stImportedPartialDefs :: Lens' TCState (Set QName) stImportedUserWarnings :: Lens' TCState UserWarnings stImports :: Lens' TCState Signature stImportsDisplayForms :: Lens' TCState DisplayForms stInstanceDefs :: Lens' TCState TempInstanceTable stInstanceHack :: Lens' TCState Bool stInstanceTree :: Lens' TCState (DiscrimTree QName) stInstantiateBlocking :: Lens' TCState Bool stInteractionPoints :: Lens' TCState InteractionPoints stLibCache :: Lens' TCState LibCache stLoadedFileCache :: Lens' TCState (Maybe LoadedFileCache) stLocalBuiltins :: Lens' TCState BuiltinThings stLocalPartialDefs :: Lens' TCState (Set QName) stLocalUserWarnings :: Lens' TCState UserWarnings stModuleCheckpoints :: Lens' TCState ModuleCheckpoints stMutualBlocks :: Lens' TCState MutualBlocks stNameCopies :: Lens' TCState (HashMap QName (HashSet QName)) stOccursCheckDefs :: Lens' TCState (Set QName) stOpaqueBlocks :: Lens' TCState (Map OpaqueId OpaqueBlock) stOpaqueIds :: Lens' TCState (Map QName OpaqueId) stOpenMetaStore :: Lens' TCState LocalMetaStore stPatternSynImports :: Lens' TCState PatternSynDefns stPatternSyns :: Lens' TCState PatternSynDefns stPostAreWeCaching :: Lens' Flags64 Bool stPostConsideringInstance :: Lens' Flags64 Bool stPostDirty :: Lens' Flags64 Bool stPostInstanceHack :: Lens' Flags64 Bool -- | Should we instantiate away blocking metas? This can produce ill-typed -- terms but they are often more readable. See issue #3606. Best set to -- True only for calls to pretty*/reify to limit unwanted reductions. -- -- Is this a context where we should always try every possible instance -- candidate? Used to support "inert improvement", see -- shouldBlockOverlap in InstanceArguments. stPostInstantiateBlocking :: Lens' Flags64 Bool stPostPostponeInstanceSearch :: Lens' Flags64 Bool stPostponeInstanceSearch :: Lens' TCState Bool stPragmaOptions :: Lens' TCState PragmaOptions stRewriteRules :: Lens' TCState GlobalRewriteRuleMap stScope :: Lens' TCState ScopeInfo stSignature :: Lens' TCState Signature stSleepingConstraints :: Lens' TCState Constraints stSolvedMetaStore :: Lens' TCState LocalMetaStore stStatistics :: Lens' TCState Statistics stSyntaxInfo :: Lens' TCState HighlightingInfo stTCWarnings :: Lens' TCState (Set TCWarning) stTemporaryInstances :: Lens' TCState (Set QName) stTokens :: Lens' TCState HighlightingInfo stTopLevelModuleNames :: Lens' TCState (BiMap RawTopLevelModuleName ModuleNameHash) stUnusedImportsState :: Lens' TCState UnusedImportsState stVisitedModules :: Lens' TCState VisitedModules stWarningOnImport :: Lens' TCState (Maybe Text) stWarningSet :: Lens' TCState (Set WarningName) -- | Like stateSessionLensM, but the modification function is not -- allowed to perform effects. stateSessionLens :: ModifySession m => Lens' SessionState a -> (a -> (r, a)) -> m r -- | Modify the part of the TCState focused on by the lens, and -- return some result. stateTCLens :: (MonadTCState m, ReadTCState m) => Lens' TCState a -> (a -> (r, a)) -> m r -- | Modify a part of the state monadically, and return some result. -- -- This is an instance of %%=. stateTCLensM :: (MonadTCState m, ReadTCState m) => Lens' TCState a -> (a -> m (r, a)) -> m r -- | Append an ArgName to a MetaNameSuggestion, for computing -- the name suggestions of eta-expansion metas. If the -- MetaNameSuggestion is empty or an underscore, the field name is -- taken as the suggestion. suffixNameSuggestion :: MetaNameSuggestion -> ArgName -> MetaNameSuggestion syntaxError :: (HasCallStack, MonadTCError m) => String -> m a tcWarningOrigin :: TCWarning -> SrcFile thenReduce :: ReduceM a -> ReduceM b -> ReduceM b thenTCMT :: forall (m :: Type -> Type) a b. Applicative m => TCMT m a -> TCMT m b -> TCMT m b toExpandLast :: Bool -> ExpandHidden toReduceDefs :: (Bool, [QName]) -> ReduceDefs -- | Lookup the path of a top level module name, which must be a known one. topLevelModuleFilePath :: HasCallStack => ModuleToSource -> TopLevelModuleName -> AbsolutePath typeError :: (HasCallStack, MonadTCError m) => TypeError -> m a typeError' :: MonadTCError m => CallStack -> TypeError -> m a typeError'_ :: (MonadTCEnv m, ReadTCState m) => CallStack -> TypeError -> m TCErr typeError_ :: (HasCallStack, MonadTCEnv m, ReadTCState m) => TypeError -> m TCErr unKleisli :: (a -> ReduceM b) -> ReduceM (a -> b) unTCM :: TCMT m a -> IORef TCState -> TCEnv -> m a -- | Union two Builtins. unionBuiltin :: Builtin a -> Builtin a -> Builtin a unquoteError :: (HasCallStack, MonadTCError m) => UnquoteError -> m a unquoteNormalise :: Lens' UnquoteFlags Bool useR :: ReadTCState m => Lens' TCState a -> m a -- | Access a part of the SessionState through a lens. useSession :: ReadTCState m => Lens' SessionState a -> m a useTC :: ReadTCState m => Lens' TCState a -> m a viewTC :: MonadTCEnv m => Lens' TCEnv a -> m a warningName :: Warning -> WarningName withoutKOption :: HasOptions m => m Bool data AbstractMode -- | Abstract things in the current module can be accessed. AbstractMode :: AbstractMode -- | No abstract things can be accessed. ConcreteMode :: AbstractMode -- | All abstract things can be accessed. IgnoreAbstractMode :: AbstractMode -- | Controlling reduce. data AllowedReduction -- | (Projection and) projection-like functions may be reduced. ProjectionReductions :: AllowedReduction -- | Functions marked INLINE may be reduced. InlineReductions :: AllowedReduction -- | Copattern definitions may be reduced. CopatternReductions :: AllowedReduction -- | The primRewriteNoMatch primitive may be reduced. RewriteNoMatchReductions :: AllowedReduction -- | Non-recursive functions and primitives may be reduced. FunctionReductions :: AllowedReduction -- | Even recursive functions may be reduced. RecursiveReductions :: AllowedReduction -- | Reduce Level terms. LevelReductions :: AllowedReduction -- | Allow allReductions in types, even if not allowed at term -- level (used by confluence checker) TypeLevelReductions :: AllowedReduction -- | Functions whose termination has not (yet) been confirmed. UnconfirmedReductions :: AllowedReduction -- | Functions that have failed termination checking. NonTerminatingReductions :: AllowedReduction type AllowedReductions = SmallSet AllowedReduction data ArgsCheckState a ACState :: [CheckedArg] -> Expr -> Type -> a -> ArgsCheckState a -- | Checked and inserted arguments so far. [acCheckedArgs] :: ArgsCheckState a -> [CheckedArg] -- | The function applied to the already checked arguments. [acFun] :: ArgsCheckState a -> Expr -- | Type of the function (for checking the remaining arguments). [acType] :: ArgsCheckState a -> Type [acData] :: ArgsCheckState a -> a data AxiomData AxiomData :: Bool -> AxiomData -- | Can transp for this postulate be constant? Set to True for -- builtins like String. [_axiomConstTransp] :: AxiomData -> Bool type Backend = Backend_boot Definition TCM type Backend' opts env menv mod def = Backend'_boot Definition TCM opts env menv mod def type BackendForeignCode = Map BackendName ForeignCodeStack newtype BlockT (m :: Type -> Type) a BlockT :: ExceptT Blocker m a -> BlockT (m :: Type -> Type) a [unBlockT] :: BlockT (m :: Type -> Type) a -> ExceptT Blocker m a data Builtin pf Builtin :: Term -> Builtin pf Prim :: pf -> Builtin pf -- | BUILTIN REWRITE. We can have several rewrite relations. BuiltinRewriteRelations :: Set QName -> Builtin pf data BuiltinDescriptor BuiltinData :: TCM Type -> [BuiltinId] -> BuiltinDescriptor BuiltinDataCons :: TCM Type -> BuiltinDescriptor BuiltinPrim :: PrimitiveId -> (Term -> TCM ()) -> BuiltinDescriptor BuiltinSort :: BuiltinSort -> BuiltinDescriptor BuiltinPostulate :: Relevance -> TCM Type -> BuiltinDescriptor -- | Builtin of any kind. Type can be checked (Just t) or inferred -- (Nothing). The second argument is the hook for the -- verification function. BuiltinUnknown :: Maybe (TCM Type) -> (Term -> Type -> TCM ()) -> BuiltinDescriptor data BuiltinInfo BuiltinInfo :: BuiltinId -> BuiltinDescriptor -> BuiltinInfo [builtinName] :: BuiltinInfo -> BuiltinId [builtinDesc] :: BuiltinInfo -> BuiltinDescriptor data BuiltinSort SortUniv :: Univ -> BuiltinSort SortOmega :: Univ -> BuiltinSort SortIntervalUniv :: BuiltinSort SortLevelUniv :: BuiltinSort type BuiltinThings = BuiltinThings' PrimFun type BuiltinThings' pf = Map SomeBuiltin Builtin pf -- | A log of what the type checker does and states after the action is -- completed. The cached version is stored first executed action first. type CachedTypeCheckLog = [(TypeCheckAction, PostScopeState)] data Call CheckClause :: Type -> SpineClause -> Call CheckLHS :: SpineLHS -> Call CheckPattern :: Pattern -> Telescope -> Type -> Call CheckPatternLinearityType :: Name -> Call CheckPatternLinearityValue :: Name -> Call CheckLetBinding :: LetBinding -> Call InferExpr :: Expr -> Call CheckExprCall :: Comparison -> Expr -> Type -> Call CheckDotPattern :: Expr -> Term -> Call CheckProjection :: Range -> QName -> Type -> Call IsTypeCall :: Comparison -> Expr -> Sort -> Call IsType_ :: Expr -> Call InferVar :: Name -> Call InferDef :: QName -> Call CheckArguments :: Expr -> [NamedArg Expr] -> Type -> Maybe Type -> Call CheckMetaSolution :: Range -> MetaId -> Type -> Term -> Call CheckTargetType :: Range -> Type -> Type -> Call CheckDataDef :: Range -> QName -> [LamBinding] -> [Constructor] -> Call CheckRecDef :: Range -> QName -> [LamBinding] -> [Constructor] -> Call CheckConstructor :: QName -> Telescope -> Sort -> Constructor -> Call CheckConArgFitsIn :: QName -> Bool -> Type -> Sort -> Call -- | Highlight (interactively) if and only if the boolean is True. CheckFunDefCall :: Range -> QName -> Bool -> Call CheckPragma :: Range -> Pragma -> Call CheckPrimitive :: Range -> QName -> Expr -> Call CheckIsEmpty :: Range -> Type -> Call CheckConfluence :: QName -> QName -> Call CheckModuleParameters :: ModuleName -> Telescope -> Call CheckWithFunctionType :: Type -> Call CheckSectionApplication :: Range -> Erased -> ModuleName -> ModuleApplication -> Call CheckNamedWhere :: ModuleName -> Call -- | Checking a clause for confluence with endpoint reductions. Always -- φ ⊢ f vs = rhs for now, but we store the simplifications of -- f vs[φ] and rhs[φ]. CheckIApplyConfluence :: Range -> QName -> Term -> Term -> Term -> Type -> Call CheckLocalRewriteConstraint :: LocalEquation -> Maybe (Closure Call) -> Call ScopeCheckExpr :: Expr -> Call ScopeCheckDeclaration :: NiceDeclaration -> Call ScopeCheckLHS :: QName -> Pattern -> Call NoHighlighting :: Call -- | Interaction command: show module contents. ModuleContents :: Call -- | used by setCurrentRange SetRange :: Range -> Call -- | Information about a call. data CallInfo CallInfo :: QName -> Closure Term -> CallInfo -- | Target function name. (Contains its range.) [callInfoTarget] :: CallInfo -> QName -- | To be formatted representation of the call. [callInfoCall] :: CallInfo -> Closure Term -- | A candidate solution for an instance meta is a term with its type. It -- may be the case that the candidate is not fully applied yet or of the -- wrong type, hence the need for the type. data Candidate Candidate :: CandidateKind -> Term -> Type -> OverlapMode -> Candidate [candidateKind] :: Candidate -> CandidateKind [candidateTerm] :: Candidate -> Term [candidateType] :: Candidate -> Type [candidateOverlap] :: Candidate -> OverlapMode data CandidateKind LocalCandidate :: CandidateKind GlobalCandidate :: QName -> CandidateKind -- | Extra information for error CannotQuote. data CannotQuote -- | quote is applied to a really ambiguous name. CannotQuoteAmbiguous :: AmbiguousQName -> CannotQuote -- | quote is applied to an expression that is not an unambiguous -- defined name. CannotQuoteExpression :: Expr -> CannotQuote -- | quote is applied to a non-visible argument. CannotQuoteHidden :: CannotQuote -- | quote is unapplied. CannotQuoteNothing :: CannotQuote -- | quote is applied to a pattern that is not an unambiguous -- defined name. CannotQuotePattern :: NamedArg Pattern -> CannotQuote data CheckedArg CheckedArg :: Elim -> Range -> Maybe (Abs Constraint) -> CheckedArg -- | Checked and inserted argument. [caElim] :: CheckedArg -> Elim -- | Range of checked argument, where present. E.g. inserted implicits have -- no correponding abstract syntax. [caRange] :: CheckedArg -> Range -- | Head constraint before applying the argument. [caConstraint] :: CheckedArg -> Maybe (Abs Constraint) -- | Solving a CheckArgs constraint may or may not check the target -- type. If it did, it returns a handle to any unsolved constraints. data CheckedTarget CheckedTarget :: Maybe ProblemId -> CheckedTarget NotCheckedTarget :: CheckedTarget newtype CheckpointId CheckpointId :: Int -> CheckpointId -- | Name a ClashingDefinition clashes with. data ClashingName -- | We have WhyInScope information for the previously defined name. ClashingAbstractName :: AbstractName -> ClashingName -- | We have no extra information for the previously defined name. ClashingQName :: QName -> ClashingName data Closure a Closure :: Signature -> TCEnv -> ScopeInfo -> ModuleCheckpoints -> a -> Closure a [clSignature] :: Closure a -> Signature [clEnv] :: Closure a -> TCEnv [clScope] :: Closure a -> ScopeInfo [clModuleCheckpoints] :: Closure a -> ModuleCheckpoints [clValue] :: Closure a -> a data ColdEnv ColdEnv :: ModuleName -> Maybe Int -> Maybe FileId -> [(ModuleName, Nat)] -> [TopLevelModuleName] -> Maybe MutualId -> TerminationCheck () -> CoverageCheck -> WhereClause_ -> Maybe ProblemId -> AbstractMode -> Range -> Range -> IPClause -> Maybe (Closure Call) -> HighlightingLevel -> HighlightingMethod -> ExpandHidden -> Simplification -> ReduceDefs -> Int -> UnquoteFlags -> Int -> [QName] -> DoGeneralize -> Map QName GeneralizedValue -> Maybe BackendName -> Maybe OpaqueId -> Maybe String -> ColdEnv [envCurrentModule] :: ColdEnv -> ModuleName -- | If this counter is Nothing, then syntactic equality checking is -- unrestricted. If it is zero, then syntactic equality checking is not -- run at all. If it is a positive number, then syntactic equality -- checking is allowed to run, but the counter is decreased in the -- failure continuation of checkSyntacticEquality. [envSyntacticEqualityFuel] :: ColdEnv -> Maybe Int -- | The path to the file that is currently being type-checked. -- Nothing if we do not have a file (like in interactive mode see -- CommandLine). [envCurrentPath] :: ColdEnv -> Maybe FileId -- | anonymous modules and their number of free variables [envAnonymousModules] :: ColdEnv -> [(ModuleName, Nat)] -- | The module stack with the entry being the top-level module as Agda -- chases modules. It will be empty if there is no main module, will have -- a single entry for the top level module, or more when descending past -- the main module. This is used to detect import cycles and in some -- cases highlighting behavior. The level of a given module is not -- necessarily the same as the length, in the module dependency graph, of -- the shortest path from the top-level module; it depends on in which -- order Agda chooses to chase dependencies. [envImportStack] :: ColdEnv -> [TopLevelModuleName] -- | the current (if any) mutual block [envMutualBlock] :: ColdEnv -> Maybe MutualId -- | are we inside the scope of a termination pragma [envTerminationCheck] :: ColdEnv -> TerminationCheck () -- | are we inside the scope of a coverage pragma [envCoverageCheck] :: ColdEnv -> CoverageCheck -- | Have we stepped into the where-declarations of a clause? Everything -- under a where will be checked with this flag on. [envCheckingWhere] :: ColdEnv -> WhereClause_ -- | If inside a runUnquoteM call, stores the top-level problem id -- assigned to the invokation. We use this to decide which instance -- constraints originate from the current call and which come from the -- outside, for the purpose of a solveInstanceConstraints inside -- noConstraints only failing for local instance constraints. [envUnquoteProblem] :: ColdEnv -> Maybe ProblemId -- | When checking the typesignature of a public definition or the body of -- a non-abstract definition this is true. To prevent information about -- abstract things leaking outside the module. [envAbstractMode] :: ColdEnv -> AbstractMode [envRange] :: ColdEnv -> Range -- | Interactive highlighting uses this range rather than envRange. [envHighlightingRange] :: ColdEnv -> Range -- | What is the current clause we are type-checking? Will be recorded in -- interaction points in this clause. [envClause] :: ColdEnv -> IPClause -- | what we're doing at the moment [envCall] :: ColdEnv -> Maybe (Closure Call) -- | Set to None when imported modules are type-checked. [envHighlightingLevel] :: ColdEnv -> HighlightingLevel [envHighlightingMethod] :: ColdEnv -> HighlightingMethod -- | When type-checking an alias f=e, we do not want to insert hidden -- arguments in the end, because these will become unsolved metas. [envExpandLast] :: ColdEnv -> ExpandHidden -- | Did we encounter a simplification (proper match) during the current -- reduction process? [envSimplification] :: ColdEnv -> Simplification [envReduceDefs] :: ColdEnv -> ReduceDefs -- | Injectivity can cause non-termination for unsolvable contraints (#431, -- #3067). Keep a limit on the nesting depth of injectivity uses. [envInjectivityDepth] :: ColdEnv -> Int [envUnquoteFlags] :: ColdEnv -> UnquoteFlags -- | Until we get a termination checker for instance search (#1743) we -- limit the search depth to ensure termination. [envInstanceDepth] :: ColdEnv -> Int -- | #3004: pattern lambdas with copatterns may refer to themselves. We -- don't have a good story for what to do in this case, but at least -- printing shouldn't loop. Here we keep track of which pattern lambdas -- we are currently in the process of printing. [envPrintingPatternLambdas] :: ColdEnv -> [QName] -- | Should new metas generalized over. [envGeneralizeMetas] :: ColdEnv -> DoGeneralize -- | Values for used generalizable variables. [envGeneralizedVars] :: ColdEnv -> Map QName GeneralizedValue -- | Is some backend active at the moment, and if yes, which? NB: we only -- store the BackendName here, otherwise instance Data -- TEnv is not derivable. The actual backend can be obtained from -- the name via stBackends. [envActiveBackendName] :: ColdEnv -> Maybe BackendName -- | Unique identifier of the opaque block we are currently under, if any. -- Used by the scope checker (to associate definitions to blocks), and by -- the type checker (for unfolding control). [envCurrentOpaqueId] :: ColdEnv -> Maybe OpaqueId -- | A string to be used as the prefix for module chasing (Checking, -- Loading, etc.) messages. If unset, the length of the import stack is -- used. [envChasePrefix] :: ColdEnv -> Maybe String data CompKit CompKit :: Maybe QName -> Maybe QName -> CompKit [nameOfHComp] :: CompKit -> Maybe QName [nameOfTransp] :: CompKit -> Maybe QName -- | We can either compare two terms at a given type, or compare two types -- without knowing (or caring about) their sorts. data CompareAs -- | Type should not be Size. But currently, we do not -- rely on this invariant. AsTermsOf :: Type -> CompareAs -- | Replaces AsTermsOf Size. AsSizes :: CompareAs AsTypes :: CompareAs -- | An extension of Comparison to >=. data CompareDirection DirEq :: CompareDirection DirLeq :: CompareDirection DirGeq :: CompareDirection type CompiledRepresentation = Map BackendName [CompilerPragma] -- | The backends are responsible for parsing their own pragmas. data CompilerPragma CompilerPragma :: Range -> String -> CompilerPragma type ConcreteNames = Map Name List1 Name data Constraint ValueCmp :: Comparison -> CompareAs -> Term -> Term -> Constraint ValueCmpOnFace :: Comparison -> Term -> Type -> Term -> Term -> Constraint ElimCmp :: [Polarity] -> [IsForced] -> Type -> Term -> [Elim] -> [Elim] -> Constraint SortCmp :: Comparison -> Sort -> Sort -> Constraint LevelCmp :: Comparison -> Level -> Level -> Constraint HasBiggerSort :: Sort -> Constraint HasPTSRule :: Dom Type -> Abs Sort -> Constraint -- | Check that the sort Sort of data type QName admits -- data/record types. E.g., sorts IUniv, SizeUniv etc. -- do not admit such constructions. See checkDataSort. CheckDataSort :: QName -> Sort -> Constraint CheckMetaInst :: MetaId -> Constraint CheckType :: Type -> Constraint -- | Meta created for a term blocked by a postponed type checking problem -- or unsolved constraints. The MetaInstantiation for the meta -- (when unsolved) is either BlockedConst or -- PostponedTypeCheckingProblem. UnBlock :: MetaId -> Constraint -- | The range is the one of the absurd pattern. IsEmpty :: Range -> Dom Type -> Constraint -- | Check that the Term is either not a SIZELT or a non-empty -- SIZELT. CheckSizeLtSat :: Term -> Constraint -- | the second argument is the instance argument and the third one is dhe -- list of candidates (or Nothing if we haven’t determined the list of -- candidates yet) FindInstance :: Range -> MetaId -> Maybe [Candidate] -> Constraint -- | Resolve the head symbol of the type that the given instance targets -- The KwRange is the range of the instance keyword. ResolveInstanceHead :: KwRange -> QName -> Constraint -- | Last argument is the error causing us to postpone. CheckFunDef :: DefInfo -> QName -> [Clause] -> TCErr -> Constraint -- | First argument is computation and the others are hole and goal type. UnquoteTactic :: Term -> Term -> Type -> Constraint -- | CheckLockedVars t ty lk lk_ty with t : ty, lk : -- lk_ty and t lk well-typed. CheckLockedVars :: Term -> Type -> Arg Term -> Type -> Constraint -- | Is the term usable at the given modality? This check should run if the -- Sort is Nothing or isFibrant. UsableAtModality :: WhyCheckModality -> Maybe Sort -> Modality -> Term -> Constraint -- | Does the local rewrite rule hold definitionally at the call-site? -- Essentially a ValueCmp but with a more specific error message RewConstraint :: LocalEquation -> Constraint type Constraints = [ProblemConstraint] data ConstructorData ConstructorData :: Int -> Int -> ConHead -> QName -> IsAbstract -> IsPathCons -> CompKit -> Maybe [QName] -> [IsForced] -> Maybe [Bool] -> Bool -> Bool -> ConstructorData -- | Number of parameters. [_conPars] :: ConstructorData -> Int -- | Number of arguments (excluding parameters). [_conArity] :: ConstructorData -> Int -- | Name of (original) constructor and fields. (This might be in a module -- instance.) [_conSrcCon] :: ConstructorData -> ConHead -- | Name of datatype or record type. [_conData] :: ConstructorData -> QName [_conAbstr] :: ConstructorData -> IsAbstract -- | Is this a path constructor (HIT constructor) or an ordinary "point" -- constructor? [_conPathCons] :: ConstructorData -> IsPathCons -- | Cubical composition. [_conComp] :: ConstructorData -> CompKit -- | Projections. Nothing if not yet computed. [_conProj] :: ConstructorData -> Maybe [QName] -- | Which arguments are forced (i.e. determined by the type of the -- constructor)? Either this list is empty (if the forcing analysis isn't -- run), or its length is conArity. [_conForced] :: ConstructorData -> [IsForced] -- | Which arguments are erased at runtime (computed during compilation to -- treeless)? True means erased, False means retained. -- Nothing if no erasure analysis has been performed yet. The -- length of the list is conArity. [_conErased] :: ConstructorData -> Maybe [Bool] -- | Was --erasure in effect when the constructor was defined? -- (This can affect the constructor's type.) [_conErasure] :: ConstructorData -> Bool -- | Shall we translate the constructor on the root of the rhs into -- copattern matching on the lhs? Activated by INLINE pragma. [_conInline] :: ConstructorData -> Bool -- | Information we have constructored in the middle of disambiguating a -- constructor. data ConstructorDisambiguationData ConstructorDisambiguationData :: QName -> List1 (QName, Type, ConHead) -> Args -> Type -> ConstructorDisambiguationData -- | One of the eligible ambiguous names (for error messages). [bcdConName] :: ConstructorDisambiguationData -> QName -- | The possible candidates for disambiguation [bcdCandidates] :: ConstructorDisambiguationData -> List1 (QName, Type, ConHead) -- | The arguments given to the constructor. [bcdArguments] :: ConstructorDisambiguationData -> Args -- | The type of the constructor application [bcdType] :: ConstructorDisambiguationData -> Type -- | Like CachedTypeCheckLog, but storing the log for an ongoing -- type checking of a module. Stored in reverse order (last performed -- action first). type CurrentTypeCheckLog = [(TypeCheckAction, PostScopeState)] data DataOrRecSigData DataOrRecSigData :: Int -> DataOrRecord_ -> DataOrRecSigData -- | Number of parameters. [_datarecPars] :: DataOrRecSigData -> Int -- | Is it a data or record signature? [_datarecKind] :: DataOrRecSigData -> DataOrRecord_ type DataOrRecordE = DataOrRecord' InductionAndEta data DatatypeData DatatypeData :: Nat -> Nat -> Maybe Term -> [QName] -> Sort -> Maybe [QName] -> PositivityCheck -> IsAbstract -> IsHIT -> Maybe QName -> Maybe QName -> DatatypeData -- | Number of parameters. [_dataPars] :: DatatypeData -> Nat -- | Number of indices. [_dataIxs] :: DatatypeData -> Nat -- | Was this data type created by a module application (is it a -- copy)? If yes, this is its definition, linking back to the -- original data type: a term t such that D args equals -- t `applyE` args. It is kept eta-contracted, so that it also -- unfolds underapplied occurrences of D (issue #8545). [_dataClause] :: DatatypeData -> Maybe Term -- | Constructor names, ordered according to the order of their definition. [_dataCons] :: DatatypeData -> [QName] [_dataSort] :: DatatypeData -> Sort -- | Mutually recursive functions, datas and records. -- Does include this data type. Empty if not recursive. Nothing -- if not yet computed (by positivity checker). [_dataMutual] :: DatatypeData -> Maybe [QName] -- | Should positivity errors be reported for this data type? [_dataPositivityCheck] :: DatatypeData -> PositivityCheck [_dataAbstr] :: DatatypeData -> IsAbstract -- | Does this data type have any path constructors, i.e., is it a higher -- inductive type (HIT)? [_dataHIT] :: DatatypeData -> IsHIT -- | If indexed datatype, name of the "index transport" function. [_dataTranspIx] :: DatatypeData -> Maybe QName -- | Transport function, should be available for all datatypes in supported -- sorts. [_dataTransp] :: DatatypeData -> Maybe QName type DecodedModules = Map TopLevelModuleName ModuleInfo data Definition Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe InstanceInfo -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> Language -> Bool -> Defn -> Definition -- | Hiding should not be used. [defArgInfo] :: Definition -> ArgInfo -- | The canonical name, used e.g. in compilation. [defName] :: Definition -> QName -- | Type of the lifted definition. [defType] :: Definition -> Type -- | Variance information on arguments of the definition. Does not include -- info for dropped parameters to projection(-like) functions and -- constructors. [defPolarity] :: Definition -> [Polarity] -- | Positivity information on arguments of the definition. Does not -- include info for dropped parameters to projection(-like) functions and -- constructors. [defArgOccurrences] :: Definition -> [Occurrence] -- | Gives the name of the (bound variable) parameter for named generalized -- parameters. This is needed to bring it into scope when type checking -- the data/record definition corresponding to a type with generalized -- parameters. [defGeneralizedParams] :: Definition -> [Maybe Name] [defDisplay] :: Definition -> [LocalDisplayForm] [defMutual] :: Definition -> MutualId [defCompiledRep] :: Definition -> CompiledRepresentation -- | Just q when this definition is an instance. [defInstance] :: Definition -> Maybe InstanceInfo -- | Has this function been created by a module instantiation? [defCopy] :: Definition -> Bool -- | The set of symbols with rewrite rules that match against this symbol -- Does not account for local rewrite rules [defMatchable] :: Definition -> Set QName -- | should compilers skip this? Used for e.g. cubical's comp [defNoCompilation] :: Definition -> Bool -- | Should the def be treated as injective by the pattern matching -- unifier? [defInjective] :: Definition -> Bool -- | Is this a function defined by copatterns? Does not account for local -- rewrite rules [defCopatternLHS'] :: Definition -> Bool -- | What blocking tag to use when we cannot reduce this def? Used when -- checking a function definition is blocked on a meta in the type. [defBlocked] :: Definition -> Blocked_ -- | The language used for the definition. [defLanguage] :: Definition -> Language -- | If this is False, the definition doesn't contain metavariables. -- If True, the definition may or may not contain metavariables. -- This field is updated by DeadCode, and it's used to avoid -- unnecessary instantiateFull on the definition before -- serialization. [defMightContainMetas] :: Definition -> Bool [theDef] :: Definition -> Defn type Definitions = HashMap QName Definition data Defn -- | Postulate. AxiomDefn :: AxiomData -> Defn -- | Data or record type signature that doesn't yet have a definition. DataOrRecSigDefn :: DataOrRecSigData -> Defn -- | Generalizable variable (introduced in variable block). GeneralizableVar :: NumGeneralizableArgs -> Defn -- | Returned by getConstInfo if definition is abstract. AbstractDefn :: Defn -> Defn FunctionDefn :: FunctionData -> Defn DatatypeDefn :: DatatypeData -> Defn RecordDefn :: RecordData -> Defn ConstructorDefn :: ConstructorData -> Defn -- | Primitive or builtin functions. PrimitiveDefn :: PrimitiveData -> Defn PrimitiveSortDefn :: PrimitiveSortData -> Defn -- | Name disambiguation for the sake of highlighting. data DisambiguatedName DisambiguatedName :: NameKind -> QName -> DisambiguatedName -- | Name from file position of occurrence to disambiguation. type DisambiguatedNames = IntMap DisambiguatedName -- | A DisplayForm is in essence a rewrite rule q ts --> -- dt for a defined symbol (could be a constructor as well) -- q. The right hand side is a DisplayTerm which is used -- to reify to a more readable Syntax. -- -- The patterns ts are just terms, but the first -- dfPatternVars variables are pattern variables that matches -- any term. data DisplayForm Display :: Nat -> Elims -> DisplayTerm -> DisplayForm -- | Number n of pattern variables in dfPats. [dfPatternVars] :: DisplayForm -> Nat -- | Left hand side patterns, the n first free variables are -- pattern variables, any variables above n are fixed and only -- match that particular variable. This happens when you have display -- forms inside parameterised modules that match on the module -- parameters. The ArgInfo is ignored in these patterns. [dfPats] :: DisplayForm -> Elims -- | Right hand side. [dfRHS] :: DisplayForm -> DisplayTerm type DisplayForms = HashMap QName List1 LocalDisplayForm -- | A structured presentation of a Term for reification into -- Syntax. data DisplayTerm -- | (f vs | ws) es. The first DisplayTerm is the parent -- function f with its args vs. The list of -- DisplayTerms are the with expressions ws. The -- Elims are additional arguments es (possible in case -- the with-application is of function type) or projections (if it is of -- record type). DWithApp :: DisplayTerm -> List1 DisplayTerm -> Elims -> DisplayTerm -- | c vs. DCon :: ConHead -> ConInfo -> [Arg DisplayTerm] -> DisplayTerm -- | d vs. DDef :: QName -> [Elim' DisplayTerm] -> DisplayTerm -- | .(v es). See DTerm'. DDot' :: Term -> Elims -> DisplayTerm -- | v es. This is a frozen elimination that is not always safe to -- run, because display forms may be ill-typed. (See issue #6476.) DTerm' :: Term -> Elims -> DisplayTerm data DoGeneralize -- | Generalize because it is a generalizable variable. YesGeneralizeVar :: DoGeneralize -- | Generalize because it is a metavariable and we're currently checking -- the type of a generalizable variable (this should get the default -- modality). YesGeneralizeMeta :: DoGeneralize -- | Don't generalize. NoGeneralize :: DoGeneralize -- | Should a record type admit eta-equality? data EtaEquality EtaEquality :: HasEta -> EtaProvenance -> EtaEquality -- | Eta or no eta? [theEtaEquality] :: EtaEquality -> HasEta -- | Where does this information come from? [etaProvenance] :: EtaEquality -> EtaProvenance -- | Provenance of the eta equality. Keep constructors in order -- EtaFromOption < EtaFromDirective < -- EtaFromPragma. data EtaProvenance -- | Default stemming from option (etaEnabled) and inductivity. EtaFromOption :: EtaProvenance -- | User specified (no-)eta-equality in record directive. EtaFromDirective :: EtaProvenance -- | User specified eta-equality through pragma, overruling safety checks. EtaFromPragma :: EtaProvenance -- | Error when trying to call an external executable during reflection. data ExecError -- | The given executable is not listed as trusted. ExeNotTrusted :: ExeName -> ExeMap -> ExecError -- | The given executable could not be found under the given path. ExeNotFound :: ExeName -> FilePath -> ExecError -- | The given file path does not have executable permissions. ExeNotExecutable :: ExeName -> FilePath -> ExecError data ExpandHidden -- | Add implicit arguments in the end until type is no longer hidden -- Pi. ExpandLast :: ExpandHidden -- | Do not append implicit arguments. DontExpandLast :: ExpandHidden -- | Makes doExpandLast have no effect. Used to avoid implicit -- insertion of arguments to metavariables. ReallyDontExpandLast :: ExpandHidden -- | Additional information for extended lambdas. data ExtLamInfo ExtLamInfo :: ModuleName -> Bool -> Maybe System -> ExtLamInfo -- | For complicated reasons the scope checker decides the QName of a -- pattern lambda, and thus its module. We really need to decide the -- module during type checking though, since if the lambda appears in a -- refined context the module picked by the scope checker has very much -- the wrong parameters. [extLamModule] :: ExtLamInfo -> ModuleName -- | Was this definition created from an absurd lambda λ ()? [extLamAbsurd] :: ExtLamInfo -> Bool [extLamSys] :: ExtLamInfo -> Maybe System type Face = [(Term, Bool)] newtype Fields Fields :: [(Name, Type)] -> Fields newtype Flags64 Flags64 :: Word64 -> Flags64 data ForeignCode ForeignCode :: Range -> String -> ForeignCode -- | Foreign code fragments are stored in reversed order to support -- efficient appending: head points to the latest pragma in module. newtype ForeignCodeStack ForeignCodeStack :: [ForeignCode] -> ForeignCodeStack [getForeignCodeStack] :: ForeignCodeStack -> [ForeignCode] -- | Create a fresh name from a. class FreshName a freshName_ :: (FreshName a, MonadFresh NameId m) => a -> m Name -- | Frozen meta variable cannot be instantiated by unification. This -- serves to prevent the completion of a definition by its use outside of -- the current block. (See issues 118, 288, 399). data Frozen -- | Do not instantiate. Frozen :: Frozen Instantiable :: Frozen data FunctionData FunctionData :: [Clause] -> Maybe CompiledClauses -> Maybe SplitTree -> Maybe Compiled -> [Clause] -> FunctionInverse -> Maybe [QName] -> Either ProjectionLikenessMissing Projection -> SmallSet FunctionFlag -> Maybe Bool -> Maybe ExtLamInfo -> IsWithFunction QName -> Maybe QName -> IsOpaque -> FunctionData [_funClauses] :: FunctionData -> [Clause] -- | Nothing while function is still type-checked. Just cc -- after type and coverage checking and translation to case trees. [_funCompiled] :: FunctionData -> Maybe CompiledClauses -- | The split tree constructed by the coverage checker. Needed to -- re-compile the clauses after forcing translation. [_funSplitTree] :: FunctionData -> Maybe SplitTree -- | Intermediate representation for compiler backends. [_funTreeless] :: FunctionData -> Maybe Compiled -- | Covering clauses computed by coverage checking. Erased by (IApply) -- confluence checking(?) [_funCovering] :: FunctionData -> [Clause] [_funInv] :: FunctionData -> FunctionInverse -- | Mutually recursive functions, datas and records. -- Does include this function. Empty list if not recursive. -- Nothing if not yet computed (by positivity checker). [_funMutual] :: FunctionData -> Maybe [QName] -- | Is it a record projection? If yes, then return the name of the record -- type and index of the record argument. Start counting with 1, because -- 0 means that it is already applied to the record. (Can happen in -- module instantiation.) This information is used in the termination -- checker. [_funProjection] :: FunctionData -> Either ProjectionLikenessMissing Projection -- | Various boolean flags pertaining to the function definition, see -- FunctionFlag. [_funFlags] :: FunctionData -> SmallSet FunctionFlag -- | Has this function been termination checked? Did it pass? [_funTerminates] :: FunctionData -> Maybe Bool -- | Is this function generated from an extended lambda? If yes, then -- return the number of hidden and non-hidden lambda-lifted arguments. [_funExtLam] :: FunctionData -> Maybe ExtLamInfo -- | Is this a generated with-function? If yes, then what's the name of the -- parent function? [_funWith] :: FunctionData -> IsWithFunction QName -- | Is this a helper for one of the Kan operations (transp, hcomp) on data -- types/records? If so, for which data type? [_funIsKanOp] :: FunctionData -> Maybe QName -- | Is this function opaque? If so, and we're not in an opaque block that -- includes this function('s name), it will be treated abstractly. [_funOpaque] :: FunctionData -> IsOpaque data FunctionFlag -- | Should calls to this function be normalised at compile-time? FunStatic :: FunctionFlag -- | Should calls to this function be inlined by the compiler? FunInline :: FunctionFlag -- | Is this function a macro? FunMacro :: FunctionFlag -- | Is this function INJECTIVE_FOR_INFERENCE? Indicates whether -- the first-order shortcut should be applied to the definition. FunFirstOrder :: FunctionFlag -- | Was --erasure in effect when the function was defined? (This -- can affect the type of a projection.) FunErasure :: FunctionFlag -- | Is the function abstract? FunAbstract :: FunctionFlag -- | Is this function a descendant of a field (typically, a projection)? FunProj :: FunctionFlag type FunctionInverse = FunctionInverse' Clause data FunctionInverse' c NotInjective :: FunctionInverse' c Inverse :: InversionMap c -> FunctionInverse' c -- | Errors raised by the GHC backend. data GHCBackendError -- | The number of Haskell constructors (String list) does not match -- the number of constructors of the given data type. ConstructorCountMismatch :: QName -> [QName] -> [String] -> GHCBackendError -- | GHC backend fails to represent given Agda type in Haskell. NotAHaskellType :: Term -> WhyNotAHaskellType -> GHCBackendError -- | The type of main should be IO _ (QName) but -- is instead Type. WrongTypeOfMain :: QName -> Type -> GHCBackendError -- | The value of a generalizable variable. This is created to be a -- generalizable meta before checking the type to be generalized. data GeneralizedValue GeneralizedValue :: CheckpointId -> Term -> Type -> GeneralizedValue [genvalCheckpoint] :: GeneralizedValue -> CheckpointId [genvalTerm] :: GeneralizedValue -> Term [genvalType] :: GeneralizedValue -> Type -- | Rewrite rules can be added independently from function clauses. data GlobalRewriteRule GlobalRewriteRule :: QName -> Telescope -> QName -> PElims -> Term -> Type -> Bool -> TopLevelModuleName -> GlobalRewriteRule -- | Name of rewrite rule q : Γ → f ps ≡ rhs where ≡ is -- the rewrite relation. [grName] :: GlobalRewriteRule -> QName -- | Γ. [grContext] :: GlobalRewriteRule -> Telescope -- | f. [grHead] :: GlobalRewriteRule -> QName -- | Γ ⊢ f ps : t. [grPats] :: GlobalRewriteRule -> PElims -- | Γ ⊢ rhs : t. [grRHS] :: GlobalRewriteRule -> Term -- | Γ ⊢ t. [grType] :: GlobalRewriteRule -> Type -- | Was this rewrite rule created from a clause in the definition of the -- function? [grFromClause] :: GlobalRewriteRule -> Bool -- | In which file is this rewrite rule defined? This information is used -- to eliminate rewrite rules that happen to be in stImports but -- are not actually transitively imported. [grTopModule] :: GlobalRewriteRule -> TopLevelModuleName type GlobalRewriteRuleMap = HashMap QName GlobalRewriteRules type GlobalRewriteRules = [GlobalRewriteRule] class Enum i => HasFresh i freshLens :: HasFresh i => Lens' TCState i nextFresh' :: HasFresh i => i -> i type IPBoundary = IPBoundary' Term newtype IPBoundary' t IPBoundary :: Map (IntMap Bool) t -> IPBoundary' t [getBoundary] :: IPBoundary' t -> Map (IntMap Bool) t -- | Which clause is an interaction point located in? data IPClause IPClause :: QName -> ClauseNumber -> Type -> IsWithFunction Substitution -> SpineClause -> Closure () -> IPClause -- | The name of the function. [ipcQName] :: IPClause -> QName -- | The number of the clause of this function. [ipcClauseNo] :: IPClause -> ClauseNumber -- | The type of the function [ipcType] :: IPClause -> Type -- | Module parameter substitution [ipcWithSub] :: IPClause -> IsWithFunction Substitution -- | The original AST clause. [ipcClause] :: IPClause -> SpineClause -- | Environment for rechecking the clause. [ipcClosure] :: IPClause -> Closure () -- | The interaction point is not in the rhs of a clause. IPNoClause :: IPClause data IllegalRewriteRuleReason LHSNotDefinitionOrConstructor :: IllegalRewriteRuleReason VariablesNotBoundByLHS :: VarSet -> IllegalRewriteRuleReason VariablesBoundMoreThanOnce :: VarSet -> IllegalRewriteRuleReason VariablesBoundInSingleton :: VarSet -> IllegalRewriteRuleReason LHSReduces :: Term -> Term -> IllegalRewriteRuleReason HeadSymbolIsProjectionLikeFunction :: QName -> IllegalRewriteRuleReason HeadSymbolIsTypeConstructor :: QName -> IllegalRewriteRuleReason HeadSymbolContainsMetas :: QName -> IllegalRewriteRuleReason ConstructorParametersNotGeneral :: ConHead -> Args1 -> IllegalRewriteRuleReason ContainsUnsolvedMetaVariables :: Set1 MetaId -> IllegalRewriteRuleReason BlockedOnProblems :: Set1 ProblemId -> IllegalRewriteRuleReason RequiresDefinitions :: Set1 QName -> IllegalRewriteRuleReason DoesNotTargetRewriteRelation :: IllegalRewriteRuleReason BeforeFunctionDefinition :: IllegalRewriteRuleReason BeforeMutualFunctionDefinition :: QName -> IllegalRewriteRuleReason DuplicateRewriteRule :: IllegalRewriteRuleReason LocalRewriteOutsideTelescope :: IllegalRewriteRuleReason type ImportedModules = Set TopLevelModuleName data IncorrectTypeForRewriteRelationReason ShouldAcceptAtLeastTwoArguments :: IncorrectTypeForRewriteRelationReason FinalTwoArgumentsNotVisible :: IncorrectTypeForRewriteRelationReason TypeDoesNotEndInSort :: Type -> Telescope -> IncorrectTypeForRewriteRelationReason data InductionAndEta InductionAndEta :: Maybe Induction -> EtaEquality -> InductionAndEta [recordInduction] :: InductionAndEta -> Maybe Induction [recordEtaEquality] :: InductionAndEta -> EtaEquality -- | Information about an instance definition. data InstanceInfo InstanceInfo :: QName -> OverlapMode -> InstanceInfo -- | Name of the "class" this is an instance for [instanceClass] :: InstanceInfo -> QName -- | Does this instance have a specified overlap mode? [instanceOverlap] :: InstanceInfo -> OverlapMode -- | Records information about the instances in the signature. Does not -- deal with local instances. data InstanceTable InstanceTable :: DiscrimTree QName -> Map QName Int -> InstanceTable -- | The actual discrimination tree for looking up instances with [_itableTree] :: InstanceTable -> DiscrimTree QName -- | For profiling, we store the number of instances on a per-class basis. -- This lets us compare the result from the discrimination tree with all -- the instances in scope, thus informing us how many validity checks -- were skipped. [_itableCounts] :: InstanceTable -> Map QName Int -- | Meta-variable instantiations. data Instantiation Instantiation :: [Arg String] -> Term -> Instantiation -- | The solution is abstracted over these free variables. [instTel] :: Instantiation -> [Arg String] -- | The body of the solution. [instBody] :: Instantiation -> Term -- | Errors raised in --interaction mode. data InteractionError -- | Failure of the give interactive tactic. CannotGive :: Expr -> InteractionError -- | Failure of the refine interactive tactic. CannotRefine :: String -> InteractionError -- | Failure of the makeCase interactive tactic. CaseSplitError :: Doc -> InteractionError -- | Expected the given expression to be an identifier. ExpectedIdentifier :: Expr -> InteractionError -- | Expected an argument of the form f e1 e2 .. en. ExpectedApplication :: InteractionError -- | Interaction point has not been reached during type checking. NoActionForInteractionPoint :: InteractionId -> InteractionError -- | InteractionId does not resolve to an InteractionPoint. NoSuchInteractionPoint :: InteractionId -> InteractionError -- | where not allowed in hole. UnexpectedWhere :: InteractionError -- | Callback fuction to call when there is a response to give to the -- interactive frontend. -- -- Note that the response is given in pieces and incrementally, so the -- user can have timely response even during long computations. -- -- Typical InteractionOutputCallback functions: -- -- type InteractionOutputCallback = Response_boot TCErr TCWarning WarningsAndNonFatalErrors -> TCM () -- | Interaction points are created by the scope checker who sets the -- range. The meta variable is created by the type checker and then -- hooked up to the interaction point. data InteractionPoint InteractionPoint :: Range -> Maybe MetaId -> Bool -> IPClause -> IPBoundary -> InteractionPoint -- | The position of the interaction point. [ipRange] :: InteractionPoint -> Range -- | The meta variable, if any, holding the type etc. [ipMeta] :: InteractionPoint -> Maybe MetaId -- | Has this interaction point already been solved? [ipSolved] :: InteractionPoint -> Bool -- | The clause of the interaction point (if any). Used for case splitting. [ipClause] :: InteractionPoint -> IPClause [ipBoundary] :: InteractionPoint -> IPBoundary -- | Data structure managing the interaction points. -- -- We never remove interaction points from this map, only set their -- ipSolved to True. (Issue #2368) type InteractionPoints = BiMap InteractionId InteractionPoint data Interface Interface :: Hash -> Text -> FileType -> [(TopLevelModuleName, Hash)] -> ModuleName -> TopLevelModuleName -> Map ModuleName Scope -> ScopeInfo -> Signature -> RemoteMetaStore -> DisplayForms -> UserWarnings -> Maybe Text -> BuiltinThings' (PrimitiveId, QName) -> Map BackendName ForeignCodeStack -> HighlightingInfo -> [OptionsPragma] -> [OptionsPragma] -> PragmaOptions -> PatternSynDefns -> Set TCWarning -> Set QName -> Map OpaqueId OpaqueBlock -> Map QName OpaqueId -> Interface -- | Hash of the source code. [iSourceHash] :: Interface -> Hash -- | The source code. The source code is stored so that the HTML and LaTeX -- backends can generate their output without having to re-read the -- (possibly out of date) source code. [iSource] :: Interface -> Text -- | Source file type, determined from the file extension [iFileType] :: Interface -> FileType -- | Imported modules and their hashes. [iImportedModules] :: Interface -> [(TopLevelModuleName, Hash)] -- | Module name of this interface. [iModuleName] :: Interface -> ModuleName -- | The module's top-level module name. [iTopLevelModuleName] :: Interface -> TopLevelModuleName -- | Scope defined by this module. -- -- Andreas, AIM XX: Too avoid duplicate serialization, this field is not -- serialized, so if you deserialize an interface, iScope will -- be empty. But constructIScope constructs iScope from -- iInsideScope. [iScope] :: Interface -> Map ModuleName Scope -- | Scope after we loaded this interface. Used in AtTopLevel and -- interactionLoop. [iInsideScope] :: Interface -> ScopeInfo [iSignature] :: Interface -> Signature -- | Instantiations for meta-variables that come from this module. [iMetaBindings] :: Interface -> RemoteMetaStore -- | Display forms added for imported identifiers. [iDisplayForms] :: Interface -> DisplayForms -- | User warnings for imported identifiers [iUserWarnings] :: Interface -> UserWarnings -- | Whether this module should raise a warning when imported [iImportWarning] :: Interface -> Maybe Text [iBuiltin] :: Interface -> BuiltinThings' (PrimitiveId, QName) [iForeignCode] :: Interface -> Map BackendName ForeignCodeStack [iHighlighting] :: Interface -> HighlightingInfo -- | Pragma options set in library files. [iDefaultPragmaOptions] :: Interface -> [OptionsPragma] -- | Pragma options set in the file. [iFilePragmaOptions] :: Interface -> [OptionsPragma] -- | Options/features used when checking the file (can be different from -- options set directly in the file). [iOptionsUsed] :: Interface -> PragmaOptions [iPatternSyns] :: Interface -> PatternSynDefns [iWarnings] :: Interface -> Set TCWarning [iPartialDefs] :: Interface -> Set QName [iOpaqueBlocks] :: Interface -> Map OpaqueId OpaqueBlock [iOpaqueNames] :: Interface -> Map QName OpaqueId -- | Extra information for InvalidFileName error. data InvalidFileNameReason DoesNotCorrespondToValidModuleName :: InvalidFileNameReason RootNameModuleNotAQualifiedModuleName :: Text -> InvalidFileNameReason type InversionMap c = Map TermHead [c] -- | Boolean flag whether a name is ambiguous. data IsAmbiguous YesAmbiguous :: AmbiguousQName -> IsAmbiguous NotAmbiguous :: IsAmbiguous data IsAxiom YesAxiom :: IsAxiom NoAxiom :: IsAxiom -- | Information about whether an argument is forced by the type of a -- function. data IsForced Forced :: IsForced NotForced :: IsForced -- | Is a constructor of a data type a path constructor (HIT constructor) -- or an ordinary "point" constructor? data IsPathCons PathCons :: IsPathCons PointCons :: IsPathCons -- | Three cases: 1. not reduced, 2. reduced, but blocked, 3. reduced, not -- blocked. data IsReduced NotReduced :: IsReduced Reduced :: Blocked () -> IsReduced -- | Errors raised by the JS backend. data JSBackendError BadCompilePragma :: JSBackendError -- | Parametrized since it is used without MetaId when creating a new meta. data Judgement a HasType :: a -> Comparison -> Type -> Judgement a [jMetaId] :: Judgement a -> a -- | are we checking (CmpLeq) or inferring (CmpEq) the -- type? [jComparison] :: Judgement a -> Comparison [jMetaType] :: Judgement a -> Type IsSort :: a -> Type -> Judgement a [jMetaId] :: Judgement a -> a [jMetaType] :: Judgement a -> Type -- | Distinguish error message when parsing lhs or pattern synonym, resp. data LHSOrPatSyn IsLHS :: LHSOrPatSyn IsPatSyn :: LHSOrPatSyn class LensClosure b a | b -> a lensClosure :: LensClosure b a => Lens' b (Closure a) class LensTCEnv a lensTCEnv :: LensTCEnv a => Lens' a TCEnv data LetBinding LetBinding :: IsAxiom -> Origin -> Term -> Dom Type -> LetBinding -- | Does this let binding origin from a LetAxiom? [letAxiom] :: LetBinding -> IsAxiom [letOrigin] :: LetBinding -> Origin [letTerm] :: LetBinding -> Term [letType] :: LetBinding -> Dom Type type LetBindings = Map Name Open LetBinding data Listener EtaExpand :: MetaId -> Listener CheckConstraint :: Nat -> ProblemConstraint -> Listener data LoadedFileCache LoadedFileCache :: CachedTypeCheckLog -> CurrentTypeCheckLog -> LoadedFileCache [lfcCached] :: LoadedFileCache -> CachedTypeCheckLog [lfcCurrent] :: LoadedFileCache -> CurrentTypeCheckLog type LocalDisplayForm = Open DisplayForm -- | Used for meta-variables from the current module. type LocalMetaStore = Map MetaId MetaVariable -- | Map from head symbols to local rewrite rules While the head symbols -- need to be eagerly updated to live in the current context, the rewrite -- rules do not. They instead each store a checkpoint id. data LocalRewriteRuleMap LocalRewriteRuleMap :: HashMap QName [Open RewriteRule] -> IntMap [Open RewriteRule] -> LocalRewriteRuleMap [defHeadedRews] :: LocalRewriteRuleMap -> HashMap QName [Open RewriteRule] [varHeadedRews] :: LocalRewriteRuleMap -> IntMap [Open RewriteRule] data MaybeReduced a MaybeRed :: IsReduced -> a -> MaybeReduced a [isReduced] :: MaybeReduced a -> IsReduced [ignoreReduced] :: MaybeReduced a -> a type MaybeReducedArgs = [MaybeReduced Arg Term] type MaybeReducedElims = [MaybeReduced Elim] -- | MetaInfo is cloned from one meta to the next during pruning. data MetaInfo MetaInfo :: Closure Range -> Modality -> RunMetaOccursCheck -> MetaNameSuggestion -> Arg DoGeneralize -> MetaInfo [miClosRange] :: MetaInfo -> Closure Range -- | Instantiable with irrelevant/erased solution? [miModality] :: MetaInfo -> Modality -- | Run the extended occurs check that goes in definitions? [miMetaOccursCheck] :: MetaInfo -> RunMetaOccursCheck -- | Used for printing. Just x if meta-variable comes from omitted -- argument with name x. [miNameSuggestion] :: MetaInfo -> MetaNameSuggestion -- | Should this meta be generalized if unsolved? If so, at what ArgInfo? [miGeneralizable] :: MetaInfo -> Arg DoGeneralize -- | Solution status of meta. data MetaInstantiation -- | Solved by Instantiation. InstV :: Instantiation -> MetaInstantiation -- | Unsolved (open to solutions). OpenMeta :: MetaKind -> MetaInstantiation -- | Solved, but solution blocked by unsolved constraints. BlockedConst :: Term -> MetaInstantiation -- | Meta stands for value of the expression that is still to be type -- checked. PostponedTypeCheckingProblem :: Closure TypeCheckingProblem -> MetaInstantiation -- | Meta variable priority: When we have an equation between -- meta-variables, which one should be instantiated? -- -- Higher value means higher priority to be instantiated. newtype MetaPriority MetaPriority :: Int -> MetaPriority -- | Information about local meta-variables. data MetaVariable MetaVar :: MetaInfo -> MetaPriority -> Permutation -> Judgement MetaId -> MetaInstantiation -> Set Listener -> Frozen -> Maybe MetaId -> MetaVariable [mvInfo] :: MetaVariable -> MetaInfo -- | some metavariables are more eager to be instantiated [mvPriority] :: MetaVariable -> MetaPriority -- | a metavariable doesn't have to depend on all variables in the context, -- this "permutation" (on de Bruijn levels) will throw away the ones it -- does not depend on [mvPermutation] :: MetaVariable -> Permutation [mvJudgement] :: MetaVariable -> Judgement MetaId [mvInstantiation] :: MetaVariable -> MetaInstantiation -- | meta variables scheduled for eta-expansion but blocked by this one [mvListeners] :: MetaVariable -> Set Listener -- | are we past the point where we can instantiate this meta variable? [mvFrozen] :: MetaVariable -> Frozen -- | Just m means that this meta-variable will be equated to -- m when the latter is unblocked. See -- blockTermOnProblem. [mvTwin] :: MetaVariable -> Maybe MetaId -- | Extra information for MissingTypeSignature error. data MissingTypeSignatureInfo -- | The data definition for Name lacks a data signature. MissingDataSignature :: Name -> MissingTypeSignatureInfo -- | The record definition for Name lacks a record -- signature. MissingRecordSignature :: Name -> MissingTypeSignatureInfo -- | The function lhs misses a type signature. MissingFunctionSignature :: LHS -> MissingTypeSignatureInfo data ModalEnv ModalEnv :: Relevance -> Quantity -> LetBindings -> AllowedReductions -> ModalEnv -- | Are we checking an irrelevant argument? (=Irrelevant) Then -- top-level irrelevant declarations are enabled. Other value: -- Relevant, then only relevant decls. are available. [envRelevance] :: ModalEnv -> Relevance -- | Are we checking a runtime-irrelevant thing? (=Quantity0) Then -- runtime-irrelevant things are usable. [envQuantity] :: ModalEnv -> Quantity [envLetBindings] :: ModalEnv -> LetBindings [envAllowedReductions] :: ModalEnv -> AllowedReductions class ReadTCState m => ModifySession (m :: Type -> Type) -- | Modify a part of the SessionState through a lens. If the -- continuation fails, modifications to the *session* state are reset. -- Other monadic states will not necessarily be reverted. -- -- This function keeps an **exclusive** lock on the session state **for -- the entire execution of the continuation**, regardless of what the -- given lens focuses on. -- -- No thread can access **any** part of the session state while -- stateSessionLensM is executing. This includes the continuation! -- Nested applications of this function **will always** deadlock. -- -- This function is strict in the modification to the session state, and -- the exclusive lock on the session state is maintained for the duration -- of forcing the new session state. -- -- This function has a few variants if less flexibility is required: * -- stateSessionLens takes a pure modification function. * -- modifySession does not allow returning an additional result. stateSessionLensM :: ModifySession m => Lens' SessionState a -> (a -> m (r, a)) -> m r -- | Distinguishes between type-checked and scope-checked interfaces when -- stored in the map of VisitedModules. data ModuleCheckMode ModuleScopeChecked :: ModuleCheckMode ModuleTypeChecked :: ModuleCheckMode -- | A stack of module checkpoints for the current module. -- -- We use a hand-rolled stack over a list so that we can UNPACK -- the CheckpointId and make all the fields strict. data ModuleCheckpoints -- | We are in a top-level module, so we don't need to worry about -- checkpoints. ModuleCheckpointsTop :: ModuleCheckpoints -- | A group of modules that all share a single checkpoint. ModuleCheckpointsSection :: ModuleCheckpoints -> Set ModuleName -> CheckpointId -> ModuleCheckpoints data ModuleInfo ModuleInfo :: Interface -> Set TCWarning -> Maybe IsBuiltinModule -> ModuleCheckMode -> SourceFile -> ModuleInfo [miInterface] :: ModuleInfo -> Interface -- | Warnings were encountered when the module was type checked. These -- might include warnings not stored in the interface itself, -- specifically unsolved interaction metas. See -- Agda.Interaction.Imports [miWarnings] :: ModuleInfo -> Set TCWarning -- | True if the module is a primitive module, which should always -- be importable. [miIsBuiltin] :: ModuleInfo -> Maybe IsBuiltinModule -- | The ModuleCheckMode used to create the Interface [miMode] :: ModuleInfo -> ModuleCheckMode -- | The file belonging to the module. [miSourceFile] :: ModuleInfo -> SourceFile class Monad m => MonadBlock (m :: Type -> Type) -- | `patternViolation b` aborts the current computation patternViolation :: MonadBlock m => Blocker -> m a ($dmpatternViolation) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a. (MonadBlock m, MonadTrans t, MonadBlock n, m ~ t n) => Blocker -> m a -- | `catchPatternErr handle m` runs m, handling pattern violations with -- handle (doesn't roll back the state) catchPatternErr :: MonadBlock m => (Blocker -> m a) -> m a -> m a class Monad m => MonadFresh i (m :: Type -> Type) fresh :: MonadFresh i m => m i ($dmfresh) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadFresh i m, MonadTrans t, MonadFresh i n, t n ~ m) => m i class (Applicative m, MonadTCEnv m, ReadTCState m, HasOptions m) => MonadReduce (m :: Type -> Type) liftReduce :: MonadReduce m => ReduceM a -> m a ($dmliftReduce) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a. (MonadReduce m, MonadTrans t, MonadReduce n, t n ~ m) => ReduceM a -> m a -- | A monad that has read and write access to the stConcreteNames part of -- the TCState. Basically, this is a synonym for `MonadState -- ConcreteNames m` (which cannot be used directly because of the -- limitations of Haskell's typeclass system). class Monad m => MonadStConcreteNames (m :: Type -> Type) runStConcreteNames :: MonadStConcreteNames m => StateT ConcreteNames m a -> m a useConcreteNames :: MonadStConcreteNames m => m ConcreteNames modifyConcreteNames :: MonadStConcreteNames m => (ConcreteNames -> ConcreteNames) -> m () -- | MonadTCEnv made into its own dedicated service class. This -- allows us to use MonadReader for ReaderT extensions of -- TCM. class Monad m => MonadTCEnv (m :: Type -> Type) askTC :: MonadTCEnv m => m TCEnv ($dmaskTC) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadTCEnv m, MonadTrans t, MonadTCEnv n, t n ~ m) => m TCEnv localTC :: MonadTCEnv m => (TCEnv -> TCEnv) -> m a -> m a ($dmlocalTC) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a. (MonadTCEnv m, MonadTransControl t, MonadTCEnv n, t n ~ m) => (TCEnv -> TCEnv) -> m a -> m a -- | The constraints needed for typeError and similar. type MonadTCError (m :: Type -> Type) = (MonadTCEnv m, ReadTCState m, MonadError TCErr m) -- | Embedding a TCM computation. class (Applicative tcm, MonadIO tcm, MonadTCEnv tcm, MonadTCState tcm, HasOptions tcm) => MonadTCM (tcm :: Type -> Type) liftTCM :: MonadTCM tcm => TCM a -> tcm a ($dmliftTCM) :: forall (m :: Type -> Type) (t :: (Type -> Type) -> Type -> Type) a. (MonadTCM tcm, MonadTCM m, MonadTrans t, tcm ~ t m) => TCM a -> tcm a -- | MonadTCState made into its own dedicated service class. This -- allows us to use MonadState for StateT extensions of -- TCM. class Monad m => MonadTCState (m :: Type -> Type) getTC :: MonadTCState m => m TCState ($dmgetTC) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => m TCState putTC :: MonadTCState m => TCState -> m () ($dmputTC) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => TCState -> m () modifyTC :: MonadTCState m => (TCState -> TCState) -> m () ($dmmodifyTC) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => (TCState -> TCState) -> m () -- | A mutual block of names in the signature. data MutualBlock MutualBlock :: MutualInfo -> Set QName -> MutualBlock -- | The original info of the mutual block. [mutualInfo] :: MutualBlock -> MutualInfo [mutualNames] :: MutualBlock -> Set QName -- | Map MutualId to MutualBlock. type MutualBlocks = IntMap MutualBlock newtype MutualId MutualId :: Word32 -> MutualId data NegativeUnification UnifyConflict :: Telescope -> Term -> Term -> NegativeUnification UnifyCycle :: Telescope -> Int -> Term -> NegativeUnification data NumGeneralizableArgs NoGeneralizableArgs :: NumGeneralizableArgs -- | When lambda-lifting new args are generalizable if -- SomeGeneralizableArgs, also when the number is zero. SomeGeneralizableArgs :: Int -> NumGeneralizableArgs -- | A block of opaque definitions. data OpaqueBlock OpaqueBlock :: OpaqueId -> HashSet QName -> HashSet QName -> Maybe OpaqueId -> Range -> OpaqueBlock -- | Unique identifier for this block. [opaqueId] :: OpaqueBlock -> OpaqueId -- | Set of names we are allowed to unfold. After scope-checking, this set -- should be transitively closed. [opaqueUnfolding] :: OpaqueBlock -> HashSet QName -- | Declarations contained in this abstract block. [opaqueDecls] :: OpaqueBlock -> HashSet QName -- | Pointer to an enclosing opaque block, if one exists. [opaqueParent] :: OpaqueBlock -> Maybe OpaqueId -- | Where is this opaque block? [opaqueRange] :: OpaqueBlock -> Range -- | A thing tagged with the context it came from. Also keeps the -- substitution from previous checkpoints. This lets us handle the case -- when an open thing was created in a context that we have since exited. -- Remember which module it's from to make sure we don't get confused by -- checkpoints from other files. data Open a OpenThing :: CheckpointId -> Map CheckpointId Substitution -> ModuleNameHash -> a -> Open a [openThingCheckpoint] :: Open a -> CheckpointId [openThingCheckpointMap] :: Open a -> Map CheckpointId Substitution [openThingModule] :: Open a -> ModuleNameHash [openThing] :: Open a -> a -- | Flag to indicate whether the meta is overapplied in the constraint. A -- meta is overapplied if it has more arguments than the size of the -- telescope in its creation environment (as stored in MetaInfo). data Overapplied Overapplied :: Overapplied NotOverapplied :: Overapplied -- | A part of the state which is not reverted when an error is thrown or -- the state is reset. data PersistentTCState PersistentTCSt :: Atomic SessionState -> DecodedModules -> BiMap RawTopLevelModuleName ModuleNameHash -> CommandLineOptions -> Statistics -> Maybe LoadedFileCache -> PersistentTCState -- | State that persists for the whole Agda session. Grows monotonically, -- never sees any deletion. [stPersistentSession] :: PersistentTCState -> Atomic SessionState -- | Type-checked modules we visited during our Agda session. A module gets -- dropped from this list if its source or the source of any of its -- dependencies changed, or when its identity or the identity of one of -- its dependencies changed due to a change of the include paths. [stDecodedModules] :: PersistentTCState -> DecodedModules -- | Module name hashes for top-level module names (and vice versa). [stPersistentTopLevelModuleNames] :: PersistentTCState -> BiMap RawTopLevelModuleName ModuleNameHash [stPersistentOptions] :: PersistentTCState -> CommandLineOptions -- | Should be strict field. [stAccumStatistics] :: PersistentTCState -> Statistics -- | Cached typechecking state from the last loaded file. Should be -- Nothing when checking imports. [stPersistLoadedFileCache] :: PersistentTCState -> Maybe LoadedFileCache -- | Dirty when a constraint is added, used to prevent pointer update. -- Currently unused. data PostColdState PostColdState :: Flags64 -> HighlightingInfo -> DisambiguatedNames -> InteractionPoints -> Signature -> DisplayForms -> BackendForeignCode -> Maybe (Pair ModuleName TopLevelModuleName) -> Set QName -> Set QName -> ConcreteNames -> Statistics -> Set TCWarning -> MutualBlocks -> BuiltinThings -> MutualId -> Int -> NameId -> OpaqueId -> Set QName -> Map OpaqueId OpaqueBlock -> Map QName OpaqueId -> PostColdState [stPostFlags] :: PostColdState -> Flags64 -- | Highlighting info. [stPostSyntaxInfo] :: PostColdState -> HighlightingInfo -- | Disambiguation carried out by the type checker. Maps position of first -- name character to disambiguated QName for each -- AmbiguousQName already passed by the type checker. [stPostDisambiguatedNames] :: PostColdState -> DisambiguatedNames [stPostInteractionPoints] :: PostColdState -> InteractionPoints -- | Declared identifiers of the current file. These will be serialized -- after successful type checking. [stPostSignature] :: PostColdState -> Signature -- | Display forms we add for imported identifiers [stPostImportsDisplayForms] :: PostColdState -> DisplayForms -- | {-# FOREIGN #-} code that should be included in the compiled -- output. Does not include code for imported modules. [stPostForeignCode] :: PostColdState -> BackendForeignCode -- | The current module is available after it has been type checked. [stPostCurrentModule] :: PostColdState -> Maybe (Pair ModuleName TopLevelModuleName) [stPostPendingInstances] :: PostColdState -> Set QName [stPostTemporaryInstances] :: PostColdState -> Set QName -- | Map keeping track of concrete names assigned to each abstract name -- (can be more than one name in case the first one is shadowed) [stPostConcreteNames] :: PostColdState -> ConcreteNames -- | Counters to collect various statistics about meta variables etc. Only -- for current file. [stPostStatistics] :: PostColdState -> Statistics [stPostTCWarnings] :: PostColdState -> Set TCWarning [stPostMutualBlocks] :: PostColdState -> MutualBlocks [stPostLocalBuiltins] :: PostColdState -> BuiltinThings [stPostFreshMutualId] :: PostColdState -> MutualId [stPostFreshInt] :: PostColdState -> Int [stPostFreshNameId] :: PostColdState -> NameId [stPostFreshOpaqueId] :: PostColdState -> OpaqueId -- | Local partial definitions, to be stored in the Interface [stPostLocalPartialDefs] :: PostColdState -> Set QName -- | Associates opaque identifiers to their actual blocks. [stPostOpaqueBlocks] :: PostColdState -> Map OpaqueId OpaqueBlock -- | Associates each opaque QName to the block it was defined in. [stPostOpaqueIds] :: PostColdState -> Map QName OpaqueId data PostMetaState PostMetaState :: MetaId -> ProblemId -> LocalMetaStore -> LocalMetaStore -> Constraints -> Constraints -> Set QName -> PostMetaState [stPostFreshMetaId] :: PostMetaState -> MetaId [stPostFreshProblemId] :: PostMetaState -> ProblemId -- | Used for open meta-variables. [stPostOpenMetaStore] :: PostMetaState -> LocalMetaStore -- | Used for local, instantiated meta-variables. [stPostSolvedMetaStore] :: PostMetaState -> LocalMetaStore [stPostAwakeConstraints] :: PostMetaState -> Constraints [stPostSleepingConstraints] :: PostMetaState -> Constraints -- | Definitions to be considered during occurs check. Initialized to the -- current mutual block before the check. During occurs check, we remove -- definitions from this set as soon we have checked them. [stPostOccursCheckDefs] :: PostMetaState -> Set QName data PostNamesCheckpoints PostNamesCheckpoints :: ModuleCheckpoints -> CheckpointId -> PostNamesCheckpoints -- | For each module remember the checkpoint corresponding to the orignal -- context of the module parameters. [stPostModuleCheckpoints] :: PostNamesCheckpoints -> ModuleCheckpoints [stPostFreshCheckpointId] :: PostNamesCheckpoints -> CheckpointId data PostScopeState PostScopeState :: PostNamesCheckpoints -> PostMetaState -> PostColdState -> PostScopeState [stPostNamesCheckpoints] :: PostScopeState -> PostNamesCheckpoints [stPostMetaState] :: PostScopeState -> PostMetaState [stPostColdState] :: PostScopeState -> PostColdState data PreScopeState PreScopeState :: Maybe FileId -> HighlightingInfo -> Signature -> ImportedModules -> ImportedModules -> VisitedModules -> ScopeInfo -> PatternSynDefns -> PatternSynDefns -> Maybe (Set QName) -> PragmaOptions -> BuiltinThings -> DisplayForms -> InteractionId -> UserWarnings -> UserWarnings -> Maybe Text -> Set QName -> LibCache -> RemoteMetaStore -> HashMap QName QName -> HashMap QName (HashSet QName) -> UnusedImportsState -> PreScopeState -- | The file being type-checked, if any. [stPreFileId] :: PreScopeState -> Maybe FileId -- | Highlighting info for tokens and Happy parser warnings (but not for -- those tokens/warnings for which highlighting exists in -- stPostSyntaxInfo). [stPreTokens] :: PreScopeState -> HighlightingInfo -- | Imported declared identifiers. Those must not be serialized! [stPreImports] :: PreScopeState -> Signature -- | The top-level modules imported by the current module. [stPreImportedModules] :: PreScopeState -> ImportedModules -- | The top-level modules transitively imported by the current module. [stPreImportedModulesTransitive] :: PreScopeState -> ImportedModules -- | Modules loaded so far. In contrast stDecodedModules, contains -- also modules that are only scope-checked. [stPreVisitedModules] :: PreScopeState -> VisitedModules [stPreScope] :: PreScopeState -> ScopeInfo -- | Pattern synonyms of the current file. Serialized. [stPrePatternSyns] :: PreScopeState -> PatternSynDefns -- | Imported pattern synonyms. Must not be serialized! [stPrePatternSynImports] :: PreScopeState -> PatternSynDefns -- | Collected variables we wish to generalize over; used during scope -- checking of terms. If Nothing, we are in a position where we do -- not support generalization, and do not accept additions to this -- collection. [stPreGeneralizedVars] :: PreScopeState -> Maybe (Set QName) -- | Options applying to the current file. OPTIONS pragmas only -- affect this field. [stPrePragmaOptions] :: PreScopeState -> PragmaOptions [stPreImportedBuiltins] :: PreScopeState -> BuiltinThings -- | Display forms added by someone else to imported identifiers [stPreImportedDisplayForms] :: PreScopeState -> DisplayForms [stPreFreshInteractionId] :: PreScopeState -> InteractionId -- | Imported UserWarnings, not to be stored in the -- Interface [stPreImportedUserWarnings] :: PreScopeState -> UserWarnings -- | Locally defined UserWarnings, to be stored in the -- Interface [stPreLocalUserWarnings] :: PreScopeState -> UserWarnings -- | Whether the current module should raise a warning when opened [stPreWarningOnImport] :: PreScopeState -> Maybe Text -- | Imported partial definitions, not to be stored in the -- Interface [stPreImportedPartialDefs] :: PreScopeState -> Set QName -- | Cached .agda-lib files. [stPreLibCache] :: PreScopeState -> LibCache -- | Used for meta-variables from other modules. [stPreImportedMetaStore] :: PreScopeState -> RemoteMetaStore -- | Associates a copied name (the key) to its original name (the value). -- Computed by the scope checker, used to compute opaque blocks. [stPreCopiedNames] :: PreScopeState -> HashMap QName QName -- | Associates an original name (the key) to all its copies (the value). -- Computed by the scope checker, used to compute opaque blocks. [stPreNameCopies] :: PreScopeState -> HashMap QName (HashSet QName) -- | Information collected by the scope checker to generate warnings about -- unused imports. [stPreUnusedImportsState] :: PreScopeState -> UnusedImportsState data PrimFun PrimFun :: QName -> Arity -> [Occurrence] -> ([Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term)) -> PrimFun [primFunName] :: PrimFun -> QName [primFunArity] :: PrimFun -> Arity -- | See defArgOccurrences. [primFunArgOccurrences] :: PrimFun -> [Occurrence] [primFunImplementation] :: PrimFun -> [Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term) data PrimitiveData PrimitiveData :: IsAbstract -> PrimitiveId -> [Clause] -> FunctionInverse -> Maybe CompiledClauses -> IsOpaque -> PrimitiveData [_primAbstr] :: PrimitiveData -> IsAbstract [_primName] :: PrimitiveData -> PrimitiveId -- | null for primitive functions, not null for builtin -- functions. [_primClauses] :: PrimitiveData -> [Clause] -- | Builtin functions can have inverses. For instance, natural number -- addition. [_primInv] :: PrimitiveData -> FunctionInverse -- | Nothing for primitive functions, Just something -- for builtin functions. [_primCompiled] :: PrimitiveData -> Maybe CompiledClauses -- | Primitives can also live in opaque blocks. [_primOpaque] :: PrimitiveData -> IsOpaque -- | Primitives data PrimitiveImpl PrimImpl :: Type -> PrimFun -> PrimitiveImpl data PrimitiveSortData PrimitiveSortData :: BuiltinSort -> Sort -> PrimitiveSortData [_primSortName] :: PrimitiveSortData -> BuiltinSort [_primSortSort] :: PrimitiveSortData -> Sort data PrincipalArgTypeMetas PrincipalArgTypeMetas :: Args -> Type -> PrincipalArgTypeMetas -- | metas created for hidden and instance arguments in the principal -- argument's type [patmMetas] :: PrincipalArgTypeMetas -> Args -- | principal argument's type, stripped of hidden and instance arguments [patmRemainder] :: PrincipalArgTypeMetas -> Type data ProblemConstraint PConstr :: Set ProblemId -> Blocker -> Closure Constraint -> ProblemConstraint [constraintProblems] :: ProblemConstraint -> Set ProblemId [constraintUnblocker] :: ProblemConstraint -> Blocker [theConstraint] :: ProblemConstraint -> Closure Constraint -- | Abstractions to build projection function (dropping parameters). newtype ProjLams ProjLams :: [Arg ArgName] -> ProjLams [getProjLams] :: ProjLams -> [Arg ArgName] -- | Additional information for projection Functions. data Projection Projection :: Maybe QName -> QName -> Arg QName -> Int -> ProjLams -> Projection -- | Nothing if only projection-like, Just r if record -- projection. The r is the name of the record type projected -- from. This field is updated by module application. [projProper] :: Projection -> Maybe QName -- | The original projection name (current name could be from module -- application). [projOrig] :: Projection -> QName -- | Type projected from. Original record type if projProper = -- Just{}. Also stores ArgInfo of the principal argument. -- This field is unchanged by module application. [projFromType] :: Projection -> Arg QName -- | Index of the record argument. Start counting with 1, because 0 means -- that it is already applied to the record value. This can happen in -- module instantiation, but then either the record value is var -- 0, or funProjection == Left _. [projIndex] :: Projection -> Int -- | Term t to be be applied to record parameters and record -- value. The parameters will be dropped. In case of a proper projection, -- a postfix projection application will be created: t = pars r -> -- r .p (Invariant: the number of abstractions equals -- projIndex.) In case of a projection-like function, just the -- function symbol is returned as Def: t = pars -> f. [projLams] :: Projection -> ProjLams -- | Indicates the reason behind a function having not been marked -- projection-like. data ProjectionLikenessMissing -- | Projection-likeness analysis has not run on this function yet. It may -- do so in the future. MaybeProjection :: ProjectionLikenessMissing -- | The user has requested that this function be not be marked -- projection-like. The analysis may already have run on this function, -- but the results have been discarded, and it will not be run again. NeverProjection :: ProjectionLikenessMissing -- | Class for monads which offer scoped access to the TCState, as -- well as read-only access to the SessionState. class Monad m => ReadTCState (m :: Type -> Type) -- | Read the current TCState. getTCState :: ReadTCState m => m TCState ($dmgetTCState) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (ReadTCState m, MonadTrans t, ReadTCState n, t n ~ m) => m TCState -- | Scoped modification of the TCState: run the continuation where -- the part of the state targeted by the lens has its value altered by -- the given function, without modifying the state in the "enclosing" -- thread. locallyTCState :: ReadTCState m => Lens' TCState a -> (a -> a) -> m b -> m b ($dmlocallyTCState) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a b. (ReadTCState m, MonadTransControl t, ReadTCState n, t n ~ m) => Lens' TCState a -> (a -> a) -> m b -> m b -- | Read the current SessionState. -- -- Since the SessionState is shared between threads, it is unwise -- to hold onto the result of this function for very long. getSessionState :: ReadTCState m => m SessionState ($dmgetSessionState) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (ReadTCState m, MonadTrans t, ReadTCState n, t n ~ m) => m SessionState withTCState :: ReadTCState m => (TCState -> TCState) -> m a -> m a data RecordData RecordData :: Nat -> Maybe Term -> ConHead -> Bool -> [Dom QName] -> Telescope -> Maybe [QName] -> PositivityCheck -> EtaEquality -> PatternOrCopattern -> Maybe Induction -> Maybe Bool -> IsAbstract -> CompKit -> RecordData -- | Number of parameters. [_recPars] :: RecordData -> Nat -- | Was this record type created by a module application (is it a -- copy)? If yes, this is its definition, linking back to the -- original record type. See _dataClause. [_recClause] :: RecordData -> Maybe Term -- | Constructor name and fields. [_recConHead] :: RecordData -> ConHead -- | Does this record have a constructor? [_recNamedCon] :: RecordData -> Bool -- | The record field names. [_recFields] :: RecordData -> [Dom QName] -- | The record field telescope. (Includes record parameters.) Note: -- TelV recTel _ == telView' recConType. Thus, recTel -- is redundant. [_recTel] :: RecordData -> Telescope -- | Mutually recursive functions, datas and records. -- Does include this record. Empty if not recursive. Nothing if -- not yet computed (by positivity checker). [_recMutual] :: RecordData -> Maybe [QName] -- | Should positivity errors be reported for this record type? [_recPositivityCheck] :: RecordData -> PositivityCheck -- | Eta-expand at this record type? False for unguarded recursive -- records and coinductive records unless the user specifies otherwise. [_recEtaEquality'] :: RecordData -> EtaEquality -- | In case eta-equality is off, do we allow pattern matching on the -- constructor or construction by copattern matching? Having both loses -- subject reduction, see issue #4560. After positivity checking, this -- field is obsolete, part of EtaEquality. [_recPatternMatching] :: RecordData -> PatternOrCopattern -- | Inductive or CoInductive? Matters only for recursive -- records. Nothing means that the user did not specify it, which -- is an error for recursive records. [_recInduction] :: RecordData -> Maybe Induction -- | 'Just True' means that unfolding of the recursive record terminates, -- 'Just False' means that we have no evidence for termination, and -- Nothing means we have not run the termination checker yet. [_recTerminates] :: RecordData -> Maybe Bool [_recAbstr] :: RecordData -> IsAbstract [_recComp] :: RecordData -> CompKit data ReduceDefs OnlyReduceDefs :: Set QName -> ReduceDefs DontReduceDefs :: Set QName -> ReduceDefs -- | Environment of the reduce monad. data ReduceEnv ReduceEnv :: TCEnv -> TCState -> SessionState -> Maybe (MetaId -> ReduceM Bool) -> ReduceEnv -- | Read only access to environment. [redEnv] :: ReduceEnv -> TCEnv -- | Read only access to state (signature, metas...). [redSt] :: ReduceEnv -> TCState -- | Read only access to the *session* state (module - source maps, etc) [redSess] :: ReduceEnv -> SessionState -- | An optional predicate that is used by instantiate' and -- instantiateFull': meta-variables are only instantiated if -- they satisfy this predicate. [redPred] :: ReduceEnv -> Maybe (MetaId -> ReduceM Bool) newtype ReduceM a ReduceM# :: (ReduceEnv -> a) -> ReduceM a [unReduceM] :: ReduceM a -> ReduceEnv -> a data Reduced no yes NoReduction :: no -> Reduced no yes YesReduction :: Simplification -> yes -> Reduced no yes -- | Used for meta-variables from other modules (and in Interfaces). type RemoteMetaStore = HashMap MetaId RemoteMetaVariable -- | Information about remote meta-variables. -- -- Remote meta-variables are meta-variables originating in other modules. -- These meta-variables are always instantiated. We do not retain all the -- information about a local meta-variable when creating an interface: -- -- data RemoteMetaVariable RemoteMetaVariable :: Instantiation -> Modality -> Judgement MetaId -> RemoteMetaVariable [rmvInstantiation] :: RemoteMetaVariable -> Instantiation [rmvModality] :: RemoteMetaVariable -> Modality [rmvJudgement] :: RemoteMetaVariable -> Judgement MetaId type RewriteRules = [RewriteRule] type RewriteSource = RewriteSource' Definition -- | Source of the rewrite rule Parameterised by the info for global -- rewrite rules (it is convenient to remember the definition during -- checking, but when serialising we just store the QName) data RewriteSource' a GlobalRewrite :: a -> RewriteSource' a LocalRewrite :: Context -> Maybe Name -> Type -> RewriteSource' a data RunMetaOccursCheck RunMetaOccursCheck :: RunMetaOccursCheck DontRunMetaOccursCheck :: RunMetaOccursCheck newtype Section Section :: Telescope -> Section [_secTelescope] :: Section -> Telescope type Sections = Map ModuleName Section type SerialisableRewriteSource = RewriteSource' QName -- | A part of the state that grows monotonically over the whole Agda -- session. Shared between all threads, and never reset. data SessionState SessionState :: [Backend] -> FileDictWithBuiltins -> ModuleToSourceId -> InteractionOutputCallback -> SessionState -- | Backends with their options. [stSessionBackends] :: SessionState -> [Backend] -- | Map file names to unique FileId and back. Assuming we do not -- see terribly many different files during one Agda session, this map -- needs not be garbage-collected. -- -- Also informs about whether a FileId belongs to one of Agda's -- primitive and builtin modules. [stSessionFileDict] :: SessionState -> FileDictWithBuiltins -- | Maps TopLevelModuleNames to the FileIds from which -- they were loaded. [stSessionModuleToSourceId] :: SessionState -> ModuleToSourceId -- | Callback function to call when there is a response to give to the -- interactive frontend. See the documentation of -- InteractionOutputCallback. Set by the interactor (Terminal -- (default), Emacs, JSON), remaining fixed throughout the session. [stSessionInteractionOutputCallback] :: SessionState -> InteractionOutputCallback data Signature Sig :: Sections -> Definitions -> GlobalRewriteRuleMap -> InstanceTable -> Signature [_sigSections] :: Signature -> Sections [_sigDefinitions] :: Signature -> Definitions -- | The rewrite rules defined in this file. [_sigRewriteRules] :: Signature -> GlobalRewriteRuleMap [_sigInstances] :: Signature -> InstanceTable -- | Did we encounter a simplifying reduction? In terms of CIC, that would -- be a iota-reduction. In terms of Agda, this is a constructor or -- literal pattern that matched. Just beta-reduction (substitution) or -- delta-reduction (unfolding of definitions) does not count as -- simplifying? data Simplification YesSimplification :: Simplification NoSimplification :: Simplification -- | Error when splitting a pattern variable into possible constructor -- patterns. data SplitError -- | Neither data type nor record. NotADatatype :: Closure Type -> SplitError -- | Type could not be sufficiently reduced. BlockedType :: Blocker -> Closure Type -> SplitError -- | Data type, but in erased position. ErasedDatatype :: ErasedDatatypeReason -> Closure Type -> SplitError -- | Split on codata not allowed. UNUSED, but keep! -- | -- NoRecordConstructor Type -- ^ record type, but no constructor CoinductiveDatatype :: Closure Type -> SplitError UnificationStuck :: Maybe Blocker -> QName -> Telescope -> Args -> Args -> [UnificationFailure] -> SplitError -- | Blocking metavariable (if any) [cantSplitBlocker] :: SplitError -> Maybe Blocker -- | Constructor. [cantSplitConName] :: SplitError -> QName -- | Context for indices. [cantSplitTel] :: SplitError -> Telescope -- | Inferred indices (from type of constructor). [cantSplitConIdx] :: SplitError -> Args -- | Expected indices (from checking pattern). [cantSplitGivenIdx] :: SplitError -> Args -- | Reason(s) why unification got stuck. [cantSplitFailures] :: SplitError -> [UnificationFailure] -- | We do not know the target type of the clause. CosplitNoTarget :: SplitError -- | Target type is not a record type. CosplitNoRecordType :: Closure Type -> SplitError CannotCreateMissingClause :: QName -> (Telescope, [NamedArg DeBruijnPattern]) -> Doc -> Closure (Abs Type) -> SplitError GenericSplitError :: String -> SplitError -- | Statistics is a collection of arbitrary string counters. The -- keys that can be found in the map depend on what profiling options -- were given. data Statistics Statistics :: HashMap String (Sum Word64) -> HashMap String (Max Word64) -> Statistics -- | Tally counters, which should be added when merging. [statTicks] :: Statistics -> HashMap String (Sum Word64) -- | Record counters, which [statMaxes] :: Statistics -> HashMap String (Max Word64) -- | An alternative representation of partial elements in a telescope: Γ ⊢ -- λ Δ. [φ₁ u₁, ... , φₙ uₙ] : Δ → PartialP (∨_ᵢ φᵢ) T see cubicaltt -- paper (however we do not store the type T). data System System :: Telescope -> [(Face, Term)] -> System -- | the telescope Δ, binding vars for the clauses, Γ ⊢ Δ [systemTel] :: System -> Telescope -- | a system [φ₁ u₁, ... , φₙ uₙ] where Γ, Δ ⊢ φᵢ and Γ, Δ, φᵢ ⊢ uᵢ [systemClauses] :: System -> [(Face, Term)] data TCContext TCContext :: Context -> CheckpointId -> LocalRewriteRuleMap -> Map CheckpointId Substitution -> Maybe QName -> TCContext [envContext] :: TCContext -> Context -- | Checkpoints track the evolution of the context as we go under binders -- or refine it by pattern matching. [envCurrentCheckpoint] :: TCContext -> CheckpointId [envLocalRewriteRules] :: TCContext -> LocalRewriteRuleMap -- | Keeps the substitution from each previous checkpoint to the current -- context. [envCheckpoints] :: TCContext -> Map CheckpointId Substitution -- | We are reducing an application of this function. (For tracking of -- incomplete matches.) [envAppDef] :: TCContext -> Maybe QName data TCEnv TCEnv :: TCContext -> Set ProblemId -> ModalEnv -> Flags64 -> ColdEnv -> TCEnv [envTCContext] :: TCEnv -> TCContext [envActiveProblems] :: TCEnv -> Set ProblemId [envModalEnv] :: TCEnv -> ModalEnv [envFlags] :: TCEnv -> Flags64 [envColdEnv] :: TCEnv -> ColdEnv -- | Type-checking errors. data TCErr TypeError :: CallStack -> TCState -> Closure TypeError -> TCErr -- | Location in the internal Agda source code where the error was raised [tcErrLocation] :: TCErr -> CallStack -- | The state in which the error was raised. [tcErrState] :: TCErr -> TCState -- | The environment in which the error as raised plus the error. [tcErrClosErr] :: TCErr -> Closure TypeError -- | Error raised by the Happy parser. ParserError :: ParseError -> TCErr -- | Unspecific error without Range. GenericException :: String -> TCErr -- | The first argument is the state in which the error was raised. IOException :: Maybe TCState -> Range -> IOException -> TCErr -- | The exception which is usually caught. Raised for pattern violations -- during unification (assignV) but also in other situations -- where we want to backtrack. Contains an unblocker to control when the -- computation should be retried. PatternErr :: Blocker -> TCErr -- | Type checking monad. type TCM = TCMT IO -- | The type checking monad transformer. Adds readonly TCEnv and -- mutable TCState. newtype TCMT (m :: Type -> Type) a TCM# :: (MutVar# RealWorld TCState -> TCEnv -> m a) -> TCMT (m :: Type -> Type) a [unTCM#] :: TCMT (m :: Type -> Type) a -> MutVar# RealWorld TCState -> TCEnv -> m a data TCState TCSt :: PersistentTCState -> PreScopeState -> PostScopeState -> TCState -- | State which persists while we build an Agda project (same main file). [stPersistentState] :: TCState -> PersistentTCState -- | The state which is frozen after scope checking. [stPreScopeState] :: TCState -> PreScopeState -- | The state which is modified after scope checking. [stPostScopeState] :: TCState -> PostScopeState data TCWarning TCWarning :: CallStack -> Range -> Warning -> Doc -> String -> Bool -> TCWarning -- | Location in the internal Agda source code location where the error -- raised [tcWarningLocation] :: TCWarning -> CallStack -- | Range where the warning was raised [tcWarningRange] :: TCWarning -> Range -- | The warning itself [tcWarning] :: TCWarning -> Warning -- | The warning printed in the state and environment where it was raised [tcWarningDoc] :: TCWarning -> Doc -- | Caches render tcWarningDoc for the sake of an Ord -- instance. [tcWarningString] :: TCWarning -> String -- | Should the warning be affected by caching. [tcWarningCached] :: TCWarning -> Bool -- | When typechecking something of the following form: -- -- instance x : _ x = y -- -- it's not yet known where to add x, so we add it to a list of -- unresolved instances and we'll deal with it later. type TempInstanceTable = (InstanceTable, Set QName) data TermHead SortHead :: TermHead PiHead :: TermHead ConsHead :: QName -> TermHead VarHead :: Nat -> TermHead UnknownHead :: TermHead -- | Information about a mutual block which did not pass the termination -- checker. data TerminationError TerminationError :: [QName] -> [CallInfo] -> GuardednessHelps -> TerminationError -- | The functions which failed to check. (May not include automatically -- generated functions.) [termErrFunctions] :: TerminationError -> [QName] -- | The problematic call sites. [termErrCalls] :: TerminationError -> [CallInfo] -- | Is the termination error resolved by activating -- --guardedness? [termErrGuardednessHelps] :: TerminationError -> GuardednessHelps -- | A complete log for a module will look like this: -- -- data TypeCheckAction EnterSection :: Erased -> ModuleName -> Telescope -> TypeCheckAction LeaveSection :: ModuleName -> TypeCheckAction -- | Never a Section or ScopeDecl Decl :: Declaration -> TypeCheckAction Pragmas :: PragmaOptions -> TypeCheckAction data TypeCheckingProblem CheckExpr :: Comparison -> Expr -> Type -> TypeCheckingProblem CheckArgs :: Comparison -> ExpandHidden -> Expr -> [NamedArg Expr] -> Type -> Type -> (ArgsCheckState CheckedTarget -> TCM Term) -> TypeCheckingProblem CheckProjAppToKnownPrincipalArg :: Comparison -> Expr -> ProjOrigin -> AmbiguousQName -> Expr -> Args -> Type -> Int -> Term -> Type -> PrincipalArgTypeMetas -> TypeCheckingProblem -- | (λ (xs : t₀) → e) : t This is not an instance of -- CheckExpr as the domain type has already been checked. For -- example, when checking (λ (x y : Fin _) → e) : (x : Fin n) → -- ? we want to postpone (λ (y : Fin n) → e) : ? where -- Fin n is a Type rather than an Expr. CheckLambda :: Comparison -> Arg (List1 (WithHiding Name), Maybe Type) -> Expr -> Type -> TypeCheckingProblem -- | A stuck constructor disambiguation with the bits to retry it on and -- the success continuation. DisambiguateConstructor :: ConstructorDisambiguationData -> (ConHead -> TCM Term) -> TypeCheckingProblem -- | Quote the given term and check type against Term DoQuoteTerm :: Comparison -> Term -> Type -> TypeCheckingProblem data TypeError InternalError :: String -> TypeError NotImplemented :: String -> TypeError NotSupported :: String -> TypeError CompilationError :: String -> TypeError -- | Essential syntax error thrown after successful parsing. Description in -- String. SyntaxError :: String -> TypeError -- | Error thrown by the option parser. OptionError :: OptionError -> TypeError -- | Error thrown in the nicifier phase Definitions. NicifierError :: DeclarationException' -> TypeError -- | Error during unsugaring some do notation. Error message in -- String. DoNotationError :: String -> TypeError -- | Error during (operator) parsing and interpreting the contents of idiom -- brackets. Error message in String. IdiomBracketError :: String -> TypeError -- | The user has given a record expression with the given fields, but no -- record type known to type inference has all these fields. The list can -- be empty. NoKnownRecordWithSuchFields :: [Name] -> TypeError -- | The target of a constructor isn't an application of its datatype. The -- Type records what it does target. ShouldEndInApplicationOfTheDatatype :: Type -> TypeError ConstructorPatternInWrongDatatype :: QName -> QName -> DataOrRecord_ -> TypeError -- | Datatype, constructors. CantResolveOverloadedConstructorsTargetingSameDatatype :: QName -> List1 QName -> TypeError -- | constructor, type ConstructorDoesNotTargetGivenType :: QName -> Type -> TypeError -- | .e in non-argument position. InvalidDottedExpression :: TypeError -- | An integer literal that would be too costly to expand to unary. LiteralTooBig :: TypeError -- | Negative literals are not supported in patterns. NegativeLiteralInPattern :: TypeError -- | The left hand side of a function definition has a hidden argument -- where a non-hidden was expected. WrongHidingInLHS :: TypeError -- | Expected a non-hidden function and found a hidden lambda. WrongHidingInLambda :: Type -> TypeError -- | A function is applied to a hidden argument where a non-hidden was -- expected. WrongHidingInApplication :: Type -> TypeError WrongHidingInProjection :: QName -> TypeError IllegalHidingInPostfixProjection :: NamedArg Expr -> TypeError -- | A function is applied to a hidden named argument it does not have. The -- list contains names of possible hidden arguments at this point. WrongNamedArgument :: NamedArg Expr -> List1 NamedName -> TypeError -- | Wrong user-given (lock/tick) annotation in lambda. WrongAnnotationInLambda :: TypeError -- | Wrong user-given relevance annotation in lambda. WrongIrrelevanceInLambda :: TypeError -- | Wrong user-given quantity annotation in lambda. WrongQuantityInLambda :: TypeError -- | Wrong user-given cohesion annotation in lambda. WrongCohesionInLambda :: TypeError -- | Wrong user-given polarity annotation in lambda. WrongPolarityInLambda :: TypeError -- | The given quantity does not correspond to the expected quantity. QuantityMismatch :: Quantity -> Quantity -> TypeError -- | The given hiding does not correspond to the expected hiding. HidingMismatch :: Hiding -> Hiding -> TypeError -- | The given relevance does not correspond to the expected relevance. RelevanceMismatch :: Relevance -> Relevance -> TypeError ForcedConstructorNotInstantiated :: Pattern -> TypeError IllformedProjectionPatternAbstract :: Pattern -> TypeError IllformedProjectionPatternConcrete :: Pattern -> TypeError CannotEliminateWithPattern :: Maybe Blocker -> NamedArg Pattern -> Type -> TypeError CannotEliminateWithProjection :: Maybe Blocker -> Arg Type -> Bool -> QName -> TypeError WrongNumberOfConstructorArguments :: QName -> Nat -> Nat -> TypeError -- | Type should be empty. The list gives possible patterns that match, but -- can be empty. ShouldBeEmpty :: Type -> [DeBruijnPattern] -> TypeError -- | The given type should have been a sort. ShouldBeASort :: Type -> TypeError -- | The given type should have been a pi. ShouldBePi :: Type -> TypeError ShouldBePath :: Type -> TypeError ShouldBeRecordType :: Type -> TypeError ShouldBeRecordPattern :: TypeError -- | A record has been declared as both ETA_EQUALITY and -- no-eta-equality. EtaPragmaVsNoEtaEquality :: TypeError -- | The given expression is used as a function but its type is not a -- function type. CannotApply :: Expr -> Type -> TypeError -- | This sort is not a type expression. InvalidTypeSort :: Sort -> TypeError SplitOnCoinductive :: TypeError SplitOnIrrelevant :: Dom Type -> TypeError SplitOnUnusableCohesion :: Dom Type -> TypeError SplitOnUnusablePolarity :: Dom Type -> TypeError SplitOnNonVariable :: Term -> Type -> TypeError SplitOnNonEtaRecord :: QName -> TypeError SplitOnAbstract :: QName -> TypeError SplitOnUnchecked :: QName -> TypeError SplitOnPartial :: Dom Type -> TypeError SplitInProp :: DataOrRecordE -> TypeError DefinitionIsIrrelevant :: QName -> TypeError DefinitionIsErased :: QName -> TypeError ProjectionIsIrrelevant :: QName -> TypeError VariableIsIrrelevant :: Name -> TypeError VariableIsErased :: Name -> TypeError VariableIsOfUnusableCohesion :: Name -> Cohesion -> TypeError LambdaIsErased :: TypeError RecordIsErased :: TypeError InvalidModalTelescopeUse :: Term -> Modality -> Modality -> Definition -> TypeError VariableIsOfUnusablePolarity :: Name -> PolarityModality -> TypeError ConversionError_ :: ConversionError -> TypeError NotLeqSort :: Sort -> Sort -> TypeError -- | The arguments are the meta variable, the proposed solution, and the -- parameter that it wants to depend on. MetaCannotDependOn :: MetaId -> Term -> Nat -> TypeError -- | When solving MetaId ... := Term, part of the -- Term is invalid as it was created in an irrelevant context. MetaIrrelevantSolution :: MetaId -> Term -> TypeError -- | When solving MetaId ... := Term, part of the -- Term is invalid as it was created in an erased context. MetaErasedSolution :: MetaId -> Term -> TypeError -- | Error message produced by a meta program. UserError :: Doc -> TypeError -- | the meta is what we might be blocked on. SortOfSplitVarError :: Maybe Blocker -> Doc -> TypeError WrongSharpArity :: QName -> TypeError BuiltinMustBeConstructor :: BuiltinId -> Expr -> TypeError BuiltinMustBeData :: BuiltinId -> Int -> TypeError BuiltinMustBeDef :: BuiltinId -> TypeError BuiltinMustBeFunction :: BuiltinId -> TypeError BuiltinMustBePostulate :: BuiltinId -> TypeError NoSuchBuiltinName :: String -> TypeError InvalidBuiltin :: String -> TypeError DuplicateBuiltinBinding :: BuiltinId -> Term -> Term -> TypeError NoBindingForBuiltin :: BuiltinId -> TypeError NoBindingForPrimitive :: PrimitiveId -> TypeError NoSuchPrimitiveFunction :: String -> TypeError DuplicatePrimitiveBinding :: PrimitiveId -> QName -> QName -> TypeError WrongArgInfoForPrimitive :: PrimitiveId -> ArgInfo -> ArgInfo -> TypeError TrustedBuiltin :: BuiltinId -> TypeError TrustedPrimitive :: QName -> TypeError ShadowedModule :: Name -> List1 ModuleName -> TypeError BuiltinInParameterisedModule :: BuiltinId -> TypeError IllegalLetInTelescope :: TypedBinding -> TypeError IllegalPatternInTelescope :: Binder -> TypeError AbsentRHSRequiresAbsurdPattern :: TypeError -- | Record type, fields not supplied by user, possibly non-fields but -- supplied. TooManyFields :: QName -> [Name] -> List1 Name -> TypeError DuplicateFields :: List1 Name -> TypeError DuplicateConstructors :: List1 Name -> TypeError DuplicateOverlapPragma :: QName -> OverlapMode -> OverlapMode -> TypeError WithOnFreeVariable :: Expr -> Term -> TypeError UnexpectedWithPatterns :: List1 Pattern -> TypeError WithClausePatternMismatch :: Pattern -> NamedArg DeBruijnPattern -> TypeError IllTypedPatternAfterWithAbstraction :: Pattern -> TypeError TooFewPatternsInWithClause :: TypeError TooManyPatternsInWithClause :: TypeError PathAbstractionFailed :: Abs Type -> TypeError FieldOutsideRecord :: TypeError ModuleArityMismatch :: ModuleName -> Telescope -> Either (List1 (NamedArg Expr)) Args -> TypeError GeneralizeCyclicDependency :: TypeError -- | The first term references the given list of variables, which are in -- "the future" with respect to the given lock (and its leftmost -- variable) ReferencesFutureVariables :: Term -> List1 Int -> Arg Term -> Int -> TypeError -- | Arguments: later term, its type, lock term. The lock term does not -- mention any @lock variables. DoesNotMentionTicks :: Term -> Type -> Arg Term -> TypeError MismatchedProjectionsError :: QName -> QName -> TypeError AttributeKindNotEnabled :: String -> String -> String -> TypeError InvalidProjectionParameter :: NamedArg Expr -> TypeError TacticAttributeNotAllowed :: TypeError CannotRewriteByNonEquation :: Type -> TypeError MacroResultTypeMismatch :: Type -> TypeError -- | The lists should have the same length. TODO: enforce this by -- construction. NamedWhereModuleInRefinedContext :: [Term] -> [String] -> TypeError -- | A named where module in a with or rewrite -- clause. Disallowed since Agda 2.9.0, see issue #8698. NamedWhereModuleUnderWith :: TypeError ComatchingDisabledForRecord :: QName -> TypeError -- | When constructing a rewrite rule from a type, an error occurred, -- possibly due to non-confluence of rewrite rules. This was a -- GenericDocError before. IlltypedRewriteRule :: Doc -> TypeError IncorrectTypeForRewriteRelation :: Term -> IncorrectTypeForRewriteRelationReason -> TypeError -- | Cannot generate hcomp clause because type is not fibrant. CannotGenerateHCompClause :: Type -> TypeError -- | Cannot generate transport clause because type is not fibrant. CannotGenerateTransportClause :: QName -> Closure (Abs Type) -> TypeError -- | Name was defined for --cubical[=full] and for use in -- --cubical=erased the option --erasure is needed. CubicalNotErasure :: QName -> TypeError CubicalPrimitiveNotFullyApplied :: QName -> TypeError -- | Expected an interval literal (0 or 1) but found Expr. ExpectedIntervalLiteral :: Expr -> TypeError FaceConstraintDisjunction :: TypeError FaceConstraintUnsatisfiable :: TypeError -- | Attempt to pattern match in an abstraction of interval type. PatternInPathLambda :: TypeError -- | Attempt to pattern or copattern match in a system. PatternInSystem :: TypeError -- | Cannot generate transport for data or record type because there is a -- local rewrite rule in the telescope. Data errors CannotGenerateTransportLocalRewrite :: QName -> TypeError UnexpectedParameter :: LamBinding -> TypeError NoParameterOfName :: ArgName -> TypeError UnexpectedModalityAnnotationInParameter :: LamBinding -> TypeError ExpectedBindingForParameter :: Dom Type -> Abs Type -> TypeError UnexpectedTypeSignatureForParameter :: List1 (NamedArg Binder) -> TypeError SortDoesNotAdmitDataDefinitions :: QName -> Sort -> TypeError SortCannotDependOnItsIndex :: QName -> Type -> TypeError UnusableAtModality :: WhyCheckModality -> Modality -> Term -> TypeError SplitError :: SplitError -> TypeError ImpossibleConstructor :: QName -> NegativeUnification -> TypeError -- | An index of a data type has a polarity different from Mixed. DatatypeIndexPolarity :: TypeError UnguardedEtaRecord :: QName -> TypeError -- | The list of constraints is given redundantly as pairs of -- ProblemConstraint (original constraint) and -- HypSizeConstraint (form with size assumptions in context -- spelled out). The Doc is some extra reason for why solving -- failed. CannotSolveSizeConstraints :: List1 (ProblemConstraint, HypSizeConstraint) -> Doc -> TypeError ContradictorySizeConstraint :: (ProblemConstraint, HypSizeConstraint) -> TypeError -- | This type, representing a type of sizes, might be empty. EmptyTypeOfSizes :: Term -> TypeError -- | This term, a function type constructor, lives in SizeUniv, -- which is not allowed. FunctionTypeInSizeUniv :: Term -> TypeError PostulatedSizeInModule :: TypeError -- | Collected errors when processing the .agda-lib file. LibraryError :: LibErrors -> TypeError -- | The .agda-lib file for the given module is not on the right -- level. LibTooFarDown :: TopLevelModuleName -> AgdaLibFile -> TypeError -- | Some interaction points (holes) in the given module have not been -- filled by the user. These are not UnsolvedMetas since -- unification solved them. This is an error, since interaction points -- are never filled without user interaction. SolvedButOpenHoles :: TopLevelModuleNameWithSourceFile -> TypeError -- | The cycle starts and ends with the same module. CyclicModuleDependency :: List2 TopLevelModuleName -> TypeError -- | No file for the module was found when searching in the given list of -- include directories. FileNotFound :: TopLevelModuleName -> List1 AbsolutePath -> TypeError OverlappingProjects :: AbsolutePath -> TopLevelModuleName -> TopLevelModuleName -> TypeError -- | The given module has at least 2 file locations. AmbiguousTopLevelModuleName :: TopLevelModuleName -> List2 AbsolutePath -> TypeError -- | Found module name, expected module name. ModuleNameUnexpected :: TopLevelModuleNameWithSourceFile -> TopLevelModuleName -> TypeError -- | No matching file for the module was found when searching in the given -- list of include directories. ModuleNameDoesntMatchFileName :: TopLevelModuleName -> List1 AbsolutePath -> TypeError -- | Module name, file from which it was loaded, file which the include -- path says contains the module. ModuleDefinedInOtherFile :: TopLevelModuleName -> AbsolutePath -> AbsolutePath -> TypeError -- | The file name does not correspond to a module name. InvalidFileName :: AbsolutePath -> InvalidFileNameReason -> TypeError ModuleNameHashCollision :: RawTopLevelModuleName -> Maybe RawTopLevelModuleName -> TypeError BothWithAndRHS :: TypeError AbstractConstructorNotInScope :: QName -> TypeError CopatternHeadNotProjection :: QName -> TypeError NotAllowedInDotPatterns :: NotAllowedInDotPatterns -> TypeError NotInScope :: QName -> TypeError NoSuchModule :: QName -> TypeError AmbiguousName :: QName -> AmbiguousNameReason -> TypeError AmbiguousModule :: QName -> List1 ModuleName -> TypeError AmbiguousField :: Name -> List2 ModuleName -> TypeError -- | The list contains all interpretations of the name. AmbiguousConstructor :: QName -> List2 QName -> TypeError ClashingDefinition :: QName -> ClashingName -> Maybe NiceDeclaration -> TypeError ClashingModule :: ModuleName -> ModuleName -> TypeError -- | The given data/record definition rests in a different module than its -- signature. DefinitionInDifferentModule :: QName -> TypeError DuplicateImports :: QName -> List1 ImportedName -> TypeError InvalidPattern :: Pattern -> TypeError -- | Expected the identifier to be a variable, not a constructor or pattern -- synonym. InvalidPun :: ConstructorOrPatternSynonym -> QName -> TypeError -- | Some names are bound several times by an import/open -- directive. RepeatedNamesInImportDirective :: List1 (List2 ImportedName) -> TypeError RepeatedVariablesInPattern :: List1 Name -> TypeError CannotGeneralizeEtaExpandable :: QName -> Type -> TypeError GeneralizationFailed :: Doc -> TypeError GeneralizationPrepruneErrorRefinedContext :: Closure MetaId -> TypeError GeneralizationPrepruneErrorCyclicDependencies :: Closure MetaId -> TypeError GeneralizationPrepruneErrorFailedToInstantiate :: Closure MetaId -> TypeError GeneralizeNotSupportedHere :: QName -> TypeError GeneralizedVarInLetOpenedModule :: QName -> TypeError MultipleFixityDecls :: List1 (Name, Pair Fixity') -> TypeError MultiplePolarityPragmas :: List1 Name -> TypeError ExplicitPolarityVsPragma :: QName -> TypeError ConstructorNameOfNonRecord :: ResolvedName -> TypeError CannotQuote :: CannotQuote -> TypeError CannotQuoteTerm :: CannotQuoteTerm -> TypeError DeclarationsAfterTopLevelModule :: TypeError IllegalDeclarationBeforeTopLevelModule :: TypeError MissingTypeSignature :: MissingTypeSignatureInfo -> TypeError NotAnExpression :: Expr -> TypeError NotAValidLetBinding :: Maybe NotAValidLetBinding -> TypeError NotAValidLetExpression :: NotAValidLetExpression -> TypeError NotValidBeforeField :: NiceDeclaration -> TypeError PrivateRecordField :: TypeError QualifiedLocalModule :: TypeError AsPatternInPatternSynonym :: TypeError DotPatternInPatternSynonym :: TypeError BadArgumentsToPatternSynonym :: AmbiguousQName -> TypeError TooFewArgumentsToPatternSynonym :: AmbiguousQName -> TypeError CannotResolveAmbiguousPatternSynonym :: List1 (QName, PatternSynDefn) -> TypeError -- | This variable is bound in the lhs of the pattern synonym in instance -- position, but not on the rhs. This is forbidden because expansion of -- pattern synonyms would not be faithful to availability of instances in -- instance search. IllegalInstanceVariableInPatternSynonym :: Name -> TypeError -- | A variable to be bound in the pattern synonym resolved on the rhs as -- name of a constructor or a pattern synonym. The resolvents are given -- in the list. PatternSynonymArgumentShadows :: ConstructorOrPatternSynonym -> Name -> List1 AbstractName -> TypeError -- | This variable is only bound on the lhs of the pattern synonym, not on -- the rhs. UnusedVariableInPatternSynonym :: Name -> TypeError -- | These variables are only bound on the rhs of the pattern synonym, not -- on the lhs. Operator errors UnboundVariablesInPatternSynonym :: List1 Name -> TypeError NoParseForApplication :: List2 Expr -> TypeError AmbiguousParseForApplication :: List2 Expr -> List1 Expr -> TypeError -- | The list contains patterns that failed to be interpreted. If it is -- non-empty, the first entry could be printed as error hint. NoParseForLHS :: LHSOrPatSyn -> [Pattern] -> Pattern -> TypeError -- | Pattern and its possible interpretations. AmbiguousParseForLHS :: LHSOrPatSyn -> Pattern -> List2 Pattern -> TypeError -- | The list contains alternative interpretations of the name. AmbiguousProjection :: QName -> List1 QName -> TypeError AmbiguousOverloadedProjection :: AmbiguousQName -> Doc -> TypeError -- | The list of notations can be empty. OperatorInformation :: [NotationSection] -> OperatorScope -> TypeError -> TypeError -- | The list can be empty. Reflection errors InstanceNoCandidate :: Type -> [(Term, TCErr)] -> TypeError ExecError :: ExecError -> TypeError UnquoteFailed :: UnquoteError -> TypeError -- | The list can be empty. DeBruijnIndexOutOfScope :: Nat -> Telescope -> [Name] -> TypeError MissingBindingsForTelescopeVariables :: List1 Text -> TypeError NeedOptionAllowExec :: TypeError NeedOptionCopatterns :: TypeError -- | Flavor of cubical needed for the given reason. NeedOptionCubical :: Cubical -> String -> TypeError NeedOptionPatternMatching :: TypeError NeedOptionIrrelevance :: TypeError NeedOptionProp :: TypeError NeedOptionRewriting :: TypeError -- | Need --sized-types for the given reason. NeedOptionSizedTypes :: String -> TypeError NeedOptionTwoLevel :: TypeError NeedOptionUniversePolymorphism :: TypeError NonFatalErrors :: Set1 TCWarning -> TypeError InstanceSearchDepthExhausted :: Term -> Type -> Int -> TypeError TriedToCopyConstrainedPrim :: QName -> TypeError InvalidInstanceHeadType :: Type -> WhyInvalidInstanceType -> TypeError InteractionError :: InteractionError -> TypeError -- | The given backend does not support --only-scope-checking. BackendDoesNotSupportOnlyScopeChecking :: BackendName -> TypeError -- | NYI: Compilation of files using the given flavor of Cubical. CubicalCompilationNotSupported :: Cubical -> TypeError -- | Used for backend-specific errors. The string is the backend name. CustomBackendError :: BackendName -> Doc -> TypeError -- | Errors raised by the GHC backend. GHCBackendError :: GHCBackendError -> TypeError -- | Errors raised by the JS backend. JSBackendError :: JSBackendError -> TypeError -- | Unknown backend requested, known ones are in the Set. UnknownBackend :: BackendName -> Set BackendName -> TypeError data UnificationFailure -- | Failed to apply injectivity to constructor of indexed datatype UnifyIndicesNotVars :: Telescope -> Type -> Term -> Term -> Args -> UnificationFailure -- | Can't solve equation because variable occurs in (type of) lhs UnifyRecursiveEq :: Telescope -> Type -> Int -> Term -> UnificationFailure -- | Can't solve reflexive equation because --without-K is enabled UnifyReflexiveEq :: Telescope -> Type -> Term -> UnificationFailure -- | Can't solve equation because solution modality is less "usable" UnifyUnusableModality :: Telescope -> Type -> Int -> Term -> Modality -> UnificationFailure -- | Can't solve equation because variable occurs in a local rewrite rule UnifyVarInRewrite :: Telescope -> Type -> Int -> Term -> UnificationFailure -- | Can't eta-expand variable because variable occurs in a local rewrite -- rule UnifyVarInRewriteEta :: Telescope -> Int -> UnificationFailure data UnquoteError BlockedOnMeta :: TCState -> Blocker -> UnquoteError -- | Attempt to unquoteDecl with Hiding other than -- NotHidden. CannotDeclareHiddenFunction :: QName -> UnquoteError CommitAfterDef :: UnquoteError ConInsteadOfDef :: QName -> String -> String -> UnquoteError DefineDataNotData :: QName -> UnquoteError DefInsteadOfCon :: QName -> String -> String -> UnquoteError -- | Given meta-program produces unbound variable under -- extendContext. EscapingVariable :: Closure Term -> UnquoteError MissingDeclaration :: QName -> UnquoteError MissingDefinition :: QName -> UnquoteError NakedUnquote :: UnquoteError NonCanonical :: String -> Term -> UnquoteError PatLamWithoutClauses :: Term -> UnquoteError -- | Attempt to unquote a serialized meta. StaleMeta :: TopLevelModuleName -> MetaId -> UnquoteError -- | Attempt to shave of Nat many parameters from function type -- Expr. TooManyParameters :: Nat -> Expr -> UnquoteError UnboundName :: QName -> UnquoteError data UnquoteFlags UnquoteFlags :: Bool -> UnquoteFlags [_unquoteNormalise] :: UnquoteFlags -> Bool type UserWarnings = Map QName Text type VisitedModules = Map TopLevelModuleName ModuleInfo -- | A non-fatal error is an error which does not prevent us from checking -- the document further and interacting with the user. data Warning NicifierIssue :: DeclarationWarning -> Warning TerminationIssue :: List1 TerminationError -> Warning -- | UnreachableClauses f rs means that the clauses in f -- whose ranges are rs are unreachable. UnreachableClauses :: QName -> List1 Range -> Warning -- | `CoverageIssue f pss` means that pss are not covered in -- f CoverageIssue :: QName -> List1 (Telescope, [NamedArg DeBruijnPattern]) -> Warning CoverageNoExactSplit :: QName -> List1 Clause -> Warning -- | Clause was turned into copattern matching clause(s) by an -- {-# INLINE constructor #-} and thus is not a definitional -- equality any more. InlineNoExactSplit :: QName -> Clause -> Warning NotStrictlyPositive :: QName -> Seq OccursWhere -> Warning -- | Checking whether constructor QName Sort fits into -- data Sort produced TCErr. ConstructorDoesNotFitInData :: DataOrRecord_ -> QName -> Sort -> Sort -> TCErr -> Warning -- | A record type declared as both coinductive and having -- eta-equality. CoinductiveEtaRecord :: QName -> Warning -- | A record type with eta-equality which unguarded. This warning -- can be switched off via the ETA_EQUALITY pragma. UnguardedEtaRecordW :: QName -> Warning -- | Do not use directly with warning UnsolvedMetaVariables :: Set1 Range -> Warning -- | Do not use directly with warning UnsolvedInteractionMetas :: Set1 Range -> Warning -- | Do not use directly with warning UnsolvedConstraints :: List1 ProblemConstraint -> Warning -- | Do not use directly with warning InteractionMetaBoundaries :: Set1 Range -> Warning CantGeneralizeOverSorts :: Set1 MetaId -> Warning AbsurdPatternRequiresAbsentRHS :: Warning -- | In `OldBuiltin old new`, the BUILTIN old has been replaced by new. OldBuiltin :: BuiltinId -> BuiltinId -> Warning -- | The builtin declares a new identifier, so it should not be in scope. BuiltinDeclaresIdentifier :: BuiltinId -> Warning -- | The given record directive is conflicting with a prior one in the same -- record declaration. DuplicateRecordDirective :: RecordDirective -> Warning -- | If the user wrote just {-# REWRITE #-}. EmptyRewritePragma :: Warning -- | An empty where block is dead code. TODO: linearity -- | -- FixingQuantity String Quantity Quantity -- -- ^ Auto-correcting -- quantity pertaining to String from to. EmptyWhere :: Warning -- | Auto-correcting relevance pertaining to String from -- to. FixingRelevance :: String -> Relevance -> Relevance -> Warning -- | Auto-correcting cohesion pertaining to String from -- to. FixingCohesion :: String -> Cohesion -> Cohesion -> Warning -- | Auto-correcting polarity pertaining to String from -- to. FixingPolarity :: String -> PolarityModality -> PolarityModality -> Warning -- | Auto-correcting rewrite pertaining to String by ignoring it IgnoringRew :: String -> RewriteAnn -> Warning -- | If the user wrote something other than an unqualified name in the -- as clause of an import statement. The String -- gives optionally extra explanation. IllformedAsClause :: String -> Warning -- | A character literal Agda does not support, e.g. surrogate code points. InvalidCharacterLiteral :: Char -> Warning -- | If a renaming import directive introduces a name or module -- name clash in the exported names of a module. (See issue #4154.) ClashesViaRenaming :: NameOrModule -> Set1 Name -> Warning -- | The given module was opened but the names and modules in the list were -- not used. They are given as they are in scope after the opening, with -- the ranges from the opening directive (if any). If Nothing, -- then none of the imported names and modules was used. UnusedImports :: ModuleName -> Maybe (List1 ImportedName) -> Warning -- | The 'pattern' declaration is useless in the presence of either -- coinductive or eta-equality. Content of -- String is "coinductive" or "eta", resp. UselessPatternDeclarationForRecord :: String -> Warning -- | Warning when pragma is useless and thus ignored. Range is for -- dead code highlighting. UselessPragma :: Range -> Doc -> Warning -- | If the user opens a module public before the module header. (See issue -- #2377.) UselessPublic :: UselessPublicReason -> Warning -- | Names in hiding directive that don't hide anything imported by -- a using directive. UselessHiding :: List1 ImportedName -> Warning UselessInline :: QName -> Warning -- | A tactic attribute applied to a non-hidden (visible or instance) -- argument. UselessTactic :: Warning -- | The KwRange is the range of the instance keyword. WrongInstanceDeclaration :: KwRange -> Warning -- | An instance was declared with an implicit argument, which means it -- will never actually be considered by instance search. The -- KwRange is the range of the instance keyword. InstanceWithExplicitArg :: KwRange -> QName -> Warning -- | The type of an instance argument doesn't end in a named or variable -- type, so it will never be considered by instance search. InstanceNoOutputTypeName :: Doc -> Warning -- | As InstanceWithExplicitArg, but for local bindings rather than -- top-level instances. InstanceArgWithExplicitArg :: Doc -> Warning -- | The --inversion-max-depth was reached. InversionDepthReached :: QName -> Warning SafeFlagPostulate :: QName -> Warning -- | Unsafe OPTIONS. SafeFlagPragma :: Set String -> Warning SafeFlagWithoutKFlagPrimEraseEquality :: Warning WithoutKFlagPrimEraseEquality :: Warning -- | `ConflictingPragmaOptions a b`: Inconsistent options `--a` and -- `--no-b`, since `--a` implies `--b`. Ignoring `--no-b`. ConflictingPragmaOptions :: String -> String -> Warning OptionWarning :: OptionWarning -> Warning ParseWarning :: ParseWarning -> Warning LibraryWarning :: LibWarning -> Warning -- | DeprecationWarning old new version: old is -- deprecated, use new instead (if given). This will be an error -- in version. DeprecationWarning :: String -> Maybe String -> String -> Warning -- | User-defined warning (e.g. to mention that a name is deprecated) UserWarning :: Text -> Warning -- | Duplicate mentions of the same name in using directive(s). DuplicateUsing :: List1 ImportedName -> Warning -- | Fixity of modules cannot be changed via renaming (since modules have -- no fixity). FixityInRenamingModule :: List1 Range -> Warning -- | Some imported names are not actually exported by the source module. -- The second argument is the names that could be exported. The third -- argument is the module names that could be exported. ModuleDoesntExport :: QName -> [Name] -> [Name] -> List1 ImportedName -> Warning -- | Importing a file using an infective option into one which doesn't InfectiveImport :: Doc -> Warning -- | Importing a file not using a coinfective option from one which does CoInfectiveImport :: Doc -> Warning -- | Confluence checking incomplete because the definition of the -- QName contains unsolved metavariables. ConfluenceCheckingIncompleteBecauseOfMeta :: QName -> Warning -- | Confluence checking with --cubical might be incomplete. ConfluenceForCubicalNotSupported :: Warning -- | IllegalRewriteRule detected during scope checking. NotARewriteRule :: QName -> IsAmbiguous -> Warning IllegalRewriteRule :: SerialisableRewriteSource -> IllegalRewriteRuleReason -> Warning -- | Confluence checker found critical pair and equality checking resulted -- in a type error RewriteNonConfluent :: Term -> Term -> Term -> Doc -> Warning -- | Confluence checker got stuck on computing overlap between two rewrite -- rules RewriteMaybeNonConfluent :: Term -> Term -> [Doc] -> Warning -- | The global confluence checker found a term u that reduces to -- both v1 and v2 and there is no rule to resolve the -- ambiguity. RewriteAmbiguousRules :: Term -> Term -> Term -> Warning -- | The global confluence checker found a term u that reduces to -- v, but v does not reduce to rho(u). RewriteMissingRule :: Term -> Term -> Term -> Warning -- | Inferred that some meta should be solved with an @rewrite function (We -- never infer local rewrite rules) InferredLocalRewrite :: MetaId -> Term -> Warning -- | COMPILE directive for an erased symbol. PragmaCompileErased :: BackendName -> QName -> Warning -- | COMPILE GHC pragma for lists; ignored. PragmaCompileList :: Warning -- | COMPILE GHC pragma for MAYBE; ignored. PragmaCompileMaybe :: Warning -- | COMPILE GHC pragma String not parsable; ignored. PragmaCompileUnparsable :: String -> Warning -- | Wrong COMPILE GHC given for QName; explanation is in -- String. PragmaCompileWrong :: QName -> String -> Warning -- | COMPILE pragma with name QName that is not an -- unambiguous constructor or definition. PragmaCompileWrongName :: QName -> IsAmbiguous -> Warning -- | Pragma String with name QName that is not an Def. PragmaExpectsDefinedSymbol :: String -> QName -> Warning -- | Pragma String with name QName that is not an unambiguous -- constructor or definition. General form of -- PragmaCompileWrongName and NotARewriteRule. PragmaExpectsUnambiguousConstructorOrFunction :: String -> QName -> IsAmbiguous -> Warning -- | Pragma String with name QName that is not an unambiguous -- projection or function. PragmaExpectsUnambiguousProjectionOrFunction :: String -> QName -> IsAmbiguous -> Warning -- | A primitive was compiled to Undefined by the JS backend -- because it was not listed in the known or intentionally undefined -- primitives. UnknownJSPrimitive :: String -> Warning -- | Compiler run on module that does not have a main function. NoMain :: TopLevelModuleName -> Warning -- | Out of scope error we can recover from. NotInScopeW :: QName -> Warning -- | Was not able to compute a full equivalence when splitting. UnsupportedIndexedMatch :: Doc -> Warning -- | The as-name in an as-pattern may not shadow a constructor or pattern -- synonym name, because this can be confusing to read. AsPatternShadowsConstructorOrPatternSynonym :: ConstructorOrPatternSynonym -> Warning -- | A pattern variable has the name of a constructor (data constructor or -- matchable record constructor). PatternShadowsConstructor :: Name -> QName -> Warning -- | Explicit use of @ω or @plenty in hard compile-time -- mode. PlentyInHardCompileTimeMode :: QωOrigin -> Warning RecordFieldWarning :: RecordFieldWarning -> Warning -- | An abstract or opaque definition lacks a type -- signature. MissingTypeSignatureForOpaque :: QName -> IsOpaque -> Warning NotAffectedByOpaque :: Warning -- | Name in unfolding clause does not resolve to unambiguous -- defined name. UnfoldingWrongName :: QName -> Warning UnfoldTransparentName :: QName -> Warning UselessOpaque :: Warning HiddenNotInArgumentPosition :: Expr -> Warning InstanceNotInArgumentPosition :: Expr -> Warning MacroInLetBindings :: Warning AbstractInLetBindings :: Warning -- | The declaration list comes from a single NiceDeclaration. IllegalDeclarationInDataDefinition :: List1 Declaration -> Warning -- | DISPLAY form for QName is invalid because String. InvalidDisplayForm :: QName -> String -> Warning -- | The given names are bound in the lhs of the display form but not used -- on the rhs. This can indicate a user misunderstanding of display -- forms. UnusedVariablesInDisplayForm :: List1 Name -> Warning -- | Irrefutable match (match in binder) on a non-eta record pattern. Some -- expected definitional equalities will not hold. ShouldBeEtaRecordPattern :: Warning -- | Extra arguments to sort (will be ignored). TooManyArgumentsToSort :: QName -> List1 (NamedArg Expr) -> Warning -- | A definition appears before its declaration in a mutual -- block. DefinitionBeforeDeclaration :: AbstractName -> Warning -- | A rewrite expression that does not fire. RewritesNothing :: Warning -- | The with-clause uses projection in a different fixity style than the -- parent clause. WithClauseProjectionFixityMismatch :: NamedArg Pattern -> ProjOrigin -> NamedArg DeBruijnPattern -> ProjOrigin -> Warning [withClausePattern] :: Warning -> NamedArg Pattern [withClauseProjectionOrigin] :: Warning -> ProjOrigin [parentPattern] :: Warning -> NamedArg DeBruijnPattern [parentProjectionOrigin] :: Warning -> ProjOrigin -- | A record type inferred as recursive needs a manual declaration whether -- it should be inductively or coinductively. RecursiveRecordNeedsInductivity :: QName -> Warning -- | Too many polarities given in POLARITY pragma for QName. -- PragmaPolarities contains the (likely) excessive polarities. TooManyPolarities :: QName -> PragmaPolarities -> Warning -- | Definition with non-default polarity annotation. TopLevelPolarity :: QName -> PolarityModality -> Warning -- | Face constraint patterns (i = 0) must be visible arguments. FaceConstraintCannotBeHidden :: ArgInfo -> Warning -- | Face constraint patterns (i = 0) must be unnamed arguments. FaceConstraintCannotBeNamed :: NamedName -> Warning -- | Used for backend-specific warnings. The string is the backend name. CustomBackendWarning :: String -> Doc -> Warning -- | Assorted warnings and errors to be displayed to the user data WarningsAndNonFatalErrors WarningsAndNonFatalErrors :: Set TCWarning -> Set TCWarning -> WarningsAndNonFatalErrors [tcWarnings] :: WarningsAndNonFatalErrors -> Set TCWarning [nonFatalErrors] :: WarningsAndNonFatalErrors -> Set TCWarning -- | Why are we performing a modality check? data WhyCheckModality -- | Because --without-K is enabled, so the types of data constructors must -- be usable at the context's modality. ConstructorType :: WhyCheckModality -- | Because --without-K is enabled, so the result type of clauses must be -- usable at the context's modality. IndexedClause :: WhyCheckModality -- | Because --without-K is enabled, so any argument (second name) which -- mentions a dotted argument (first name) must have a type which is -- usable at the context's modality. IndexedClauseArg :: Name -> Name -> WhyCheckModality -- | Because we double-check the --cubical=compatible clauses. This is an -- internal error! GeneratedClause :: WhyCheckModality -- | Reason for why the instance type is invalid. data WhyInvalidInstanceType -- | The type isn't headed by a local, a definition, or a postulate (e.g. -- it's a universe) ImproperInstHead :: WhyInvalidInstanceType -- | The type we're looking for has a visible argument ImproperInstTele :: WhyInvalidInstanceType -- | Extra information for NotAHaskellType error. data WhyNotAHaskellType NoPragmaFor :: QName -> WhyNotAHaskellType WrongPragmaFor :: Range -> QName -> WhyNotAHaskellType BadLambda :: Term -> WhyNotAHaskellType BadMeta :: Term -> WhyNotAHaskellType BadDontCare :: Term -> WhyNotAHaskellType NotCompiled :: QName -> WhyNotAHaskellType -- | Extra information for error CannotQuoteTerm. data CannotQuoteTerm CannotQuoteTermHidden :: CannotQuoteTerm CannotQuoteTermNothing :: CannotQuoteTerm -- | The reason for an ErasedDatatype error. data ErasedDatatypeReason -- | There are several constructors. SeveralConstructors :: ErasedDatatypeReason -- | Erased matches are disabled for empty types. ErasedMatchesDisabledEmpty :: ErasedDatatypeReason -- | Erased matches are disabled for non-indexed, single-constructor types. ErasedMatchesDisabledNonDependent :: ErasedDatatypeReason -- | Erased matches are disabled for indexed, single-constructor types. ErasedMatchesDisabledDependent :: ErasedDatatypeReason -- | Reasons for error NotAValidLetBinding. data NotAValidLetBinding MissingRHS :: NotAValidLetBinding NotAValidLetPattern :: NotAValidLetBinding WhereClausesNotAllowed :: NotAValidLetBinding CopatternsNotAllowed :: NotAValidLetBinding -- | Reasons for error NotAValidLetExpression. data NotAValidLetExpression MissingBody :: NotAValidLetExpression -- | Things not allowed in dot patterns. data NotAllowedInDotPatterns LetExpressions :: NotAllowedInDotPatterns PatternLambdas :: NotAllowedInDotPatterns -- | Unique identifier of a file. data FileId class Monad m => MonadFileId (m :: Type -> Type) fileFromId :: MonadFileId m => FileId -> m File ($dmfileFromId) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadFileId m, MonadTrans t, MonadFileId n, m ~ t n) => FileId -> m File idFromFile :: MonadFileId m => File -> m FileId ($dmidFromFile) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadFileId m, MonadTrans t, MonadFileId n, m ~ t n) => File -> m FileId class (Functor m, Applicative m, Monad m) => HasOptions (m :: Type -> Type) -- | Returns the pragma options which are currently in effect. pragmaOptions :: HasOptions m => m PragmaOptions ($dmpragmaOptions) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasOptions m, HasOptions n, MonadTrans t, m ~ t n) => m PragmaOptions -- | Returns the command line options which are currently in effect. commandLineOptions :: HasOptions m => m CommandLineOptions ($dmcommandLineOptions) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasOptions m, HasOptions n, MonadTrans t, m ~ t n) => m CommandLineOptions data RecordFieldWarning data UselessPublicReason UselessPublicPreamble :: UselessPublicReason UselessPublicLet :: UselessPublicReason UselessPublicNoOpen :: UselessPublicReason UselessPublicAnonymousModule :: UselessPublicReason instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.TypeChecking.Monad.Base.CompareAs instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.TypeChecking.Monad.Base.Constraint instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.NLPSort instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.NLPType instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.NLPat instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.TypeChecking.Monad.Base.PrincipalArgTypeMetas instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Applicative (Agda.TypeChecking.Monad.Base.BlockT m) instance GHC.Internal.Base.Applicative Agda.TypeChecking.Monad.Base.ReduceM instance GHC.Internal.Base.Applicative m => GHC.Internal.Base.Applicative (Agda.TypeChecking.Monad.Base.TCMT m) instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.EtaProvenance instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.FunctionFlag instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.ModuleCheckMode instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Agda.Utils.Impossible.CatchImpossible Agda.TypeChecking.Monad.Base.TCM instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.TypeChecking.Monad.Base.EtaEquality instance Agda.Utils.Functor.Decoration Agda.TypeChecking.Monad.Base.Open instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.CheckpointId instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.EtaProvenance instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.FunctionFlag instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.ModuleCheckMode instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.MutualId instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.AbstractMode instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.BuiltinSort instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.CheckpointId instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.CompKit instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.CompareDirection instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.CompilerPragma instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.DoGeneralize instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.EtaEquality instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.EtaProvenance instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.ExpandHidden instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Flags64 instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Frozen instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.FunctionFlag instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.IPClause instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.InteractionPoint instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.IsAxiom instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.IsForced instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.IsPathCons instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Listener instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.MetaPriority instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.ModuleCheckMode instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.MutualBlock instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.MutualId instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.OpaqueBlock instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Overapplied instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.RunMetaOccursCheck instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Simplification instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Statistics instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.TCWarning instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.TermHead instance GHC.Internal.Exception.Type.Exception Agda.TypeChecking.Monad.Base.TCErr instance Agda.Utils.ExpandCase.ExpandCase a => Agda.Utils.ExpandCase.ExpandCase (Agda.TypeChecking.Monad.Base.ReduceM a) instance Agda.Utils.ExpandCase.ExpandCase (Agda.TypeChecking.Monad.Base.TCM a) instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Monad.Base.Builtin instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Monad.Base.Closure instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Monad.Base.IPBoundary' instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Monad.Base.Open instance Agda.TypeChecking.Free.Generic.Free Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Free.Generic.Free Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Free.Generic.Free Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Monad.Base.FreshName GHC.Internal.Base.String instance Agda.TypeChecking.Monad.Base.FreshName Agda.Syntax.Concrete.Name.Name instance Agda.TypeChecking.Monad.Base.FreshName Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Monad.Base.FreshName Agda.Syntax.Position.Range instance Agda.TypeChecking.Monad.Base.FreshName (Agda.Syntax.Position.Range, GHC.Internal.Base.String) instance Agda.TypeChecking.Monad.Base.FreshName () instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.TypeChecking.Monad.Base.BlockT m) instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.Builtin instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.Closure instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.FunctionInverse' instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.IPBoundary' instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.MaybeReduced instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.Open instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.ReduceM instance GHC.Internal.Base.Functor (Agda.TypeChecking.Monad.Base.Reduced no) instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Base.RewriteSource' instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.TypeChecking.Monad.Base.TCMT m) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.AbstractMode instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.AxiomData instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.Builtin pf) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.BuiltinSort instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Call instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.CallInfo instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Candidate instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.CandidateKind instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.CannotQuote instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ClashingName instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.Closure a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ColdEnv instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.CompKit instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.CompareAs instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.CompilerPragma instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Constraint instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ConstructorData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ConstructorDisambiguationData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.DataOrRecSigData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.DatatypeData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Definition instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Defn instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.DisambiguatedName instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.DisplayForm instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.DisplayTerm instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.DoGeneralize instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.EtaEquality instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.EtaProvenance instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ExecError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ExpandHidden instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ExtLamInfo instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Flags64 instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ForeignCode instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ForeignCodeStack instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Frozen instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.FunctionData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.FunctionFlag instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.FunctionInverse' c) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.GHCBackendError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.GeneralizedValue instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IPClause instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IllegalRewriteRuleReason instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IncorrectTypeForRewriteRelationReason instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.InductionAndEta instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.InstanceInfo instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.InstanceTable instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Instantiation instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.InteractionError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.InteractionPoint instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Interface instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.InvalidFileNameReason instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IsAmbiguous instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IsAxiom instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IsForced instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.IsPathCons instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.JSBackendError instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.Judgement a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.LetBinding instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Listener instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.LoadedFileCache instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.LocalRewriteRuleMap instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.MetaInfo instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.MetaInstantiation instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.MetaVariable instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.MissingTypeSignatureInfo instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ModalEnv instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ModuleCheckMode instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ModuleCheckpoints instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ModuleInfo instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.MutualBlock instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.NegativeUnification instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.OpaqueBlock instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.Open a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Overapplied instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PersistentTCState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PostColdState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PostMetaState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PostNamesCheckpoints instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PostScopeState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PreScopeState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PrimFun instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PrimitiveData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PrimitiveSortData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.PrincipalArgTypeMetas instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ProblemConstraint instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ProjLams instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Projection instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.RecordData instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.ReduceDefs instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance GHC.Internal.Generics.Generic (Agda.TypeChecking.Monad.Base.RewriteSource' a) instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.RunMetaOccursCheck instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.SessionState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Signature instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Simplification instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.SplitError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Statistics instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.System instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TCContext instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TCEnv instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TCState instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TCWarning instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TermHead instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TerminationError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TypeCheckAction instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TypeCheckingProblem instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.TypeError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.UnificationFailure instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.UnquoteError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.UnquoteFlags instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.Warning instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.WhyCheckModality instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.WhyInvalidInstanceType instance GHC.Internal.Generics.Generic Agda.TypeChecking.Monad.Base.WhyNotAHaskellType instance Agda.Utils.FileId.GetFileId Agda.TypeChecking.Monad.Base.Types.FileDictWithBuiltins instance Agda.Utils.FileId.GetIdFile Agda.TypeChecking.Monad.Base.Types.FileDictWithBuiltins instance Agda.TypeChecking.Monad.Base.HasFresh Agda.TypeChecking.Monad.Base.CheckpointId instance Agda.TypeChecking.Monad.Base.HasFresh GHC.Internal.Types.Int instance Agda.TypeChecking.Monad.Base.HasFresh Agda.Syntax.Common.InteractionId instance Agda.TypeChecking.Monad.Base.HasFresh Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Monad.Base.HasFresh Agda.TypeChecking.Monad.Base.MutualId instance Agda.TypeChecking.Monad.Base.HasFresh Agda.Syntax.Common.NameId instance Agda.TypeChecking.Monad.Base.HasFresh Agda.Syntax.Common.OpaqueId instance Agda.TypeChecking.Monad.Base.HasFresh Agda.Syntax.Common.ProblemId instance Agda.Interaction.Options.HasOptions.HasOptions m => Agda.Interaction.Options.HasOptions.HasOptions (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.Interaction.Options.HasOptions.HasOptions Agda.TypeChecking.Monad.Base.ReduceM instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.Interaction.Options.HasOptions.HasOptions (Agda.TypeChecking.Monad.Base.TCMT m) instance Agda.Syntax.Common.HasOverlapMode Agda.TypeChecking.Monad.Base.Candidate instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.Call instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.CallInfo instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.CompilerPragma instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.Constraint instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.MetaVariable instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.TCErr instance Agda.Syntax.Position.HasRange Agda.TypeChecking.Monad.Base.TCWarning instance Agda.Utils.BiMap.HasTag Agda.TypeChecking.Monad.Base.InteractionPoint instance Data.Hashable.Class.Hashable Agda.TypeChecking.Monad.Base.OpaqueBlock instance GHC.Internal.Real.Integral Agda.TypeChecking.Monad.Base.CheckpointId instance Agda.Syntax.Internal.Elim.IsProjElim e => Agda.Syntax.Internal.Elim.IsProjElim (Agda.TypeChecking.Monad.Base.MaybeReduced e) instance (GHC.Internal.Data.String.IsString a, GHC.Internal.Control.Monad.IO.Class.MonadIO m) => GHC.Internal.Data.String.IsString (Agda.TypeChecking.Monad.Base.TCMT m a) instance GHC.Internal.Ix.Ix Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Ix.Ix Agda.TypeChecking.Monad.Base.FunctionFlag instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.BuiltinSort instance Agda.Syntax.Position.KillRange (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.CompKit instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Defn instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.DoGeneralize instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.EtaEquality instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.FunctionFlag instance Agda.Syntax.Position.KillRange c => Agda.Syntax.Position.KillRange (Agda.TypeChecking.Monad.Base.FunctionInverse' c) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Definitions instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.GlobalRewriteRuleMap instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.InstanceInfo instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.InstanceTable instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.IsForced instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.IsPathCons instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Sections instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.CompiledRepresentation instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.MutualId instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.TypeChecking.Monad.Base.Open a) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Types.Polarity instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.ProjLams instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Projection instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Section instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.Signature instance Agda.Syntax.Position.KillRange (Agda.Utils.SmallSet.SmallSet Agda.TypeChecking.Monad.Base.FunctionFlag) instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.System instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Monad.Base.TermHead instance Agda.Syntax.Common.LensArgInfo Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Monad.Base.LensClosure (Agda.TypeChecking.Monad.Base.Closure a) a instance Agda.TypeChecking.Monad.Base.LensClosure Agda.TypeChecking.Monad.Base.MetaInfo Agda.Syntax.Position.Range instance Agda.TypeChecking.Monad.Base.LensClosure Agda.TypeChecking.Monad.Base.MetaVariable Agda.Syntax.Position.Range instance Agda.Syntax.Common.LensIsAbstract (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.Syntax.Common.LensIsAbstract Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Common.LensIsAbstract Agda.TypeChecking.Monad.Base.MetaVariable instance Agda.Syntax.Common.LensIsAbstract Agda.TypeChecking.Monad.Base.TCEnv instance Agda.Syntax.Common.LensIsOpaque Agda.TypeChecking.Monad.Base.TCEnv instance Agda.Syntax.Common.LensModalPolarity Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Common.LensModalPolarity Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Common.LensModalPolarity Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Monad.Base.MetaVariable instance Agda.Syntax.Common.LensModality Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.Interaction.Options.Types.LensPragmaOptions Agda.TypeChecking.Monad.Base.PreScopeState instance Agda.Interaction.Options.Types.LensPragmaOptions Agda.TypeChecking.Monad.Base.TCState instance Agda.Syntax.Common.LensQuantity Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Common.LensQuantity Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Common.LensQuantity Agda.TypeChecking.Monad.Base.MetaVariable instance Agda.Syntax.Common.LensQuantity Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Monad.Base.MetaVariable instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.TypeChecking.Monad.Base.LensTCEnv (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Monad.Base.LensTCEnv Agda.TypeChecking.Monad.Base.TCEnv instance Agda.TypeChecking.Monad.Base.ModifySession m => Agda.TypeChecking.Monad.Base.ModifySession (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.ModifySession m => Agda.TypeChecking.Monad.Base.ModifySession (Control.Monad.Trans.State.Lazy.StateT s m) instance (GHC.Internal.Control.Monad.IO.Class.MonadIO m, Control.Monad.Catch.MonadMask m) => Agda.TypeChecking.Monad.Base.ModifySession (Agda.TypeChecking.Monad.Base.TCMT m) instance Agda.Utils.Benchmark.MonadBench Agda.TypeChecking.Monad.Base.TCM instance GHC.Internal.Base.Monad m => Agda.TypeChecking.Monad.Base.MonadBlock (Agda.TypeChecking.Monad.Base.BlockT m) instance GHC.Internal.Base.Monad m => Agda.TypeChecking.Monad.Base.MonadBlock (Control.Monad.Trans.Except.ExceptT Agda.TypeChecking.Monad.Base.TCErr m) instance Agda.TypeChecking.Monad.Base.MonadBlock m => Agda.TypeChecking.Monad.Base.MonadBlock (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.MonadBlock m => Agda.TypeChecking.Monad.Base.MonadBlock (Agda.Utils.StrictReader.ReaderT e m) instance Agda.TypeChecking.Monad.Base.MonadBlock m => Agda.TypeChecking.Monad.Base.MonadBlock (Control.Monad.Trans.Reader.ReaderT e m) instance Agda.TypeChecking.Monad.Base.MonadBlock Agda.TypeChecking.Monad.Base.TCM instance Control.Monad.Error.Class.MonadError Agda.TypeChecking.Monad.Base.TCErr Agda.TypeChecking.Monad.Base.TCM instance GHC.Internal.Control.Monad.Fail.MonadFail m => GHC.Internal.Control.Monad.Fail.MonadFail (Agda.TypeChecking.Monad.Base.BlockT m) instance GHC.Internal.Control.Monad.Fail.MonadFail Agda.TypeChecking.Monad.Base.ReduceM instance GHC.Internal.Control.Monad.Fail.MonadFail Agda.TypeChecking.Monad.Base.TCM instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Base.MonadFresh i m => Agda.TypeChecking.Monad.Base.MonadFresh i (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Base.MonadFresh i m => Agda.TypeChecking.Monad.Base.MonadFresh i (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Base.MonadFresh i m => Agda.TypeChecking.Monad.Base.MonadFresh i (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Base.MonadFresh i m => Agda.TypeChecking.Monad.Base.MonadFresh i (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.MonadFresh i m => Agda.TypeChecking.Monad.Base.MonadFresh i (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadFresh i m => Agda.TypeChecking.Monad.Base.MonadFresh i (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Base.HasFresh i => Agda.TypeChecking.Monad.Base.MonadFresh i Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.Base.MonadFresh i m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Base.MonadFresh i (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.TypeChecking.Monad.Base.BlockT m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.TypeChecking.Monad.Base.TCMT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Control.Monad.Trans.Except.ExceptT err m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadReduce Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.Utils.StrictState.StateT w m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Control.Monad.Trans.State.Lazy.StateT w m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.TypeChecking.Monad.Base.TCMT m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadReduce m) => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadReduce m) => Agda.TypeChecking.Monad.Base.MonadReduce (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames m => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames m => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames m => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames m => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames m => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.Base.MonadStConcreteNames m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Control.Monad.Trans.Except.ExceptT err m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Control.Monad.Trans.State.Lazy.StateT s m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.TypeChecking.Monad.Base.TCMT m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadTCEnv m) => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadTCEnv m) => Agda.TypeChecking.Monad.Base.MonadTCEnv (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.TypeChecking.Monad.Base.BlockT m) instance GHC.Internal.Base.Monad Agda.TypeChecking.Monad.Base.ReduceM instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.TypeChecking.Monad.Base.TCMT m) instance Agda.TypeChecking.Monad.Base.MonadTCM m => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.Utils.Update.ChangeT tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Control.Monad.Trans.Except.ExceptT err tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Control.Monad.Trans.Identity.IdentityT tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.Utils.ListT.ListT tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Control.Monad.Trans.Maybe.MaybeT tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.Utils.StrictReader.ReaderT r tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Control.Monad.Trans.Reader.ReaderT r tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.Utils.StrictState.StateT s tcm) instance Agda.TypeChecking.Monad.Base.MonadTCM tcm => Agda.TypeChecking.Monad.Base.MonadTCM (Control.Monad.Trans.State.Lazy.StateT s tcm) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.TypeChecking.Monad.Base.TCMT m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadTCM tcm) => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.Utils.StrictWriter.WriterT w tcm) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadTCM tcm) => Agda.TypeChecking.Monad.Base.MonadTCM (Control.Monad.Trans.Writer.Lazy.WriterT w tcm) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Control.Monad.Trans.Except.ExceptT err m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Control.Monad.Trans.State.Lazy.StateT s m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.TypeChecking.Monad.Base.TCMT m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadTCState m) => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.MonadTCState m) => Agda.TypeChecking.Monad.Base.MonadTCState (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Control.Monad.Trans.Class.MonadTrans Agda.TypeChecking.Monad.Base.BlockT instance Control.Monad.Trans.Class.MonadTrans Agda.TypeChecking.Monad.Base.TCMT instance GHC.Internal.Base.Monoid Agda.TypeChecking.Monad.Base.InstanceTable instance GHC.Internal.Base.Monoid Agda.TypeChecking.Monad.Base.Simplification instance GHC.Internal.Base.Monoid Agda.TypeChecking.Monad.Base.Statistics instance (GHC.Internal.Control.Monad.IO.Class.MonadIO m, GHC.Internal.Base.Monoid a) => GHC.Internal.Base.Monoid (Agda.TypeChecking.Monad.Base.TCMT m a) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.AbstractMode instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.AllowedReduction instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.AxiomData instance Control.DeepSeq.NFData (Agda.Utils.BiMap.BiMap Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InteractionPoints instance Control.DeepSeq.NFData pf => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.Builtin pf) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.BuiltinSort instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Call instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CallInfo instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Candidate instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CandidateKind instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CannotQuote instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CheckpointId instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ClashingName instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.Closure a) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ColdEnv instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CompKit instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CompareAs instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.Comparison instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.CompilerPragma instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Constraint instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ConstructorData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ConstructorDisambiguationData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.DataOrRecSigData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.DatatypeData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Definition instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Defn instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.DisambiguatedName instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.DisplayForm instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.DisplayTerm instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.DoGeneralize instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.EtaEquality instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.EtaProvenance instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ExecError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ExpandHidden instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ExtLamInfo instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Flags64 instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ForeignCode instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ForeignCodeStack instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Frozen instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.FunctionData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.FunctionFlag instance Control.DeepSeq.NFData c => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.FunctionInverse' c) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.GHCBackendError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.GeneralizedValue instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.HighlightingLevel instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.HighlightingMethod instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IPClause instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IllegalRewriteRuleReason instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IncorrectTypeForRewriteRelationReason instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InductionAndEta instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InstanceInfo instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InstanceTable instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Instantiation instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InteractionError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InteractionPoint instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Interface instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.InvalidFileNameReason instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IsAmbiguous instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IsAxiom instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IsForced instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.IsPathCons instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.JSBackendError instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.Judgement a) instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.LetBinding instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Listener instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.LoadedFileCache instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.LocalRewriteRuleMap instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MetaInfo instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MetaInstantiation instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MetaPriority instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MetaVariable instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MissingTypeSignatureInfo instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ModalEnv instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ModuleCheckMode instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ModuleCheckpoints instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ModuleInfo instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MutualBlock instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.MutualId instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.NegativeUnification instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.OpaqueBlock instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.Monad.Base.Open a) instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.OpenedModule instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Overapplied instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PersistentTCState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Types.Polarity instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PostColdState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PostMetaState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PostNamesCheckpoints instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PostScopeState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PreScopeState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PrimFun instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PrimitiveData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PrimitiveSortData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.PrincipalArgTypeMetas instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ProblemConstraint instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ProjLams instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Projection instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.RecordData instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Warning.RecordFieldWarning instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.ReduceDefs instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.SerialisableRewriteSource instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.RunMetaOccursCheck instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Section instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.SessionState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Signature instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Simplification instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.SplitError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Statistics instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.System instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TCContext instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TCEnv instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TCErr instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TCState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TCWarning instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TermHead instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TerminationError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TypeCheckAction instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TypeCheckingProblem instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.TypeError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.UnificationFailure instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.UnquoteError instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.UnquoteFlags instance Control.DeepSeq.NFData Agda.Syntax.Scope.Base.UnusedImportsState instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.Warning instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.WhyCheckModality instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.WhyInvalidInstanceType instance Control.DeepSeq.NFData Agda.TypeChecking.Monad.Base.WhyNotAHaskellType instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.Fields instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.InstanceTable instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.LocalRewriteRuleMap instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.MutualBlock instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.ProjLams instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.Signature instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.Simplification instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.Statistics instance (GHC.Internal.Control.Monad.IO.Class.MonadIO m, Agda.Utils.Null.Null a) => Agda.Utils.Null.Null (Agda.TypeChecking.Monad.Base.TCMT m a) instance Agda.Utils.Null.Null (Agda.TypeChecking.Monad.Base.TCM Agda.Syntax.Common.Pretty.Doc) instance Agda.Utils.Null.Null Agda.TypeChecking.Monad.Base.WarningsAndNonFatalErrors instance GHC.Internal.Num.Num Agda.TypeChecking.Monad.Base.CheckpointId instance GHC.Internal.Num.Num Agda.TypeChecking.Monad.Base.MutualId instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.CheckpointId instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.CompKit instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.DoGeneralize instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.EtaProvenance instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.FunctionFlag instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.Listener instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.MetaPriority instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.ModuleCheckMode instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.MutualId instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.RunMetaOccursCheck instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.TCWarning instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.TermHead instance Agda.Syntax.Common.PatternMatchingAllowed Agda.TypeChecking.Monad.Base.EtaEquality instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Call instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.CallInfo instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.CheckpointId instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.CompareAs instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.CompareDirection instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Types.Comparison instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.ConstructorData instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.DataOrRecSigData instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Common.DataOrRecord' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.DatatypeData instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Defn instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.FunctionData instance Agda.Syntax.Common.Pretty.Pretty c => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Monad.Base.FunctionInverse' c) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Interface instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Monad.Base.Judgement a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.MetaInstantiation instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.ModuleCheckpoints instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Types.ModuleToSource instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.MutualId instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Types.NamedMeta instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.OpaqueBlock instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Monad.Base.Open a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Types.Polarity instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.PrimitiveData instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.PrimitiveSortData instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.ProjLams instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Projection instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.RecordData instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.Section instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Base.TermHead instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Control.Monad.Trans.Except.ExceptT err m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Control.Monad.Trans.State.Lazy.StateT s m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.TypeChecking.Monad.Base.TCMT m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.ReadTCState m) => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Base.ReadTCState m) => Agda.TypeChecking.Monad.Base.ReadTCState (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance GHC.Internal.Real.Real Agda.TypeChecking.Monad.Base.CheckpointId instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Monad.Base.InstanceTable instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Monad.Base.Simplification instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Monad.Base.Statistics instance (GHC.Internal.Control.Monad.IO.Class.MonadIO m, GHC.Internal.Base.Semigroup a) => GHC.Internal.Base.Semigroup (Agda.TypeChecking.Monad.Base.TCMT m a) instance Agda.Syntax.Position.SetRange Agda.TypeChecking.Monad.Base.MetaInfo instance Agda.Syntax.Position.SetRange Agda.TypeChecking.Monad.Base.MetaVariable instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.AbstractMode instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.AllowedReduction instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.ArgsCheckState a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.AxiomData instance GHC.Internal.Show.Show pf => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.Builtin pf) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.BuiltinSort instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Call instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CallInfo instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Candidate instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CandidateKind instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CannotQuote instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CheckedArg instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CheckedTarget instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CheckpointId instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ClashingName instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.Closure a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CompKit instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CompareAs instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CompareDirection instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.CompilerPragma instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Constraint instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ConstructorData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.DataOrRecSigData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.DatatypeData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Definition instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Defn instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.DisplayForm instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.DisplayTerm instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.DoGeneralize instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.EtaEquality instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.EtaProvenance instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ExecError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ExtLamInfo instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ForeignCode instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ForeignCodeStack instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Frozen instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.FunctionData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.FunctionFlag instance GHC.Internal.Show.Show c => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.FunctionInverse' c) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.GHCBackendError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.GeneralizedValue instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.IllegalRewriteRuleReason instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.IncorrectTypeForRewriteRelationReason instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.InductionAndEta instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.InstanceInfo instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.InstanceTable instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Instantiation instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.InteractionError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Interface instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.InvalidFileNameReason instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.IsAmbiguous instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.IsAxiom instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.IsForced instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.IsPathCons instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.JSBackendError instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.Judgement a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.LetBinding instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.LocalRewriteRuleMap instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.MetaPriority instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.MissingTypeSignatureInfo instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ModuleCheckMode instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.MutualBlock instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.MutualId instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.NegativeUnification instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.OpaqueBlock instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.Open a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Overapplied instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.PrimitiveData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.PrimitiveSortData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ProblemConstraint instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ProjLams instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Projection instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.RecordData instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Monad.Base.RewriteSource' a) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.RunMetaOccursCheck instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Section instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Signature instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Simplification instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.SplitError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Statistics instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.System instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.TCErr instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.TCState instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.TCWarning instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.TermHead instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.TerminationError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.TypeError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.UnificationFailure instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.UnquoteError instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.Warning instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.WhyCheckModality instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.WhyInvalidInstanceType instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Base.WhyNotAHaskellType instance Agda.Utils.SmallSet.SmallSetElement Agda.TypeChecking.Monad.Base.AllowedReduction instance Agda.Utils.SmallSet.SmallSetElement Agda.TypeChecking.Monad.Base.FunctionFlag instance Agda.Syntax.Internal.Generic.TermLike Agda.TypeChecking.Monad.Base.CompareAs instance Agda.Syntax.Internal.Generic.TermLike Agda.TypeChecking.Monad.Base.Constraint instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.LocalEquation instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.NLPSort instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.NLPType instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.NLPat instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Monad.Base.Builtin instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Monad.Base.IPBoundary' instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Monad.Base.Open module Agda.TypeChecking.Monad.Imports -- | Register the given module as imported in the current state. Also -- recursively add its imports to the cumulative imports. addImport :: TopLevelModuleName -> TCM () -- | Temporarily register the given module as imported. locallyAddImport :: TopLevelModuleName -> TCM () -> TCM () -- | Assumes that the first module in the import path is the module we are -- worried about. checkForImportCycle :: TCM () dropDecodedModule :: TopLevelModuleName -> TCM () getDecodedModule :: TopLevelModuleName -> TCM (Maybe ModuleInfo) getDecodedModules :: TCM DecodedModules getPrettyVisitedModules :: ReadTCState m => m Doc getVisitedModule :: ReadTCState m => TopLevelModuleName -> m (Maybe ModuleInfo) getVisitedModules :: ReadTCState m => m VisitedModules setDecodedModules :: DecodedModules -> TCM () setVisitedModules :: VisitedModules -> TCM () storeDecodedModule :: ModuleInfo -> TCM () visitModule :: ModuleInfo -> TCM () module Agda.TypeChecking.Monad.Env -- | Get the name of the current module, if any. currentModule :: MonadTCEnv m => m ModuleName -- | Set the name of the current module. withCurrentModule :: MonadTCEnv m => ModuleName -> m a -> m a -- | Get the path of the currently checked file getCurrentPath :: (MonadTCEnv m, MonadFileId m) => m AbsolutePath -- | Get the number of variables bound by anonymous modules. getAnonymousVariables :: MonadTCEnv m => ModuleName -> m Nat -- | Add variables bound by an anonymous module. withAnonymousModule :: ModuleName -> Nat -> TCM a -> TCM a -- | Set the current environment to the given withEnv :: MonadTCEnv m => TCEnv -> m a -> m a -- | Get the current environment getEnv :: TCM TCEnv -- | Set highlighting level withHighlightingLevel :: HighlightingLevel -> TCM a -> TCM a -- | Restore setting for ExpandLast to default. doExpandLast :: TCM a -> TCM a dontExpandLast :: TCM a -> TCM a reallyDontExpandLast :: TCM a -> TCM a -- | If the reduced did a proper match (constructor or literal pattern), -- then record this as simplification step. performedSimplification :: MonadTCEnv m => m a -> m a performedSimplification' :: MonadTCEnv m => Simplification -> m a -> m a getSimplification :: MonadTCEnv m => m Simplification -- | Lens for AllowedReductions. updateAllowedReductions :: (AllowedReductions -> AllowedReductions) -> TCEnv -> TCEnv modifyAllowedReductions :: MonadTCEnv m => (AllowedReductions -> AllowedReductions) -> m a -> m a putAllowedReductions :: MonadTCEnv m => AllowedReductions -> m a -> m a -- | Reduce Def f vs only if f is a projection. onlyReduceProjections :: MonadTCEnv m => m a -> m a -- | Allow all reductions except for non-terminating functions (default). allowAllReductions :: MonadTCEnv m => m a -> m a -- | Allow all reductions including non-terminating functions. allowNonTerminatingReductions :: MonadTCEnv m => m a -> m a -- | Allow all reductions when reducing types. Otherwise only allow inlined -- functions to be unfolded. onlyReduceTypes :: MonadTCEnv m => m a -> m a -- | Update allowed reductions when working on types typeLevelReductions :: MonadTCEnv m => m a -> m a insideDotPattern :: TCM a -> TCM a isInsideDotPattern :: TCM Bool -- | Don't use call-by-need evaluation for the given computation. callByName :: TCM a -> TCM a -- | Don't fold let bindings when printing. This is a bit crude since it -- disables any folding of let bindings at all. In many cases it's better -- to use removeLetBinding before printing to drop the let -- bindings that should not be folded. dontFoldLetBindings :: MonadTCEnv m => m a -> m a -- | Logic for deciding which functions should be automatically inlined. module Agda.TypeChecking.Inlining -- | Mark a definition to be inlined if it satisfies the inlining -- criterion. autoInline :: Defn -> TCM Defn module Agda.TypeChecking.Monad.Debug __CRASH_WHEN__ :: (HasCallStack, MonadDebug m) => VerboseKey -> VerboseLevel -> m () -- | Raise internal error with extra information. __IMPOSSIBLE_VERBOSE__ :: (HasCallStack, MonadDebug m) => String -> m a -- | Conditionally render debug Doc and print it. Works regardless -- of the debug flag. alwaysReportSDoc :: MonadDebug m => VerboseKey -> VerboseLevel -> TCM Doc -> m () -- | Conditionally println debug string. Works regardless of the debug -- flag. alwaysReportSLn :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m () -- | Conditionally render debug Doc, print it, and then continue. -- Works regardless of the debug flag. alwaysTraceSDoc :: MonadDebug m => VerboseKey -> VerboseLevel -> TCM Doc -> m a -> m a -- | Conditionally debug print String, and then continue. Works -- regardless of the debug flag. alwaysTraceSLn :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m a -> m a -- | Apply a function if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. applyWhenVerboseS :: MonadDebug m => VerboseKey -> VerboseLevel -> (m a -> m a) -> m a -> m a -- | During printing, catch internal errors of kind Impossible and -- print them. catchAndPrintImpossible :: (CatchImpossible m, Monad m) => VerboseKey -> VerboseLevel -> m DocTree -> m DocTree closeVerboseBracket :: MonadDebug m => VerboseKey -> VerboseLevel -> m () closeVerboseBracketException :: MonadDebug m => VerboseKey -> VerboseLevel -> m () defaultGetProfileOptions :: HasOptions m => m ProfileOptions defaultGetVerbosity :: HasOptions m => m Verbosity defaultIsDebugPrinting :: MonadTCEnv m => m Bool defaultNowDebugPrinting :: MonadTCEnv m => m a -> m a -- | Print a debug message if switched on. displayDebugMessage :: MonadDebug m => VerboseKey -> VerboseLevel -> Doc -> m () formatDebugMessageTCM :: VerboseKey -> VerboseLevel -> TCM Doc -> TCM Doc -- | Get the verbosity level for a given key. getVerbosityLevel :: MonadDebug m => VerboseKey -> m VerboseLevel -- | Check whether a certain verbosity level is activated (exact match). hasExactVerbosity :: MonadDebug m => VerboseKey -> VerboseLevel -> m Bool -- | Check whether a certain profile option is activated. hasProfileOption :: MonadDebug m => ProfileOption -> m Bool -- | Check whether a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. hasVerbosity :: MonadDebug m => VerboseKey -> VerboseLevel -> m Bool openVerboseBracket :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m () -- | Debug print the result of a computation. reportResult :: MonadDebug m => VerboseKey -> VerboseLevel -> (a -> TCM Doc) -> m a -> m a -- | Conditionally render debug Doc and print it. reportSDoc :: MonadDebug m => VerboseKey -> VerboseLevel -> TCM Doc -> m () -- | Conditionally println debug string. reportSLn :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m () traceDebugMessageTCM :: VerboseKey -> VerboseLevel -> Doc -> TCM a -> TCM a -- | Conditionally render debug Doc, print it, and then continue. traceSDoc :: MonadDebug m => VerboseKey -> VerboseLevel -> TCM Doc -> m a -> m a -- | Conditionally debug print String, and then continue. Works -- regardless of the debug flag. traceSLn :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m a -> m a unlessDebugPrinting :: MonadDebug m => m () -> m () verboseBracketTCM :: VerboseKey -> VerboseLevel -> String -> TCM a -> TCM a -- | Run a computation if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. verboseS :: MonadDebug m => VerboseKey -> VerboseLevel -> m () -> m () -- | Run a computation if a certain verbosity level is activated (exact -- match). whenExactVerbosity :: MonadDebug m => VerboseKey -> VerboseLevel -> m () -> m () -- | Run some code when the given profiling option is active. whenProfile :: MonadDebug m => ProfileOption -> m () -> m () class (Functor m, Applicative m, Monad m) => MonadDebug (m :: Type -> Type) formatDebugMessage :: MonadDebug m => VerboseKey -> VerboseLevel -> TCM Doc -> m Doc ($dmformatDebugMessage) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => VerboseKey -> VerboseLevel -> TCM Doc -> m Doc traceDebugMessage :: MonadDebug m => VerboseKey -> VerboseLevel -> Doc -> m a -> m a ($dmtraceDebugMessage) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a. (MonadDebug m, MonadTransControl t, MonadDebug n, m ~ t n) => VerboseKey -> VerboseLevel -> Doc -> m a -> m a -- | Print brackets around debug messages issued by a computation. verboseBracket :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m a -> m a ($dmverboseBracket) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a. (MonadDebug m, MonadTransControl t, MonadDebug n, m ~ t n) => VerboseKey -> VerboseLevel -> String -> m a -> m a getVerbosity :: MonadDebug m => m Verbosity ($dmgetVerbosity) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => m Verbosity getProfileOptions :: MonadDebug m => m ProfileOptions ($dmgetProfileOptions) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => m ProfileOptions -- | Check whether we are currently debug printing. isDebugPrinting :: MonadDebug m => m Bool ($dmisDebugPrinting) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => m Bool -- | Flag in a computation that we are currently debug printing. nowDebugPrinting :: MonadDebug m => m a -> m a ($dmnowDebugPrinting) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type) a. (MonadDebug m, MonadTransControl t, MonadDebug n, m ~ t n) => m a -> m a -- | Debug print some lines if the verbosity level for the given -- VerboseKey is at least VerboseLevel. -- -- Note: In the presence of OverloadedStrings, just @ -- reportS key level "Literate string" gives an Ambiguous -- type variable error in GHC@. Use the legacy functions -- reportSLn and reportSDoc instead then. class ReportS a reportS :: (ReportS a, MonadDebug m) => VerboseKey -> VerboseLevel -> a -> m () -- | Debug print some lines if the verbosity level for the given -- VerboseKey is at least VerboseLevel. -- -- Note: In the presence of OverloadedStrings, just @ traceS -- key level "Literate string" gives an Ambiguous type -- variable error in GHC@. Use the legacy functions -- traceSLn and traceSDoc instead then. class TraceS a traceS :: (TraceS a, MonadDebug m) => VerboseKey -> VerboseLevel -> a -> m c -> m c -- | Nothing is used if no verbosity options have been given, thus -- making it possible to handle the default case relatively quickly. Note -- that Nothing corresponds to a trie with verbosity level 1 for -- the empty path. type Verbosity = Maybe Trie VerboseKeyItem VerboseLevel type VerboseKey = String type VerboseLevel = Int instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.Debug.MonadDebug m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Utils.StrictWriter.WriterT w m) instance (Agda.TypeChecking.Monad.Debug.MonadDebug m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.Debug.ReportS Agda.Syntax.Common.Pretty.Doc instance Agda.TypeChecking.Monad.Debug.ReportS GHC.Internal.Base.String instance Agda.TypeChecking.Monad.Debug.ReportS [Agda.TypeChecking.Monad.Base.TCM Agda.Syntax.Common.Pretty.Doc] instance Agda.TypeChecking.Monad.Debug.ReportS [GHC.Internal.Base.String] instance Agda.TypeChecking.Monad.Debug.ReportS [Agda.Syntax.Common.Pretty.Doc] instance Agda.TypeChecking.Monad.Debug.ReportS (Agda.TypeChecking.Monad.Base.TCM Agda.Syntax.Common.Pretty.Doc) instance Agda.TypeChecking.Monad.Debug.TraceS Agda.Syntax.Common.Pretty.Doc instance Agda.TypeChecking.Monad.Debug.TraceS GHC.Internal.Base.String instance Agda.TypeChecking.Monad.Debug.TraceS [Agda.TypeChecking.Monad.Base.TCM Agda.Syntax.Common.Pretty.Doc] instance Agda.TypeChecking.Monad.Debug.TraceS [GHC.Internal.Base.String] instance Agda.TypeChecking.Monad.Debug.TraceS [Agda.Syntax.Common.Pretty.Doc] instance Agda.TypeChecking.Monad.Debug.TraceS (Agda.TypeChecking.Monad.Base.TCM Agda.Syntax.Common.Pretty.Doc) -- | Collect statistics. module Agda.TypeChecking.Monad.Statistics class ReadTCState m => MonadStatistics (m :: Type -> Type) tickN :: MonadStatistics m => String -> Word64 -> m () ($dmtickN) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (MonadStatistics m, MonadStatistics n, MonadTrans t, t n ~ m) => String -> Word64 -> m () tickMax :: MonadStatistics m => String -> Word64 -> m () ($dmtickMax) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (MonadStatistics m, MonadStatistics n, MonadTrans t, t n ~ m) => String -> Word64 -> m () -- | Increase specified counter by 1. tick :: MonadStatistics m => String -> m () -- | Get the statistics. getStatistics :: ReadTCState m => m Statistics -- | Modify the statistics via given function. modifyStatistics :: (Statistics -> Statistics) -> TCM () -- | Print the given statistics. printStatistics :: MonadDebug m => Maybe TopLevelModuleName -> Statistics -> m () instance Agda.TypeChecking.Monad.Statistics.MonadStatistics m => Agda.TypeChecking.Monad.Statistics.MonadStatistics (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Statistics.MonadStatistics m => Agda.TypeChecking.Monad.Statistics.MonadStatistics (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Statistics.MonadStatistics m => Agda.TypeChecking.Monad.Statistics.MonadStatistics (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Statistics.MonadStatistics m => Agda.TypeChecking.Monad.Statistics.MonadStatistics (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Statistics.MonadStatistics m => Agda.TypeChecking.Monad.Statistics.MonadStatistics (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Statistics.MonadStatistics Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.Statistics.MonadStatistics m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Statistics.MonadStatistics (Control.Monad.Trans.Writer.Lazy.WriterT w m) module Agda.TypeChecking.Monad.Caching -- | Writes a TypeCheckAction to the current log, using the current -- PostScopeState writeToCurrentLog :: (MonadDebug m, MonadTCState m, ReadTCState m) => TypeCheckAction -> m () -- | Reads the next entry in the cached type check log, if present. readFromCachedLog :: (MonadDebug m, MonadTCState m, ReadTCState m) => m (Maybe (TypeCheckAction, PostScopeState)) -- | Empties the "to read" CachedState. To be used when it gets invalid. cleanCachedLog :: (MonadDebug m, MonadTCState m) => m () -- | Caches the current type check log. Discardes the old cache. Does -- nothing if caching is inactive. cacheCurrentLog :: (MonadDebug m, MonadTCState m) => m () -- | Makes sure that the stLoadedFileCache is Just, with a -- clean current log. Crashes is stLoadedFileCache is already -- active with a dirty log. Should be called when we start typechecking -- the current file. activateLoadedFileCache :: (HasOptions m, MonadDebug m, MonadTCState m) => m () -- | To be called before any write or restore calls. cachingStarts :: (MonadDebug m, MonadTCState m, ReadTCState m) => m () areWeCaching :: ReadTCState m => m Bool -- | Runs the action and restores the current cache at the end of it. localCache :: (MonadTCState m, ReadTCState m) => m a -> m a -- | Runs the action without cache and restores the current cache at the -- end of it. withoutCache :: (MonadTCState m, ReadTCState m) => m a -> m a restorePostScopeState :: (MonadDebug m, MonadTCState m) => PostScopeState -> m () cachingStartsTEST :: TCM () -- | Measure CPU time for individual phases of the Agda pipeline. module Agda.TypeChecking.Monad.Benchmark -- | Monad with access to benchmarking data. class (Ord BenchPhase m, Functor m, MonadIO m) => MonadBench (m :: Type -> Type) type family BenchPhase (m :: Type -> Type) getBenchmark :: MonadBench m => m (Benchmark (BenchPhase m)) -- | When profile options are set or changed, we need to turn benchmarking -- on or off. updateBenchmarkingStatus :: TCM () -- | Bill a computation to a specific account. Works even if the -- computation is aborted by an exception. billTo :: MonadBench m => Account (BenchPhase m) -> m c -> m c -- | Bill a pure computation to a specific account. billPureTo :: MonadBench m => Account (BenchPhase m) -> c -> m c -- | Bill a CPS function to an account. Can't handle exceptions. billToCPS :: MonadBench m => Account (BenchPhase m) -> ((b -> m c) -> m c) -> (b -> m c) -> m c -- | Resets the account and the timing information. reset :: MonadBench m => m () -- | Prints the accumulated benchmark results. Does nothing if no benchmark -- profiling is enabled. print :: MonadTCM tcm => tcm () instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.Benchmark.ModuleThroughput -- | Extract all names and meta-variables from things. module Agda.Syntax.Internal.Names -- | Some or all of the QNames that can be found in the given thing. namesIn :: (NamesIn a, Collection QName m) => a -> m -- | Some or all of the QNames that can be found in the given thing. namesIn' :: (NamesIn a, Monoid m) => (QName -> m) -> a -> m -- | Some or all of the meta-variables that can be found in the given -- thing. metasIn :: (NamesIn a, Collection MetaId m) => a -> m -- | Some or all of the meta-variables that can be found in the given -- thing. metasIn' :: (NamesIn a, Monoid m) => (MetaId -> m) -> a -> m -- | Some or all of the names and meta-variables that can be found in the -- given thing. namesAndMetasIn :: (NamesIn a, Collection QName m1, Collection MetaId m2) => a -> (m1, m2) class NamesIn a -- | Some or all of the names and meta-variables that can be found in the -- given thing. namesAndMetasIn' :: (NamesIn a, Monoid m) => (Either QName MetaId -> m) -> a -> m ($dmnamesAndMetasIn') :: forall m (f :: Type -> Type) b. (NamesIn a, Monoid m, Foldable f, NamesIn b, f b ~ a) => (Either QName MetaId -> m) -> a -> m instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Names.NamesIn GHC.Internal.Types.Bool instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.Monad.Base.Builtin a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.CompiledClause.Case a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Treeless.CaseInfo instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Treeless.CaseType instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Clause instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.CompKit instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Treeless.Compiled instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.ConHead instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.ConPatternInfo instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.Defn instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.DisplayTerm instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b) => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Dom' a b) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b) => Agda.Syntax.Internal.Names.NamesIn (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.Monad.Base.FunctionInverse' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.Syntax.Internal.Names.NamesIn b => Agda.Syntax.Internal.Names.NamesIn (Data.HashMap.Internal.HashMap a b) instance Agda.Syntax.Internal.Names.NamesIn GHC.Internal.Types.Int instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Level' a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn [a] instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Literal.Literal instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.LocalEquation' a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Data.Map.Internal.Map k a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Data.Strict.Maybe.Maybe a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Common.MetaId instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.NLPSort instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.NLPType instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.NLPat instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Utils.List1.List1 a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.Monad.Base.Open a) instance Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Abstract.Pattern' a) instance Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Pattern' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Abstract.PatternSynDefn instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.PlusLevel' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.PrimFun instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.Projection instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.RewDom' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.RewriteHead instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.RewriteRule instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.Section instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Data.Set.Internal.Set a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Sort' a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Substitution' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.System instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Treeless.TAlt instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Treeless.TTerm instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Term instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b) => Agda.Syntax.Internal.Names.NamesIn (a, b) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b, Agda.Syntax.Internal.Names.NamesIn c) => Agda.Syntax.Internal.Names.NamesIn (a, b, c) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b, Agda.Syntax.Internal.Names.NamesIn c, Agda.Syntax.Internal.Names.NamesIn d) => Agda.Syntax.Internal.Names.NamesIn (a, b, c, d) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b, Agda.Syntax.Internal.Names.NamesIn c, Agda.Syntax.Internal.Names.NamesIn d, Agda.Syntax.Internal.Names.NamesIn e) => Agda.Syntax.Internal.Names.NamesIn (a, b, c, d, e) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b, Agda.Syntax.Internal.Names.NamesIn c, Agda.Syntax.Internal.Names.NamesIn d, Agda.Syntax.Internal.Names.NamesIn e, Agda.Syntax.Internal.Names.NamesIn f) => Agda.Syntax.Internal.Names.NamesIn (a, b, c, d, e, f) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b) => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Type'' a b) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.CompiledClause.WithArity a) module Agda.Interaction.Output type OutputForm a b = OutputForm_boot TCErr a b type OutputConstraint a b = OutputConstraint_boot TCErr a b module Agda.TypeChecking.Warnings class (MonadPretty m, MonadError TCErr m) => MonadWarning (m :: Type -> Type) -- | Store a warning and generate highlighting from it. addWarning :: MonadWarning m => Bool -> TCWarning -> m () ($dmaddWarning) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (MonadWarning m, MonadWarning n, MonadTrans t, t n ~ m) => Bool -> TCWarning -> m () warning'_ :: MonadWarning m => CallStack -> Warning -> m TCWarning warning_ :: (HasCallStack, MonadWarning m) => Warning -> m TCWarning warning' :: MonadWarning m => CallStack -> Warning -> m () warning :: (HasCallStack, MonadWarning m) => Warning -> m () warnings :: (HasCallStack, MonadWarning m) => List1 Warning -> m () -- | Raise every WARNING_ON_USAGE connected to a name. raiseWarningsOnUsage :: MonadWarning m => QName -> m () isUnsolvedWarning :: Warning -> Bool isMetaWarning :: Warning -> Bool isMetaTCWarning :: TCWarning -> Bool onlyShowIfUnsolved :: Warning -> Bool -- | Classifying warnings: some are benign, others are (non-fatal) errors data WhichWarnings -- | warnings that will be turned into errors ErrorWarnings :: WhichWarnings -- | all warnings, including errors and benign ones Note: order of -- constructors is important for the derived Ord instance AllWarnings :: WhichWarnings classifyWarning :: Warning -> WhichWarnings -- | Assorted warnings and errors to be displayed to the user data WarningsAndNonFatalErrors tcWarnings :: WarningsAndNonFatalErrors -> Set TCWarning nonFatalErrors :: WarningsAndNonFatalErrors -> Set TCWarning classifyWarnings :: [TCWarning] -> WarningsAndNonFatalErrors instance GHC.Internal.Classes.Eq Agda.TypeChecking.Warnings.WhichWarnings instance Agda.TypeChecking.Warnings.MonadWarning m => Agda.TypeChecking.Warnings.MonadWarning (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Warnings.MonadWarning m => Agda.TypeChecking.Warnings.MonadWarning (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Warnings.MonadWarning m => Agda.TypeChecking.Warnings.MonadWarning (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Warnings.MonadWarning Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Warnings.MonadWarning m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Warnings.MonadWarning (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance GHC.Internal.Classes.Ord Agda.TypeChecking.Warnings.WhichWarnings module Agda.Interaction.Response type DisplayInfo = DisplayInfo_boot TCErr TCWarning WarningsAndNonFatalErrors type GoalDisplayInfo = GoalDisplayInfo_boot TCErr type Goals = Goals_boot TCErr type Info_Error = Info_Error_boot TCErr TCWarning type Response = Response_boot TCErr TCWarning WarningsAndNonFatalErrors -- | Assorted warnings and errors to be displayed to the user data WarningsAndNonFatalErrors -- | Callback fuction to call when there is a response to give to the -- interactive frontend. -- -- Note that the response is given in pieces and incrementally, so the -- user can have timely response even during long computations. -- -- Typical InteractionOutputCallback functions: -- -- type InteractionOutputCallback = Response_boot TCErr TCWarning WarningsAndNonFatalErrors -> TCM () -- | The default InteractionOutputCallback function prints certain -- things to stdout (other things generate internal errors). defaultInteractionOutputCallback :: InteractionOutputCallback -- | Lenses for TCState and more. module Agda.TypeChecking.Monad.State -- | Resets the non-persistent part of the type checking state. resetState :: TCM () -- | Resets all of the type checking state. -- -- Keep only the session state (backend information, Benchmark, -- file ids). resetAllState :: TCM () -- | Set the TCState, preserving any parts of the state which should -- persist through speculation (e.g., statistics). putTCPreservingStats :: TCState -> TCM () -- | Restore TCState after performing subcomputation. -- -- Parts of the state which should not be reset on speculation (e.g., -- statistics) will not be reset. localTCState :: TCM a -> TCM a -- | Same as localTCState, but also returns the state in which we -- were just before reverting it. localTCStateSaving :: TCM a -> TCM (a, TCState) -- | Same as localTCState but keep all warnings. localTCStateSavingWarnings :: TCM a -> TCM a -- | A fresh TCM instance. -- -- The computation is run in a fresh state, with the exception that the -- persistent state is preserved. If the computation changes the state, -- then these changes are ignored, except for changes to the persistent -- state. (Changes to the persistent state are also ignored if errors -- other than type errors or IO exceptions are encountered.) freshTCM :: TCM a -> TCM (Either TCErr a) updatePersistentState :: (PersistentTCState -> PersistentTCState) -> TCState -> TCState modifyPersistentState :: (PersistentTCState -> PersistentTCState) -> TCM () -- | Lens for stAccumStatistics. lensAccumStatisticsP :: Lens' PersistentTCState Statistics lensAccumStatistics :: Lens' TCState Statistics -- | Get the current scope. getScope :: ReadTCState m => m ScopeInfo -- | Set the current scope. setScope :: ScopeInfo -> TCM () -- | Modify the current scope without updating the inverse maps. modifyScope :: MonadTCState m => (ScopeInfo -> ScopeInfo) -> m () -- | Recompute inverse names, inverse modules and InScopeSet-s. recomputeInverseScope :: MonadTCState m => m () -- | Get a part of the current scope. useScope :: ReadTCState m => Lens' ScopeInfo a -> m a -- | Run a computation in a modified scope. locallyScope :: ReadTCState m => Lens' ScopeInfo a -> (a -> a) -> m b -> m b -- | Run a computation in a local scope. withScope :: ReadTCState m => ScopeInfo -> m a -> m (a, ScopeInfo) -- | Same as withScope, but discard the scope from the computation. evalWithScope :: ReadTCState m => ScopeInfo -> m a -> m a -- | Discard any changes to the scope by a computation. localScope :: TCM a -> TCM a -- | Scope error. notInScopeError :: QName -> TCM a notInScopeWarning :: QName -> TCM () -- | Debug print the scope. printScope :: String -> Int -> String -> TCM () modifySignature :: MonadTCState m => (Signature -> Signature) -> m () modifyImportedSignature :: MonadTCState m => (Signature -> Signature) -> m () getSignature :: ReadTCState m => m Signature -- | The same caveats as with |modifyGlobalDefinition|, applied changes -- will not persist outside the current module! modifyGlobalSignature :: MonadTCState m => (Signature -> Signature) -> m () -- | Update a possibly imported definition. Warning: changes made to -- imported definitions (during type checking) will not persist outside -- the current module. This function is currently used to update the -- compiled representation of a function during compilation. modifyGlobalDefinition :: MonadTCState m => QName -> (Definition -> Definition) -> m () setSignature :: MonadTCState m => Signature -> m () -- | Run some computation in a different signature, restore original -- signature. withSignature :: (ReadTCState m, MonadTCState m) => Signature -> m a -> m a addRewriteRulesFor :: QName -> GlobalRewriteRules -> [QName] -> TCM () updateDefsForRewrites :: QName -> GlobalRewriteRules -> [QName] -> Definitions -> Definitions setMatchableSymbols :: QName -> [QName] -> Signature -> Signature setMatchableSymbols' :: QName -> [QName] -> Definitions -> Definitions modifyRecEta :: MonadTCState m => QName -> (EtaEquality -> EtaEquality) -> m () lookupDefinition :: QName -> Signature -> Maybe Definition updateDefinitions :: (Definitions -> Definitions) -> Signature -> Signature updateDefinition :: QName -> (Definition -> Definition) -> Signature -> Signature updateTheDef :: (Defn -> Defn) -> Definition -> Definition updateDefType :: (Type -> Type) -> Definition -> Definition updateDefArgOccurrences :: ([Occurrence] -> [Occurrence]) -> Definition -> Definition updateDefPolarity :: ([Polarity] -> [Polarity]) -> Definition -> Definition updateDefCompiledRep :: (CompiledRepresentation -> CompiledRepresentation) -> Definition -> Definition addCompilerPragma :: BackendName -> CompilerPragma -> Definition -> Definition updateFunClauses :: ([Clause] -> [Clause]) -> Defn -> Defn updateCovering :: ([Clause] -> [Clause]) -> Defn -> Defn updateCompiledClauses :: (Maybe CompiledClauses -> Maybe CompiledClauses) -> Defn -> Defn updateDefCopatternLHS :: (Bool -> Bool) -> Definition -> Definition updateDefBlocked :: (Blocked_ -> Blocked_) -> Definition -> Definition -- | Translate an absolute path to a file id, and register a new file id if -- the path has not seen before. Also register whether the path belongs -- to one of Agda's builtin modules. registerFileIdWithBuiltin :: File -> FileDictWithBuiltins -> (FileId, FileDictWithBuiltins) -- | Does the given FileId belong to one of Agda's builtin modules? isBuiltinModule :: ReadTCState m => FileId -> m (Maybe IsBuiltinModule) -- | Does the given FileId belong to one of Agda's builtin modules -- that only uses safe postulates? -- -- Implies isJust . isBuiltinModule. isBuiltinModuleWithSafePostulates :: ReadTCState m => FileId -> m Bool -- | Is the current module, if any, a builtin module that only uses safe -- postulates? currentModuleIsBuiltinModuleWithSafePostulates :: ReadTCState m => m Bool -- | Tries to convert a raw top-level module name to a top-level module -- name. topLevelModuleName :: RawTopLevelModuleName -> TCM TopLevelModuleName -- | Set the top-level module. This affects the global module id of freshly -- generated names. setTopLevelModule :: TopLevelModuleName -> TCM () -- | The name of the current top-level module, if any. currentTopLevelModule :: (MonadTCEnv m, ReadTCState m) => m (Maybe TopLevelModuleName) -- | Use a different top-level module for a computation. Used when -- generating names for imported modules. withTopLevelModule :: TopLevelModuleName -> TCM a -> TCM a currentModuleNameHash :: ReadTCState m => m ModuleNameHash -- | Get a function that completes TopLevelModuleNames with their -- SourceFile to TopLevelModuleNameWithSourceFiles. topLevelModuleNameWithSourceFileCompleter :: ReadTCState m => m (TopLevelModuleName -> TopLevelModuleNameWithSourceFile) -- | Look for a backend of the given name. lookupBackend :: ReadTCState m => BackendName -> m (Maybe Backend) -- | Get the currently active backend (if any). activeBackend :: TCM (Maybe Backend) -- | Ask the active backend whether a type may be erased. See issue #3732. activeBackendMayEraseType :: QName -> TCM Bool addForeignCode :: BackendName -> String -> TCM () getInteractionOutputCallback :: ReadTCState m => m InteractionOutputCallback appInteractionOutputCallback :: Response -> TCM () setInteractionOutputCallback :: InteractionOutputCallback -> TCM () getPatternSyns :: ReadTCState m => m PatternSynDefns setPatternSyns :: PatternSynDefns -> TCM () -- | Lens for stPatternSyns. modifyPatternSyns :: (PatternSynDefns -> PatternSynDefns) -> TCM () getPatternSynImports :: ReadTCState m => m PatternSynDefns -- | Get both local and imported pattern synonyms getAllPatternSyns :: ReadTCState m => m PatternSynDefns lookupPatternSyn :: AmbiguousQName -> TCM PatternSynDefn lookupSinglePatternSyn :: QName -> TCM PatternSynDefn -- | Lens for stInstanceDefs. updateInstanceDefs :: (TempInstanceTable -> TempInstanceTable) -> TCState -> TCState modifyInstanceDefs :: (TempInstanceTable -> TempInstanceTable) -> TCM () getAllInstanceDefs :: TCM TempInstanceTable getAnonInstanceDefs :: TCM (Set QName) -- | Remove an instance from the set of unresolved instances. clearUnknownInstance :: QName -> TCM () -- | Add an instance whose type is still unresolved. addUnknownInstance :: QName -> TCM () instance Agda.Utils.FileId.MonadFileId Agda.TypeChecking.Monad.Base.ReduceM instance (GHC.Internal.Control.Monad.IO.Class.MonadIO m, Control.Monad.Catch.MonadMask m) => Agda.Utils.FileId.MonadFileId (Agda.TypeChecking.Monad.Base.TCMT m) module Agda.TypeChecking.Monad.Trace interestingCall :: Call -> Bool class (MonadTCEnv m, ReadTCState m) => MonadTrace (m :: Type -> Type) -- | Record a function call in the trace. traceCall :: MonadTrace m => Call -> m a -> m a traceCallM :: MonadTrace m => m Call -> m a -> m a -- | Like traceCall, but resets envCall and the current -- ranges to the previous values in the continuation. traceCallCPS :: MonadTrace m => Call -> ((a -> m b) -> m b) -> (a -> m b) -> m b traceClosureCall :: MonadTrace m => Closure Call -> m a -> m a -- | Lispify and print the given highlighting information. printHighlightingInfo :: MonadTrace m => RemoveTokenBasedHighlighting -> HighlightingInfo -> m () ($dmprintHighlightingInfo) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadTrace m, MonadTrans t, MonadTrace n, t n ~ m) => RemoveTokenBasedHighlighting -> HighlightingInfo -> m () traceCallCPS' :: MonadTrace m => Call -> (m b -> m b) -> m b -> m b getCurrentRange :: MonadTCEnv m => m Range -- | Sets the current range (for error messages etc.) to the range of the -- given object, if it has a range (i.e., its range is not -- noRange). setCurrentRange :: (MonadTrace m, HasRange x) => x -> m a -> m a -- | highlightAsTypeChecked rPre r m runs m and returns -- its result. Additionally, some code may be highlighted: -- -- highlightAsTypeChecked :: MonadTrace m => Range -> Range -> m a -> m a -- | Running the Parse monad, raising parser warnings. runPM :: PM a -> TCM a -- | Running the Parse monad, dropping parser warnings. runPMDropWarnings :: PM a -> TCM a instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Trace.MonadTrace m => Agda.TypeChecking.Monad.Trace.MonadTrace (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Trace.MonadTrace Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.Trace.MonadTrace m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Trace.MonadTrace (Agda.Utils.StrictWriter.WriterT w m) instance (Agda.TypeChecking.Monad.Trace.MonadTrace m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Trace.MonadTrace (Control.Monad.Trans.Writer.Lazy.WriterT w m) module Agda.TypeChecking.Monad.Mutual noMutualBlock :: TCM a -> TCM a -- | Pass the current mutual block id or create a new mutual block if we -- are not already inside on. inMutualBlock :: (MutualId -> TCM a) -> TCM a -- | Set the mutual block info for a block if non-existing. insertMutualBlockInfo :: MutualId -> MutualInfo -> TCM () -- | Set the mutual block for a definition. setMutualBlock :: MutualId -> QName -> TCM () -- | Get the current mutual block, if any, otherwise a fresh mutual block -- is returned. currentOrFreshMutualBlock :: TCM MutualId lookupMutualBlock :: ReadTCState tcm => MutualId -> tcm MutualBlock module Agda.TypeChecking.Monad.Closure enterClosure :: (MonadTCEnv m, ReadTCState m, LensClosure c a) => c -> (a -> m b) -> m b withClosure :: (MonadTCEnv m, ReadTCState m) => Closure a -> (a -> m b) -> m (Closure b) mapClosure :: (MonadTCEnv m, ReadTCState m) => (a -> m b) -> Closure a -> m (Closure b) module Agda.TypeChecking.Monad.Constraints solvingProblem :: MonadConstraint m => ProblemId -> m a -> m a solvingProblems :: MonadConstraint m => Set ProblemId -> m a -> m a isProblemSolved :: (MonadTCEnv m, ReadTCState m) => ProblemId -> m Bool isProblemCompletelySolved :: (MonadTCEnv m, ReadTCState m) => ProblemId -> m Bool isProblemSolved' :: (MonadTCEnv m, ReadTCState m) => Bool -> ProblemId -> m Bool isProblemSolved'' :: ProblemId -> TCM Bool getConstraintsForProblem :: ReadTCState m => ProblemId -> m Constraints -- | Get the awake constraints getAwakeConstraints :: ReadTCState m => m Constraints dropConstraints :: MonadConstraint m => (ProblemConstraint -> Bool) -> m () -- | Takes out all constraints matching given filter. Danger! The taken -- constraints need to be solved or put back at some point. takeConstraints :: MonadConstraint m => (ProblemConstraint -> Bool) -> m Constraints putConstraintsToSleep :: MonadConstraint m => (ProblemConstraint -> Bool) -> m () putAllConstraintsToSleep :: MonadConstraint m => m () data ConstraintStatus AwakeConstraint :: ConstraintStatus SleepingConstraint :: ConstraintStatus -- | Suspend constraints matching the predicate during the execution of the -- second argument. Caution: held sleeping constraints will not be woken -- up by events that would normally trigger a wakeup call. holdConstraints :: (ConstraintStatus -> ProblemConstraint -> Bool) -> TCM a -> TCM a takeAwakeConstraint :: MonadConstraint m => m (Maybe ProblemConstraint) takeAwakeConstraint' :: MonadConstraint m => (ProblemConstraint -> Bool) -> m (Maybe ProblemConstraint) getAllConstraints :: ReadTCState m => m Constraints withConstraint :: MonadConstraint m => (Constraint -> m a) -> ProblemConstraint -> m a buildProblemConstraint :: (MonadTCEnv m, ReadTCState m) => Set ProblemId -> Blocker -> Constraint -> m ProblemConstraint buildProblemConstraint_ :: (MonadTCEnv m, ReadTCState m) => Blocker -> Constraint -> m ProblemConstraint buildConstraint :: Blocker -> Constraint -> TCM ProblemConstraint -- | Monad service class containing methods for adding and solving -- constraints class (MonadTCEnv m, ReadTCState m, MonadError TCErr m, MonadBlock m, HasOptions m, MonadDebug m) => MonadConstraint (m :: Type -> Type) -- | Unconditionally add the constraint. addConstraint :: MonadConstraint m => Blocker -> Constraint -> m () -- | Add constraint as awake constraint. addAwakeConstraint :: MonadConstraint m => Blocker -> Constraint -> m () solveConstraint :: MonadConstraint m => Constraint -> m () -- | Solve awake constraints matching the predicate. If the second argument -- is True solve constraints even if already isSolvingConstraints. solveSomeAwakeConstraints :: MonadConstraint m => (ProblemConstraint -> Bool) -> Bool -> m () wakeConstraints :: MonadConstraint m => (ProblemConstraint -> WakeUp) -> m () stealConstraints :: MonadConstraint m => ProblemId -> m () -- | Modify both awake (first argument) and sleeping (second argument) -- constraints. modifyConstraints :: MonadConstraint m => (Constraints -> Constraints) -> (Constraints -> Constraints) -> m () modifyAwakeConstraints :: MonadConstraint m => (Constraints -> Constraints) -> m () modifySleepingConstraints :: MonadConstraint m => (Constraints -> Constraints) -> m () -- | Add new a constraint addConstraint' :: Blocker -> Constraint -> TCM () addAwakeConstraint' :: Blocker -> Constraint -> TCM () addConstraintTo :: Lens' TCState Constraints -> Blocker -> Constraint -> TCM () -- | A problem is considered solved if there are no unsolved blocking -- constraints belonging to it. There's no really good principle for what -- constraints are blocking and which are not, but the general idea is -- that nothing bad should happen if you assume a non-blocking constraint -- is solvable, but it turns out it isn't. For instance, assuming an -- equality constraint between two types that turns out to be false can -- lead to ill typed terms in places where we don't expect them. isBlockingConstraint :: Constraint -> Bool -- | Start solving constraints nowSolvingConstraints :: MonadTCEnv m => m a -> m a isSolvingConstraints :: MonadTCEnv m => m Bool -- | Add constraint if the action raises a pattern violation catchConstraint :: MonadConstraint m => Constraint -> m () -> m () isInstanceConstraint :: Constraint -> Bool canDropRecursiveInstance :: (ReadTCState m, HasOptions m) => m Bool shouldPostponeInstanceSearch :: (ReadTCState m, HasOptions m) => m Bool -- | Wake constraints matching the given predicate (and aren't instance -- constraints if shouldPostponeInstanceSearch). wakeConstraints' :: MonadConstraint m => (ProblemConstraint -> WakeUp) -> m () mapAwakeConstraints :: (Constraints -> Constraints) -> TCState -> TCState mapSleepingConstraints :: (Constraints -> Constraints) -> TCState -> TCState instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Constraints.ConstraintStatus instance Agda.TypeChecking.Monad.Constraints.MonadConstraint m => Agda.TypeChecking.Monad.Constraints.MonadConstraint (Agda.Utils.StrictReader.ReaderT e m) instance Agda.TypeChecking.Monad.Constraints.MonadConstraint m => Agda.TypeChecking.Monad.Constraints.MonadConstraint (Control.Monad.Trans.Reader.ReaderT e m) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.Constraints.ConstraintStatus -- | General functions for stateful manipulation of the scope. module Agda.Syntax.Scope.State -- | To simplify interaction between scope checking and type checking (in -- particular when chasing imports), we use the same monad. type ScopeM = TCM getCurrentModule :: ReadTCState m => m ModuleName setCurrentModule :: MonadTCState m => ModuleName -> m () withCurrentModule :: (ReadTCState m, MonadTCState m) => ModuleName -> m a -> m a withCurrentModule' :: (MonadTrans t, Monad (t ScopeM)) => ModuleName -> t ScopeM a -> t ScopeM a -- | Warn about unused imports. -- -- For each open statement, we want to issue a warning about -- concrete names and modules brought into scope by this statement which -- are not referenced subsequently. -- -- To this end, whenever we lookup a concrete name during scope checking, -- we mark it as used by calling lookedupName with the results of -- the lookup, which is an AbstractName or several -- AbstractNames in case the name is ambiguous (e.g. an ambiguous -- constructor or projection). Likewise, whenever we resolve a concrete -- module name, we mark the resulting AbstractModule as used by -- calling lookedupModule. If the concrete name is qualified, e.g. -- M.x, we also mark the module M as used that the -- qualifier resolved to. -- -- We also record for each opened module the set of AbstractNames -- and AbstractModules it brought into scope. -- -- When checking the file is done, we can traverse the each opened module -- and report all the AbstractNames and AbstractModules -- that we not used. module Agda.Syntax.Scope.UnusedImports -- | Call these whenever a concrete name was translated to an abstract one. lookedupName :: QName -> ResolvedName -> ScopeM () -- | Call this whenever a concrete module name was translated to an -- abstract one. lookedupModule :: QName -> AbstractModule -> ScopeM () -- | Call this when opening a module with all the names it brings into -- scope. When the UnusedImports warning is enabled, we will store -- this information to later issue a warning connected to this -- open statement for the names that were not used. registerModuleOpening :: KwRange -> ModuleName -> QName -> ImportDirective -> Scope -> ScopeM () -- | Call this when a file has been checked to generate the unused-imports -- warnings for each opened module. Assumes that all names have been -- looked up via lookedupName and all modules via -- lookedupModule. Needs the disambiguation information from the -- type checker to correctly report ununsed overloaded names. warnUnusedImports :: TCM () instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Scope.UnusedImports.Imported a) instance Agda.Syntax.Scope.UnusedImports.Lineage Agda.Syntax.Abstract.Name.AbstractModule instance Agda.Syntax.Scope.UnusedImports.Lineage Agda.Syntax.Abstract.Name.AbstractName instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Scope.UnusedImports.Imported a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.Syntax.Scope.UnusedImports.Imported a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Scope.UnusedImports.Imported a) -- | Lenses for CommandLineOptions and PragmaOptions. -- -- Add as needed. -- -- Nothing smart happening here. module Agda.Interaction.Options.Lenses modifyPragmaOptions :: MonadTCState m => (PragmaOptions -> PragmaOptions) -> m () class LensVerbosity a getVerbosity :: LensVerbosity a => a -> Verbosity setVerbosity :: LensVerbosity a => Verbosity -> a -> a mapVerbosity :: LensVerbosity a => (Verbosity -> Verbosity) -> a -> a modifyVerbosity :: MonadTCState m => (Verbosity -> Verbosity) -> m () putVerbosity :: MonadTCState m => Verbosity -> m () class LensCommandLineOptions a getCommandLineOptions :: LensCommandLineOptions a => a -> CommandLineOptions setCommandLineOptions :: LensCommandLineOptions a => CommandLineOptions -> a -> a mapCommandLineOptions :: LensCommandLineOptions a => (CommandLineOptions -> CommandLineOptions) -> a -> a modifyCommandLineOptions :: MonadTCState m => (CommandLineOptions -> CommandLineOptions) -> m () type SafeMode = Bool class LensSafeMode a getSafeMode :: LensSafeMode a => a -> SafeMode setSafeMode :: LensSafeMode a => SafeMode -> a -> a mapSafeMode :: LensSafeMode a => (SafeMode -> SafeMode) -> a -> a modifySafeMode :: MonadTCState m => (SafeMode -> SafeMode) -> m () putSafeMode :: MonadTCState m => SafeMode -> m () class LensIncludePaths a getAbsoluteIncludePaths :: LensIncludePaths a => a -> [AbsolutePath] setAbsoluteIncludePaths :: LensIncludePaths a => [AbsolutePath] -> a -> a mapAbsoluteIncludePaths :: LensIncludePaths a => ([AbsolutePath] -> [AbsolutePath]) -> a -> a modifyAbsoluteIncludePaths :: MonadTCState m => ([AbsolutePath] -> [AbsolutePath]) -> m () putAbsoluteIncludePaths :: MonadTCState m => [AbsolutePath] -> m () type PersistentVerbosity = Verbosity class LensPersistentVerbosity a getPersistentVerbosity :: LensPersistentVerbosity a => a -> PersistentVerbosity setPersistentVerbosity :: LensPersistentVerbosity a => PersistentVerbosity -> a -> a mapPersistentVerbosity :: LensPersistentVerbosity a => (PersistentVerbosity -> PersistentVerbosity) -> a -> a modifyPersistentVerbosity :: MonadTCState m => (PersistentVerbosity -> PersistentVerbosity) -> m () putPersistentVerbosity :: MonadTCState m => PersistentVerbosity -> m () instance Agda.Interaction.Options.Lenses.LensCommandLineOptions Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensCommandLineOptions Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensIncludePaths Agda.Interaction.Options.Types.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensIncludePaths Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensIncludePaths Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.Interaction.Options.Types.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.Interaction.Options.Types.PragmaOptions instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.Interaction.Options.Types.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.Interaction.Options.Types.PragmaOptions instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensVerbosity Agda.Interaction.Options.Types.PragmaOptions instance Agda.Interaction.Options.Lenses.LensVerbosity Agda.TypeChecking.Monad.Base.TCState module Agda.Interaction.Command type CommandM = CommandM' TCM -- | Restore both TCState and CommandState. localStateCommandM :: CommandM a -> CommandM a -- | Restore TCState, do not touch CommandState. liftLocalState :: TCM a -> CommandM a -- | Build an opposite action to lift for state monads. revLift :: MonadState st m => (forall c. () => m c -> st -> k (c, st)) -> (forall b. () => k b -> m b) -> (forall x. () => (m a -> k x) -> k x) -> m a revLiftTC :: MonadTCState m => (forall c. () => m c -> TCState -> k (c, TCState)) -> (forall b. () => k b -> m b) -> (forall x. () => (m a -> k x) -> k x) -> m a -- | Functions which map between module names and file names. -- -- Note that file name lookups are cached in the TCState. The code -- assumes that no Agda source files are added or removed from the -- include directories while the code is being type checked. module Agda.Interaction.FindFile -- | SourceFiles must exist and be registered in our file -- dictionary. newtype SourceFile SourceFile :: FileId -> SourceFile [srcFileId] :: SourceFile -> FileId -- | File must exist. data InterfaceFile -- | Converts an Agda file name to the corresponding interface file name. -- Note that we do not guarantee that the file exists. toIFile :: HasCallStack => SourceFile -> TCM AbsolutePath -- | Makes an interface file from an AbsolutePath candidate. If the file -- does not exist, then fail by returning Nothing. mkInterfaceFile :: AbsolutePath -> IO (Maybe InterfaceFile) -- | Errors which can arise when trying to find a source file. -- -- Invariant: All paths are absolute. data FindError -- | An Agda module was not found. We were looking for it in one of the -- given include directories. NotFound :: List1 AbsolutePath -> FindError -- | Several matching files were found. Ambiguous :: List2 AbsolutePath -> FindError -- | Given the module name which the error applies to this function -- converts a FindError to a TypeError. findErrorToTypeError :: TopLevelModuleName -> FindError -> TypeError -- | Finds the source file corresponding to a given top-level module name. -- The returned paths are absolute. -- -- Raises an error if the file cannot be found. findFile :: TopLevelModuleName -> TCM SourceFile -- | Tries to find the source file corresponding to a given top-level -- module name. The returned paths are absolute. -- -- SIDE EFFECT: Updates stModuleToSource. findFile' :: TopLevelModuleName -> TCM (Either FindError SourceFile) -- | A variant of findFile' which manipulates an extra -- ModuleToSourceId findFile'_ :: List1 AbsolutePath -> TopLevelModuleName -> StateT ModuleToSourceId TCM (Either FindError SourceFile) -- | A variant of findFile' which does not require TCM. findFile'' :: List1 AbsolutePath -> TopLevelModuleName -> StateT ModuleToSource IO (Either FindError SourceFile) -- | Finds the interface file corresponding to a given top-level module -- file. The returned paths are absolute. -- -- Raises Nothing if the interface file cannot be found. findInterfaceFile' :: HasCallStack => SourceFile -> TCM (Maybe InterfaceFile) -- | Finds the interface file corresponding to a given top-level module -- file. The returned paths are absolute. -- -- Raises an error if the source file cannot be found, and returns -- Nothing if the source file can be found but not the interface -- file. findInterfaceFile :: HasCallStack => TopLevelModuleName -> TCM (Maybe InterfaceFile) -- | Ensures that the module name matches the file name. The file -- corresponding to the module name (according to the include path) has -- to be the same as the given file name. checkModuleName :: TopLevelModuleName -> SourceFile -> Maybe TopLevelModuleName -> TCM () rootNameModule :: AbsolutePath -> String replaceModuleExtension :: String -> AbsolutePath -> AbsolutePath -- | Remove an existing Agda file extension from a file path. dropAgdaExtension :: FilePath -> FilePath -- | Check if a file path has an Agda extension. hasAgdaExtension :: FilePath -> Bool -- | Remove an Agda file extension from a filepath, if possible. stripAgdaExtension :: FilePath -> Maybe FilePath instance Agda.Syntax.Common.Pretty.Pretty Agda.Interaction.FindFile.InterfaceFile instance GHC.Internal.Show.Show Agda.Interaction.FindFile.FindError module Agda.TypeChecking.Serialise.Instances.Common -- | Ranges that should be serialised properly. newtype SerialisedRange SerialisedRange :: Range -> SerialisedRange [underlyingRange] :: SerialisedRange -> Range instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.AllowedErasedMatches instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.AllowedErasedMatchesIndexed instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.AllowedErasedMatchesWithDefaults instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Annotation instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Associativity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.BoundVariablePosition instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Builtin.BuiltinId instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Stack.Types.CallStack instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Catchall instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Cohesion instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ConOrigin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ConstructorOrPatternSynonym instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Cubical instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.DataOrRecord' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ExpandedEllipsis instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.FileType instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Fixity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Fixity' instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.FixityLevel instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.FreeVariables instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.HasEta' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Hiding instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.ImportedName' a b) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.Impossible.Impossible instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.Induction instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Position.Interval' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.IsAbstract instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.IsInstance instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.IsOpaque instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.KeywordRange.KwRange instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Language instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Literal.Literal instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Lock instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ModalPolarity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Modality instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.Name instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.NameId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.NameInScope instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.NamePart instance (Agda.TypeChecking.Serialise.Base.EmbPrj s, Agda.TypeChecking.Serialise.Base.EmbPrj t) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Named s t) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.NotationPart instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.OpaqueId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.OptionsPragma instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Origin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.OriginIrrelevant instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.OriginRelevant instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.OriginShapeIrrelevant instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.OverlapMode instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.PatternOrCopattern instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.PolarityModality instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Position.Position' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.PositivityCheck instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Builtin.PrimitiveId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ProblemId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ProjOrigin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Q0Origin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Q1Origin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.QName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Quantity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.QωOrigin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Position.Range instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Position.RangeFile instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Ranged a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.RecordDirective instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.RecordDirectives' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Relevance instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.RewriteAnn instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Serialise.Instances.Common.SerialisedRange instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Builtin.SomeBuiltin instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Internal.Stack.Types.SrcLoc instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.WithHiding a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.WithOrigin a) module Agda.TypeChecking.Serialise.Instances.Highlighting data KVS a Cons :: Int -> Int -> a -> KVS a -> KVS a Nil :: KVS a toAscList' :: RangeMap a -> KVS a icodRM :: EmbPrj a => KVS a -> S Node valueRM :: EmbPrj a => Node -> R [(Int, PairInt a)] instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.Aspect instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.Aspects instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.DefinitionSite instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.NameKind instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.OtherAspect instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.Range.Range instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.RangeMap.RangeMap a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Aspect.TokenBased module Agda.TypeChecking.Serialise.Instances.Abstract data AbsNameWithFixity AbsNameWithFixity :: Fixity -> QName -> KindOfName -> WhyInScope -> NameMetadata -> AbsNameWithFixity toAbsName :: AbsNameWithFixity -> AbstractName fromAbsName :: AbstractName -> AbsNameWithFixity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Serialise.Instances.Abstract.AbsNameWithFixity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.AbstractModule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.AbstractName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Access instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.BindName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.BindingSource instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Info.ConPatInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Info.ConPatLazy instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.DataOrRecordModule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.KindOfName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.LocalVar instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.NameMetadata instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.NameOrModule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.NameSpace instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.NameSpaceId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.ParenPreference instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Abstract.Pattern' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Pattern instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.PatternSynDefn instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.Precedence instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.Scope instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.ScopeInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.Suffix instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.WhyInScope module Agda.TypeChecking.Monad.Options -- | Sets the pragma options. Checks for unsafe combinations. setPragmaOptions :: PragmaOptions -> TCM () -- | Check that that you don't turn on inconsistent options. For instance, -- if --a implies --b and you have both --a and --no-b. Only warn for -- things that have changed compared to the old options. checkPragmaOptionConsistency :: PragmaOptions -> PragmaOptions -> TCM () -- | Sets the command line options (both persistent and pragma options are -- updated). -- -- Relative include directories are made absolute with respect to the -- current working directory. If the include directories have changed -- then the state is reset (partly, see setIncludeDirs). -- -- An empty list of relative include directories (Left -- []) is interpreted as ["."]. setCommandLineOptions :: CommandLineOptions -> TCM () setCommandLineOptions' :: AbsolutePath -> CommandLineOptions -> TCM () libToTCM :: LibM a -> TCM a -- | Returns the library files for a given file. -- -- Nothing is returned if optUseLibs is False. -- -- An error is raised if optUseLibs is True and a library -- file is located too far down the directory hierarchy (see -- checkLibraryFileNotTooFarDown). getAgdaLibFiles :: AbsolutePath -> TopLevelModuleName -> TCM [AgdaLibFile] -- | Returns potential library files for a file without a known top-level -- module name. -- -- Once the top-level module name is known one can use -- checkLibraryFileNotTooFarDown to check that the potential -- library files were not located too far down the directory hierarchy. -- -- Nothing is returned if optUseLibs is False. getAgdaLibFilesWithoutTopLevelModuleName :: AbsolutePath -> TCM [AgdaLibFile] -- | Checks that a library file for the module A.B.C (say) in the -- directory dirAB is located at least two directories -- above the file (not in dir/A or dirAB). checkLibraryFileNotTooFarDown :: TopLevelModuleName -> AgdaLibFile -> TCM () -- | Returns the library options for a given file. getLibraryOptions :: AbsolutePath -> TopLevelModuleName -> TCM [OptionsPragma] setLibraryPaths :: AbsolutePath -> CommandLineOptions -> TCM CommandLineOptions setLibraryIncludes :: CommandLineOptions -> TCM CommandLineOptions addDefaultLibraries :: AbsolutePath -> CommandLineOptions -> TCM CommandLineOptions addTrustedExecutables :: CommandLineOptions -> TCM CommandLineOptions -- | Set pragma options without checking for consistency. setOptionsFromPragma :: OptionsPragma -> TCM () -- | Set pragma options and check them for consistency. checkAndSetOptionsFromPragma :: OptionsPragma -> TCM () setOptionsFromPragma' :: Bool -> OptionsPragma -> TCM () -- | Disable display forms. enableDisplayForms :: MonadTCEnv m => m a -> m a -- | Disable display forms. disableDisplayForms :: MonadTCEnv m => m a -> m a -- | Check if display forms are enabled. displayFormsEnabled :: MonadTCEnv m => m Bool -- | Gets the include directories. -- -- Precondition: optAbsoluteIncludePaths must be nonempty (i.e. -- setCommandLineOptions must have run). getIncludeDirs :: TCM (List1 AbsolutePath) -- | Makes the given directories absolute and stores them as include -- directories. -- -- If the include directories change, then the state is reset -- (completely, except for the include directories and some other -- things). -- -- An empty list is interpreted as ["."]. setIncludeDirs :: [FilePath] -> AbsolutePath -> TCM () isIrrelevanceEnabled :: HasOptions m => m Bool isPropEnabled :: HasOptions m => m Bool isLevelUniverseEnabled :: HasOptions m => m Bool isTwoLevelEnabled :: HasOptions m => m Bool hasUniversePolymorphism :: HasOptions m => m Bool showImplicitArguments :: HasOptions m => m Bool showGeneralizedArguments :: HasOptions m => m Bool showIrrelevantArguments :: HasOptions m => m Bool showIdentitySubstitutions :: HasOptions m => m Bool -- | Switch on printing of implicit and irrelevant arguments. E.g. for -- reification in with-function generation. -- -- Restores all PragmaOptions after completion. Thus, do not -- attempt to make persistent PragmaOptions changes in a -- withShowAllArguments bracket. withShowAllArguments :: ReadTCState m => m a -> m a withShowAllArguments' :: ReadTCState m => Bool -> m a -> m a withoutPrintingGeneralization :: ReadTCState m => m a -> m a -- | Change PragmaOptions for a computation and restore afterwards. withPragmaOptions :: ReadTCState m => (PragmaOptions -> PragmaOptions) -> m a -> m a positivityCheckEnabled :: HasOptions m => m Bool typeInType :: HasOptions m => m Bool -- | Is eta-equality enabled according to the options -- (--(no-)eta-equality)? etaEnabled :: HasOptions m => m Bool maxInstanceSearchDepth :: HasOptions m => m Int maxInversionDepth :: HasOptions m => m Int -- | Returns the Language currently in effect. getLanguage :: HasOptions m => m Language -- | This module contains the definition of hereditary substitution and -- application operating on internal syntax which is in β-normal form (β -- including projection reductions). -- -- Further, it contains auxiliary functions which rely on substitution -- but not on reduction. module Agda.TypeChecking.Substitute pattern LargeSort :: Univ -> Integer -> SizeOfSort pattern SmallSort :: Univ -> SizeOfSort -- | Add given binding to the front of the telescope. absV :: Dom a -> ArgName -> TelV a -> TelV a abstractArgs :: Abstract a => Args -> a -> a applyNLPatSubst :: TermSubst a => Substitution' NLPat -> a -> a applyNLSubstToDom :: SubstWith NLPat a => Substitution' NLPat -> Dom a -> Dom a applyPatSubst :: TermSubst a => PatternSubstitution -> a -> a -- | Substitution on local rewrite rules is partial. applySubstLocalRewrite :: DeBruijn a => Substitution' a -> RewriteRule -> Maybe RewriteRule applySubstTerm :: (Coercible t Term, EndoSubst t, Apply t) => Substitution' t -> t -> t -- | Apply Elims while using the given function to report -- ill-typed redexes. Recursive calls for applyE and -- applySubst happen at type t to propagate the same -- strategy to subtrees. applyTermE :: (Coercible Term t, Apply t, EndoSubst t) => (Empty -> Term -> Elims -> Term) -> t -> Elims -> t argToDontCare :: Arg Term -> Term bindsToTel :: [Name] -> Dom Type -> ListTel -- | Turn a typed binding (x1 .. xn : A) into a telescope. bindsToTel' :: (Name -> a) -> [Name] -> Dom Type -> ListTel' a bindsToTel'1 :: (Name -> a) -> List1 Name -> Dom Type -> ListTel' a bindsToTel1 :: List1 Name -> Dom Type -> ListTel -- | If v is a record or constructed value, canProject f -- v returns its field f. canProject :: QName -> Term -> Maybe (Arg Term) -- | In compiled clauses, the variables in the clause body are relative to -- the pattern variables (including dot patterns) instead of the clause -- telescope. compiledClauseBody :: Clause -> Maybe Term -- | Eliminate a constructed term. conApp :: (Coercible t Term, Apply t) => (Empty -> Term -> Elims -> Term) -> ConHead -> ConInfo -> Elims -> Elims -> Term -- | defApp f us vs applies Def f us to further arguments -- vs, eliminating top projection redexes. If us is not -- empty, we cannot have a projection redex, since the record argument is -- the first one. defApp :: QName -> Elims -> Elims -> Term domFromNamedArgName :: NamedArg Name -> Dom () domNameFromNamedArgName :: NamedArg Name -> Dom Name fromPatternSubstitution :: PatternSubstitution -> Substitution funSort :: Bool -> Sort -> Sort -> Sort -- | Compute the sort of a function type from the sorts of its domain and -- codomain. -- -- The first argument is the value of isLevelUniverseEnabled funSort' :: Bool -> Sort -> Sort -> Either Blocker Sort funSortM :: HasOptions m => Sort -> Sort -> m Sort funSortM' :: HasOptions m => Sort -> Sort -> m (Either Blocker Sort) isSmallSort :: Sort -> Bool lamView :: Term -> ([Arg ArgName], Term) -- | Given two levels a and b, compute a ⊔ b and -- return its canonical form. levelLub :: Level -> Level -> Level -- | Computes n0 ⊔ a₁ ⊔ a₂ ⊔ ... ⊔ aₙ and return its canonical -- form. levelMax :: Integer -> [PlusLevel] -> Level levelTm :: Level -> Term lookupSVar :: EndoSubst a => Substitution' a -> Nat -> Maybe Nat mkLam :: Arg ArgName -> Term -> Term -- |
--   mkPi dom t = telePi (telFromList [dom]) t
--   
mkPi :: Dom (ArgName, Type) -> Type -> Type mkPiSort :: Dom Type -> Abs Type -> Sort -- | Turn a typed binding (x1 .. xn : A) into a telescope. namedBindsToTel :: [NamedArg Name] -> Type -> Telescope namedBindsToTel1 :: List1 (NamedArg Name) -> Type -> Telescope namedTelVars :: Int -> Telescope -> [NamedArg DeBruijnPattern] -- |
--   (x:A)->B(x) piApply [u] = B(u)
--   
-- -- Precondition: The type must contain the right number of pis without -- having to perform any reduction. -- -- piApply is potentially unsafe, the monadic piApplyM -- is preferable. piApply :: Type -> Args -> Type piSort :: Dom Term -> Sort -> Abs Sort -> Sort -- | Compute the sort of a pi type from three inputs: 1. The "raw" domain -- of the pi type (without the sort) 2. The sort of the domain 3. The -- sort of the codomain (which lives in an extended context) -- -- Note that unlike funSort', we don't care whether --level-universe is -- enabled here. Instead, we just return a FunSort constructor and assume -- it will be simplified in the next step. See also: * `instance Reduce -- Sort` in Agda.TypeChecking.Substitute (this file) * -- inferPiSort in Agda.TypeChecking.Sort piSort' :: Dom Term -> Sort -> Abs Sort -> Either Blocker Sort -- | Compute the sort of a pi type where the codomain sort is a proper Abs. -- Compared to piSort' we take two additional arguments: 4. The -- occurrence of the variable in the codomain. 5. Whether we have already -- tried to remove the dependency by normalising the codomain sort (e.g. -- with forceNoAbs) piSortAbs :: Dom Term -> Sort -> Abs Sort -> FlexRig -> IsCodomainNormalised -> Either Blocker Sort piSortM :: HasOptions m => Dom Term -> Sort -> Abs Sort -> m Sort -- |
--   projDropParsApply proj o args = projDropPars proj o `apply' args
--   
-- -- This function is an optimization, saving us from construction lambdas -- we immediately remove through application. projDropParsApply :: Projection -> ProjOrigin -> Relevance -> Args -> Term relToDontCare :: LensRelevance a => a -> Term -> Term -- | The permutation should permute the corresponding context. (as de -- Bruijn _indices_) renameP :: Subst a => Impossible -> Permutation -> a -> a -- | If permute π : [a]Γ -> [a]Δ, then applySubst (renaming -- _ π) : Term Γ -> Term Δ Assumes that π works on de Bruijn -- _indices_. renaming :: DeBruijn a => Impossible -> Permutation -> Substitution' a -- | If permute π : [a]Γ -> [a]Δ, then applySubst -- (renamingR π) : Term Δ -> Term Γ Assumes that π works on de -- Bruijn _levels_. renamingR :: DeBruijn a => Permutation -> Substitution' a -- | Returns Left blocker for unknown (blocked) sorts, and -- otherwise returns Right s where s indicates the size -- and fibrancy. sizeOfSort :: Sort -> Either Blocker SizeOfSort sort :: Sort -> Type ssort :: Level -> Type telVars :: Int -> Telescope -> [Arg DeBruijnPattern] -- | Takes off all exposed function domains from the given type. This means -- that it does not reduce to expose Pi-types. telView' :: Type -> TelView -- | telView'UpTo n t takes off the first n exposed -- function types of t. Takes off all (exposed ones) if n -- < 0. telView'UpTo :: Int -> Type -> TelView -- | Abstract over a telescope in a term, producing lambdas. Dumb -- abstraction: Always produces Abs, never NoAbs. -- -- The implementation is sound because Telescope does not use -- NoAbs. teleLam :: Telescope -> Term -> Term -- | Uses free variable analysis to introduce NoAbs bindings. telePi :: Telescope -> Type -> Type telePi' :: (Abs Type -> Abs Type) -> Telescope -> Type -> Type -- | Only abstract the visible components of the telescope, and all that -- bind variables. Everything will be an Abs! Caution: quadratic -- time! telePiVisible :: Telescope -> Type -> Type -- | Everything will be an Abs. telePi_ :: Telescope -> Type -> Type -- | Attempts to convert a substitution into a renaming. Returns Nothing if -- any of the variables in the set are mapped to non-variable terms. -- Variables not in the set are strengthened-away. Returns a polymorphic -- substitution. toRenOn :: DeBruijn a => VarSet -> Substitution' a -> Maybe AnySubstitution -- | Given arguments vs : tel (vector typing), extract their -- individual types. Returns Nothing is tel is not long -- enough. typeArgsWithTel :: Telescope -> [Term] -> Maybe [Dom Type] univSort :: Sort -> Sort -- | univSort' univInf s gets the next higher sort of s, -- if it is known (i.e. it is not just UnivSort s). -- -- Precondition: s is reduced univSort' :: Sort -> Either Blocker Sort unlamView :: [Arg ArgName] -> Term -> Term usePatOrigin :: PatOrigin -> Pattern' a -> Pattern' a usePatternInfo :: PatternInfo -> Pattern' a -> Pattern' a -- | Polymorphic substitution I.e. Substitutions which can be applied to -- any a where 'DeBruijn (SubstArg a)' Used to encode -- not-necessarily-surjective renamings (Permutation is always -- assumed to be surjective) data AnySubstitution AnySub :: (forall a. DeBruijn a => Substitution' a) -> AnySubstitution [getSub] :: AnySubstitution -> forall a. DeBruijn a => Substitution' a data IsCodomainNormalised CodomainNormalised :: IsCodomainNormalised CodomainNotNormalised :: IsCodomainNormalised -- | A sort can either be small (Set l, Prop l, Size, ...) or large (Setω -- n). data SizeOfSort SizeOfSort :: Univ -> Integer -> SizeOfSort [szSortUniv] :: SizeOfSort -> Univ [szSortSize] :: SizeOfSort -> Integer data TelV a TelV :: Tele (Dom a) -> a -> TelV a [theTel] :: TelV a -> Tele (Dom a) [theCore] :: TelV a -> a type TelView = TelV Type -- | Performs void (noAbs) abstraction over telescope. class TeleNoAbs a teleNoAbs :: TeleNoAbs a => a -> Term -> Term -- | Substitutions. data Substitution' a -- | Identity substitution. Γ ⊢ IdS : Γ IdS :: Substitution' a -- | Empty substitution, lifts from the empty context. First argument is -- IMPOSSIBLE. Apply this to closed terms you want to use -- in a non-empty context. Γ ⊢ EmptyS : () EmptyS :: Impossible -> Substitution' a -- | Substitution extension, `cons'. Γ ⊢ u : Aρ Γ ⊢ ρ : Δ -- ---------------------- Γ ⊢ u :# ρ : Δ, A (:#) :: a -> Substitution' a -> Substitution' a -- | Strengthening substitution. First argument is -- IMPOSSIBLE. In 'Strengthen err n ρ the number -- n must be non-negative. This substitution should only be -- applied to values t for which none of the variables -- 0 up to n - 1 are free in t[ρ], and in that -- case n is subtracted from all free de Bruijn indices in -- t[ρ]. Γ ⊢ ρ : Δ |Θ| = n --------------------------- Γ ⊢ -- Strengthen n ρ : Δ, Θ @ Strengthen :: Impossible -> Int -> Substitution' a -> Substitution' a -- | Weakening substitution, lifts to an extended context. Γ ⊢ ρ : Δ -- ------------------- Γ, Ψ ⊢ Wk |Ψ| ρ : Δ Wk :: Int -> Substitution' a -> Substitution' a -- | Lifting substitution. Use this to go under a binder. Lift 1 ρ == -- var 0 :# Wk 1 ρ. Γ ⊢ ρ : Δ ------------------------- Γ, Ψρ ⊢ -- Lift |Ψ| ρ : Δ, Ψ Lift :: Int -> Substitution' a -> Substitution' a infixr 4 :# type Substitution = Substitution' Term instance Agda.TypeChecking.Substitute.Class.Abstract a => Agda.TypeChecking.Substitute.Class.Abstract (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.Defn instance Agda.Utils.Permutation.DoDrop a => Agda.TypeChecking.Substitute.Class.Abstract (Agda.Utils.Permutation.Drop a) instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.TypeChecking.Substitute.Class.Abstract v => Agda.TypeChecking.Substitute.Class.Abstract (Data.HashMap.Internal.HashMap k v) instance Agda.TypeChecking.Substitute.Class.Abstract [Agda.TypeChecking.Positivity.Occurrence.Occurrence] instance Agda.TypeChecking.Substitute.Class.Abstract [Agda.TypeChecking.Monad.Base.Types.Polarity] instance Agda.TypeChecking.Substitute.Class.Abstract t => Agda.TypeChecking.Substitute.Class.Abstract [t] instance Agda.TypeChecking.Substitute.Class.Abstract v => Agda.TypeChecking.Substitute.Class.Abstract (Data.Map.Internal.Map k v) instance Agda.TypeChecking.Substitute.Class.Abstract t => Agda.TypeChecking.Substitute.Class.Abstract (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.PrimFun instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.ProjLams instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.Projection instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Syntax.Internal.Term instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Syntax.Internal.Type instance Agda.TypeChecking.Substitute.Class.Abstract a => Agda.TypeChecking.Substitute.Class.Abstract (Agda.TypeChecking.CompiledClause.WithArity a) instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply (Agda.Syntax.Internal.Blocked t) instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.BraveTerm instance Agda.TypeChecking.Substitute.Class.Apply a => Agda.TypeChecking.Substitute.Class.Apply (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.Utils.Permutation.DoDrop a => Agda.TypeChecking.Substitute.Class.Apply (Agda.Utils.Permutation.Drop a) instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.TypeChecking.Substitute.Class.Apply v => Agda.TypeChecking.Substitute.Class.Apply (Data.HashMap.Internal.HashMap k v) instance Agda.TypeChecking.Substitute.Class.Apply [Agda.TypeChecking.Positivity.Occurrence.Occurrence] instance Agda.TypeChecking.Substitute.Class.Apply [Agda.TypeChecking.Monad.Base.Types.Polarity] instance Agda.TypeChecking.Substitute.Class.Apply [Agda.Syntax.Common.NamedArg (Agda.Syntax.Internal.Pattern' a)] instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply [t] instance Agda.TypeChecking.Substitute.Class.Apply v => Agda.TypeChecking.Substitute.Class.Apply (Data.Map.Internal.Map k v) instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply (Data.Strict.Maybe.Maybe t) instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.TypeChecking.Substitute.Class.Apply Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.PrimFun instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.ProjLams instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.Projection instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Substitute.Class.TermSubst a => Agda.TypeChecking.Substitute.Class.Apply (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Substitute.Class.Apply a, Agda.TypeChecking.Substitute.Class.Apply b) => Agda.TypeChecking.Substitute.Class.Apply (a, b) instance (Agda.TypeChecking.Substitute.Class.Apply a, Agda.TypeChecking.Substitute.Class.Apply b, Agda.TypeChecking.Substitute.Class.Apply c) => Agda.TypeChecking.Substitute.Class.Apply (a, b, c) instance Agda.TypeChecking.Substitute.Class.Apply a => Agda.TypeChecking.Substitute.Class.Apply (Agda.TypeChecking.CompiledClause.WithArity a) instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.BraveTerm instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn a => Agda.TypeChecking.Substitute.DeBruijn.DeBruijn (Agda.Syntax.Internal.Pattern' a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Internal.Classes.Eq a) => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Abs a) instance GHC.Internal.Classes.Eq t => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Blocked t) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Candidate instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.CandidateKind instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.DefSing instance GHC.Internal.Classes.Eq (Agda.Syntax.Internal.DomInfo Agda.Syntax.Internal.Term) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Elim.Elim' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Level instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.LocalEquation instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.NLPSort instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.NLPType instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.NLPat instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.NotBlocked instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Pattern' a) instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.PlusLevel instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.RewDom instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.RewriteRule instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.Base.Section instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Sort instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Substitution instance (Agda.TypeChecking.Substitute.Class.TermSubst a, GHC.Internal.Classes.Eq a) => GHC.Internal.Classes.Eq (Agda.TypeChecking.Substitute.TelV a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Internal.Classes.Eq a) => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Tele a) instance GHC.Internal.Classes.Eq Agda.Syntax.Internal.Term instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Internal.Type' a) instance GHC.Internal.Base.Functor Agda.TypeChecking.Substitute.TelV instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Internal.Classes.Ord a) => GHC.Internal.Classes.Ord (Agda.Syntax.Internal.Abs a) instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.Candidate instance GHC.Internal.Classes.Ord Agda.TypeChecking.Monad.Base.CandidateKind instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.DefSing instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Internal.Dom a) instance GHC.Internal.Classes.Ord (Agda.Syntax.Internal.DomInfo Agda.Syntax.Internal.Term) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Internal.Elim.Elim' a) instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Level instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.LocalEquation instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.NLPSort instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.NLPType instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.NLPat instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.PlusLevel instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.RewDom instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.RewriteHead instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.RewriteRule instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Sort instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Substitution instance (Agda.TypeChecking.Substitute.Class.TermSubst a, GHC.Internal.Classes.Ord a) => GHC.Internal.Classes.Ord (Agda.TypeChecking.Substitute.TelV a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Internal.Classes.Ord a) => GHC.Internal.Classes.Ord (Agda.Syntax.Internal.Tele a) instance GHC.Internal.Classes.Ord Agda.Syntax.Internal.Term instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Syntax.Internal.Type' a) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Substitute.TelV a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Blocked a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.BraveTerm instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.DisplayTerm instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b) => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Dom' a b) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.EqualityTypeData instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.LetBinding instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Level' a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst [a] instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.LocalEquation' a) instance (GHC.Internal.Classes.Ord k, Agda.TypeChecking.Substitute.Class.Subst a) => Agda.TypeChecking.Substitute.Class.Subst (Data.Map.Internal.Map k a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Common.Named name a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Utils.List1.List1 a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Pattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.DeBruijnPattern instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.PlusLevel' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Abstract.ProblemEq instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Position.Range instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Common.Ranged a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.RewDom' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.RewriteHead instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Sort' a) instance Agda.TypeChecking.Substitute.Class.EndoSubst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Substitution' a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b) => Agda.TypeChecking.Substitute.Class.Subst (a, b) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.Subst c, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b, Agda.TypeChecking.Substitute.Class.SubstArg b GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg c) => Agda.TypeChecking.Substitute.Class.Subst (a, b, c) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.Subst c, Agda.TypeChecking.Substitute.Class.Subst d, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b, Agda.TypeChecking.Substitute.Class.SubstArg b GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg c, Agda.TypeChecking.Substitute.Class.SubstArg c GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg d) => Agda.TypeChecking.Substitute.Class.Subst (a, b, c, d) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.Internal.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b) => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Type'' a b) instance Agda.TypeChecking.Substitute.Class.Subst () instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Common.WithHiding a) instance Agda.TypeChecking.Substitute.TeleNoAbs Agda.Syntax.Internal.ListTel instance Agda.TypeChecking.Substitute.TeleNoAbs Agda.Syntax.Internal.Telescope module Agda.TypeChecking.Monad.Open -- | Create an open term in the current context. makeOpen :: (ReadTCState m, MonadTCEnv m) => a -> m (Open a) -- | Extract the value from an open term. The checkpoint at which it was -- created must be in scope. getOpen :: (TermSubst a, MonadTCEnv m) => Open a -> m a -- | Extract the value from an open term. If the checkpoint is no longer in -- scope use the provided function to pull the object to the most recent -- common checkpoint. The function is given the substitution from the -- common ancestor to the checkpoint of the thing. tryGetOpen :: (TermSubst a, ReadTCState m, MonadTCEnv m) => (Substitution -> a -> Maybe a) -> Open a -> m (Maybe a) -- | Try to extract the value from an open local rewrite rule. The -- checkpoint at which it was created must be in scope. tryGetOpenRew :: MonadTCEnv m => (Substitution -> m RewriteRule) -> Open RewriteRule -> m RewriteRule -- | An Open is closed if it has checkpoint 0. isClosed :: Open a -> Bool module Agda.TypeChecking.Monad.Context -- | Modify a Context in a computation. Warning: does not update the -- checkpoints. Use updateContext instead. unsafeModifyContext :: MonadTCEnv tcm => (Context -> Context) -> tcm a -> tcm a -- | Modify the Dom part of context entries. modifyContextInfo :: MonadTCEnv tcm => (forall e. () => Dom e -> Dom e) -> tcm a -> tcm a -- | Change to top (=empty) context. Resets the checkpoints. inTopContext :: (MonadTCEnv tcm, ReadTCState tcm) => tcm a -> tcm a -- | Change to top (=empty) context, but don't update the checkpoints. -- Totally not safe! unsafeInTopContext :: (MonadTCEnv m, ReadTCState m) => m a -> m a -- | Delete the last n bindings from the context. -- -- Doesn't update checkpoints! Use escapeContext or `updateContext -- rho (drop n)` instead, for an appropriate substitution rho. unsafeEscapeContext :: MonadTCM tcm => Int -> tcm a -> tcm a -- | Delete the last n bindings from the context. Any occurrences -- of these variables are replaced with the given err. escapeContext :: MonadAddContext m => Impossible -> Int -> m a -> m a -- | Add a new checkpoint. Do not use directly! Also updates head symbols -- of local rewrite rules with variable heads checkpoint :: Substitution -> TCM a -> TCM a -- | Update heads of local rewrite rules for the new context updateLocalRewriteHeads :: Substitution -> LocalRewriteRuleMap -> LocalRewriteRuleMap -- | Add a module checkpoint for the provided ModuleName. setModuleCheckpoint :: MonadTCState m => ModuleName -> CheckpointId -> m () -- | Set every module checkpoint in the checkpoint stack to the provided -- CheckpointId. setAllModuleCheckpoints :: MonadTCState m => CheckpointId -> m () -- | Unwind the current module checkpoint stack until we reach a target -- CheckpointId, and place the checkpoints onto the provided -- ModuleCheckpoints stack. unwindModuleCheckpointsOnto :: MonadTCState m => CheckpointId -> ModuleCheckpoints -> m () -- | Run a computation with no module checkpoints set. withoutModuleCheckpoints :: ReadTCState m => m a -> m a -- | Get the substitution from the context at a given checkpoint to the -- current context. checkpointSubstitution :: MonadTCEnv tcm => CheckpointId -> tcm Substitution -- | Get the substitution from the context at a given checkpoint to the -- current context. checkpointSubstitution' :: MonadTCEnv tcm => CheckpointId -> tcm (Maybe Substitution) -- | Get the CheckpointId of a module name. getModuleCheckpoint :: ModuleName -> ModuleCheckpoints -> Maybe CheckpointId -- | Get substitution Γ ⊢ ρ : Γm where Γ is the current -- context and Γm is the module parameter telescope of module -- m. -- -- Returns Nothing in case the we don't have a checkpoint for -- m. getModuleParameterSub :: (MonadTCEnv m, ReadTCState m) => ModuleName -> m (Maybe Substitution) class MonadTCEnv m => MonadAddContext (m :: Type -> Type) -- | addCtx x arg cont add a variable to the context. -- -- Chooses an unused Name. -- -- Warning: Does not update module parameter substitution! addCtx :: MonadAddContext m => Name -> Dom Type -> m a -> m a ($dmaddCtx) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type) a. (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => Name -> Dom Type -> m a -> m a -- | Add a let bound variable to the context addLetBinding' :: MonadAddContext m => IsAxiom -> Origin -> Name -> Term -> Dom Type -> m a -> m a ($dmaddLetBinding') :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type) a. (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => IsAxiom -> Origin -> Name -> Term -> Dom Type -> m a -> m a -- | Adds a local rewrite rule to the context addLocalRewrite :: MonadAddContext m => RewriteRule -> m a -> m a ($dmaddLocalRewrite) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type) a. (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => RewriteRule -> m a -> m a -- | Update the context. Requires a substitution that transports things -- living in the old context to the new. updateContext :: MonadAddContext m => Substitution -> (Context -> Context) -> m a -> m a ($dmupdateContext) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type) a. (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => Substitution -> (Context -> Context) -> m a -> m a withFreshName :: MonadAddContext m => Range -> ArgName -> (Name -> m a) -> m a ($dmwithFreshName) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type) a. (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => Range -> ArgName -> (Name -> m a) -> m a -- | Default implementation of addCtx in terms of updateContext defaultAddCtx :: MonadAddContext m => Name -> Dom Type -> m a -> m a addRewDom :: MonadAddContext m => RewDom -> m a -> m a withFreshName_ :: MonadAddContext m => ArgName -> (Name -> m a) -> m a -- | Adds a rewrite rule to the local typechecking environment defaultAddLocalRewrite :: (MonadTCEnv m, ReadTCState m) => RewriteRule -> m a -> m a addRecordNameContext :: (MonadAddContext m, MonadFresh NameId m) => Dom Type -> m b -> m b -- | Various specializations of addCtx. class AddContext b addContext :: (AddContext b, MonadAddContext m) => b -> m a -> m a contextSize :: AddContext b => b -> Nat -- | Wrapper to tell addContext not to mark names as -- NotInScope. Used when adding a user-provided, but already type -- checked, telescope to the context. newtype KeepNames a KeepNames :: a -> KeepNames a extendReduceEnv :: String -> Dom Type -> ReduceEnv -> ReduceEnv -- | Go under an abstraction in ReduceM. This performs the minimal -- adjustment to make reduce work, which is to extend the local -- Context with a name and a type. underAbsReduceM :: Dom Type -> Abs a -> (a -> ReduceM b) -> ReduceM b -- | Go under an abstraction in ReduceM while adding a dummy type to -- the context. underAbsReduceM_ :: Abs a -> (a -> ReduceM b) -> ReduceM b -- | Go under an abstraction. Do not extend context in case of -- NoAbs. underAbstraction :: (Subst a, MonadAddContext m) => Dom Type -> Abs a -> (a -> m b) -> m b underAbstraction' :: (Subst a, MonadAddContext m, AddContext (name, Dom Type)) => (String -> name) -> Dom Type -> Abs a -> (a -> m b) -> m b -- | Go under an abstraction, treating NoAbs as Abs. underAbstractionAbs :: (Subst a, MonadAddContext m) => Dom Type -> Abs a -> (a -> m b) -> m b underAbstractionAbs' :: (Subst a, MonadAddContext m, AddContext (name, Dom Type)) => (String -> name) -> Dom Type -> Abs a -> (a -> m b) -> m b -- | Go under an abstract without worrying about the type to add to the -- context. underAbstraction_ :: (Subst a, MonadAddContext m) => Abs a -> (a -> m b) -> m b -- | Map a monadic function on the thing under the abstraction, adding the -- abstracted variable to the context. mapAbstraction :: (Subst a, MonadAddContext m) => Dom Type -> (a -> m b) -> Abs a -> m (Abs b) mapAbstraction_ :: (Subst a, MonadAddContext m) => (a -> m b) -> Abs a -> m (Abs b) getLetBindings :: MonadTCEnv tcm => tcm [(Name, LetBinding)] -- | Add a let bound variable. defaultAddLetBinding' :: (ReadTCState m, MonadTCEnv m) => IsAxiom -> Origin -> Name -> Term -> Dom Type -> m a -> m a unsafeRule :: forall (m :: Type -> Type). MonadWarning m => RewriteSource -> IllegalRewriteRuleReason -> MaybeT m () illegalRule :: forall (m :: Type -> Type) a. MonadWarning m => RewriteSource -> IllegalRewriteRuleReason -> MaybeT m a -- | Add a let bound variable. addLetBinding :: MonadWarning m => ArgInfo -> Origin -> Name -> Term -> Type -> m a -> m a -- | Add a let bound variable without a definition. addLetAxiom :: MonadWarning m => ArgInfo -> Origin -> Name -> Term -> Type -> m a -> m a -- | Remove a let bound variable. removeLetBinding :: MonadTCEnv m => Name -> m a -> m a -- | Remove a let bound variable and all let bindings introduced after it. -- For instance before printing its body to avoid folding the binding -- itself, or using bindings defined later. Relies on the invariant that -- names introduced later are sorted after earlier names. removeLetBindingsFrom :: MonadTCEnv m => Name -> m a -> m a -- | Get the current context. getContext :: MonadTCEnv m => m Context -- | Get the size of the current context. getContextSize :: MonadTCEnv m => m Nat getContextVars :: MonadTCEnv m => m [(Int, Dom Name)] getContextVars' :: MonadTCEnv m => m [(Int, Dom Name)] contextVars :: Context -> [(Int, Dom Name)] contextVars' :: Context -> [(Int, Dom Name)] -- | Generate [var (n - 1), ..., var 0] for all bound variables in -- the context. getContextArgs :: MonadTCEnv m => m Args contextArgs :: Context -> Args -- | Generate [var (n - 1), ..., var 0] for all declarations in -- the context. getContextTerms :: MonadTCEnv m => m [Term] contextTerms :: Context -> [Term] -- | Get the current context as a Telescope. getContextTelescope :: MonadTCEnv m => m Telescope contextToTel :: Context -> Telescope -- | Get the names of all declarations in the context. getContextNames :: MonadTCEnv m => m [Name] getContextNames' :: MonadTCEnv m => m [Name] contextNames :: Context -> [Name] contextNames' :: Context -> [Name] -- | get type of bound variable (i.e. deBruijn index) lookupBV_ :: Nat -> Context -> Maybe ContextEntry lookupBV' :: MonadTCEnv m => Nat -> m (Maybe ContextEntry) lookupBV :: (MonadDebug m, MonadTCEnv m) => Nat -> m ContextEntry ctxEntryName :: ContextEntry -> Name ctxEntryDom :: ContextEntry -> Dom Type ctxEntryType :: ContextEntry -> Type domOfBV :: (MonadDebug m, MonadTCEnv m) => Nat -> m (Dom Type) typeOfBV :: (MonadDebug m, MonadTCEnv m) => Nat -> m Type nameOfBV' :: MonadTCEnv m => Nat -> m (Maybe Name) nameOfBV :: (MonadDebug m, MonadTCEnv m) => Nat -> m Name -- | Get the term corresponding to a named variable. If it is a lambda -- bound variable the deBruijn index is returned and if it is a let bound -- variable its definition is returned. getVarInfo :: (MonadDebug m, MonadFail m, MonadTCEnv m) => Name -> m (Term, Dom Type) instance Agda.TypeChecking.Monad.Context.AddContext Agda.TypeChecking.Monad.Base.Types.Context instance Agda.TypeChecking.Monad.Context.AddContext Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Internal.Dom (Agda.Syntax.Abstract.Name.Name, Agda.Syntax.Internal.Type)) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Internal.Dom (GHC.Internal.Base.String, Agda.Syntax.Internal.Type)) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.TypeChecking.Monad.Context.KeepNames Agda.Syntax.Internal.Telescope) instance Agda.TypeChecking.Monad.Context.AddContext a => Agda.TypeChecking.Monad.Context.AddContext [a] instance Agda.TypeChecking.Monad.Context.AddContext GHC.Internal.Base.String instance Agda.TypeChecking.Monad.Context.AddContext Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Monad.Context.AddContext Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Common.WithHiding Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Utils.List1.List1 (Agda.Syntax.Common.WithHiding Agda.Syntax.Abstract.Name.Name), Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Common.Arg Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Utils.List1.List1 (Agda.Syntax.Common.Arg Agda.Syntax.Abstract.Name.Name), Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Utils.List1.List1 (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Name.Name), Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Internal.Dom Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Utils.List1.List1 (Agda.Syntax.Internal.Dom Agda.Syntax.Abstract.Name.Name), Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Abstract.Name.Name, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Utils.List1.List1 Agda.Syntax.Abstract.Name.Name, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (GHC.Internal.Base.String, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Data.Text.Internal.Text, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.TypeChecking.Monad.Context.KeepNames GHC.Internal.Base.String, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Utils.StrictState.StateT r m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.State.Lazy.StateT r m) instance Agda.TypeChecking.Monad.Context.MonadAddContext Agda.TypeChecking.Monad.Base.TCM instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Context.MonadAddContext m) => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Context.MonadAddContext m) => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.Writer.Lazy.WriterT w m) -- | Modality. -- -- Agda has support for several modalities, namely: -- -- -- -- In order to type check such modalities, we must store the current -- modality in the typing context. This module provides functions to -- update the context based on a given modality. -- -- See Agda.TypeChecking.Irrelevance. module Agda.TypeChecking.Monad.Modality -- | Prepare parts of a parameter telescope for abstraction in constructors -- and projections. hideAndRelParams :: (LensHiding a, LensRelevance a) => a -> a -- | Modify the context whenever going from the l.h.s. (term side) of the -- typing judgement to the r.h.s. (type side). workOnTypes :: (MonadTCEnv m, HasOptions m, MonadDebug m) => m a -> m a -- | Internal workhorse, expects value of --experimental-irrelevance flag -- as argument. workOnTypes' :: MonadTCEnv m => Bool -> m a -> m a applyPolarityToContext :: (MonadTCEnv tcm, LensModalPolarity p) => p -> tcm a -> tcm a -- | (Conditionally) wake up irrelevant variables and make them relevant. -- For instance, in an irrelevant function argument otherwise irrelevant -- variables may be used, so they are awoken before type checking the -- argument. -- -- Also allow the use of irrelevant definitions. applyRelevanceToContext :: (MonadTCEnv tcm, LensRelevance r) => r -> tcm a -> tcm a -- | (Conditionally) wake up irrelevant variables and make them relevant. -- For instance, in an irrelevant function argument otherwise irrelevant -- variables may be used, so they are awoken before type checking the -- argument. -- -- Precondition: Relevance /= Relevant applyRelevanceToContextOnly :: MonadTCEnv tcm => Relevance -> tcm a -> tcm a -- | Apply relevance rel the the relevance annotation of the -- (typing/equality) judgement. This is part of the work done when going -- into a rel-context. -- -- Precondition: Relevance /= Relevant applyRelevanceToJudgementOnly :: MonadTCEnv tcm => Relevance -> tcm a -> tcm a -- | Like applyRelevanceToContext, but only act on context if -- --irrelevant-projections. See issue #2170. applyRelevanceToContextFunBody :: (MonadTCM tcm, ExpandCase (tcm a), LensRelevance r) => r -> tcm a -> tcm a -- | Apply the quantity to the quantity annotation of the (typing/equality) -- judgement. -- -- Precondition: The quantity must not be Quantity1 -- something. applyQuantityToJudgement :: (MonadTCEnv tcm, LensQuantity q) => q -> tcm a -> tcm a -- | Apply inverse composition with the given cohesion to the typing -- context. applyCohesionToContext :: (MonadTCEnv tcm, LensCohesion m) => m -> tcm a -> tcm a applyCohesionToContextOnly :: MonadTCEnv tcm => Cohesion -> tcm a -> tcm a -- | Can we split on arguments of the given cohesion? splittableCohesion :: (HasOptions m, LensCohesion a) => a -> m Bool applyDomToContext' :: RewDom' Term -> TCM () -- | Apply modalities and equational constraints (local rewrite rules) to -- the context. applyDomToContext :: Dom e -> TCM a -> TCM a -- | Adds an equational constraint due to a local rewrite rule. addRewConstraint :: MonadConstraint tcm => LocalEquation -> tcm () -- | (Conditionally) wake up irrelevant variables and make them relevant. -- For instance, in an irrelevant function argument otherwise irrelevant -- variables may be used, so they are awoken before type checking the -- argument. -- -- Also allow the use of irrelevant definitions. -- -- This function might also do something for other modalities. applyModalityToContext :: (MonadTCEnv tcm, ExpandCase (tcm a), LensModality m) => m -> tcm a -> tcm a applyModalityToContext' :: Modality -> TCEnv -> TCEnv -- | (Conditionally) wake up irrelevant variables and make them relevant. -- For instance, in an irrelevant function argument otherwise irrelevant -- variables may be used, so they are awoken before type checking the -- argument. -- -- This function might also do something for other modalities, but not -- for quantities. -- -- Precondition: Modality /= Relevant applyModalityToContextOnly :: MonadTCEnv tcm => Modality -> tcm a -> tcm a applyModalityToContextOnly' :: Modality -> TCEnv -> TCEnv -- | Apply the relevance and quantity components of the modality to the -- modality annotation of the (typing/equality) judgement. -- -- Precondition: The relevance component must not be Relevant. applyModalityToJudgementOnly :: MonadTCEnv tcm => Modality -> tcm a -> tcm a applyModalityToJudgementOnly' :: Modality -> TCEnv -> TCEnv -- | Like applyModalityToContext, but only act on context (for -- Relevance) if --irrelevant-projections. See issue #2170. applyModalityToContextFunBody :: (MonadTCM tcm, LensModality r, ExpandCase (tcm a)) => r -> tcm a -> tcm a -- | Wake up irrelevant variables and make them relevant. This is used when -- type checking terms in a hole, in which case you want to be able to -- (for instance) infer the type of an irrelevant variable. In the course -- of type checking an irrelevant function argument -- applyRelevanceToContext is used instead, which also sets the -- context relevance to Irrelevant. This is not the right thing to -- do when type checking interactively in a hole since it also marks all -- metas created during type checking as irrelevant (issue #2568). -- -- Also set the current quantity to 0. wakeIrrelevantVars :: MonadTCEnv tcm => tcm a -> tcm a module Agda.TypeChecking.Monad.Builtin bindBuiltinName :: BuiltinId -> Term -> TCM () -- | Add one (more) relation symbol to the rewrite relations. bindBuiltinRewriteRelation :: QName -> TCM () bindPrimitive :: PrimitiveId -> PrimFun -> TCM () boldPathView :: Type -> PathView coinductionKit :: TCM (Maybe CoinductionKit) -- | Tries to build a CoinductionKit. coinductionKit' :: TCM CoinductionKit -- | Primitives with typechecking constrants. constrainedPrims :: [PrimitiveId] -- | Rewrite a literal to constructor form if possible. constructorForm :: HasBuiltins m => Term -> m Term constructorForm' :: Applicative m => m Term -> m Term -> Term -> m Term -- | Produce a function that rewrites a literal to constructor form if -- possible. constructorFormer :: HasBuiltins m => m (Term -> Term) -- | Check whether the type is actually an equality (lhs ≡ rhs) and extract -- lhs, rhs, and their type. -- -- Precondition: type is reduced. equalityView :: Range -> Type -> TCM EqualityView getBuiltin :: (HasBuiltins m, MonadTCError m) => BuiltinId -> m Term -- | Returns Nothing if built-in is not bound or bound to a -- Prim. getBuiltin' :: HasBuiltins m => BuiltinId -> m (Maybe Term) getBuiltinName' :: HasBuiltins m => BuiltinId -> m (Maybe QName) getBuiltinName_ :: (HasBuiltins m, MonadTCError m) => BuiltinId -> m QName -- | Get the currently registered rewrite relation symbols. getBuiltinRewriteRelations :: (HasBuiltins m, MonadTCError m) => m (Set QName) -- | Get the currently registered rewrite relation symbols, if any. getBuiltinRewriteRelations' :: HasBuiltins m => m (Maybe (Set QName)) getName' :: (HasBuiltins m, IsBuiltin a) => a -> m (Maybe QName) getNameOfConstrained :: HasBuiltins m => PrimitiveId -> m (Maybe QName) getPrimName :: Term -> QName getPrimitive :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => PrimitiveId -> m PrimFun -- | Returns Nothing if primitive is not bound or bound to a -- Builtin. getPrimitive' :: HasBuiltins m => PrimitiveId -> m (Maybe PrimFun) getPrimitiveName' :: HasBuiltins m => PrimitiveId -> m (Maybe QName) getPrimitiveTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => PrimitiveId -> m Term getPrimitiveTerm' :: HasBuiltins m => PrimitiveId -> m (Maybe Term) -- | getTerm use name looks up name as a primitive or -- builtin, and throws an error otherwise. The use argument -- describes how the name is used for the sake of the error message. getTerm :: (HasBuiltins m, IsBuiltin a) => String -> a -> m Term getTerm' :: (HasBuiltins m, IsBuiltin a) => a -> m (Maybe Term) -- | Compute a SortKit in contexts that do not support failure (e.g. -- Reify). This should only be used when we are sure that the -- primitive sorts have been bound, i.e. because it is "after" type -- checking. infallibleSortKit :: HasBuiltins m => m SortKit intervalSort :: Sort intervalUnview :: HasBuiltins m => IntervalView -> m Term intervalUnview' :: HasBuiltins m => m (IntervalView -> Term) intervalView :: HasBuiltins m => Term -> m IntervalView intervalView' :: HasBuiltins m => m (Term -> IntervalView) isPrimitive :: HasBuiltins m => PrimitiveId -> QName -> m Bool litType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => Literal -> m Type mkSortKit :: QName -> QName -> QName -> QName -> QName -> QName -> SortKit -- | Revert the PathView. -- -- Postcondition: type is reduced. pathUnview :: PathView -> Type -- | Check whether the type is actually an path (lhs ≡ rhs) and extract -- lhs, rhs, and their type. -- -- Precondition: type is reduced. pathView :: HasBuiltins m => Type -> m PathView pathView' :: HasBuiltins m => m (Type -> PathView) primAbs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAbsAbs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaBlocker :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaBlockerAll :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaBlockerAny :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaBlockerMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaClause :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaClauseAbsurd :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaClauseClause :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinition :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionDataConstructor :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionDataDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionFunDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionPostulate :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionPrimitive :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionRecordDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPart :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPartName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPartPatt :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPartString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPartTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitChar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitFloat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitNat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitQName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitWord64 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLiteral :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatAbsurd :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatCon :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatDot :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatLit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatProj :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatVar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPattern :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSort :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortInf :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortLit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortProp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortPropLit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortSet :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortUnsupported :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCM :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMAskExpandLast :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMAskNormalisation :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMAskReconstructed :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMAskReduceDefs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMBind :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMBlock :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCatchError :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCheckFromString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCheckType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCommit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDebugPrint :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDeclareData :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDeclareDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDeclarePostulate :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDefineData :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDefineFun :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMExec :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMExtendContext :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMFormatErrorParts :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMFreshName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetContext :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetDefinition :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetInstances :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMInContext :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMInferType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMIsMacro :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMNoConstraints :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMNormalise :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMPragmaCompile :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMPragmaForeign :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMQuoteOmegaTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMQuoteTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMReduce :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMReturn :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMRunSpeculative :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMSolveInstances :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMTypeError :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMUnify :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMUnquoteTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWithExpandLast :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWithNormalisation :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWithReconstructed :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWithReduceDefs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWorkOnTypes :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermCon :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermExtLam :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermLam :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermLit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermPi :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermSort :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermUnsupported :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermVar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primArg :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primArgArg :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primArgArgInfo :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primArgInfo :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAssoc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAssocLeft :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAssocNon :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAssocRight :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primBool :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primChar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primCons :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primEquality :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term -- | Get the name of the equality type. primEqualityName :: TCM QName primEquiv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primEquivFun :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primEquivProof :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFaceForall :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFalse :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFixity :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFixityFixity :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFlat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFloat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFromNat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFromNeg :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFromString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primGlue :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primHComp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primHidden :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primHiding :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIMin :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primINeg :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIO :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIOne :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIZero :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInf :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInstance :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInteger :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIntegerNegSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIntegerPos :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInterval :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIntervalUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIrrelevant :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIsOne :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIsOne1 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIsOne2 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIsOneEmpty :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primItIsOne :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primJust :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevel :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelZero :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primList :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLockUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primMaybe :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primModality :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primModalityConstructor :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatDivSucAux :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatEquality :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatLess :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatMinus :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatModSucAux :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatPlus :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatTimes :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNil :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNothing :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPartial :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPartialP :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPath :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPathP :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPrecRelated :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPrecUnrelated :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPrecedence :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primProp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPropOmega :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primQName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primQuantity :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primQuantity0 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primQuantityω :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primQuotientConstructor :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primRefl :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primRelevance :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primRelevant :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSSetOmega :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSet :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSetOmega :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSharp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSigma :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSize :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeInf :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeLt :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primStrictSet :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSub :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSubIn :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSubOut :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primTrans :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primTranspProof :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primTrue :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primUnit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primUnitUnit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primVisible :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primWord64 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primZero :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term prim_glue :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term prim_glueU :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term prim_unglue :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term prim_unglueU :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term -- | Run a BuiltinAccess monad. runBuiltinAccess :: TCState -> BuiltinAccess a -> a setBuiltinThings :: BuiltinThings -> TCM () -- | Compute a SortKit in an environment that supports failures. -- -- When optLoadPrimitives is set to False, sortKit -- is a fallible operation, so for the uses of sortKit in fallible -- contexts (e.g. TCM), we report a type error rather than -- exploding. sortKit :: (HasBuiltins m, MonadTCError m) => m SortKit -- | The trivial implementation of HasBuiltins, using a constant -- TCState. -- -- This may be used instead of TCMT/ReduceM where builtins -- must be accessed in a pure context. newtype BuiltinAccess a BuiltinAccess :: (TCState -> a) -> BuiltinAccess a [unBuiltinAccess] :: BuiltinAccess a -> TCState -> a -- | The coinductive primitives. data CoinductionKit CoinductionKit :: QName -> QName -> QName -> CoinductionKit [nameOfInf] :: CoinductionKit -> QName [nameOfSharp] :: CoinductionKit -> QName [nameOfFlat] :: CoinductionKit -> QName -- | Revert the EqualityView. -- -- Postcondition: type is reduced. class EqualityUnview a equalityUnview :: EqualityUnview a => a -> Type class (Functor m, Applicative m, Monad m) => HasBuiltins (m :: Type -> Type) getBuiltinThing :: HasBuiltins m => SomeBuiltin -> m (Maybe (Builtin PrimFun)) ($dmgetBuiltinThing) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (HasBuiltins m, MonadTrans t, HasBuiltins n, t n ~ m) => SomeBuiltin -> m (Maybe (Builtin PrimFun)) -- | Sort primitives. data SortKit SortKit :: (UnivSize -> Univ -> QName) -> (QName -> Maybe (UnivSize, Univ)) -> SortKit [nameOfUniv] :: SortKit -> UnivSize -> Univ -> QName [isNameOfUniv] :: SortKit -> QName -> Maybe (UnivSize, Univ) instance GHC.Internal.Base.Applicative Agda.TypeChecking.Monad.Builtin.BuiltinAccess instance Agda.TypeChecking.Monad.Builtin.EqualityUnview Agda.Syntax.Internal.EqualityTypeData instance Agda.TypeChecking.Monad.Builtin.EqualityUnview Agda.Syntax.Internal.EqualityView instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.Builtin.BuiltinAccess instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins Agda.TypeChecking.Monad.Builtin.BuiltinAccess instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.Utils.StrictReader.ReaderT e m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Reader.ReaderT e m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.State.Lazy.StateT s m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.TypeChecking.Monad.Base.TCMT m) instance (Agda.TypeChecking.Monad.Builtin.HasBuiltins m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.Utils.StrictWriter.WriterT w m) instance (Agda.TypeChecking.Monad.Builtin.HasBuiltins m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance GHC.Internal.Base.Monad Agda.TypeChecking.Monad.Builtin.BuiltinAccess instance GHC.Internal.Control.Monad.Fail.MonadFail Agda.TypeChecking.Monad.Builtin.BuiltinAccess -- | Stuff for sized types that does not require modules -- Agda.TypeChecking.Reduce or -- Agda.TypeChecking.Constraints (which import -- Agda.TypeChecking.Monad). module Agda.TypeChecking.Monad.SizedTypes -- | Ensure that option --sized-types is on, for the given reason. requireOptionSizedTypes :: (HasCallStack, HasOptions m, MonadTCError m) => String -> m () getBuiltinSize :: HasBuiltins m => m (Maybe QName, Maybe QName) -- | Test whether the SIZELT builtin is defined. haveSizeLt :: TCM Bool -- | Add polarity info to a SIZE builtin. builtinSizeHook :: BuiltinId -> QName -> Type -> TCM () -- | Result of querying whether size variable i is bounded by -- another size. data BoundedSize -- | yes i : Size< t BoundedLt :: Term -> BoundedSize BoundedNo :: BoundedSize -- | Check if a type is the primSize type. The argument should be -- reduced. class IsSizeType a isSizeType :: (IsSizeType a, HasOptions m, HasBuiltins m) => a -> m (Maybe BoundedSize) isSizeTypeTest :: (HasOptions m, HasBuiltins m) => m (Term -> Maybe BoundedSize) isSizeNameTest :: (HasOptions m, HasBuiltins m) => m (QName -> Bool) isSizeNameTestRaw :: (HasOptions m, HasBuiltins m) => m (QName -> Bool) -- | The sort of built-in types SIZE and SIZELT. sizeSort :: Sort -- | The type of built-in types SIZE and SIZELT. sizeUniv :: Type -- | The built-in type SIZE with user-given name. sizeType_ :: QName -> Type -- | The built-in type SIZE. sizeType :: HasBuiltins m => m Type -- | The name of SIZESUC. sizeSucName :: (HasBuiltins m, HasOptions m) => m (Maybe QName) sizeSuc :: HasBuiltins m => Nat -> Term -> m Term sizeSuc_ :: QName -> Term -> Term -- | Transform list of terms into a term build from binary maximum. sizeMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => List1 Term -> m Term -- | A useful view on sizes. data SizeView SizeInf :: SizeView SizeSuc :: Term -> SizeView OtherSize :: Term -> SizeView -- | Expects argument to be reduced. sizeView :: HasBuiltins m => Term -> m SizeView -- | A de Bruijn index under some projections. data ProjectedVar ProjectedVar :: Int -> [(ProjOrigin, QName)] -> ProjectedVar [pvIndex] :: ProjectedVar -> Int [prProjs] :: ProjectedVar -> [(ProjOrigin, QName)] viewProjectedVar :: Term -> Maybe ProjectedVar unviewProjectedVar :: ProjectedVar -> Term type Offset = Nat -- | A deep view on sizes. data DeepSizeView DSizeInf :: DeepSizeView DSizeVar :: ProjectedVar -> Offset -> DeepSizeView DSizeMeta :: MetaId -> Elims -> Offset -> DeepSizeView DOtherSize :: Term -> DeepSizeView data SizeViewComparable a NotComparable :: SizeViewComparable a YesAbove :: DeepSizeView -> a -> SizeViewComparable a YesBelow :: DeepSizeView -> a -> SizeViewComparable a -- | sizeViewComparable v w checks whether v >= w -- (then Left) or v <= w (then Right). If -- uncomparable, it returns NotComparable. sizeViewComparable :: DeepSizeView -> DeepSizeView -> SizeViewComparable () sizeViewSuc_ :: QName -> DeepSizeView -> DeepSizeView -- | sizeViewPred k v decrements v by k (must be -- possible!). sizeViewPred :: Nat -> DeepSizeView -> DeepSizeView -- | sizeViewOffset v returns the number of successors or Nothing -- when infty. sizeViewOffset :: DeepSizeView -> Maybe Offset -- | Remove successors common to both sides. removeSucs :: (DeepSizeView, DeepSizeView) -> (DeepSizeView, DeepSizeView) -- | Turn a size view into a term. unSizeView :: SizeView -> TCM Term unDeepSizeView :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => DeepSizeView -> m Term type SizeMaxView = List1 DeepSizeView type SizeMaxView' = [DeepSizeView] maxViewMax :: SizeMaxView -> SizeMaxView -> SizeMaxView -- | maxViewCons v ws = max v ws. It only adds v to -- ws if it is not subsumed by an element of ws. maxViewCons :: DeepSizeView -> SizeMaxView -> SizeMaxView -- | sizeViewComparableWithMax v ws tries to find w in -- ws that compares with v and singles this out. -- Precondition: v /= DSizeInv. sizeViewComparableWithMax :: DeepSizeView -> SizeMaxView -> SizeViewComparable SizeMaxView' maxViewSuc_ :: QName -> SizeMaxView -> SizeMaxView unMaxView :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => SizeMaxView -> m Term instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.SizedTypes.BoundedSize instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.SizedTypes.ProjectedVar instance GHC.Internal.Base.Functor Agda.TypeChecking.Monad.SizedTypes.SizeViewComparable instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType a => Agda.TypeChecking.Monad.SizedTypes.IsSizeType (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType a => Agda.TypeChecking.Monad.SizedTypes.IsSizeType (b, a) instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType a => Agda.TypeChecking.Monad.SizedTypes.IsSizeType (Agda.Syntax.Internal.Type' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Monad.SizedTypes.DeepSizeView instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.SizedTypes.BoundedSize instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.SizedTypes.DeepSizeView instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.SizedTypes.ProjectedVar -- | The scope monad with operations. module Agda.Syntax.Scope.Monad addNameToInverseScope :: KindOfName -> Name -> AbstractName -> ScopeInfo -> ScopeInfo addVarToBind :: Name -> LocalVar -> ScopeM () annotateDecls :: ReadTCState m => m [Declaration] -> m (Maybe Declaration) annotateExpr :: ReadTCState m => m Expr -> m Expr -- | Apply an import directive and check that all the names mentioned -- actually exist. -- -- Monadic for the sake of error reporting. applyImportDirectiveM :: QName -> ImportDirective -> Scope -> ScopeM (ImportDirective, Scope) -- | Bind a module name. bindModule :: Access -> Name -> ModuleName -> ScopeM () -- | Bind a defined name. Must not shadow anything. bindName :: Access -> KindOfName -> Name -> QName -> ScopeM () bindName' :: Access -> KindOfName -> NameMetadata -> Name -> QName -> ScopeM () -- | Bind a name. Returns the TypeError if exists, but does not -- throw it. bindName'' :: Access -> KindOfName -> NameMetadata -> Name -> QName -> ScopeM (Maybe TypeError) -- | Bind a qualified module name. Adds it to the imports field of the -- scope. bindQModule :: Access -> QName -> ModuleName -> ScopeM () -- | Bind the pseudo-name constructor in the scope of the record -- module, mapping it to the (possibly anonymous) constructor of the -- record. -- -- This is what makes R.constructor resolve: R is the -- record module and constructor an ordinary name in it, -- so no special treatment is needed when resolving the qualified name -- R.constructor. -- -- Note that constructor is a keyword, thus, it can never be -- parsed as an unqualified name. In particular, open R does not -- make the record constructor accessible under the name -- constructor, and constructor cannot be mentioned in -- using, hiding or renaming. -- -- This does not put the record constructor itself into the record module -- (which would be wrong, see issue #4189, since the record module is -- parameterized over the record value, but the constructor is not); it -- only adds this alias for it. bindRecordConstructorPseudoName :: ModuleName -> KindOfName -> QName -> ScopeM () -- | Bind a variable. bindVariable :: BindingSource -> Name -> Name -> ScopeM () -- | After collecting some variable names in the scopeVarsToBind, bind them -- all simultaneously. bindVarsToBind :: ScopeM () -- | Test if a given abstract name can appear with a suffix. Currently only -- true for the names of builtin sorts. canHaveSuffixTest :: HasBuiltins m => m (QName -> Bool) -- | Warn about fixity declarations for targets that are non-operators or -- closed operators: checkNoFixityForClosedOperator :: [Renaming] -> ScopeM () -- | Warn about useless fixity declarations in renaming -- directives. Monadic for the sake of error reporting. checkNoFixityInRenamingModule :: [Renaming] -> ScopeM () checkNoShadowing :: LocalVars -> LocalVars -> ScopeM () -- | Collect the fixity/syntax declarations and polarity pragmas from the -- list of declarations and store them in the scope. computeFixitiesAndPolarities :: DoWarn -> [Declaration] -> ScopeM a -> ScopeM a -- | Mark a name as being a copy in the TC state, associating it with the -- given ScopeCopyRef for liveness information. copyName :: QName -> QName -> ScopeM () -- | Create a new scope with the given name from an old scope. Renames -- public names in the old scope to match the new name and returns the -- renamings. copyScope :: QName -> ModuleName -> Scope -> ScopeM (Scope, ScopeCopyInfo) -- | Create a new module with an empty scope. If the module is not new -- (e.g. duplicate import), don't erase its contents. -- (Just if it is a datatype or record module.) createModule :: Maybe DataOrRecordModule -> ModuleName -> ScopeM () -- | Remove the record constructor pseudo-name from the scope of a record -- module. -- -- The alias constructor is only meant to be used in the -- qualified form R.constructor, where R is the record -- module. Thus, it is not brought into scope by open R. -- -- It is also not copied when the record module R itself is -- applied to arguments (as in module M = R): the record module -- is parameterized over the record value, but the record constructor is -- not (issue #4189). (When R is only copied as a submodule of -- the applied module, the constructor is copied correctly, since the -- arguments are then taken from the enclosing module.) dropRecordConstructorPseudoName :: Scope -> Scope -- | Create a fresh abstract name from a concrete name. -- -- This function is used when we translate a concrete name in a binder. -- The Range of the concrete name is saved as the -- nameBindingSite of the abstract name. freshAbstractName :: Fixity' -> Name -> ScopeM Name -- |
--   freshAbstractName_ = freshAbstractName noFixity'
--   
freshAbstractName_ :: Name -> ScopeM Name -- | Create a fresh abstract qualified name. freshAbstractQName :: Fixity' -> Name -> ScopeM QName freshAbstractQName' :: Name -> ScopeM QName -- | Create a concrete name that is not yet in scope. | NOTE: See -- chooseName in -- Agda.Syntax.Translation.AbstractToConcrete for similar logic. -- | NOTE: See withName in -- Agda.Syntax.Translation.ReflectedToAbstract for similar -- logic. freshConcreteName :: Range -> Int -> String -> ScopeM Name -- | Get the fixity of a not yet bound name. getConcreteFixity :: Name -> ScopeM Fixity' -- | Get the polarities of a not yet bound name. getConcretePolarity :: Name -> ScopeM (Maybe PragmaPolarities) getCurrentScope :: ScopeM Scope getLocalVars :: ReadTCState m => m LocalVars getNamedScope :: ModuleName -> ScopeM Scope -- | Get the notation of a name. The name is assumed to be in scope. getNotation :: QName -> Set1 Name -> ScopeM NewNotation getVarsToBind :: ScopeM LocalVars -- | Create a ImportedNameMap. importedNameMapFromList :: (Ord n1, Ord m1) => [ImportedName' (n1, n2) (m1, m2)] -> ImportedNameMap n1 n2 m1 m2 isDatatypeModule :: ReadTCState m => ModuleName -> m (Maybe DataOrRecordModule) -- | Is this the qualified name which refers to the constructor of a record -- (like Foo.constructor)? -- -- If so, return the part of the name referring to the record -- (Foo). -- -- This is only used to produce a good error message when -- Foo.constructor does not resolve; the resolution itself goes -- through the ordinary scope lookup, see -- bindRecordConstructorPseudoName. isRecordConstructor :: QName -> Maybe QName -- | Apply a ImportedNameMap. lookupImportedName :: (Ord n1, Ord m1) => ImportedNameMap n1 n2 m1 m2 -> ImportedName' n1 m1 -> ImportedName' n2 m2 -- | Translation of ImportDirective. mapImportDir :: (Ord n1, Ord m1) => [ImportedName' (n1, n2) (m1, m2)] -> [ImportedName' (n1, n2) (m1, m2)] -> ImportDirective' n1 m1 -> ImportDirective' n2 m2 -- | Translation of Renaming. mapRenaming :: (Ord n1, Ord m1) => ImportedNameMap n1 n2 m1 m2 -> ImportedNameMap n1 n2 m1 m2 -> Renaming' n1 m1 -> Renaming' n2 m2 memoToScopeInfo :: ScopeMemo -> ScopeCopyInfo -- | Apply a function to the current scope. modifyCurrentScope :: (Scope -> Scope) -> ScopeM () modifyLocalVars :: (LocalVars -> LocalVars) -> ScopeM () -- | Apply a function to the given scope. modifyNamedScope :: ModuleName -> (Scope -> Scope) -> ScopeM () -- | Apply a function to the scope map. modifyScopes :: (Map ModuleName Scope -> Map ModuleName Scope) -> ScopeM () noGeneralizedVarsIfLetOpen :: OpenKind -> Scope -> Scope -- | Open a module, possibly given an already resolved module name. openModule :: KwRange -> OpenKind -> Maybe ModuleName -> QName -> ImportDirective -> ScopeM ImportDirective -- | Open a module. openModule_ :: KwRange -> OpenKind -> QName -> ImportDirective -> ScopeM ImportDirective -- | Run a computation outside some number of local variables and add them -- back afterwards. This lets you bind variables in the middle of the -- context and is used when binding generalizable variables (#3735). outsideLocalVars :: Int -> ScopeM a -> ScopeM a printLocals :: Int -> String -> ScopeM () -- | Rebind a name. Use with care! Ulf, 2014-06-29: Currently used to -- rebind the name defined by an unquoteDecl, which is a -- QuotableName in the body, but a DefinedName later on. rebindName :: Access -> KindOfName -> NameMetadata -> Name -> QName -> ScopeM () -- | The pseudo-name constructor under which the constructor of a -- record is bound in the scope of the record module. -- -- Since constructor is a keyword, this name is only reachable -- as the tail of a qualified name, e.g., R.constructor. recordConstructorPseudoName :: Name -- | Look up a module in the scope. Marks the module as used for the -- unused-imports analysis. resolveModule :: QName -> ScopeM AbstractModule -- | Look up the abstract name referred to by a given concrete name. resolveName :: QName -> ScopeM ResolvedName -- | Look up the abstract name corresponding to a concrete name of a -- certain kind and/or from a given set of names. Sometimes we know -- already that we are dealing with a constructor or pattern synonym -- (e.g. when we have parsed a pattern). Then, we can ignore conflicting -- definitions of that name of a different kind. (See issue 822.) resolveName' :: KindsOfNames -> Maybe (Set1 Name) -> QName -> ScopeM ResolvedName scopeWarning :: HasCallStack => DeclarationWarning' -> ScopeM () scopeWarning' :: CallStack -> DeclarationWarning' -> ScopeM () setContextPrecedence :: PrecedenceStack -> ScopeM () setLocalVars :: LocalVars -> ScopeM () -- | Clear the scope of any no names. stripNoNames :: ScopeM () tryResolveName :: (ReadTCState m, HasBuiltins m, MonadError NameResolutionError m) => KindsOfNames -> Maybe (Set1 Name) -> QName -> m ResolvedName -- | Temporarily unbind a variable. Used for non-recursive lets. unbindVariable :: Name -> ScopeM a -> ScopeM a -- | Check that the newly added variable have unique names. withCheckNoShadowing :: ScopeM a -> ScopeM a withContextPrecedence :: ReadTCState m => Precedence -> m a -> m a -- | Run a computation without changing the local variables. withLocalVars :: ScopeM a -> ScopeM a -- | A finite map for ImportedNames. data ImportedNameMap n1 n2 m1 m2 ImportedNameMap :: Map n1 n2 -> Map m1 m2 -> ImportedNameMap n1 n2 m1 m2 [inameMap] :: ImportedNameMap n1 n2 m1 m2 -> Map n1 n2 [imoduleMap] :: ImportedNameMap n1 n2 m1 m2 -> Map m1 m2 data OpenKind LetOpenModule :: OpenKind TopOpenModule :: OpenKind data ScopeMemo ScopeMemo :: Ren QName -> Map ModuleName (ModuleName, Bool) -> ScopeMemo [memoNames] :: ScopeMemo -> Ren QName -- | Bool: did we copy recursively? We need to track this because we don't -- copy recursively when creating new modules for reexported functions -- (issue1985), but we might need to copy recursively later. [memoModules] :: ScopeMemo -> Map ModuleName (ModuleName, Bool) type WSM = StateT ScopeMemo ScopeM instance Agda.Syntax.Concrete.Fixity.MonadFixityError Agda.Syntax.Scope.State.ScopeM -- | Computing scopes of names that are relevant to parsing some raw -- expression. module Agda.Syntax.Scope.Operator -- | Names that are relevant to operator parsing. data OperatorScope OpScope :: Bool -> Map QName (List1 AbstractName) -> AssocList Name Name -> OperatorScope -- | Are there any operators or notations in scope? [osHasOps] :: OperatorScope -> Bool -- | All relevant names in global scope. [osScope] :: OperatorScope -> Map QName (List1 AbstractName) -- | Relevant names in local scope. [osLocals] :: OperatorScope -> AssocList Name Name getOperatorScope :: Set QName -> ScopeInfo -> OperatorScope getDefinedNames :: KindsOfNames -> OperatorScope -> [List1 NewNotation] -- | Compute all names (first component) and operators/notations (second -- component) in scope. -- -- For IsPattern, only constructor-like names are returned. localNames :: ExprKind -> Maybe QName -> OperatorScope -> ScopeM ([QName], [NewNotation]) -- | The parser doesn't know about operators and parses everything as -- normal function application. This module contains the functions that -- parses the operators properly. For a stand-alone implementation of -- this see src/prototyping/mixfix/old. -- -- It also contains the function that puts parenthesis back given the -- precedence of the context. module Agda.Syntax.Concrete.Operators -- | Parse a list of expressions (typically from a RawApp) into an -- application. parseApplication :: List2 Expr -> ScopeM Expr -- | Parse the arguments of a raw application with known head. parseArguments :: Expr -> [Expr] -> ScopeM [NamedArg Expr] -- | Parses a left-hand side, and makes sure that it defined the expected -- name. parseLHS :: DisplayLHS -> QName -> Pattern -> ScopeM LHSCore -- | Parses a pattern. parsePattern :: Pattern -> ScopeM Pattern parsePatternSyn :: Pattern -> ScopeM Pattern instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Concrete.Operators.ParseLHS module Agda.TypeChecking.DropArgs -- | When making a function projection-like, we drop the first n -- arguments. class DropArgs a dropArgs :: DropArgs a => Int -> a -> a instance Agda.TypeChecking.DropArgs.DropArgs Agda.Syntax.Internal.Clause instance Agda.TypeChecking.DropArgs.DropArgs Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.DropArgs.DropArgs Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.DropArgs.DropArgs a => Agda.TypeChecking.DropArgs.DropArgs (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.DropArgs.DropArgs Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.DropArgs.DropArgs Agda.TypeChecking.Coverage.SplitTree.SplitTree instance Agda.TypeChecking.DropArgs.DropArgs Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.DropArgs.DropArgs Agda.Syntax.Internal.Term module Agda.Compiler.Treeless.Subst newtype UnderLambda UnderLambda :: Any -> UnderLambda newtype SeqArg SeqArg :: All -> SeqArg data Occurs Occurs :: Int -> UnderLambda -> SeqArg -> Occurs once :: Occurs inSeq :: Occurs -> Occurs underLambda :: Occurs -> Occurs class HasFree a freeVars :: HasFree a => a -> IntMap Occurs freeIn :: HasFree a => Int -> a -> Bool occursIn :: HasFree a => Int -> a -> Occurs data Binder a Binder :: Int -> a -> Binder a newtype InSeq a InSeq :: a -> InSeq a -- | Strenghtening. tryStrengthen :: (HasFree a, Subst a) => Int -> a -> Maybe a instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Treeless.TTerm instance GHC.Internal.Classes.Eq Agda.Compiler.Treeless.Subst.Occurs instance GHC.Internal.Classes.Eq Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Internal.Classes.Eq Agda.Compiler.Treeless.Subst.UnderLambda instance Agda.Compiler.Treeless.Subst.HasFree a => Agda.Compiler.Treeless.Subst.HasFree (Agda.Compiler.Treeless.Subst.Binder a) instance Agda.Compiler.Treeless.Subst.HasFree a => Agda.Compiler.Treeless.Subst.HasFree (Agda.Compiler.Treeless.Subst.InSeq a) instance Agda.Compiler.Treeless.Subst.HasFree GHC.Internal.Types.Int instance Agda.Compiler.Treeless.Subst.HasFree a => Agda.Compiler.Treeless.Subst.HasFree [a] instance Agda.Compiler.Treeless.Subst.HasFree Agda.Syntax.Treeless.TAlt instance Agda.Compiler.Treeless.Subst.HasFree Agda.Syntax.Treeless.TTerm instance (Agda.Compiler.Treeless.Subst.HasFree a, Agda.Compiler.Treeless.Subst.HasFree b) => Agda.Compiler.Treeless.Subst.HasFree (a, b) instance GHC.Internal.Base.Monoid Agda.Compiler.Treeless.Subst.Occurs instance GHC.Internal.Base.Monoid Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Internal.Base.Monoid Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Internal.Classes.Ord Agda.Compiler.Treeless.Subst.Occurs instance GHC.Internal.Classes.Ord Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Internal.Classes.Ord Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Internal.Base.Semigroup Agda.Compiler.Treeless.Subst.Occurs instance GHC.Internal.Base.Semigroup Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Internal.Base.Semigroup Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Internal.Show.Show Agda.Compiler.Treeless.Subst.Occurs instance GHC.Internal.Show.Show Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Internal.Show.Show Agda.Compiler.Treeless.Subst.UnderLambda instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Treeless.TAlt instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Treeless.TTerm module Agda.Compiler.Treeless.Pretty instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Treeless.Compiled instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Treeless.TAlt instance Agda.Syntax.Common.Pretty.Pretty Agda.Syntax.Treeless.TTerm module Agda.Compiler.Treeless.Compare equalTerms :: TTerm -> TTerm -> Bool module Agda.Compiler.Treeless.Uncase caseToSeq :: Monad m => TTerm -> m TTerm module Agda.TypeChecking.Monad.Signature -- | If the first argument is Erased something, then hard -- compile-time mode is enabled when the continuation is run. setHardCompileTimeModeIfErased :: Erased -> TCM a -> TCM a -- | If the quantity is "erased", then hard compile-time mode is enabled -- when the continuation is run. -- -- Precondition: The quantity must not be Quantity1 -- something. setHardCompileTimeModeIfErased' :: LensQuantity q => q -> TCM a -> TCM a -- | Use run-time mode in the continuation unless the current mode is the -- hard compile-time mode. setRunTimeModeUnlessInHardCompileTimeMode :: TCM a -> TCM a -- | Use hard compile-time mode in the continuation if the first argument -- is Erased something. Use run-time mode if the first -- argument is NotErased something and the current mode -- is not hard compile-time mode. setModeUnlessInHardCompileTimeMode :: Erased -> TCM a -> TCM a -- | Warn if the user explicitly wrote @ω or @plenty but -- the current mode is the hard compile-time mode. warnForPlentyInHardCompileTimeMode :: Erased -> TCM () -- | Add a constant to the signature. Lifts the definition to top level. addConstant :: QName -> Definition -> TCM () -- | Bring the definition of a data or record type copy into normal form: -- fully instantiated and eta-contracted (see _dataClause). -- -- Lambda-lifting (the Abstract instance for Defn) wraps -- the body of a copy into one lambda per module parameter. -- Eta-contracting these away again is what makes the copy unfold when it -- is applied to fewer arguments than it has parameters, which in turn -- lets chains of copies arising from partial module instantiations -- unfold all the way down (issue #8545). Metas are instantiated first, -- since a solved meta can hide an eta-redex. normalizeCopyBody :: Definition -> TCM Definition -- | A combination of addConstant and defaultDefn. The -- Language does not need to be supplied. addConstant' :: QName -> ArgInfo -> Type -> Defn -> TCM () -- | Set termination info of a defined function symbol. setTerminates :: MonadTCState m => QName -> Maybe Bool -> m () -- | Set CompiledClauses of a defined function symbol. setCompiledClauses :: QName -> CompiledClauses -> TCM () -- | Set SplitTree of a defined function symbol. setSplitTree :: QName -> SplitTree -> TCM () -- | Modify the clauses of a function. modifyFunClauses :: QName -> ([Clause] -> [Clause]) -> TCM () -- | Lifts clauses to the top-level and adds them to definition. Also -- adjusts the funCopatternLHS field if necessary. addClauses :: (MonadConstraint m, MonadTCState m) => QName -> [Clause] -> m () mkPragma :: String -> TCM CompilerPragma -- | Add a compiler pragma `{-# COMPILE backend name -- text #-}` addPragma :: BackendName -> QName -> String -> TCM () getUniqueCompilerPragma :: BackendName -> QName -> TCM (Maybe CompilerPragma) setFunctionFlag :: FunctionFlag -> Bool -> QName -> TCM () markStatic :: QName -> TCM () markInline :: Bool -> QName -> TCM () markInjective :: QName -> TCM () markFirstOrder :: QName -> TCM () -- | Add a section to the signature. -- -- The current context will be stored as the cumulative module parameters -- for this section, and a module checkpoint entry will be added into the -- module checkpoint stack. addSection :: ModuleName -> TCM () addSection' :: ModuleName -> Telescope -> TCM () -- | Get a section. -- -- Why Maybe? The reason is that we look up all prefixes of a module to -- compute number of parameters, and for hierarchical top-level modules, -- A.B.C say, A and A.B do not exist. getSection :: ReadTCState m => ModuleName -> m (Maybe Section) -- | Lookup a section telescope. -- -- If it doesn't exist, like in hierarchical top-level modules, the -- section telescope is empty. lookupSection :: ReadTCState m => ModuleName -> m Telescope -- | Add display forms for a name f copied by a module -- application. Essentially if f can reduce to -- --
--   λ xs → A.B.C.f vs
--   
-- -- by unfolding module application copies (defCopy), then we add a -- display form -- --
--   A.B.C.f vs ==> f xs
--   
-- -- Invoking addDisplayForms x will add a display form for -- each copy x transitively reduces to. E.g. consider the -- following iterated module application. module M0 (n : Nat) where -- b : Bool b = n > 42 module M1 (n : Nat) = M0 (suc n) module M2 (n : -- Nat) = M1 (suc n) module M3 (n : Nat) = M2 (suc n) -- -- For the first copy M1.b n = M0.b (suc n) we add the display -- form M0.b (suc n) --> M1.b n. -- -- For the second copy M2.b n = M1.b (suc n) we first add -- display form M1.b (suc n) --> M2.b n and for the further -- unfolding we add display form M0.b (suc (suc n)) --> M2.b -- n. -- -- For the third copy M3.b n = M2.b (suc n) we add display forms -- M2.b (suc n) --> M3.b n, M1.b (suc (suc n)) --> -- M3.b n and M0.b (suc (suc (suc n))) --> M3.b n. addDisplayForms :: QName -> TCM () -- | Module application (followed by module parameter abstraction). applySection :: ModuleName -> Telescope -> ModuleName -> Args -> ScopeCopyInfo -> TCM () applySection' :: ModuleName -> Telescope -> ModuleName -> Args -> ScopeCopyInfo -> TCM () -- | Add a display form to a definition (could be in this or imported -- signature). addDisplayForm :: QName -> DisplayForm -> TCM () isLocal :: ReadTCState m => QName -> m Bool getDisplayForms :: (HasConstInfo m, ReadTCState m) => QName -> m [LocalDisplayForm] hasDisplayForms :: (HasConstInfo m, ReadTCState m) => QName -> m Bool -- | Find all names used (recursively) by display forms of a given name. class ChaseDisplayForms a chaseDisplayForms :: ChaseDisplayForms a => a -> Set QName -> TCM (Set QName) canonicalName :: HasConstInfo m => QName -> m QName sameDef :: HasConstInfo m => QName -> QName -> m (Maybe QName) -- | Does the given constructor come from a single-constructor type? -- -- Precondition: The name has to refer to a constructor. singleConstructorType :: QName -> TCM Bool -- | Signature lookup errors. data SigError -- | The name is not in the signature; default error message. SigUnknown :: String -> SigError -- | The name is not available, since it is abstract. SigAbstract :: SigError -- | The name is not available because it was defined in Cubical Agda, but -- the current language is Erased Cubical Agda, and --erasure is -- not active. SigCubicalNotErasure :: SigError -- | Generates a string error message corresponding to -- SigCubicalNotErasure for a given QName. notSoPrettySigCubicalNotErasure :: QName -> String -- | Generates an error message corresponding to -- SigCubicalNotErasure for a given QName. prettySigCubicalNotErasure :: MonadPretty m => QName -> m Doc -- | An eliminator for SigError. All constructors except for -- SigAbstract are assumed to be impossible. sigError :: (HasCallStack, MonadDebug m) => QName -> m a -> SigError -> m a class (Functor m, Applicative m, HasOptions m, MonadDebug m, MonadTCEnv m) => HasConstInfo (m :: Type -> Type) -- | Lookup the definition of a name. The result is a closed thing, all -- free variables have been abstracted over. getConstInfo :: HasConstInfo m => QName -> m Definition -- | Version that reports exceptions: getConstInfo' :: HasConstInfo m => QName -> m (Either SigError Definition) ($dmgetConstInfo') :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasConstInfo m, HasCallStack, HasConstInfo n, MonadTrans t, m ~ t n) => QName -> m (Either SigError Definition) -- | Return the global rewrite rules for the given head symbol that could -- be tried. Not categorically all rewrite rules are returned, in -- particular, none when reduction of the head symbol is disabled. -- Rewrite rules that only happen to be in the signature but are not in -- scope are also not returned. getGlobalRewriteRulesFor :: HasConstInfo m => QName -> m GlobalRewriteRules ($dmgetGlobalRewriteRulesFor) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasConstInfo m, HasConstInfo n, MonadTrans t, m ~ t n) => QName -> m GlobalRewriteRules -- | Return the local rewrite rules for the given head symbol. getLocalRewriteRulesFor :: HasConstInfo m => RewriteHead -> m RewriteRules ($dmgetLocalRewriteRulesFor) :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (HasConstInfo m, HasConstInfo n, MonadTrans t, m ~ t n) => RewriteHead -> m RewriteRules justTheRule :: GlobalRewriteRule -> Maybe RewriteRule getAllRewriteRulesForDefHead :: (HasConstInfo m, ReadTCState m) => QName -> m RewriteRules -- | A local rewrite rule forces us to consider the definition as defined -- by copatterns (see #3812 for an example case with global rewrite -- rules) This is necessary because binding local rewrite rules does not -- update defCopatternLHS' rewUsesCopatterns :: HasConstInfo m => RewriteHead -> m Bool -- | Is this a function defined by copatterns? Accounts for local rewrite -- rules defCopatternLHS :: HasConstInfo m => QName -> Definition -> m Bool getAllRewriteRulesForVarHead :: HasConstInfo m => Nat -> m RewriteRules -- | The computation getConstInfo sometimes tweaks the returned -- Definition, depending on the current Language and the -- Language of the Definition. This variant of -- getConstInfo does not perform any tweaks. getOriginalConstInfo :: (HasCallStack, ReadTCState m, HasConstInfo m) => QName -> m Definition -- | Return the rewrite rules for the given head symbol that could be -- tried. Not categorically all rewrite rules are returned, e.g. none -- when reduction of the head symbol is disabled. Rewrite rules that only -- happen to be in the signature but are not in scope are also not -- returned. defaultGetGlobalRewriteRulesFor :: (ReadTCState m, MonadTCEnv m) => QName -> m GlobalRewriteRules defaultGetLocalRewriteRulesFor :: (ReadTCState m, MonadTCEnv m, MonadDebug m, HasOptions m) => RewriteHead -> m RewriteRules -- | If the Bool parameter is True, get the rules in scope, -- otherwise, get *all* rules unfiltered. getFilteredGlobalRewriteRulesFor :: ReadTCState m => Bool -> QName -> m GlobalRewriteRules -- | Get the original name of the projection (the current one could be from -- a module application). getOriginalProjection :: (HasCallStack, HasConstInfo m) => QName -> m QName defaultGetConstInfo :: (HasCallStack, HasOptions m, MonadDebug m) => TCState -> TCEnv -> QName -> m (Either SigError Definition) getConInfo :: (HasCallStack, HasConstInfo m) => ConHead -> m Definition -- | Look up the polarity of a definition. getPolarity :: (HasCallStack, HasConstInfo m) => QName -> m [Polarity] -- | Look up polarity of a definition and compose with polarity represented -- by Comparison. getPolarity' :: (HasCallStack, HasConstInfo m) => Comparison -> QName -> m [Polarity] -- | Set the polarity of a definition. setPolarity :: (MonadTCState m, MonadDebug m) => QName -> [Polarity] -> m () -- | Look up the forced arguments of a definition. getForcedArgs :: HasConstInfo m => QName -> m [IsForced] -- | Returns the occurences given explicitely as polarity annotations in -- the function type getOccurrencesFromType :: Type -> TCM [Occurrence] -- | Get argument occurrence info for argument i of definition -- d (never fails). getArgOccurrence :: HasCallStack => QName -> Nat -> TCM Occurrence -- | Sets the defArgOccurrences for the given identifier (which -- should already exist in the signature). setArgOccurrences :: MonadTCState m => QName -> [Occurrence] -> m () modifyArgOccurrences :: MonadTCState m => QName -> ([Occurrence] -> [Occurrence]) -> m () getArgOccurrences :: ReadTCState m => QName -> m [Occurrence] setTreeless :: QName -> TTerm -> TCM () setCompiledArgUse :: QName -> [ArgUsage] -> TCM () getCompiled :: HasConstInfo m => QName -> m (Maybe Compiled) -- | Returns a list of length conArity. If no erasure analysis has -- been performed yet, this will be a list of Falses. getErasedConArgs :: (HasCallStack, HasConstInfo m) => QName -> m [Bool] setErasedConArgs :: QName -> [Bool] -> TCM () getTreeless :: HasConstInfo m => QName -> m (Maybe TTerm) getCompiledArgUse :: HasConstInfo m => QName -> m (Maybe [ArgUsage]) -- | add data constructors to a datatype addDataCons :: QName -> [QName] -> TCM () -- | Get the mutually recursive identifiers of a symbol from the signature. getMutual :: QName -> TCM (Maybe [QName]) -- | Get the mutually recursive identifiers from a Definition. getMutual_ :: Defn -> Maybe [QName] -- | Set the mutually recursive identifiers. -- -- TODO: This produces data of quadratic size (which has to be processed -- upon serialization). Presumably qs is usually short, but in some cases -- (for instance for generated code) it may be long. It would be better -- to assign a unique identifier to each SCC, and store the names -- separately. setMutual :: QName -> [QName] -> TCM () -- | Check whether two definitions are mutually recursive. mutuallyRecursive :: QName -> QName -> TCM Bool -- | A function, data, or record definition is definitely not recursive if -- it is not even mutually recursive with itself. definitelyNonRecursive_ :: Defn -> Bool -- | Get the number of parameters to the current module. getCurrentModuleFreeVars :: TCM Nat getDefModule :: HasConstInfo m => QName -> m (Either SigError ModuleName) -- | Compute the number of free variables of a defined name. This is the -- sum of number of parameters shared with the current module and the -- number of anonymous variables (if the name comes from a let-bound -- module). getDefFreeVars :: (ReadTCState m, MonadTCEnv m) => QName -> m Nat freeVarsToApply :: (HasConstInfo m, ReadTCState m) => QName -> m Args getModuleFreeVars :: (MonadTCEnv m, ReadTCState m) => ModuleName -> m Nat -- | Compute the context variables to apply a definition to. -- -- We have to insert the module telescope of the common prefix of the -- current module and the module where the definition comes from. -- (Properly raised to the current context.) -- -- Example: module M₁ Γ where module M₁ Δ where f = ... module M₃ Θ -- where ... M₁.M₂.f [insert Γ raised by Θ] moduleParamsToApply :: (HasOptions m, MonadTCEnv m, ReadTCState m, MonadDebug m) => ModuleName -> m Args -- | Unless all variables in the context are module parameters, create a -- fresh module to capture the non-module parameters. Used when unquoting -- to make sure generated definitions work properly. inFreshModuleIfFreeParams :: TCM a -> TCM a -- | Instantiate a closed definition with the correct part of the current -- context. instantiateDef :: (HasConstInfo m, ReadTCState m) => Definition -> m Definition -- | Instantiate a global rewrite rule instantiateRewriteRule :: (HasConstInfo m, ReadTCState m) => GlobalRewriteRule -> m GlobalRewriteRule -- | Instantiate global rewrite rules instantiateRewriteRules :: (HasConstInfo m, ReadTCState m) => GlobalRewriteRules -> m GlobalRewriteRules -- | Return the abstract view of a definition, regardless of whether -- the definition would be treated abstractly. alwaysMakeAbstract :: Definition -> Maybe Definition -- | Enter abstract mode. Abstract definition in the current module are -- transparent. inAbstractMode :: MonadTCEnv m => m a -> m a -- | Not in abstract mode. All abstract definitions are opaque. inConcreteMode :: MonadTCEnv m => m a -> m a -- | Ignore abstract mode. All abstract definitions are transparent. ignoreAbstractMode :: MonadTCEnv m => m a -> m a -- | Go under the given opaque block. The unfolding set will turn opaque -- definitions transparent. underOpaqueId :: MonadTCEnv m => OpaqueId -> m a -> m a -- | Outside of any opaque blocks. notUnderOpaque :: MonadTCEnv m => m a -> m a -- | Enter the reducibility environment associated with a definition: The -- environment will have the same concreteness as the name, and we will -- be in the opaque block enclosing the name, if any. inConcreteOrAbstractMode :: HasConstInfo m => QName -> (Definition -> m a) -> m a -- | Get type of a constant, instantiated to the current context. typeOfConst :: (HasConstInfo m, ReadTCState m) => QName -> m Type -- | Get relevance of a constant. relOfConst :: HasConstInfo m => QName -> m Relevance -- | Get modality of a constant. modalityOfConst :: HasConstInfo m => QName -> m Modality -- | The number of dropped parameters for a definition. 0 except for -- projection(-like) functions and constructors. droppedPars :: Definition -> Int -- | Is it the name of a record projection or field or a projection-like -- function? isProjection :: HasConstInfo m => QName -> m (Maybe Projection) -- | Is it a record projection or field or a projection-like function? isProjection_ :: Defn -> Maybe Projection -- | Is it the name of a non-irrelevant record projection or field or -- projection-like function? isRelevantProjection :: HasConstInfo m => QName -> m (Maybe Projection) -- | Is it a non-irrelevant record projection or field or projection-like -- function? isRelevantProjection_ :: Definition -> Maybe Projection -- | Is it a function marked STATIC? isStaticFun :: Defn -> Bool -- | Is it a function marked INLINE? isInlineFun :: Defn -> Bool -- | Returns True if we are dealing with a proper projection, -- i.e., not a projection-like function nor a record field value -- (projection applied to argument). isProperProjection :: Defn -> Bool -- | Returns True if we are dealing with a proper projection, -- i.e., not a projection-like function nor a record field value -- (projection applied to argument). isProperProjection_ :: Projection -> Bool -- | Number of dropped initial arguments of a projection(-like) function. projectionArgs :: Definition -> Int -- | Check whether a definition uses copatterns. usesCopatterns :: HasConstInfo m => QName -> m Bool -- | Apply a function f to its first argument, producing the -- proper postfix projection if f is a projection which is not -- irrelevant. applyDef :: HasConstInfo m => ProjOrigin -> QName -> Arg Term -> m Term instance Agda.TypeChecking.Monad.Signature.ChaseDisplayForms Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Monad.Signature.ChaseDisplayForms Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Monad.Signature.ChaseDisplayForms a => Agda.TypeChecking.Monad.Signature.ChaseDisplayForms [a] instance Agda.TypeChecking.Monad.Signature.ChaseDisplayForms a => Agda.TypeChecking.Monad.Signature.ChaseDisplayForms (Agda.TypeChecking.Monad.Base.Open a) instance Agda.TypeChecking.Monad.Signature.ChaseDisplayForms Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Monad.Signature.ChaseDisplayForms a => Agda.TypeChecking.Monad.Signature.ChaseDisplayForms (Data.Set.Internal.Set a) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Except.ExceptT err m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.TypeChecking.Monad.Base.TCM instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Signature.HasConstInfo m) => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.Utils.StrictWriter.WriterT w m) instance (GHC.Internal.Base.Monoid w, Agda.TypeChecking.Monad.Signature.HasConstInfo m) => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Writer.Lazy.WriterT w m) -- | A typeclass collecting all pure typechecking operations | (i.e. -- ones that do not modify the typechecking state, throw or | catch -- errors, or do IO other than debug printing). module Agda.TypeChecking.Monad.Pure class (HasBuiltins m, HasConstInfo m, MonadAddContext m, MonadDebug m, MonadFileId m, MonadReduce m, MonadTCEnv m, ReadTCState m) => PureTCM (m :: Type -> Type) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.Utils.Update.ChangeT m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.Utils.StrictState.StateT s m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.Pure.PureTCM Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.Pure.PureTCM m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.Utils.StrictWriter.WriterT w m) instance (Agda.TypeChecking.Monad.Pure.PureTCM m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.Writer.Lazy.WriterT w m) module Agda.TypeChecking.Monad.MetaVars -- | Various classes of metavariables. data MetaClass -- | Meta variables of record type. Records :: MetaClass -- | Meta variables of "hereditarily singleton" record type. SingletonRecords :: MetaClass -- | Meta variables of level type, if type-in-type is activated. Levels :: MetaClass -- | All possible metavariable classes. allMetaClasses :: [MetaClass] data KeepMetas KeepMetas :: KeepMetas RollBackMetas :: KeepMetas -- | Monad service class for creating, solving and eta-expanding of -- metavariables. class (MonadConstraint m, MonadReduce m, MonadAddContext m, MonadTCEnv m, ReadTCState m, HasBuiltins m, HasConstInfo m, MonadDebug m) => MonadMetaSolver (m :: Type -> Type) -- | Generate a new meta variable with some instantiation given. For -- instance, the instantiation could be a -- PostponedTypeCheckingProblem. newMeta' :: MonadMetaSolver m => MetaInstantiation -> Frozen -> MetaInfo -> MetaPriority -> Permutation -> Judgement a -> m MetaId -- | Assign to an open metavar which may not be frozen. First check that -- metavar args are in pattern fragment. Then do extended occurs check on -- given thing. -- -- Assignment is aborted by throwing a PatternErr via a call to -- patternViolation. This error is caught by -- catchConstraint during equality checking -- (compareAtom) and leads to restoration of the original -- constraints. assignV :: MonadMetaSolver m => CompareDirection -> MetaId -> Args -> Term -> CompareAs -> m () -- | Directly instantiate the metavariable. Skip pattern check, occurs -- check and frozen check. Used for eta expanding frozen metas. assignTerm' :: MonadMetaSolver m => MetaId -> [Arg ArgName] -> Term -> m () -- | Eta-expand a local meta-variable, if it is of the specified class. -- Don't do anything if the meta-variable is a blocked term. etaExpandMeta :: MonadMetaSolver m => [MetaClass] -> MetaId -> m () -- | Update the status of the metavariable updateMetaVar :: MonadMetaSolver m => MetaId -> (MetaVariable -> MetaVariable) -> m () -- | 'speculateMetas fallback m' speculatively runs m, but if the -- result is RollBackMetas any changes to metavariables are rolled -- back and fallback is run instead. speculateMetas :: MonadMetaSolver m => m () -> m KeepMetas -> m () -- | Switch off assignment of metas. dontAssignMetas :: (MonadTCEnv m, MonadDebug m) => m a -> m a -- | Is the meta-variable from another top-level module? isRemoteMeta :: ReadTCState m => m (MetaId -> Bool) -- | If another meta-variable is created, then it will get this -- MetaId (unless the state is changed too much, for instance by -- setTopLevelModule). nextLocalMeta :: ReadTCState m => m MetaId -- | Pairs of local meta-stores. data LocalMetaStores LocalMetaStores :: LocalMetaStore -> LocalMetaStore -> LocalMetaStores -- | A MetaStore containing open meta-variables. [openMetas] :: LocalMetaStores -> LocalMetaStore -- | A MetaStore containing instantiated meta-variables. [solvedMetas] :: LocalMetaStores -> LocalMetaStore -- | Run a computation and record which new metas it created. metasCreatedBy :: ReadTCState m => m a -> m (a, LocalMetaStores) -- | Find information about the given local meta-variable, if any. lookupLocalMeta' :: ReadTCState m => MetaId -> m (Maybe MetaVariable) -- | Find information about the given local meta-variable. lookupLocalMeta :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m MetaVariable -- | Find information about the (local or remote) meta-variable, if any. -- -- If no meta-variable is found, then the reason could be that the -- dead-code elimination (eliminateDeadCode) failed to find the -- meta-variable, perhaps because some NamesIn instance is -- incorrectly defined. lookupMeta :: ReadTCState m => MetaId -> m (Maybe (Either RemoteMetaVariable MetaVariable)) -- | Find the meta-variable's instantiation. lookupMetaInstantiation :: ReadTCState m => MetaId -> m MetaInstantiation -- | Find the meta-variable's judgement. lookupMetaJudgement :: ReadTCState m => MetaId -> m (Judgement MetaId) -- | Find the meta-variable's modality. lookupMetaModality :: ReadTCState m => MetaId -> m Modality -- | The type of a term or sort meta-variable. metaType :: ReadTCState m => MetaId -> m Type -- | Update the information associated with a local meta-variable. updateMetaVarTCM :: HasCallStack => MetaId -> (MetaVariable -> MetaVariable) -> TCM () -- | Insert a new meta-variable with associated information into the local -- meta store. insertMetaVar :: MetaId -> MetaVariable -> TCM () -- | Returns the MetaPriority of the given local meta-variable. getMetaPriority :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m MetaPriority isSortMeta :: ReadTCState m => MetaId -> m Bool isSortMeta_ :: MetaVariable -> Bool isSortJudgement :: Judgement a -> Bool -- | If a meta variable is still open, what is its kind? metaInstantiationToMetaKind :: MetaInstantiation -> MetaKind getMetaType :: ReadTCState m => MetaId -> m Type -- | Compute the context variables that a local meta-variable should be -- applied to, accounting for pruning. getMetaContextArgs :: MonadTCEnv m => MetaVariable -> m Args -- | Given a local meta-variable, return the type applied to the current -- context. getMetaTypeInContext :: (HasBuiltins m, HasCallStack, MonadDebug m, MonadReduce m) => MetaId -> m Type -- | Is it a local meta-variable that might be generalized? isGeneralizableMeta :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m DoGeneralize -- | Check whether all metas are instantiated. Precondition: argument is a -- meta (in some form) or a list of metas. class IsInstantiatedMeta a isInstantiatedMeta :: (IsInstantiatedMeta a, ReadTCState m) => a -> m Bool isInstantiatedMeta' :: ReadTCState m => MetaId -> m (Maybe Term) -- | Returns all metavariables in a constraint. Slightly complicated by the -- fact that blocked terms are represented by two meta variables. To find -- the second one we need to look up the meta listeners for the one in -- the UnBlock constraint. This is used for the purpose of deciding if a -- metavariable is constrained or if it can be generalized over (see -- Agda.TypeChecking.Generalize). constraintMetas :: Constraint -> TCM (Set MetaId) -- | Create MetaInfo in the current environment. createMetaInfo :: (MonadTCEnv m, ReadTCState m) => m MetaInfo createMetaInfo' :: (MonadTCEnv m, ReadTCState m) => RunMetaOccursCheck -> m MetaInfo setValueMetaName :: MonadMetaSolver m => Term -> MetaNameSuggestion -> m () getMetaNameSuggestion :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m MetaNameSuggestion setMetaNameSuggestion :: MonadMetaSolver m => MetaId -> MetaNameSuggestion -> m () -- | Change the ArgInfo that will be used when generalizing over this local -- meta-variable. setMetaGeneralizableArgInfo :: MonadMetaSolver m => MetaId -> ArgInfo -> m () updateMetaVarRange :: MonadMetaSolver m => MetaId -> Range -> m () setMetaOccursCheck :: MonadMetaSolver m => MetaId -> RunMetaOccursCheck -> m () class (MonadTCEnv m, ReadTCState m) => MonadInteractionPoints (m :: Type -> Type) freshInteractionId :: MonadInteractionPoints m => m InteractionId ($dmfreshInteractionId) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadInteractionPoints m, MonadTrans t, MonadInteractionPoints n, t n ~ m) => m InteractionId modifyInteractionPoints :: MonadInteractionPoints m => (InteractionPoints -> InteractionPoints) -> m () ($dmmodifyInteractionPoints) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (MonadInteractionPoints m, MonadTrans t, MonadInteractionPoints n, t n ~ m) => (InteractionPoints -> InteractionPoints) -> m () -- | Register an interaction point during scope checking. If there is no -- interaction id yet, create one. registerInteractionPoint :: MonadInteractionPoints m => Bool -> Range -> Maybe Nat -> m InteractionId -- | Find an interaction point by Range by searching the whole map. -- Issue 3000: Don't consider solved interaction points. -- -- O(n): linear in the number of registered interaction points. findInteractionPoint_ :: Range -> InteractionPoints -> Maybe InteractionId -- | Hook up a local meta-variable to an interaction point. connectInteractionPoint :: MonadInteractionPoints m => InteractionId -> MetaId -> m () -- | Mark an interaction point as solved. removeInteractionPoint :: MonadInteractionPoints m => InteractionId -> m () -- | Get a list of unsolved interaction ids. getInteractionPoints :: ReadTCState m => m [InteractionId] -- | Get all metas that correspond to unsolved interaction ids. getInteractionMetas :: ReadTCState m => m [MetaId] getUniqueMetasRanges :: (HasCallStack, MonadDebug m, ReadTCState m) => [MetaId] -> m [Range] getUnsolvedMetas :: (HasCallStack, MonadDebug m, ReadTCState m) => m [Range] getUnsolvedInteractionMetas :: (HasCallStack, MonadDebug m, ReadTCState m) => m [Range] -- | Get all metas that correspond to unsolved interaction ids. getInteractionIdsAndMetas :: ReadTCState m => m [(InteractionId, MetaId)] -- | Does the meta variable correspond to an interaction point? -- -- Time: O(log n) where n is the number of interaction -- metas. isInteractionMeta :: ReadTCState m => MetaId -> m (Maybe InteractionId) -- | Get the information associated to an interaction point. lookupInteractionPoint :: (ReadTCState m, MonadError TCErr m, MonadTCEnv m) => InteractionId -> m InteractionPoint -- | Get MetaId for an interaction point. Precondition: interaction -- point is connected. lookupInteractionId :: (ReadTCState m, MonadError TCErr m, MonadTCEnv m) => InteractionId -> m MetaId -- | Check whether an interaction id is already associated with a meta -- variable. lookupInteractionMeta :: ReadTCState m => InteractionId -> m (Maybe MetaId) lookupInteractionMeta_ :: InteractionId -> InteractionPoints -> Maybe MetaId -- | Generate new meta variable. newMeta :: MonadMetaSolver m => Frozen -> MetaInfo -> MetaPriority -> Permutation -> Judgement a -> m MetaId -- | Generate a new meta variable with some instantiation given. For -- instance, the instantiation could be a -- PostponedTypeCheckingProblem. newMetaTCM' :: MetaInstantiation -> Frozen -> MetaInfo -> MetaPriority -> Permutation -> Judgement a -> TCM MetaId -- | Get the Range for an interaction point. getInteractionRange :: (MonadInteractionPoints m, MonadDebug m, MonadError TCErr m) => InteractionId -> m Range -- | Set the Range for an interaction point. setInteractionRange :: (MonadInteractionPoints m, MonadDebug m) => Range -> InteractionId -> m () -- | Get the Range for a local meta-variable. getMetaRange :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m Range getInteractionScope :: (MonadDebug m, ReadTCState m, MonadError TCErr m, MonadTCEnv m) => InteractionId -> m ScopeInfo withMetaInfo' :: MonadTrace m => MetaVariable -> m a -> m a withMetaInfo :: MonadTrace m => Closure Range -> m a -> m a withInteractionId :: (MonadDebug m, MonadError TCErr m, MonadTrace m) => InteractionId -> m a -> m a withMetaId :: (HasCallStack, MonadDebug m, MonadTrace m) => MetaId -> m a -> m a getOpenMetas :: ReadTCState m => m [MetaId] isOpenMeta :: MetaInstantiation -> Bool -- | listenToMeta l m: register l as a listener to -- m. This is done when the type of l is blocked by m. listenToMeta :: MonadMetaSolver m => Listener -> MetaId -> m () -- | Unregister a listener. unlistenToMeta :: MonadMetaSolver m => Listener -> MetaId -> m () -- | Get the listeners for a local meta-variable. getMetaListeners :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m [Listener] clearMetaListeners :: MonadMetaSolver m => MetaId -> m () -- | Do safe eta-expansions for meta (SingletonRecords,Levels). etaExpandMetaSafe :: MonadMetaSolver m => MetaId -> m () -- | Eta expand metavariables listening on the current meta. etaExpandListeners :: MonadMetaSolver m => MetaId -> m () -- | Wake up a meta listener and let it do its thing wakeupListener :: MonadMetaSolver m => Listener -> m () solveAwakeConstraints :: MonadConstraint m => m () solveAwakeConstraints' :: MonadConstraint m => Bool -> m () -- | Freeze the given meta-variables (but only if they are open) and return -- those that were not already frozen. freezeMetas :: (MonadTCState m, ReadTCState m, Traversable t) => t MetaId -> m (Set MetaId) -- | Thaw all open meta variables. unfreezeMetas :: TCM () unfreeze_ :: MetaVariable -> MetaVariable isFrozen :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m Bool -- | Temporarily freeze all open metas (from stOpenMetaStore) and -- unfreeze exactly those that were frozen in the first step. withFrozenMetas :: (MonadMetaSolver m, MonadTCState m) => m a -> m a -- | Unfreeze a meta and its type if this is a meta again. Does not -- unfreeze deep occurrences of meta-variables or remote meta-variables. class UnFreezeMeta a unfreezeMeta :: (UnFreezeMeta a, MonadMetaSolver m) => a -> m () instance GHC.Internal.Enum.Bounded Agda.TypeChecking.Monad.MetaVars.MetaClass instance GHC.Internal.Enum.Enum Agda.TypeChecking.Monad.MetaVars.MetaClass instance GHC.Internal.Classes.Eq Agda.TypeChecking.Monad.MetaVars.MetaClass instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta a => Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta a => Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Internal.Level instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta a => Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta [a] instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta a => Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Control.Monad.Trans.Identity.IdentityT m) instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Control.Monad.Trans.State.Lazy.StateT s m) instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints Agda.TypeChecking.Monad.Base.TCM instance (Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m, GHC.Internal.Base.Monoid w) => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver m => Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver (Agda.Utils.StrictReader.ReaderT r m) instance Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver m => Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver (Control.Monad.Trans.Reader.ReaderT r m) instance GHC.Internal.Show.Show Agda.TypeChecking.Monad.MetaVars.MetaClass instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta a => Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Level instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta a => Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta [a] instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Type module Agda.TypeChecking.Monad module Agda.TypeChecking.Serialise.Instances.Compilers instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.CompilerPragma instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ForeignCode instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ForeignCodeStack module Agda.TypeChecking.Serialise.Instances.Internal blockedToMaybe :: Blocked_ -> Maybe NotBlocked blockedFromMaybe :: Maybe NotBlocked -> Blocked_ instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Blocked_ instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Monad.Base.Builtin a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.BuiltinSort instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.CheckpointId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.ClauseRecursive instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.CompKit instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Types.Comparison instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.DefSing instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Defn instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, GHC.Internal.Classes.Ord a) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.DoGeneralize instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.Permutation.Drop a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.DummyTermKind instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.EtaEquality instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.EtaProvenance instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.FunctionFlag instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Monad.Base.FunctionInverse' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.InstanceInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.InstanceTable instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Instantiation instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Univ.IsFibrant instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.IsForced instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.IsHIT instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.IsPathCons instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Monad.Base.Judgement a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.DiscrimTree.Types.Key instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Coverage.SplitTree.LazySplit instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Level instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.LitPatternInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.MatchPrio instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.MutualId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.NotBlocked instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.OpaqueBlock instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Monad.Base.Open a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.PatOrigin instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.PatternInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Types.Polarity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ProjLams instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Projection instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.RewDom instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.RewriteHead instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.RewriteRule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Section instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Signature instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Substitution' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Term instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.TermHead instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Type' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Univ.Univ instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.CompiledClause.WithArity a) module Agda.TypeChecking.Serialise.Instances.Errors instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Types.ConfluenceCheck instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Types.Context instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Termination.CutOff.CutOff instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Pretty.Doc instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.ExecutablesFile instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.IllegalRewriteRuleReason instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Types.InfectiveCoinfective instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.IsAmbiguous instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.LHSOrPatSyn instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.LibPositionInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.LibWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.LibWarning' instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Parser.Monad.OpenBracket instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Definitions.Errors.OpenOrImport instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Base.OptionWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Parser.Monad.ParseWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Types.PragmaOptions instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.ProfileOptions.ProfileOption instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.ProfileOptions.ProfileOptions instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Warning.RecordFieldWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.SerialisableRewriteSource instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.TCWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Warning.UselessPublicReason instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Warning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Warnings.WarningMode instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Warnings.WarningModeError instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Warnings.WarningName module Agda.TypeChecking.Serialise.Instances instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Interface -- | Structure-sharing serialisation of Agda interface files. module Agda.TypeChecking.Serialise type InterfacePrefix = (Hash, Hash, Word64) -- | Hash-consed encoding of a value. type Encoded = (Word32, Array Node, Array String, Array Text, Array Text, Array Integer, Array VarSet, Array Double) -- | Encodes something as a hash-consed tuple of arrays. To ensure -- relocatability, file paths in positions are replaced with module -- names. encode :: EmbPrj a => a -> TCM Encoded -- | Encodes an interface. To ensure relocatability file paths in positions -- are replaced with module names. A hash-consed and compacted interface -- is returned. encodeFile :: FilePath -> Interface -> TCM Interface -- | Decode a hash-consed value. The result depends on the include path. decode :: EmbPrj a => Encoded -> MaybeT TCM a decodeFile :: FilePath -> TCM (Maybe Interface) -- | Decode an interface from a bytestring. We check the stored interface -- version against the current interface version, but we don't do -- anything with the hash prefix. decodeInterface :: ByteString -> MaybeT TCM Interface deserializeInterface :: ByteString -> MaybeT TCM Encoded deserializeHashes :: ByteString -> IO (Maybe (Hash, Hash)) module Agda.TypeChecking.Rewriting.Clause -- | Get all the clauses of a definition and convert them to rewrite rules. getClausesAsRewriteRules :: (HasConstInfo m, ReadTCState m, MonadFresh NameId m) => QName -> m [GlobalRewriteRule] -- | Generate a sensible name for the given clause clauseQName :: (HasConstInfo m, MonadFresh NameId m) => QName -> Int -> m QName -- | clauseToRewriteRule f q cl converts the clause cl of -- the function f to a rewrite rule with name q. -- Returns Nothing if clauseBody cl is -- Nothing. Precondition: clauseType cl is not -- Nothing. clauseToRewriteRule :: (MonadTCEnv m, ReadTCState m) => QName -> QName -> Clause -> m (Maybe GlobalRewriteRule) class ToNLPat a b toNLPat :: ToNLPat a b => a -> b ($dmtoNLPat) :: forall a' b' (f :: Type -> Type). (ToNLPat a b, ToNLPat a' b', Functor f, a ~ f a', b ~ f b') => a -> b instance Agda.TypeChecking.Rewriting.Clause.ToNLPat a b => Agda.TypeChecking.Rewriting.Clause.ToNLPat (Agda.Syntax.Internal.Abs a) (Agda.Syntax.Internal.Abs b) instance Agda.TypeChecking.Rewriting.Clause.ToNLPat (Agda.Syntax.Common.Arg Agda.Syntax.Internal.DeBruijnPattern) (Agda.Syntax.Internal.Elim.Elim' Agda.Syntax.Internal.NLPat) instance Agda.TypeChecking.Rewriting.Clause.ToNLPat (Agda.Syntax.Common.NamedArg Agda.Syntax.Internal.DeBruijnPattern) (Agda.Syntax.Internal.Elim.Elim' Agda.Syntax.Internal.NLPat) instance Agda.TypeChecking.Rewriting.Clause.ToNLPat a b => Agda.TypeChecking.Rewriting.Clause.ToNLPat (Agda.Syntax.Internal.Dom a) (Agda.Syntax.Internal.Dom b) instance Agda.TypeChecking.Rewriting.Clause.ToNLPat a b => Agda.TypeChecking.Rewriting.Clause.ToNLPat (Agda.Syntax.Internal.Elim.Elim' a) (Agda.Syntax.Internal.Elim.Elim' b) instance Agda.TypeChecking.Rewriting.Clause.ToNLPat a b => Agda.TypeChecking.Rewriting.Clause.ToNLPat [a] [b] module Agda.TypeChecking.Reduce.Monad enterClosure :: (MonadTCEnv m, ReadTCState m, LensClosure c a) => c -> (a -> m b) -> m b -- | Lookup the definition of a name. The result is a closed thing, all -- free variables have been abstracted over. getConstInfo :: HasConstInfo m => QName -> m Definition askR :: ReduceM ReduceEnv -- | Apply a function if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. applyWhenVerboseS :: MonadDebug m => VerboseKey -> VerboseLevel -> (m a -> m a) -> m a -> m a instance Agda.TypeChecking.Monad.Builtin.HasBuiltins Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Context.MonadAddContext Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Pure.PureTCM Agda.TypeChecking.Monad.Base.ReduceM -- | Facility to test throwing internal errors. module Agda.ImpossibleTest -- | If the given list of words is non-empty, print them as debug message -- (using __IMPOSSIBLE_VERBOSE__) before raising the internal -- error. impossibleTest :: (MonadDebug m, HasCallStack) => [String] -> m a impossibleTestReduceM :: HasCallStack => [String] -> TCM a -- | The translation of abstract syntax to concrete syntax has two -- purposes. First it allows us to pretty print abstract syntax values -- without having to write a dedicated pretty printer, and second it -- serves as a sanity check for the concrete to abstract translation: -- translating from concrete to abstract and then back again should be -- (more or less) the identity. module Agda.Syntax.Translation.AbstractToConcrete class ToConcrete a where { type ConOfAbs a; } toConcrete :: (ToConcrete a, MonadToConcrete m) => a -> m (ConOfAbs a) bindToConcrete :: (ToConcrete a, MonadToConcrete m) => a -> (ConOfAbs a -> m b) -> m b -- | Translate something in a context of the given precedence. toConcreteCtx :: (MonadToConcrete m, ToConcrete a) => Precedence -> a -> m (ConOfAbs a) -- | Preconditions to run the AbstractToConcrete translation. type MonadAbsToCon (m :: Type -> Type) = (MonadFileId m, MonadFresh NameId m, MonadInteractionPoints m, MonadStConcreteNames m, HasOptions m, PureTCM m, IsString m Doc, Null m Doc, Semigroup m Doc) abstractToConcrete_ :: (ToConcrete a, MonadAbsToCon m) => a -> m (ConOfAbs a) abstractToConcreteCtx :: (ToConcrete a, MonadAbsToCon m) => Precedence -> a -> m (ConOfAbs a) abstractToConcreteHiding :: (LensHiding i, ToConcrete a, MonadAbsToCon m) => i -> a -> m (ConOfAbs a) abstractToConcreteQName :: MonadAbsToCon m => AllowAmbiguousNames -> QName -> m QName abstractToConcreteScope :: (ToConcrete a, MonadAbsToCon m) => ScopeInfo -> a -> m (ConOfAbs a) abstractToConcreteTelescope :: MonadAbsToCon m => Telescope -> m [Maybe TypedBinding] abstractToConcreteUnqualify :: (ToConcrete a, MonadAbsToCon m) => a -> m (ConOfAbs a) data RangeAndPragma RangeAndPragma :: Range -> Pragma -> RangeAndPragma noTakenNames :: MonadToConcrete m => m a -> m a instance GHC.Internal.Base.Applicative m => GHC.Internal.Base.Applicative (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Syntax.Translation.AbstractToConcrete.MaybeSection a) instance GHC.Internal.Data.Foldable.Foldable Agda.Syntax.Translation.AbstractToConcrete.MaybeSection instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance GHC.Internal.Base.Functor Agda.Syntax.Translation.AbstractToConcrete.MaybeSection instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.Interaction.Options.HasOptions.HasOptions m => Agda.Interaction.Options.HasOptions.HasOptions (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Translation.AbstractToConcrete.MaybeSection a) instance (GHC.Internal.Base.Monad m, GHC.Internal.Data.String.IsString (m Agda.Syntax.Common.Pretty.Doc)) => GHC.Internal.Data.String.IsString (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m Agda.Syntax.Common.Pretty.Doc) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Base.MonadFresh Agda.Syntax.Common.NameId m => Agda.TypeChecking.Monad.Base.MonadFresh Agda.Syntax.Common.NameId (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints m => Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance GHC.Internal.Base.Monad m => Control.Monad.Reader.Class.MonadReader Agda.Syntax.Translation.AbstractToConcrete.Env (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames m => Agda.TypeChecking.Monad.Base.MonadStConcreteNames (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.Syntax.Translation.AbstractToConcrete.NameAspects Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Syntax.Translation.AbstractToConcrete.NameAspects Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.NameAspects Agda.Syntax.Abstract.Name.QName instance (GHC.Internal.Base.Monad m, Agda.Utils.Null.Null (m Agda.Syntax.Common.Pretty.Doc)) => Agda.Utils.Null.Null (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m Agda.Syntax.Common.Pretty.Doc) instance (Agda.TypeChecking.Monad.Builtin.HasBuiltins m, Agda.TypeChecking.Monad.Signature.HasConstInfo m, Agda.TypeChecking.Monad.Context.MonadAddContext m, Agda.Utils.FileId.MonadFileId m, Agda.TypeChecking.Monad.Base.MonadReduce m) => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Semigroup (Agda.Syntax.Translation.AbstractToConcrete.AbsToConT m Agda.Syntax.Common.Pretty.Doc) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Syntax.Translation.AbstractToConcrete.MaybeSection a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.BindName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Abstract.Binder' a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.BindingPattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete GHC.Internal.Types.Bool instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete GHC.Internal.Types.Char instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a, Agda.Syntax.Translation.AbstractToConcrete.ConOfAbs a GHC.Internal.Types.~ Agda.Syntax.Concrete.LHS) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Abstract.Clause' a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Constr Agda.Syntax.Abstract.Constructor) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Declaration instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (GHC.Internal.Data.Either.Either a1 a2) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Expr instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.FreshenName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Common.InteractionId instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LHS instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LHSCore instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete [a] instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.TypeChecking.Monad.Base.Types.NamedMeta instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Utils.List1.List1 a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Pattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.RHS instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.RangeAndPragma instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.RecordDirectives instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Scope.Base.ResolvedName instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete p, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.RewriteEqn' qn Agda.Syntax.Abstract.BindName p a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.SplitPattern Agda.Syntax.Abstract.Pattern) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.SplitPattern (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Pattern)) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Concrete.TacticAttribute' a) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (a1, a2) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a3) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (a1, a2, a3) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete () instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.UserPattern Agda.Syntax.Abstract.Pattern) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.UserPattern (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Pattern)) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.WithHiding a) instance GHC.Internal.Data.Traversable.Traversable Agda.Syntax.Translation.AbstractToConcrete.MaybeSection module Agda.Syntax.Abstract.Pretty showA :: (ToConcrete a, Show (ConOfAbs a), MonadAbsToCon m) => a -> m String prettyA :: (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) => a -> m Doc prettyAs :: (ToConcrete a, ConOfAbs a ~ [ce], Pretty ce, MonadAbsToCon m) => a -> m Doc -- | Variant of showA which does not insert outermost parentheses. showATop :: (ToConcrete a, Show (ConOfAbs a), MonadAbsToCon m) => a -> m String -- | Variant of prettyA which does not insert outermost parentheses. prettyATop :: (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) => a -> m Doc -- | Variant of prettyA which unqualifies out-of-scope names. prettyAUnqualify :: (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) => a -> m Doc module Agda.TypeChecking.MetaVars.Mention class MentionsMeta t mentionsMetas :: MentionsMeta t => HashSet MetaId -> t -> Bool mentionsMeta :: MentionsMeta t => MetaId -> t -> Bool instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.Syntax.Internal.Abs t) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta a => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Elim instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Level instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta [t] instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Sort instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta a => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Term instance (Agda.TypeChecking.MetaVars.Mention.MentionsMeta a, Agda.TypeChecking.MetaVars.Mention.MentionsMeta b) => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (a, b) instance (Agda.TypeChecking.MetaVars.Mention.MentionsMeta a, Agda.TypeChecking.MetaVars.Mention.MentionsMeta b, Agda.TypeChecking.MetaVars.Mention.MentionsMeta c) => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (a, b, c) instance (Agda.TypeChecking.MetaVars.Mention.MentionsMeta a, Agda.TypeChecking.MetaVars.Mention.MentionsMeta b, Agda.TypeChecking.MetaVars.Mention.MentionsMeta c, Agda.TypeChecking.MetaVars.Mention.MentionsMeta d) => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (a, b, c, d) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Type -- | Compute eta short normal forms. module Agda.TypeChecking.EtaContract data BinAppView App :: Term -> Arg Term -> BinAppView NoApp :: Term -> BinAppView binAppView :: Term -> BinAppView -- | Contracts all eta-redexes it sees without reducing. etaContract :: (HasConstInfo m, TermLike a) => a -> m a etaOnce :: HasConstInfo m => Term -> m Term -- | If record constructor, call eta-contraction function. etaCon :: HasConstInfo m => ConHead -> ConInfo -> Elims -> (QName -> ConHead -> ConInfo -> Args -> m Term) -> m Term -- | Try to contract a lambda-abstraction Lam i (Abs x b). etaLam :: (MonadTCEnv m, HasOptions m) => ArgInfo -> ArgName -> Term -> m Term module Agda.TypeChecking.Reduce -- | Instantiate something. Results in an open meta variable or a non meta. -- Doesn't do any reduction, and preserves blocking tags (when blocking -- meta is uninstantiated). class Instantiate t instantiate' :: Instantiate t => t -> ReduceM t instantiate :: (Instantiate a, MonadReduce m) => a -> m a -- | A variant of instantiateFull that only instantiates those -- meta-variables that satisfy the predicate. instantiateWhen :: (InstantiateFull a, MonadReduce m) => (MetaId -> ReduceM Bool) -> a -> m a -- | instantiateFull' instantiates metas everywhere (and -- recursively) but does not reduce. class InstantiateFull t instantiateFull' :: InstantiateFull t => t -> ReduceM t instantiateFull :: (InstantiateFull a, MonadReduce m) => a -> m a -- | Is something (an elimination of) a meta variable? Does not perform any -- reductions. class IsMeta a isMeta :: IsMeta a => a -> Maybe MetaId class Reduce t reduce' :: Reduce t => t -> ReduceM t reduceB' :: Reduce t => t -> ReduceM (Blocked t) reduce :: (Reduce a, MonadReduce m) => a -> m a reduceB :: (Reduce a, MonadReduce m) => a -> m (Blocked a) reduceWithBlocker :: (Reduce a, IsMeta a, MonadReduce m) => a -> m (Blocker, a) reduceIApply' :: (Term -> ReduceM (Blocked Term)) -> ReduceM (Blocked Term) -> [Elim] -> ReduceM (Blocked Term) -- | Reduce a non-primitive definition if it is a copy linking to another -- def. reduceDefCopy :: PureTCM m => QName -> Elims -> m (Reduced () Term) -- | Specialized version to put in boot file. reduceDefCopyTCM :: QName -> Elims -> TCM (Reduced () Term) -- | Recursively apply reduceDefCopy so remove all copy-indirections -- but otherwise do not reduce the term. reduceDefCopies :: Term -> TCM Term -- | Reduce simple (single clause) definitions. reduceHead :: PureTCM m => Term -> m (Blocked Term) slowReduceTerm :: Term -> ReduceM (Blocked Term) unfoldCorecursion :: Term -> ReduceM (Blocked Term) unfoldCorecursionE :: Elim -> ReduceM (Blocked Elim) unfoldDefinitionE :: (Term -> ReduceM (Blocked Term)) -> Term -> QName -> Elims -> ReduceM (Blocked Term) unfoldDefinitionStep :: Term -> QName -> Elims -> ReduceM (Reduced (Blocked Term) Term) -- | Unfold as many copies as possible, and then potentially a single -- inline function. unfoldInlined :: PureTCM m => Term -> m Term appDefE_ :: QName -> Term -> [Clause] -> Maybe CompiledClauses -> RewriteRules -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) -- | Like appDefE_, but takes the whole Definition and thus -- also handles data and record type copies, which are defined by a term -- rather than by clauses (see defCopyClause). Applying that term -- never gets stuck, so this also unfolds underapplied occurrences of the -- copy (issue #8545). appDefE0 :: QName -> Definition -> Term -> RewriteRules -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) -- | Apply a defined function to it's arguments, using the original -- clauses. appDef' :: QName -> Term -> [Clause] -> RewriteRules -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDefE' :: QName -> Term -> [Clause] -> RewriteRules -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) -- | Throw pattern violation if blocked or a meta. abortIfBlocked :: (MonadReduce m, MonadBlock m, IsMeta t, Reduce t) => t -> m t -- | Case on whether a term is blocked on a meta (or is a meta). That means -- it can change its shape when the meta is instantiated. ifBlocked :: (Reduce t, IsMeta t, MonadReduce m) => t -> (Blocker -> t -> m a) -> (NotBlocked -> t -> m a) -> m a isBlocked :: (Reduce t, IsMeta t, MonadReduce m) => t -> m (Maybe Blocker) -- | Throw a pattern violation if the argument is Blocked, -- otherwise return the value embedded in the NotBlocked. fromBlocked :: MonadBlock m => Blocked a -> m a -- | Run the given computation but turn any errors into blocked -- computations with the given blocker blockOnError :: Blocker -> TCM a -> TCM a -- | Only unfold definitions if this leads to simplification which means -- that a constructor/literal pattern is matched. We include reduction of -- IApply patterns, as `p i0` is akin to matcing on the i0 -- constructor of interval. class Simplify t simplify :: (Simplify a, MonadReduce m) => a -> m a simplifyBlocked' :: Simplify t => Blocked t -> ReduceM t class Normalise t normalise' :: Normalise t => t -> ReduceM t normalise :: (Normalise a, MonadReduce m) => a -> m a slowNormaliseArgs :: Term -> ReduceM Term instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.InstantiateFull a) => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Internal.Types.Bool instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Builtin a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Internal.Types.Char instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Types.Context instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Reduce.InstantiateFull e => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Dom e) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Data.HashMap.Internal.HashMap k t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Instantiation instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Internal.Types.Int instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Interface instance Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Judgement Agda.Syntax.Common.MetaId) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.LetBinding instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull [a] instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Data.Map.Internal.Map k t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Data.Strict.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Utils.List1.List1 t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Open t) instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Builtin.PrimitiveId instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.RewDom instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.RewriteRule instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Scope.Base.Scope instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Section instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Signature instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Substitution instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.System instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.InstantiateFull a) => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Reduce.InstantiateFull a, Agda.TypeChecking.Reduce.InstantiateFull b) => Agda.TypeChecking.Reduce.InstantiateFull (a, b) instance (Agda.TypeChecking.Reduce.InstantiateFull a, Agda.TypeChecking.Reduce.InstantiateFull b, Agda.TypeChecking.Reduce.InstantiateFull c) => Agda.TypeChecking.Reduce.InstantiateFull (a, b, c) instance (Agda.TypeChecking.Reduce.InstantiateFull a, Agda.TypeChecking.Reduce.InstantiateFull b, Agda.TypeChecking.Reduce.InstantiateFull c, Agda.TypeChecking.Reduce.InstantiateFull d) => Agda.TypeChecking.Reduce.InstantiateFull (a, b, c, d) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.CompiledClause.WithArity t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Abs t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Instantiate a => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Blocked a) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Instantiate a => Agda.TypeChecking.Reduce.Instantiate (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Instantiate e => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Dom e) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate [t] instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Data.Map.Internal.Map k t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Data.Strict.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Utils.List1.List1 t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.PlusLevel' t) instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.RewDom instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.RewriteRule instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Tele t) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Reduce.Instantiate a, Agda.TypeChecking.Reduce.Instantiate b) => Agda.TypeChecking.Reduce.Instantiate (a, b) instance (Agda.TypeChecking.Reduce.Instantiate a, Agda.TypeChecking.Reduce.Instantiate b, Agda.TypeChecking.Reduce.Instantiate c) => Agda.TypeChecking.Reduce.Instantiate (a, b, c) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.Instantiate () instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Reduce.IsMeta Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.Level' a) instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.PlusLevel' a) instance Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.Sort' a) instance Agda.TypeChecking.Reduce.IsMeta Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.Type'' t a) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.Normalise a) => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Normalise GHC.Internal.Types.Bool instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Normalise GHC.Internal.Types.Char instance Agda.TypeChecking.Reduce.Normalise a => Agda.TypeChecking.Reduce.Normalise (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Agda.TypeChecking.Reduce.Normalise GHC.Internal.Types.Int instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise [t] instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Data.Map.Internal.Map k t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Data.Strict.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Utils.List1.List1 t) instance Agda.TypeChecking.Reduce.Normalise a => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Common.Ranged t) instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Sort instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.Normalise a) => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Reduce.Normalise a, Agda.TypeChecking.Reduce.Normalise b) => Agda.TypeChecking.Reduce.Normalise (a, b) instance (Agda.TypeChecking.Reduce.Normalise a, Agda.TypeChecking.Reduce.Normalise b, Agda.TypeChecking.Reduce.Normalise c) => Agda.TypeChecking.Reduce.Normalise (a, b, c) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Common.WithHiding t) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.Reduce a) => Agda.TypeChecking.Reduce.Reduce (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Reduce a => Agda.TypeChecking.Reduce.Reduce (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Elim instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce [t] instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Reduce.Reduce e => Agda.TypeChecking.Reduce.Reduce (Data.Map.Internal.Map k e) instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.DeBruijnPattern instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Reduce.Reduce b) => Agda.TypeChecking.Reduce.Reduce (a, b) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Reduce.Reduce b, Agda.TypeChecking.Reduce.Reduce c) => Agda.TypeChecking.Reduce.Reduce (a, b, c) instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Type instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.Simplify a) => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Simplify GHC.Internal.Types.Bool instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Simplify a => Agda.TypeChecking.Reduce.Simplify (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify [t] instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.LocalEquation instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Data.Map.Internal.Map k t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Data.Strict.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (GHC.Internal.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Sort instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Reduce.Simplify a) => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Reduce.Simplify a, Agda.TypeChecking.Reduce.Simplify b) => Agda.TypeChecking.Reduce.Simplify (a, b) instance (Agda.TypeChecking.Reduce.Simplify a, Agda.TypeChecking.Reduce.Simplify b, Agda.TypeChecking.Reduce.Simplify c) => Agda.TypeChecking.Reduce.Simplify (a, b, c) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Type' t) module Agda.TypeChecking.Telescope -- | Flatten telescope: (Γ : Tel) -> [Type Γ]. -- -- flattenTel is lazy in both the spine and values of the -- resulting list. flattenTel :: TermSubst a => Tele (Dom a) -> [Dom a] -- | Flatten telescope: (Γ : Tel) -> [Type Γ] into a reversed -- list. -- -- flattenRevTel is lazy in both the spine and values of the -- resulting list. flattenRevTel :: TermSubst a => Tele (Dom a) -> [Dom a] -- | Turn a context into a flat telescope: all entries live in the whole -- context. (Γ : Context) -> [Type Γ] flattenContext :: Context -> [ContextEntry] -- | Order a flattened telescope in the correct dependency order: Γ -> -- Permutation (Γ -> Γ~) -- -- Since reorderTel tel uses free variable analysis of type in -- tel, the telescope should be normalised. reorderTel :: [Dom Type] -> Maybe Permutation reorderTel_ :: [Dom Type] -> Permutation -- | Unflatten: turns a flattened telescope into a proper telescope. Must -- be properly ordered. unflattenTel :: [ArgName] -> [Dom Type] -> Telescope -- | A variant of unflattenTel which takes the size of the last -- argument as an argument. unflattenTel' :: Int -> [ArgName] -> [Dom Type] -> Telescope -- | Rename the variables in the telescope to the given names Precondition: -- size xs == size tel. renameTel :: [Maybe ArgName] -> Telescope -> Telescope -- | Get the suggested names from a telescope teleNames :: Telescope -> [ArgName] teleArgNames :: Telescope -> [Arg ArgName] -- | Convert a telescope to a list of Arg in left-to-right order: -- --
--   teleArgs ((a : A) (b : B a) {c : C}) = [a, b, {c}] = [2, 1, {0}]
--   
teleArgs :: DeBruijn a => Tele (Dom t) -> [Arg a] -- | Convert a telescope to a list of Dom in left-to-right order: -- --
--   teleDoms ((a : A) (b : B a) {c : C}) = [a, b, {c}] = [2, 1, {0}]
--   
teleDoms :: DeBruijn a => Tele (Dom t) -> [Dom a] teleNamedArgs :: DeBruijn a => Tele (Dom t) -> [NamedArg a] -- | A variant of teleNamedArgs which takes the argument names (and -- the argument info) from the first telescope and the variable names -- from the second telescope. -- -- Precondition: the two telescopes have the same length. tele2NamedArgs :: DeBruijn a => Telescope -> Telescope -> [NamedArg a] -- | Split the telescope at the specified position. splitTelescopeAt :: Int -> Telescope -> (Telescope, Telescope) -- | Permute telescope: permutes or drops the types in the telescope -- according to the given permutation (on de Bruijn _levels_). Assumes -- that the permutation preserves the dependencies in the telescope. -- -- For example (Andreas, 2016-12-18, issue #2344): tel = (A : Set) -- (X : _18 A) (i : Fin (_m_23 A X)) tel (de Bruijn) = 2:Set, 1:_18 -- 0, 0:Fin(_m_23 1 0) flattenTel tel = 2:Set, 1:_18 0, -- 0:Fin(_m_23 1 0) |- [ Set, _18 2, Fin (_m_23 2 -- 1) ] perm = 0,1,2 -> 0,1 (picks the first two) renaming _ perm -- = [var 0, var 1, error] -- THE WRONG RENAMING! (levels) renaming _ -- (reverseP perm) = [error, var 0, var 1] -- The correct renaming! -- (indices) apply to flattened tel = ... |- [ Set, _18 1, Fin (_m_23 -- 1 0) ] permute perm it = ... |- [ Set, _18 1 ] unflatten -- (de Bruijn) = 1:Set, 0: _18 0 unflatten = (A : Set) (X : _18 A) -- permuteTel :: Permutation -> Telescope -> Telescope -- | Like permuteTel, but start with a context. permuteContext :: Permutation -> Context -> Telescope -- | Recursively computes dependencies of a set of variables in a given -- telescope. Any dependencies outside of the telescope are ignored. -- -- Note that varDependencies considers a variable to depend on -- itself. varDependencies :: Telescope -> VarSet -> VarSet -- | Computes the set of variables in a telescope whose type depend on one -- of the variables in the given set (including recursive dependencies). -- Any dependencies outside of the telescope are ignored. -- -- Unlike varDependencies, a variable is *not* considered to -- depend on itself. varDependents :: Telescope -> VarSet -> VarSet -- | A telescope split in two. data SplitTel SplitTel :: Telescope -> Telescope -> Permutation -> SplitTel [firstPart] :: SplitTel -> Telescope [secondPart] :: SplitTel -> Telescope -- | The permutation (of de Bruijn _levels_) that takes us from the -- original telescope to firstPart ++ secondPart. [splitPerm] :: SplitTel -> Permutation -- | Split a telescope into the part that defines the given variables and -- the part that doesn't. -- -- See prop_splitTelescope. splitTelescope :: VarSet -> Telescope -> SplitTel -- | As splitTelescope, but fails if any additional variables or reordering -- would be needed to make the first part well-typed. splitTelescopeExact :: [Int] -> Telescope -> Maybe SplitTel -- | Try to instantiate one variable in the telescope (given by its de -- Bruijn level) with the given value, returning the new telescope and a -- substitution to the old one. Returns Nothing if the given value -- depends (directly or indirectly) on the variable. instantiateTelescope :: Telescope -> Int -> DeBruijnPattern -> Maybe (Telescope, PatternSubstitution, Permutation) -- | Try to eta-expand one variable in the telescope (given by its de -- Bruijn level) expandTelescopeVar :: Telescope -> Int -> Telescope -> ConHead -> (Telescope, PatternSubstitution) -- | Gather leading Πs of a type in a telescope. telView :: (MonadReduce m, MonadAddContext m) => Type -> m TelView -- | telViewUpTo n t takes off the first n function types -- of t. Takes off all if n < 0. telViewUpTo :: (MonadReduce m, MonadAddContext m) => Int -> Type -> m TelView -- | telViewUpTo' n p t takes off $t$ the first n (or -- arbitrary many if n < 0) function domains as long as they -- satify p. telViewUpTo' :: (MonadReduce m, MonadAddContext m) => Int -> (Dom Type -> Bool) -> Type -> m TelView -- | Returns Nothing if there are invalidated local rewrite rules present -- in the telescope safeTelViewUpTo' :: forall (m :: Type -> Type). (MonadReduce m, MonadAddContext m) => Int -> (Dom Type -> Bool) -> Type -> MaybeT m TelView telViewPath :: PureTCM m => Type -> m TelView -- | telViewUpToPath n t takes off t the first n -- (or arbitrary many if n < 0) function domains or Path -- types. -- --
--   telViewUpToPath n t = fst $ telViewUpToPathBoundary' n t
--   
telViewUpToPath :: PureTCM m => Int -> Type -> m TelView -- | Boundary conditions [[ (i,(x,y)) ]] = [(i=0) -> x, (i=1) -> -- y]. For instance, if p : Path A a b, then p i -- has boundary condition (i,(a,b)). We call i the -- dimension and (x,y) its boundary. newtype Boundary' x a Boundary :: [(x, (a, a))] -> Boundary' x a [theBoundary] :: Boundary' x a -> [(x, (a, a))] -- | Usually, the dimensions of a boundary condition are interval -- variables, represented by a de Bruijn index Int. type Boundary = Boundary' Int Term -- | Substitution formally creates dimensions that are interval -- expressions, represented by a Term. However, in -- practice these terms should be of the form var i. type TmBoundary = Boundary' Term Term -- | Turn dimension variables i into dimension expressions -- var i. tmBoundary :: Boundary' Int a -> Boundary' Term a -- | Turn dimension expressions into dimension variables. Formally this is -- a partial operation, but should only be called when the precondition -- is met. -- -- Precondition: the dimension terms in the boundary are all of the form -- var i. varBoundary :: Boundary' Term a -> Boundary' Int a -- | Like telViewUpToPath but also returns the Boundary -- expected by the Path types encountered. The boundary terms live in the -- telescope given by the TelView. Each point of the boundary has -- the type of the codomain of the Path type it got taken from, see -- fullBoundary. -- --
--   (TelV Γ b, [(i,t_i,u_i)]) <- telViewUpToPathBoundary' n a
--   Input:  Δ ⊢ a
--   Output: Δ.Γ ⊢ b
--           Δ.Γ ⊢ T is the codomain of the PathP at variable i
--           Δ.Γ ⊢ i : I
--           Δ.Γ ⊢ [ (i=0) -> t_i; (i=1) -> u_i ] : T
--   
-- -- Useful to reconstruct IApplyP patterns after teleNamedArgs Γ. telViewUpToPathBoundary' :: PureTCM m => Int -> Type -> m (TelView, Boundary) fullBoundary :: Telescope -> Boundary -> Boundary -- | (TelV Γ b, [(i,t_i,u_i)]) <- telViewUpToPathBoundary n a -- Input: Δ ⊢ a Output: ΔΓ ⊢ b ΔΓ ⊢ i : I ΔΓ ⊢ [ (i=0) -> t_i; (i=1) -- -> u_i ] : b telViewUpToPathBoundary :: PureTCM m => Int -> Type -> m (TelView, Boundary) telViewPathBoundary :: PureTCM m => Type -> m (TelView, Boundary) -- | teleElimsB args bs = es Input: Δ.Γ ⊢ args : Γ Δ.Γ ⊢ T is the -- codomain of the PathP at variable i Δ.Γ ⊢ i : I Δ.Γ ⊢ bs = [ (i=0) -- -> t_i; (i=1) -> u_i ] : T Output: Δ.Γ | PiPath Γ bs A ⊢ es : A teleElims :: DeBruijn a => Telescope -> Boundary' Int a -> [Elim' a] -- | Reduces Type. pathViewAsPi :: PureTCM m => Type -> m (Either (Dom Type, Abs Type) Type) -- | Reduces Type. pathViewAsPi' :: PureTCM m => Type -> m (Either ((Dom Type, Abs Type), (Term, Term)) Type) pathViewAsPi'whnf :: HasBuiltins m => m (Type -> Either ((Dom Type, Abs Type), (Term, Term)) Type) -- | Returns Left (a,b) in case the type is Pi a b or -- PathP b _ _. Assumes the Type is in whnf. piOrPath :: HasBuiltins m => Type -> m (Either (Dom Type, Abs Type) Type) -- | Assumes Type is in whnf. telView'UpToPath :: Int -> Type -> TCM TelView telView'Path :: Type -> TCM TelView isPath :: PureTCM m => Type -> m (Maybe (Dom Type, Abs Type)) ifPath :: PureTCM m => Type -> (Dom Type -> Abs Type -> m a) -> (Type -> m a) -> m a ifPathB :: PureTCM m => Type -> (Dom Type -> Abs Type -> m a) -> (Blocked Type -> m a) -> m a ifNotPathB :: PureTCM m => Type -> (Blocked Type -> m a) -> (Dom Type -> Abs Type -> m a) -> m a ifPiOrPathB :: PureTCM m => Type -> (Dom Type -> Abs Type -> m a) -> (Blocked Type -> m a) -> m a ifNotPiOrPathB :: PureTCM m => Type -> (Blocked Type -> m a) -> (Dom Type -> Abs Type -> m a) -> m a telePatterns :: DeBruijn a => Telescope -> Boundary -> [NamedArg (Pattern' a)] telePatterns' :: DeBruijn a => (forall a1. DeBruijn a1 => Telescope -> [NamedArg a1]) -> Telescope -> Boundary -> [NamedArg (Pattern' a)] -- | Decomposing a function type. mustBePi :: MonadReduce m => Type -> m (Dom Type, Abs Type) -- | If the given type is a Pi, pass its parts to the first -- continuation. If not (or blocked), pass the reduced type to the second -- continuation. ifPi :: MonadReduce m => Term -> (Dom Type -> Abs Type -> m a) -> (Term -> m a) -> m a ifPiB :: MonadReduce m => Term -> (Dom Type -> Abs Type -> m a) -> (Blocked Term -> m a) -> m a ifPiTypeB :: MonadReduce m => Type -> (Dom Type -> Abs Type -> m a) -> (Blocked Type -> m a) -> m a -- | If the given type is a Pi, pass its parts to the first -- continuation. If not (or blocked), pass the reduced type to the second -- continuation. ifPiType :: MonadReduce m => Type -> (Dom Type -> Abs Type -> m a) -> (Type -> m a) -> m a -- | If the given type is blocked or not a Pi, pass it reduced to -- the first continuation. If it is a Pi, pass its parts to the -- second continuation. ifNotPi :: MonadReduce m => Term -> (Term -> m a) -> (Dom Type -> Abs Type -> m a) -> m a -- | If the given type is blocked or not a Pi, pass it reduced to -- the first continuation. If it is a Pi, pass its parts to the -- second continuation. ifNotPiType :: MonadReduce m => Type -> (Type -> m a) -> (Dom Type -> Abs Type -> m a) -> m a ifNotPiOrPathType :: (MonadReduce tcm, HasBuiltins tcm) => Type -> (Type -> tcm a) -> (Dom Type -> Abs Type -> tcm a) -> tcm a shouldBePath :: (PureTCM m, MonadBlock m, MonadTCError m) => Type -> m (Dom Type, Abs Type) shouldBePi :: (PureTCM m, MonadBlock m, MonadTCError m) => Type -> m (Dom Type, Abs Type) shouldBePiOrPath :: (PureTCM m, MonadBlock m, MonadTCError m) => Type -> m (Dom Type, Abs Type) -- | A safe variant of piApply. class PiApplyM a piApplyM' :: (PiApplyM a, MonadReduce m, HasBuiltins m) => m Empty -> Type -> a -> m Type piApplyM :: (PiApplyM a, MonadReduce m, HasBuiltins m) => Type -> a -> m Type -- | Compute type arity typeArity :: Type -> TCM Nat -- | Fold a telescope into a monadic computation, adding variables to the -- context at each step. foldrTelescopeM :: MonadAddContext m => (Dom (ArgName, Type) -> m b -> m b) -> m b -> Telescope -> m b instance Agda.Utils.Null.Null (Agda.TypeChecking.Telescope.Boundary' x a) instance Agda.TypeChecking.Telescope.PiApplyM a => Agda.TypeChecking.Telescope.PiApplyM (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Telescope.PiApplyM a => Agda.TypeChecking.Telescope.PiApplyM [a] instance Agda.TypeChecking.Telescope.PiApplyM a => Agda.TypeChecking.Telescope.PiApplyM (Agda.Syntax.Common.Named n a) instance Agda.TypeChecking.Telescope.PiApplyM Agda.Syntax.Internal.Term instance (Agda.Syntax.Common.Pretty.Pretty x, Agda.Syntax.Common.Pretty.Pretty a) => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Telescope.Boundary' x a) instance (GHC.Internal.Show.Show x, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Agda.TypeChecking.Telescope.Boundary' x a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Telescope.Boundary instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Telescope.TmBoundary -- | A syntactic equality check that takes meta instantiations into -- account, but does not reduce. It replaces (v, v') <- -- instantiateFull (v, v') v == v' by a more efficient routine -- which only traverses and instantiates the terms as long as they are -- equal. module Agda.TypeChecking.SyntacticEquality -- | Instantiate full as long as things are equal class SynEq a -- | Syntactic equality check for terms. If syntactic equality checking has -- fuel left, then checkSyntacticEquality behaves as if it were -- implemented in the following way (which does not match the given type -- signature), only that v and v' are only fully -- instantiated to the depth where they are equal (and the amount of fuel -- is reduced by one unit in the failure branch): -- checkSyntacticEquality v v' s f = do (v, v') <- instantiateFull (v, -- v') if v == v' then s v v' else f v v' If syntactic equality -- checking does not have fuel left, then checkSyntacticEquality -- instantiates the two terms and takes the failure branch. -- -- Note that in either case the returned values v and -- v' cannot be MetaVs that are instantiated. checkSyntacticEquality :: (Instantiate a, SynEq a, MonadReduce m) => a -> a -> (a -> a -> m b) -> (a -> a -> m b) -> m b -- | Syntactic equality check for terms without checking remaining fuel. checkSyntacticEquality' :: (SynEq a, MonadReduce m) => a -> a -> (a -> a -> m b) -> (a -> a -> m b) -> m b -- | Does the syntactic equality check have any remaining fuel? syntacticEqualityFuelRemains :: MonadReduce m => m Bool instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.SyntacticEquality.SynEq a) => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.SyntacticEquality.SynEq GHC.Internal.Types.Bool instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Level instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq [a] instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Sort instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Term instance (Agda.TypeChecking.SyntacticEquality.SynEq a, Agda.TypeChecking.SyntacticEquality.SynEq b) => Agda.TypeChecking.SyntacticEquality.SynEq (a, b) instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Type -- | Tools to manipulate patterns in internal syntax in the TCM (type -- checking monad). module Agda.TypeChecking.Patterns.Internal -- | Convert a term (from a dot pattern) to a DeBruijn pattern. class TermToPattern a b termToPattern :: TermToPattern a b => a -> TCM b ($dmtermToPattern) :: forall a' b' (f :: Type -> Type). (TermToPattern a b, TermToPattern a' b', Traversable f, a ~ f a', b ~ f b') => a -> TCM b dotPatternsToPatterns :: DeBruijn (Pattern' a) => Pattern' a -> TCM (Pattern' a) instance Agda.TypeChecking.Patterns.Internal.TermToPattern a b => Agda.TypeChecking.Patterns.Internal.TermToPattern (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.TypeChecking.Patterns.Internal.TermToPattern a b => Agda.TypeChecking.Patterns.Internal.TermToPattern [a] [b] instance Agda.TypeChecking.Patterns.Internal.TermToPattern a b => Agda.TypeChecking.Patterns.Internal.TermToPattern (Agda.Syntax.Common.Named c a) (Agda.Syntax.Common.Named c b) instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn (Agda.Syntax.Internal.Pattern' a) => Agda.TypeChecking.Patterns.Internal.TermToPattern Agda.Syntax.Internal.Term (Agda.Syntax.Internal.Pattern' a) module Agda.TypeChecking.Level data LevelKit LevelKit :: Term -> (Term -> Term) -> (Term -> Term -> Term) -> Term -> QName -> QName -> QName -> QName -> LevelKit [lvlType] :: LevelKit -> Term [lvlSuc] :: LevelKit -> Term -> Term [lvlMax] :: LevelKit -> Term -> Term -> Term [lvlZero] :: LevelKit -> Term [typeName] :: LevelKit -> QName [sucName] :: LevelKit -> QName [maxName] :: LevelKit -> QName [zeroName] :: LevelKit -> QName -- | Get the primLevel as a Type. Aborts if any of the level -- BUILTINs is undefined. levelType :: (HasBuiltins m, MonadTCError m) => m Type -- | Get the primLevel as a Type. Unsafe, crashes if the -- BUILTIN LEVEL is undefined. levelType' :: HasBuiltins m => m Type isLevelType :: PureTCM m => Type -> m Bool builtinLevelKit :: HasBuiltins m => m LevelKit -- | Raises an error if no level kit is available. requireLevels :: (HasBuiltins m, MonadTCError m) => m LevelKit -- | Checks whether level kit is fully available. haveLevels :: HasBuiltins m => m Bool unLevel :: HasBuiltins m => Term -> m Term reallyUnLevelView :: HasBuiltins m => Level -> m Term unlevelWithKit :: LevelKit -> Level -> Term unConstV :: Term -> (Term -> Term) -> Integer -> Term unPlusV :: (Term -> Term) -> PlusLevel -> Term levelView :: PureTCM m => Term -> m Level levelView' :: PureTCM m => Term -> m Level -- | Given a level l, find the maximum constant n such -- that l = n + l' levelPlusView :: Level -> (Integer, Level) -- | Given a level l, find the biggest constant n such -- that n <= l levelLowerBound :: Level -> Integer -- | Given a constant n and a level l, find the level -- l' such that l = n + l' (or Nothing if there is no -- such level). Operates on levels in canonical form. subLevel :: Integer -> Level -> Maybe Level -- | Given two levels a and b, try to decompose the first -- one as a = a' ⊔ b (for the minimal value of a'). levelMaxDiff :: Level -> Level -> Maybe Level -- | A SingleLevel is a Level that cannot be further -- decomposed as a maximum a ⊔ b. data SingleLevel' t SingleClosed :: Integer -> SingleLevel' t SinglePlus :: PlusLevel' t -> SingleLevel' t type SingleLevel = SingleLevel' Term unSingleLevel :: SingleLevel' t -> Level' t -- | Return the maximum of the given SingleLevels unSingleLevels :: [SingleLevel] -> Level levelMaxView :: Level' t -> List1 (SingleLevel' t) singleLevelView :: Level' t -> Maybe (SingleLevel' t) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Level.SingleLevel instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Level.SingleLevel' instance Agda.TypeChecking.Free.Generic.Free t => Agda.TypeChecking.Free.Generic.Free (Agda.TypeChecking.Level.SingleLevel' t) instance GHC.Internal.Base.Functor Agda.TypeChecking.Level.SingleLevel' instance GHC.Internal.Show.Show t => GHC.Internal.Show.Show (Agda.TypeChecking.Level.SingleLevel' t) instance Agda.TypeChecking.Substitute.Class.Subst t => Agda.TypeChecking.Substitute.Class.Subst (Agda.TypeChecking.Level.SingleLevel' t) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Level.SingleLevel' module Agda.TypeChecking.LevelConstraints -- | simplifyLevelConstraint c cs turns an c into an -- equality constraint if it is an inequality constraint and the reverse -- inequality is contained in cs. -- -- The constraints don't necessarily have to live in the same context, -- but they do need to be universally quanitfied over the context. This -- function takes care of renaming variables when checking for matches. simplifyLevelConstraint :: Constraint -> List1 Constraint -> Maybe [Constraint] instance GHC.Internal.Classes.Eq Agda.TypeChecking.LevelConstraints.Leq instance GHC.Internal.Show.Show Agda.TypeChecking.LevelConstraints.Leq module Agda.TypeChecking.Level.Solve -- | Run the given action. If --cumulativity is off, that's it. -- -- Otherwise, at the end, take all new metavariables of type level for -- which the only constraints are upper bounds on the level, and -- instantiate them to the lowest level. defaultOpenLevelsToZero :: (PureTCM m, MonadMetaSolver m) => m a -> m a defaultLevelsToZero :: (PureTCM m, MonadMetaSolver m) => LocalMetaStore -> m () -- | Free variable check that reduces the subject to make certain variables -- not free. Used when pruning metavariables in -- Agda.TypeChecking.MetaVars.Occurs. module Agda.TypeChecking.Free.Reduce class (PrecomputeFreeVars a, Subst a) => ForceNotFree a -- | Try to enforce a set of variables not occurring in a given type. -- Returns a possibly reduced version of the type and for each of the -- given variables whether it is either not free, or maybe free depending -- on some metavariables. forceNotFree :: (ForceNotFree a, Reduce a) => VarSet -> a -> ReduceM (IntMap IsFree, a) -- | Try to force a binder to be a NoAbs by reducing the body as needed to -- get rid of the bound variable. Returns either the reduced abstraction -- and the occurrence of the variable (if removing it failed) or else the -- strengthened body. forceNoAbs :: (Reduce a, ForceNotFree a) => Dom Type -> Abs a -> ReduceM (Either (Abs a, FlexRig) a) -- | András 2026-02-24: we specialize this, because TypeChecking.Reduce -- imports it via the hs-boot file, and if it's not specialized there, it -- is impossible to specialzie by GHC. forceNoAbsSort :: Dom Type -> Abs Sort -> ReduceM (Either (Abs Sort, FlexRig) Sort) -- | Checks if the given term contains any free variables that are in the -- given set of variables, possibly reducing the term in the process. -- Returns `Right Nothing` if there are such variables, `Right (Just v')` -- if there are none (where v' is the possibly reduced version of the -- given term) or `Left b` if the problem is blocked on a meta. reallyFree :: (Reduce a, ForceNotFree a) => VarSet -> a -> ReduceM (Either Blocked_ (Maybe a)) -- | A variable can either not occur (NotFree) or it does occur -- (MaybeFree). In the latter case, the occurrence may disappear -- depending on the instantiation of some set of metas. data IsFree MaybeFree :: FlexRig -> IsFree NotFree :: IsFree -- | Get the set of NotFree variables from a variable map. nonFreeVars :: IntMap IsFree -> VarSet instance GHC.Internal.Classes.Eq Agda.TypeChecking.Free.Reduce.IsFree instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Internal.Abs a) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Common.Arg a) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a, Agda.TypeChecking.Substitute.Class.TermSubst a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Internal.Dom a) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Level instance Agda.TypeChecking.Free.Reduce.ForceNotFree a => Agda.TypeChecking.Free.Reduce.ForceNotFree [a] instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Term instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Type instance GHC.Internal.Show.Show Agda.TypeChecking.Free.Reduce.IsFree -- | Tools for DisplayTerm and DisplayForm. module Agda.TypeChecking.DisplayForm -- | Find a matching display form for q es. In essence this tries -- to rewrite q es with any display form q ps --> dt -- and returns the instantiated dt if successful. First match -- wins. displayForm :: MonadDisplayForm m => QName -> Elims -> m (Maybe DisplayTerm) instance Agda.TypeChecking.DisplayForm.Match a => Agda.TypeChecking.DisplayForm.Match (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.DisplayForm.Match a => Agda.TypeChecking.DisplayForm.Match (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.DisplayForm.Match Agda.Syntax.Internal.Level instance Agda.TypeChecking.DisplayForm.Match a => Agda.TypeChecking.DisplayForm.Match [a] instance Agda.TypeChecking.DisplayForm.Match Agda.Syntax.Internal.Sort instance Agda.TypeChecking.DisplayForm.Match Agda.Syntax.Internal.Term instance Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Common.Arg Agda.Syntax.Internal.Term) instance Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Common.Arg Agda.TypeChecking.Monad.Base.DisplayTerm) instance Agda.TypeChecking.DisplayForm.SubstWithOrigin Agda.TypeChecking.Monad.Base.DisplayTerm instance (Agda.TypeChecking.DisplayForm.SubstWithOrigin a, Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Common.Arg a)) => Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.DisplayForm.SubstWithOrigin a => Agda.TypeChecking.DisplayForm.SubstWithOrigin [a] instance Agda.TypeChecking.DisplayForm.SubstWithOrigin a => Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Utils.List1.List1 a) instance Agda.TypeChecking.DisplayForm.SubstWithOrigin Agda.Syntax.Internal.Term module Agda.TypeChecking.DeadCode -- | Run before serialisation to remove data that's not reachable from the -- public interface. We do not compute reachable data precisely, because -- that would be very expensive, mainly because of rewrite rules. The -- following things are assumed to be "roots": - public definitions - -- definitions marked as primitive - definitions with COMPILE pragma - -- all pattern synonyms (because currently all of them go into -- interfaces) - all parameter sections (because currently all of them go -- into interfaces) (see also issues #6931 and #7382) - local builtins - -- all rewrite rules - closed display forms We only ever prune dead -- metavariables and definitions. We return the pruned metas, pruned -- definitions and closed display forms. eliminateDeadCode :: ScopeInfo -> TCM (RemoteMetaStore, Definitions, DisplayForms) module Agda.TypeChecking.CompiledClause.Match matchCompiled :: CompiledClauses -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Args) Term) -- | matchCompiledE c es takes a function given by case tree -- c and and a spine es and tries to apply the function -- to es. matchCompiledE :: CompiledClauses -> MaybeReducedElims -> ReduceM (Reduced (Blocked Elims) Term) -- | A stack entry is a triple consisting of 1. the part of the case tree -- to continue matching, 2. the current argument vector, and 3. a patch -- function taking the current argument vector back to the original -- argument vector. type Frame = (CompiledClauses, MaybeReducedElims, Elims -> Elims) type Stack = [Frame] -- | match' tries to solve the matching problems on the -- Stack. In each iteration, the top problem is removed and -- handled. -- -- If the top problem was a Done, we succeed. -- -- If the top problem was a Case n and the nth argument -- of the problem is not a constructor or literal, we are stuck, thus, -- fail. -- -- If we have a branch for the constructor/literal, we put it on the -- stack to continue. If we do not have a branch, we fall through to the -- next problem, which should be the corresponding catch-all branch. -- -- An empty stack is an exception that can come only from an incomplete -- function definition. match' :: Stack -> ReduceM (Reduced (Blocked Elims) Term) -- | Checking for recursion: -- -- -- -- Original contribution by Andrea Vezzosi (sanzhiyan). This -- implementation by Andreas. module Agda.Termination.RecCheck -- | The mutual block we are checking. -- -- The functions are numbered according to their order of appearance in -- this set. type MutualNames = Set QName -- | Given a list of formally mutually recursive functions, check for -- actual recursive calls in the bodies of these functions. Returns the -- actually recursive functions as strongly connected components. -- -- As a side effect, update the clauseRecursive field in the -- clauses belonging to the given functions. recursive :: Set QName -> TCM [MutualNames] -- | anysDef names a returns all definitions from names -- that are used in a. anyDefs :: GetDefs a => Set QName -> a -> TCM (Set QName) module Agda.Syntax.Translation.ReflectedToAbstract type Vars = [(Name, Type)] type MonadReflectedToAbstract (m :: Type -> Type) = (MonadReader Vars m, MonadFresh NameId m, MonadError TCErr m, MonadTCEnv m, ReadTCState m, HasOptions m, HasBuiltins m, HasConstInfo m) -- | Adds a new unique name to the current context. NOTE: See -- chooseName in -- Agda.Syntax.Translation.AbstractToConcrete for similar logic. -- NOTE: See freshConcreteName in -- Agda.Syntax.Scope.Monad also for similar logic. withName :: MonadReflectedToAbstract m => String -> (Name -> m a) -> m a withVar :: MonadReflectedToAbstract m => String -> Type -> (Name -> m a) -> m a withNames :: MonadReflectedToAbstract m => [String] -> ([Name] -> m a) -> m a withVars :: MonadReflectedToAbstract m => [(String, Type)] -> ([Name] -> m a) -> m a -- | Returns the name and type of the variable with the given de Bruijn -- index. askVar :: MonadReflectedToAbstract m => Int -> m (Maybe (Name, Type)) askName :: MonadReflectedToAbstract m => Int -> m (Maybe Name) class ToAbstract r where { type AbsOfRef r; } toAbstract :: (ToAbstract r, MonadReflectedToAbstract m) => r -> m (AbsOfRef r) ($dmtoAbstract) :: forall (t :: Type -> Type) s m. (ToAbstract r, Traversable t, ToAbstract s, t s ~ r, t (AbsOfRef s) ~ AbsOfRef r, MonadReflectedToAbstract m) => r -> m (AbsOfRef r) -- | Translate reflected syntax to abstract, using the names from the -- current typechecking context. toAbstract_ :: (ToAbstract r, MonadFresh NameId m, MonadError TCErr m, ReadTCState m, HasBuiltins m, HasConstInfo m) => r -> m (AbsOfRef r) -- | Drop implicit arguments unless --show-implicit is on. toAbstractWithoutImplicit :: (ToAbstract r, MonadFresh NameId m, MonadError TCErr m, ReadTCState m, HasBuiltins m, HasConstInfo m) => r -> m (AbsOfRef r) mkMetaInfo :: ReadTCState m => m MetaInfo mkDef :: HasConstInfo m => QName -> m Expr mkApp :: Expr -> Expr -> Expr mkVar :: MonadReflectedToAbstract m => Int -> m (Name, Type) mkVarName :: MonadReflectedToAbstract m => Int -> m Name -- | Check that all variables in the telescope are bound in the left-hand -- side. Since we check the telescope by attaching type annotations to -- the pattern variables there needs to be somewhere to put the -- annotation. Also, since the lhs is where the variables are actually -- bound, missing a binding for a variable that's used later in the -- telescope causes unbound variable panic (see #5044). checkClauseTelescopeBindings :: MonadReflectedToAbstract m => [(Text, Arg Type)] -> [Arg Pattern] -> m () instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract r => Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Reflected.Abs r) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract r => Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Common.Arg r) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract r => Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract [Agda.Syntax.Common.Arg r] instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract [Agda.Syntax.Abstract.Name.QNamed Agda.Syntax.Reflected.Clause] instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract Agda.Syntax.Literal.Literal instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract r => Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Common.Named name r) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Utils.List1.List1 (Agda.Syntax.Abstract.Name.QNamed Agda.Syntax.Reflected.Clause)) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract Agda.Syntax.Reflected.Pattern instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Abstract.Name.QNamed Agda.Syntax.Reflected.Clause) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract Agda.Syntax.Reflected.Sort instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract Agda.Syntax.Reflected.Term instance (Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract r, Agda.Syntax.Translation.ReflectedToAbstract.AbsOfRef r GHC.Internal.Types.~ Agda.Syntax.Abstract.Expr) => Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Internal.Dom r, Agda.Syntax.Abstract.Name.Name) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Abstract.Expr, Agda.Syntax.Reflected.Elim) instance Agda.Syntax.Translation.ReflectedToAbstract.ToAbstract (Agda.Syntax.Abstract.Expr, Agda.Syntax.Reflected.Elims) -- | Translating from internal syntax to abstract syntax. Enables nice -- pretty printing of internal syntax. -- -- TODO -- -- module Agda.Syntax.Translation.InternalToAbstract class Reify i where { type ReifiesTo i; } reify :: (Reify i, MonadReify m) => i -> m (ReifiesTo i) reifyWhen :: (Reify i, MonadReify m) => Bool -> i -> m (ReifiesTo i) type MonadReify (m :: Type -> Type) = (PureTCM m, MonadInteractionPoints m, MonadFresh NameId m) data NamedClause -- | Also tracks whether module parameters should be dropped from the -- patterns. NamedClause :: QName -> Bool -> Clause -> NamedClause -- | Assumes that pattern variables have been added to the context already. -- Picks pattern variable names from context. reifyPatterns :: MonadReify m => [NamedArg DeBruijnPattern] -> m [NamedArg Pattern] -- | Like reify but instantiates blocking metas, useful for -- reporting. reifyUnblocked :: Reify i => i -> TCM (ReifiesTo i) -- | blankNotInScope e replaces variables in expression e -- with _ if they are currently not in scope. blankNotInScope :: (MonadTCEnv m, MonadDebug m, BlankVars a) => a -> m a -- | reifyDisplayFormP tries to recursively rewrite a lhs with a -- display form. -- -- Note: we are not necessarily in the empty context upon entry! reifyDisplayFormP :: MonadReify m => QName -> Patterns -> Patterns -> m (QName, Patterns) instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.BindName instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder (Agda.Syntax.Abstract.Binder' a) instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.LHS instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.LHSCore instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder [a] instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder (GHC.Internal.Maybe.Maybe a) instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder (Agda.Syntax.Common.Named x a) instance Agda.Syntax.Translation.InternalToAbstract.Binder a => Agda.Syntax.Translation.InternalToAbstract.Binder (Agda.Utils.List1.List1 a) instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.Pattern instance (Agda.Syntax.Translation.InternalToAbstract.Binder a, Agda.Syntax.Translation.InternalToAbstract.Binder b) => Agda.Syntax.Translation.InternalToAbstract.Binder (a, b) instance Agda.Syntax.Translation.InternalToAbstract.Binder Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Translation.InternalToAbstract.BlankVars a => Agda.Syntax.Translation.InternalToAbstract.BlankVars (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.Clause instance (Agda.Syntax.Translation.InternalToAbstract.BlankVars a, Agda.Syntax.Translation.InternalToAbstract.BlankVars b) => Agda.Syntax.Translation.InternalToAbstract.BlankVars (GHC.Internal.Data.Either.Either a b) instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.Expr instance Agda.Syntax.Translation.InternalToAbstract.BlankVars a => Agda.Syntax.Translation.InternalToAbstract.BlankVars (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.LHS instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.LHSCore instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Translation.InternalToAbstract.BlankVars a => Agda.Syntax.Translation.InternalToAbstract.BlankVars [a] instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Translation.InternalToAbstract.BlankVars a => Agda.Syntax.Translation.InternalToAbstract.BlankVars (Agda.Syntax.Common.Named s a) instance Agda.Syntax.Translation.InternalToAbstract.BlankVars a => Agda.Syntax.Translation.InternalToAbstract.BlankVars (Agda.Utils.List1.List1 a) instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.Pattern instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.ProblemEq instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.RHS instance (Agda.Syntax.Translation.InternalToAbstract.BlankVars a, Agda.Syntax.Translation.InternalToAbstract.BlankVars b) => Agda.Syntax.Translation.InternalToAbstract.BlankVars (a, b) instance (Agda.Syntax.Translation.InternalToAbstract.BlankVars a, Agda.Syntax.Translation.InternalToAbstract.BlankVars b, Agda.Syntax.Translation.InternalToAbstract.BlankVars c) => Agda.Syntax.Translation.InternalToAbstract.BlankVars (a, b, c) instance Agda.Syntax.Translation.InternalToAbstract.BlankVars Agda.Syntax.Abstract.TypedBinding instance (GHC.Internal.Classes.Ord k, GHC.Internal.Base.Monoid v) => GHC.Internal.Base.Monoid (Agda.Syntax.Translation.InternalToAbstract.MonoidMap k v) instance (Agda.TypeChecking.Free.Generic.Free i, Agda.Syntax.Translation.InternalToAbstract.Reify i) => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Internal.Abs i) instance Agda.Syntax.Translation.InternalToAbstract.Reify i => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Common.Arg i) instance Agda.Syntax.Translation.InternalToAbstract.Reify GHC.Internal.Types.Bool instance Agda.Syntax.Translation.InternalToAbstract.Reify GHC.Internal.Types.Char instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.Types.Context instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.Syntax.Translation.InternalToAbstract.Reify i => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Internal.Dom i) instance Agda.Syntax.Translation.InternalToAbstract.Reify i => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Internal.Elim.Elim' i) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Abstract.Expr instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Internal.Level instance Agda.Syntax.Translation.InternalToAbstract.Reify i => Agda.Syntax.Translation.InternalToAbstract.Reify [i] instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Literal.Literal instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Common.MetaId instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.InternalToAbstract.Reify i => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Common.Named n i) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Translation.InternalToAbstract.NamedClause instance Agda.Syntax.Translation.InternalToAbstract.Reify i => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Utils.List1.List1 i) instance Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Abstract.Name.QNamed Agda.Syntax.Internal.Clause) instance Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.Syntax.Abstract.Name.QNamed Agda.TypeChecking.Monad.Base.System) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Internal.Sort instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Internal.Telescope instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Internal.Term instance (Agda.Syntax.Translation.InternalToAbstract.Reify i1, Agda.Syntax.Translation.InternalToAbstract.Reify i2) => Agda.Syntax.Translation.InternalToAbstract.Reify (i1, i2) instance (Agda.Syntax.Translation.InternalToAbstract.Reify i1, Agda.Syntax.Translation.InternalToAbstract.Reify i2, Agda.Syntax.Translation.InternalToAbstract.Reify i3) => Agda.Syntax.Translation.InternalToAbstract.Reify (i1, i2, i3) instance (Agda.Syntax.Translation.InternalToAbstract.Reify i1, Agda.Syntax.Translation.InternalToAbstract.Reify i2, Agda.Syntax.Translation.InternalToAbstract.Reify i3, Agda.Syntax.Translation.InternalToAbstract.Reify i4) => Agda.Syntax.Translation.InternalToAbstract.Reify (i1, i2, i3, i4) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.Syntax.Internal.Type instance (GHC.Internal.Classes.Ord k, GHC.Internal.Base.Monoid v) => GHC.Internal.Base.Semigroup (Agda.Syntax.Translation.InternalToAbstract.MonoidMap k v) module Agda.TypeChecking.Pretty ($$) :: Applicative m => m Doc -> m Doc -> m Doc infixl 5 $$ ($+$) :: Applicative m => m Doc -> m Doc -> m Doc infixl 5 $+$ (<+>) :: Applicative m => m Doc -> m Doc -> m Doc infixl 6 <+> () :: Applicative m => m Doc -> m Doc -> m Doc infixl 6 braces :: Functor m => m Doc -> m Doc brackets :: Functor m => m Doc -> m Doc colon :: Applicative m => m Doc comma :: Applicative m => m Doc dbraces :: Functor m => m Doc -> m Doc defnToNameKind :: Defn -> NameKind doubleQuotes :: Functor m => m Doc -> m Doc equals :: Applicative m => m Doc fsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc fwords :: Applicative m => String -> m Doc -- | Link to an issue on the Agda bug tracker. githubIssue :: Applicative m => Int -> m Doc hang :: Applicative m => m Doc -> Int -> m Doc -> m Doc hcat :: (Applicative m, Foldable t) => t (m Doc) -> m Doc hlArgument :: Functor m => m Doc -> m Doc hlBound :: Functor m => m Doc -> m Doc hlComment :: Functor m => m Doc -> m Doc hlConstructor :: Functor m => Induction -> m Doc -> m Doc hlDatatype :: Functor m => m Doc -> m Doc hlField :: Functor m => m Doc -> m Doc hlFunction :: Functor m => m Doc -> m Doc hlGeneralizable :: Functor m => m Doc -> m Doc hlHole :: Functor m => m Doc -> m Doc hlKeyword :: Functor m => m Doc -> m Doc hlMacro :: Functor m => m Doc -> m Doc hlModule :: Functor m => m Doc -> m Doc hlNumber :: Functor m => m Doc -> m Doc hlPostulate :: Functor m => m Doc -> m Doc hlPragma :: Functor m => m Doc -> m Doc hlPrimitive :: Functor m => m Doc -> m Doc hlPrimitiveType :: Functor m => m Doc -> m Doc hlRecord :: Functor m => m Doc -> m Doc hlString :: Functor m => m Doc -> m Doc hlSymbol :: Functor m => m Doc -> m Doc hsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc multiLineText :: Applicative m => String -> m Doc nest :: Functor m => Int -> m Doc -> m Doc parens :: Functor m => m Doc -> m Doc parensNonEmpty :: Functor m => m Doc -> m Doc pluralS :: (Functor m, Sized a) => a -> m Doc -> m Doc pretty :: (Applicative m, Pretty a) => a -> m Doc prettyA :: (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) => a -> m Doc prettyAs :: (ToConcrete a, ConOfAbs a ~ [ce], Pretty ce, MonadAbsToCon m) => a -> m Doc -- | Comma-separated list in brackets. prettyList :: (Applicative m, Foldable t) => t (m Doc) -> m Doc -- | prettyList without the brackets. prettyList_ :: (Applicative m, Semigroup (m Doc), Foldable t) => t (m Doc) -> m Doc -- | For unquote. prettyR :: (ToAbstract r, PrettyTCM (AbsOfRef r), MonadPretty m, MonadError TCErr m) => r -> m Doc -- | Pretty print with a given context precedence prettyTCMCtx :: (PrettyTCM a, MonadPretty m) => Precedence -> a -> m Doc prettyTCMPatternList :: MonadPretty m => [NamedArg DeBruijnPattern] -> m Doc -- | Proper pretty printing of patterns: prettyTCMPatterns :: MonadPretty m => [NamedArg DeBruijnPattern] -> m [Doc] pshow :: (Applicative m, Show a) => a -> m Doc punctuate :: (Applicative m, Semigroup (m Doc), Foldable t) => m Doc -> t (m Doc) -> [m Doc] pwords :: Applicative m => String -> [m Doc] quotes :: Functor m => m Doc -> m Doc sep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc -- |
--   sequenceAFoldable == sequenceA . Fold.toList
--   
sequenceAFoldable :: (Applicative m, Foldable t) => t (m a) -> m [a] superscript :: Applicative m => Int -> m Doc text :: Applicative m => String -> m Doc url :: Applicative m => String -> m Doc vcat :: (Applicative m, Foldable t) => t (m Doc) -> m Doc vsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc type Doc = Doc type MonadPretty (m :: Type -> Type) = MonadAbsToCon m newtype PrettyContext PrettyContext :: Context -> PrettyContext class PrettyTCM a prettyTCM :: (PrettyTCM a, MonadPretty m) => a -> m Doc -- | Pretty-print something paired with a (printable) node. | This -- intermediate typeclass exists to avoid UndecidableInstances. class PrettyTCMWithNode a prettyTCMWithNode :: (PrettyTCMWithNode a, PrettyTCM n, MonadPretty m) => WithNode n a -> m Doc -- | Pairing something with a node (for printing only). data WithNode n a WithNode :: n -> a -> WithNode n a -- | Preconditions to run the AbstractToConcrete translation. type MonadAbsToCon (m :: Type -> Type) = (MonadFileId m, MonadFresh NameId m, MonadInteractionPoints m, MonadStConcreteNames m, HasOptions m, PureTCM m, IsString m Doc, Null m Doc, Semigroup m Doc) instance (Agda.TypeChecking.Pretty.PrettyTCM a, Agda.TypeChecking.Substitute.Class.Subst a) => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.AbstractName instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Arg Agda.Syntax.Internal.Term) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Arg Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Arg GHC.Internal.Types.Bool) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Arg GHC.Internal.Base.String) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Arg Agda.Syntax.Abstract.Expr) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Expr) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.NamedArg Agda.Syntax.Internal.Term) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Blocked a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.Pretty.PrettyTCM GHC.Internal.Types.Bool instance (Agda.TypeChecking.Pretty.PrettyTCM x, Agda.TypeChecking.Pretty.PrettyTCM a) => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Telescope.Boundary' x a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.CheckpointId instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Cohesion instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Types.Comparison instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Types.Context instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Types.ContextEntry instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.DiscrimTree.Types.DiscrimTree a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Elim instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Elim.Elim' Agda.TypeChecking.Monad.Base.DisplayTerm) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Elim.Elim' Agda.Syntax.Internal.NLPat) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Erased instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Expr instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Free.Base.FlexRig' a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance (Agda.TypeChecking.Pretty.PrettyTCM n, Agda.TypeChecking.Pretty.PrettyTCMWithNode e) => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Concrete.ImportedName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Nat instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.InteractionId instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.IsForced instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.Types.IsWithFunction a) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.Judgement a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.DiscrimTree.Types.Key instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Concrete.LHS instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Level instance Agda.TypeChecking.Pretty.PrettyTCM GHC.Internal.Base.String instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM [a] instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Literal.Literal instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.LocalEquation instance (Agda.TypeChecking.Pretty.PrettyTCM k, Agda.TypeChecking.Pretty.PrettyTCM v) => Agda.TypeChecking.Pretty.PrettyTCM (Data.Map.Internal.Map k v) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.MaybeReduced a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Free.Base.MetaSet instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.ModalPolarity instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Modality instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Concrete.Name.Name instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Named_ Agda.Syntax.Internal.Term) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Translation.InternalToAbstract.NamedClause instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Types.NamedMeta instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Utils.List1.List1 a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Pattern instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Types.Polarity instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.PolarityModality instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Pretty.PrettyContext instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.ProblemId instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Concrete.Name.QName instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Abstract.Name.QNamed Agda.Syntax.Internal.Clause) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Quantity instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Position.Range instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Relevance instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.RewDom instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.RewriteHead instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.RewriteRule instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Data.Set.Internal.Set a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Coverage.SplitTree.SplitTag instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.TypeChecking.Pretty.PrettyTCM a, Agda.TypeChecking.Substitute.Class.EndoSubst a) => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Substitution' a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Term instance Agda.TypeChecking.Pretty.PrettyTCM Data.Text.Internal.Text instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance (Agda.TypeChecking.Pretty.PrettyTCM a, Agda.TypeChecking.Pretty.PrettyTCM b) => Agda.TypeChecking.Pretty.PrettyTCM (a, b) instance (Agda.TypeChecking.Pretty.PrettyTCM a, Agda.TypeChecking.Pretty.PrettyTCM b, Agda.TypeChecking.Pretty.PrettyTCM c) => Agda.TypeChecking.Pretty.PrettyTCM (a, b, c) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Type instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Type' Agda.Syntax.Internal.NLPat) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.TypeCheckingProblem instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.TypedBinding instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Free.Base.VarMap' a) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Free.Base.VarOcc' a) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.WithHiding a) instance Agda.TypeChecking.Pretty.PrettyTCMWithNode Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Internal.Base.Semigroup (Agda.TypeChecking.Monad.Base.TCM Agda.TypeChecking.Pretty.Doc) module Agda.TypeChecking.Telescope.Path -- | In an ambient context Γ, telePiPath f lams Δ t bs builds a -- type that can be telViewPathBoundaryed into (TelV Δ t, -- bs'). Γ.Δ ⊢ t bs = [(i,u_i)] Δ = Δ0,(i : I),Δ1 ∀ b ∈ {0,1}. Γ.Δ0 | -- lams Δ1 (u_i .b) : (telePiPath f Δ1 t bs)(i = b) -- kinda: see lams Γ -- ⊢ telePiPath f Δ t bs telePiPath :: (Abs Type -> Abs Type) -> ([Arg ArgName] -> Term -> Term) -> Telescope -> Type -> Boundary -> TCM Type -- | telePiPath_ Δ t [(i,u)] Δ ⊢ t i ∈ Δ Δ ⊢ u_b : t for b ∈ {0,1} telePiPath_ :: Telescope -> Type -> Boundary -> TCM Type -- | arity of the type, including both Pi and Path. Does not reduce the -- type. arityPiPath :: Type -> TCM Int -- | Collect the interval copattern variables as list of de Bruijn indices. class IApplyVars p iApplyVars :: IApplyVars p => p -> [Int] -- | Check whether a type is the built-in interval type. isInterval :: MonadTCM m => Type -> m Bool instance Agda.TypeChecking.Telescope.Path.IApplyVars p => Agda.TypeChecking.Telescope.Path.IApplyVars (Agda.Syntax.Common.NamedArg p) instance Agda.TypeChecking.Telescope.Path.IApplyVars p => Agda.TypeChecking.Telescope.Path.IApplyVars [p] instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn a => Agda.TypeChecking.Telescope.Path.IApplyVars (Agda.Syntax.Internal.Pattern' a) module Agda.TypeChecking.SizedTypes.WarshallSolver type Graph r f a = Graph Node r f a type Edge' r f a = Edge Node r f a type Key r f = Edge' r f () type Nodes r f = Nodes Node r f type LabelledEdge r f = Edge' r f Label src :: Edge n e -> n dest :: Edge n e -> n lookupEdge :: Ord n => Graph n e -> n -> n -> Maybe e graphToList :: Graph n e -> [Edge n e] graphFromList :: Ord n => [Edge n e] -> Graph n e insertEdge :: (Ord n, MeetSemiLattice e, Top e) => Edge n e -> Graph n e -> Graph n e -- | Compute list of edges that start in a given node. outgoing :: (Ord r, Ord f) => Graph r f a -> Node r f -> [Edge' r f a] -- | Compute list of edges that target a given node. -- -- Note: expensive for unidirectional graph representations. incoming :: (Ord r, Ord f) => Graph r f a -> Node r f -> [Edge' r f a] -- | Set.foldl does not exist in legacy versions of the -- containers package. setFoldl :: (b -> a -> b) -> b -> Set a -> b -- | Floyd-Warshall algorithm. transClos :: (Ord n, Dioid a) => Graph n a -> Graph n a data Weight Offset :: Offset -> Weight Infinity :: Weight -- | Test for negativity, used to detect negative cycles. class Negative a negative :: Negative a => a -> Bool -- | Going from Lt to Le is pred, going from -- Le to Lt is succ. -- -- X --(R,n)--> Y means X (R) Y + n. [ ... if -- n positive and X + (-n) (R) Y if n -- negative. ] data Label Label :: Cmp -> Offset -> Label [lcmp] :: Label -> Cmp [loffset] :: Label -> Offset -- | Nodes not connected. LInf :: Label -- | Convert a label to a weight, decrementing in case of Lt. toWeight :: Label -> Weight data Node rigid flex NodeZero :: Node rigid flex NodeInfty :: Node rigid flex NodeRigid :: rigid -> Node rigid flex NodeFlex :: flex -> Node rigid flex isFlexNode :: Node rigid flex -> Maybe flex isZeroNode :: Node rigid flex -> Bool isInftyNode :: Node rigid flex -> Bool nodeToSizeExpr :: Node rigid flex -> SizeExpr' rigid flex -- | A graph forest. type Graphs r f a = [Graph r f a] emptyGraphs :: Graphs r f a -- | Split a list of graphs gs into those that mention node -- n and those that do not. If n is zero or infinity, -- we regard it as "not mentioned". mentions :: (Ord r, Ord f) => Node r f -> Graphs r f a -> (Graphs r f a, Graphs r f a) -- | Add an edge to a graph forest. Graphs that share a node with the edge -- are joined. addEdge :: (Ord r, Ord f, MeetSemiLattice a, Top a) => Edge' r f a -> Graphs r f a -> Graphs r f a -- | Reflexive closure. Add edges 0 -> n -> n -> oo for -- all nodes n. reflClos :: (Ord r, Ord f, Dioid a) => Set (Node r f) -> Graph r f a -> Graph r f a -- | h implies g if any edge in g between rigids -- and constants is implied by a corresponding edge in h, which -- means that the edge in g carries at most the information of -- the one in h. -- -- Application: Constraint implication: Constraints are compatible with -- hypotheses. implies :: (Ord r, Ord f, Pretty r, Pretty f, Pretty a, Top a, Ord a, Negative a) => Graph r f a -> Graph r f a -> Bool nodeFromSizeExpr :: SizeExpr' rigid flex -> (Node rigid flex, Offset) edgeFromConstraint :: Constraint' rigid flex -> LabelledEdge rigid flex -- | Build a graph from list of simplified constraints. graphFromConstraints :: (Ord rigid, Ord flex) => [Constraint' rigid flex] -> Graph rigid flex Label -- | Build a graph from list of simplified constraints. graphsFromConstraints :: (Ord rigid, Ord flex) => [Constraint' rigid flex] -> Graphs rigid flex Label -- | Error messages produced by the solver. type Error = TCM Doc type CTrans r f = Constraint' r f -> Either Error [Constraint' r f] simplify1 :: (Pretty f, Pretty r, Eq r) => CTrans r f -> CTrans r f type Hyp = Constraint type Hyp' = Constraint' type HypGraph r f = Graph r f Label hypGraph :: (Ord rigid, Ord flex, Pretty rigid, Pretty flex) => Set rigid -> [Hyp' rigid flex] -> Either Error (HypGraph rigid flex) hypConn :: (Ord r, Ord f) => HypGraph r f -> Node r f -> Node r f -> Label simplifyWithHypotheses :: (Ord rigid, Ord flex, Pretty rigid, Pretty flex) => HypGraph rigid flex -> [Constraint' rigid flex] -> Either Error [Constraint' rigid flex] type ConGraph r f = Graph r f Label constraintGraph :: (Ord r, Ord f, Pretty r, Pretty f) => [Constraint' r f] -> HypGraph r f -> Either Error (ConGraph r f) type ConGraphs r f = Graphs r f Label constraintGraphs :: (Ord r, Ord f, Pretty r, Pretty f) => [Constraint' r f] -> HypGraph r f -> Either Error ([f], ConGraphs r f) -- | If we have an edge X + n <= X (with n >= 0), we must -- set X = oo. infinityFlexs :: (Ord r, Ord f) => ConGraph r f -> ([f], ConGraph r f) class SetToInfty f a setToInfty :: SetToInfty f a => [f] -> a -> a -- | Lower or upper bound for a flexible variable type Bound r f = Map f Set SizeExpr' r f emptyBound :: Bound r f data Bounds r f Bounds :: Bound r f -> Bound r f -> Set f -> Bounds r f [lowerBounds] :: Bounds r f -> Bound r f [upperBounds] :: Bounds r f -> Bound r f -- | These metas are < ∞. [mustBeFinite] :: Bounds r f -> Set f -- | Compute a lower bound for a flexible from an edge. edgeToLowerBound :: LabelledEdge r f -> Maybe (f, SizeExpr' r f) -- | Compute an upper bound for a flexible from an edge. edgeToUpperBound :: LabelledEdge r f -> Maybe (f, Cmp, SizeExpr' r f) -- | Compute the lower bounds for all flexibles in a graph. graphToLowerBounds :: (Ord r, Ord f) => [LabelledEdge r f] -> Bound r f -- | Compute the upper bounds for all flexibles in a graph. graphToUpperBounds :: (Ord r, Ord f) => [LabelledEdge r f] -> (Bound r f, Set f) -- | Compute the bounds for all flexibles in a graph. bounds :: (Ord r, Ord f) => ConGraph r f -> Bounds r f -- | Compute the relative minima in a set of nodes (those that do not have -- a predecessor in the set). smallest :: (Ord r, Ord f) => HypGraph r f -> [Node r f] -> [Node r f] -- | Compute the relative maxima in a set of nodes (those that do not have -- a successor in the set). largest :: (Ord r, Ord f) => HypGraph r f -> [Node r f] -> [Node r f] -- | Given source nodes n1,n2,... find all target nodes m1,m2, such that -- for all j, there are edges n_i --l_ij--> m_j for all i. Return -- these edges as a map from target notes to a list of edges. We assume -- the graph is reflexive-transitive. commonSuccs :: (Ord r, Ord f) => Graph r f a -> [Node r f] -> Map (Node r f) [Edge' r f a] -- | Given target nodes m1,m2,... find all source nodes n1,n2, such that -- for all j, there are edges n_i --l_ij--> m_j for all i. Return -- these edges as a map from target notes to a list of edges. We assume -- the graph is reflexive-transitive. commonPreds :: (Ord r, Ord f) => Graph r f a -> [Node r f] -> Map (Node r f) [Edge' r f a] -- | Compute the sup of two different rigids or a rigid and a constant. lub' :: (Ord r, Ord f, Pretty r, Pretty f, Show r, Show f) => HypGraph r f -> (Node r f, Offset) -> (Node r f, Offset) -> Maybe (SizeExpr' r f) -- | Compute the inf of two different rigids or a rigid and a constant. glb' :: (Ord r, Ord f, Pretty r, Pretty f, Show r, Show f) => HypGraph r f -> (Node r f, Offset) -> (Node r f, Offset) -> Maybe (SizeExpr' r f) -- | Compute the least upper bound (sup). lub :: (Ord r, Ord f, Pretty r, Pretty f, Show r, Show f) => HypGraph r f -> SizeExpr' r f -> SizeExpr' r f -> Maybe (SizeExpr' r f) -- | Compute the greatest lower bound (inf) of size expressions relative to -- a hypotheses graph. glb :: (Ord r, Ord f, Pretty r, Pretty f, Show r, Show f) => HypGraph r f -> SizeExpr' r f -> SizeExpr' r f -> Maybe (SizeExpr' r f) findRigidBelow :: (Ord r, Ord f) => HypGraph r f -> SizeExpr' r f -> Maybe (SizeExpr' r f) solveGraph :: (Ord r, Ord f, Pretty r, Pretty f, PrettyTCM f, Show r, Show f) => Polarities f -> HypGraph r f -> ConGraph r f -> Either Error (Solution r f) -- | Solve a forest of constraint graphs relative to a hypotheses graph. -- Concatenate individual solutions. solveGraphs :: (Ord r, Ord f, Pretty r, Pretty f, PrettyTCM f, Show r, Show f) => Polarities f -> HypGraph r f -> ConGraphs r f -> Either Error (Solution r f) -- | Check that after substitution of the solution, constraints are implied -- by hypotheses. verifySolution :: (Ord r, Ord f, Pretty r, Pretty f) => HypGraph r f -> [Constraint' r f] -> Solution r f -> Either Error () -- | Iterate solver until no more metas can be solved. -- -- This might trigger a (wanted) error on the second iteration (see Issue -- 2096) which would otherwise go unnoticed. iterateSolver :: (Ord r, Ord f, Pretty r, Pretty f, PrettyTCM f, Show r, Show f) => Polarities f -> HypGraph r f -> [Constraint' r f] -> Solution r f -> Either Error (Solution r f) testSuccs :: Ord f => Map (Node [Char] f) [Edge' [Char] f Label] testLub :: (Pretty f, Ord f, Show f) => Maybe (SizeExpr' [Char] f) instance (GHC.Internal.Classes.Ord r, GHC.Internal.Classes.Ord f, Agda.TypeChecking.SizedTypes.Utils.Dioid a) => Agda.TypeChecking.SizedTypes.Utils.Dioid (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance Agda.TypeChecking.SizedTypes.Utils.Dioid Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.TypeChecking.SizedTypes.Utils.Dioid Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Internal.Enum.Enum Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance (GHC.Internal.Classes.Eq rigid, GHC.Internal.Classes.Eq flex) => GHC.Internal.Classes.Eq (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance (GHC.Internal.Classes.Ord r, GHC.Internal.Classes.Ord f, Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice a) => Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative a => Agda.TypeChecking.SizedTypes.WarshallSolver.Negative (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (GHC.Internal.Classes.Ord r, GHC.Internal.Classes.Ord f, Agda.TypeChecking.SizedTypes.WarshallSolver.Negative a) => Agda.TypeChecking.SizedTypes.WarshallSolver.Negative (Agda.TypeChecking.SizedTypes.WarshallSolver.Graph r f a) instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative GHC.Internal.Types.Int instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance (GHC.Internal.Classes.Ord r, GHC.Internal.Classes.Ord f, Agda.TypeChecking.SizedTypes.WarshallSolver.Negative a) => Agda.TypeChecking.SizedTypes.WarshallSolver.Negative (Agda.TypeChecking.SizedTypes.WarshallSolver.Graphs r f a) instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Internal.Num.Num Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance (GHC.Internal.Classes.Ord rigid, GHC.Internal.Classes.Ord flex) => GHC.Internal.Classes.Ord (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.Utils.Plus Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.WarshallSolver.Weight Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.Utils.Plus (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) Agda.TypeChecking.SizedTypes.WarshallSolver.Label (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance Agda.TypeChecking.SizedTypes.Utils.Plus (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) Agda.TypeChecking.SizedTypes.WarshallSolver.Weight (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance Agda.TypeChecking.SizedTypes.Utils.Plus Agda.TypeChecking.SizedTypes.WarshallSolver.Weight Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance (Agda.Syntax.Common.Pretty.Pretty rigid, Agda.Syntax.Common.Pretty.Pretty flex) => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Internal.Classes.Eq f => Agda.TypeChecking.SizedTypes.WarshallSolver.SetToInfty f (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (GHC.Internal.Classes.Ord r, GHC.Internal.Classes.Ord f) => Agda.TypeChecking.SizedTypes.WarshallSolver.SetToInfty f (Agda.TypeChecking.SizedTypes.WarshallSolver.ConGraph r f) instance GHC.Internal.Classes.Eq f => Agda.TypeChecking.SizedTypes.WarshallSolver.SetToInfty f (Agda.TypeChecking.SizedTypes.WarshallSolver.Node r f) instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance (GHC.Internal.Show.Show rigid, GHC.Internal.Show.Show flex) => GHC.Internal.Show.Show (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance (GHC.Internal.Classes.Ord r, GHC.Internal.Classes.Ord f, Agda.TypeChecking.SizedTypes.Utils.Top a) => Agda.TypeChecking.SizedTypes.Utils.Top (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance Agda.TypeChecking.SizedTypes.Utils.Top Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.TypeChecking.SizedTypes.Utils.Top Agda.TypeChecking.SizedTypes.WarshallSolver.Weight module Agda.TypeChecking.SizedTypes.Pretty -- | Turn a size expression into a term. unSizeExpr :: HasBuiltins m => DBSizeExpr -> m Term instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.SizedTypes.Syntax.SizeConstraint instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.SizedTypes.Syntax.HypSizeConstraint instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.SizedTypes.Syntax.SizeMeta module Agda.TypeChecking.Rules.Display -- | Add display pragma if well-formed. Otherwise, throw -- InvalidDisplayForm warning and ignore it. checkDisplayPragma :: QName -> [NamedArg Pattern] -> Expr -> TCM () module Agda.TypeChecking.Pretty.Call sayWhere :: (MonadPretty m, HasRange a) => a -> m Doc -> m Doc instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Call instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.CallInfo -- | Tools to manipulate patterns in abstract syntax in the TCM (type -- checking monad). module Agda.TypeChecking.Patterns.Abstract -- | Expand literal integer pattern into suc/zero constructor patterns. expandLitPattern :: (MonadError TCErr m, MonadTCEnv m, ReadTCState m, HasBuiltins m) => Pattern -> m Pattern -- | Expand away (deeply) all pattern synonyms in a pattern. expandPatternSynonyms' :: Pattern' e -> TCM (Pattern' e) class ExpandPatternSynonyms a expandPatternSynonyms :: ExpandPatternSynonyms a => a -> TCM a ($dmexpandPatternSynonyms) :: forall (f :: Type -> Type) b. (ExpandPatternSynonyms a, Traversable f, ExpandPatternSynonyms b, f b ~ a) => a -> TCM a instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms [a] instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (Agda.Syntax.Common.Named n a) instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (Agda.Syntax.Abstract.Pattern' e) module Agda.TypeChecking.Opacity -- | Ensure that opaque blocks defined in the current module have saturated -- unfolding sets. saturateOpaqueBlocks :: (MonadTCState m, MonadFresh OpaqueId m, MonadTrace m, MonadWarning m, MonadIO m) => m () -- | Decide whether or not a definition is reducible. Returns True -- if the definition can step. isAccessibleDef :: TCEnv -> TCState -> Definition -> Bool -- | Will the given QName have a proper definition, or will it be -- wrapped in an AbstractDefn? hasAccessibleDef :: (ReadTCState m, HasConstInfo m) => QName -> m Bool -- | EDSL to construct terms without touching De Bruijn indices. -- -- e.g. given t, u :: Term, Γ ⊢ t, u : A, we can build "λ f. f t u" like -- this: -- -- runNames [] $ do -- open binds t and u to -- computations that know how to weaken themselves in -- an extended -- context -- -- -- -- -- -- lam "f" $ f -> f @ t @ u module Agda.TypeChecking.Names newtype NamesT (m :: Type -> Type) a NamesT :: ReaderT Names m a -> NamesT (m :: Type -> Type) a [unName] :: NamesT (m :: Type -> Type) a -> ReaderT Names m a -- | A list of variable names from a context. type Names = [String] runNamesT :: Names -> NamesT m a -> m a runNames :: Names -> NamesT Identity a -> a currentCxt :: forall (m :: Type -> Type). Monad m => NamesT m Names -- | cxtSubst Γ returns the substitution needed to go from Γ to -- the current context. -- -- Precondition Γ is not a subcontext of the current one. cxtSubst :: forall (m :: Type -> Type) a. Monad m => Names -> NamesT m (Substitution' a) -- | inCxt Γ t takes a t in context Γ and -- produce an action that will return t weakened to the current -- context. -- -- Fails whenever cxtSubst Γ would. inCxt :: forall (m :: Type -> Type) a. (Monad m, Subst a) => Names -> a -> NamesT m a -- | Closed terms cl' :: forall (m :: Type -> Type) a. Applicative m => a -> NamesT m a cl :: Monad m => m a -> NamesT m a -- | Open terms in the current context. open :: forall (m :: Type -> Type) a. (Monad m, Subst a) => a -> NamesT m (NamesT m a) -- | Monadic actions standing for variables. -- -- b is quantified over so the same variable can be used e.g. -- both as a pattern and as an expression. type Var (m :: Type -> Type) = forall b. (Subst b, DeBruijn b) => NamesT m b -- | bind n f provides f with a fresh variable, which can -- be used in any extended context. -- -- Returns an Abs which binds the extra variable. bind :: forall (m :: Type -> Type) a. Monad m => ArgName -> ((forall b. (Subst b, DeBruijn b) => NamesT m b) -> NamesT m a) -> NamesT m (Abs a) -- | Like bind but returns a bare term. bind' :: forall (m :: Type -> Type) a. Monad m => ArgName -> ((forall b. (Subst b, DeBruijn b) => NamesT m b) -> NamesT m a) -> NamesT m a glam :: forall (m :: Type -> Type). Monad m => ArgInfo -> ArgName -> (NamesT m Term -> NamesT m Term) -> NamesT m Term lam :: forall (m :: Type -> Type). Monad m => ArgName -> (NamesT m Term -> NamesT m Term) -> NamesT m Term ilam :: forall (m :: Type -> Type). Monad m => ArgName -> (NamesT m Term -> NamesT m Term) -> NamesT m Term data AbsN a AbsN :: [ArgName] -> a -> AbsN a [absNName] :: AbsN a -> [ArgName] [unAbsN] :: AbsN a -> a -- | Will crash on NoAbs toAbsN :: Abs (AbsN a) -> AbsN a absAppN :: Subst a => AbsN a -> [SubstArg a] -> a type ArgVars (m :: Type -> Type) = forall b. (Subst b, DeBruijn b) => [NamesT m Arg b] type Vars (m :: Type -> Type) = forall b. (Subst b, DeBruijn b) => [NamesT m b] bindN :: forall (m :: Type -> Type) a. Monad m => [ArgName] -> (Vars m -> NamesT m a) -> NamesT m (AbsN a) bindNArg :: forall (m :: Type -> Type) a. Monad m => [Arg ArgName] -> (ArgVars m -> NamesT m a) -> NamesT m (AbsN a) type Vars1 (m :: Type -> Type) = forall b. (Subst b, DeBruijn b) => List1 NamesT m b bindN1 :: forall (m :: Type -> Type) a. Monad m => List1 ArgName -> (Vars1 m -> NamesT m a) -> NamesT m (AbsN a) glamN :: forall (m :: Type -> Type). Monad m => [Arg ArgName] -> (NamesT m Args -> NamesT m Term) -> NamesT m Term applyN :: forall (m :: Type -> Type) a. (Monad m, Subst a) => NamesT m (AbsN a) -> [NamesT m (SubstArg a)] -> NamesT m a applyN' :: forall (m :: Type -> Type) a. (Monad m, Subst a) => NamesT m (AbsN a) -> NamesT m [SubstArg a] -> NamesT m a abstractN :: forall (m :: Type -> Type) a. (Monad m, Abstract a) => NamesT m Telescope -> (Vars m -> NamesT m a) -> NamesT m a abstractT :: forall (m :: Type -> Type) a. (Monad m, Abstract a) => String -> NamesT m Type -> (Var m -> NamesT m a) -> NamesT m a lamTel :: forall (m :: Type -> Type). Monad m => NamesT m (Abs [Term]) -> NamesT m [Term] appTel :: forall (m :: Type -> Type). Monad m => NamesT m [Term] -> NamesT m Term -> NamesT m [Term] instance GHC.Internal.Base.Applicative m => GHC.Internal.Base.Applicative (Agda.TypeChecking.Names.NamesT m) instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Names.AbsN instance GHC.Internal.Base.Functor Agda.TypeChecking.Names.AbsN instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.TypeChecking.Names.NamesT m) instance Agda.Interaction.Options.HasOptions.HasOptions m => Agda.Interaction.Options.HasOptions.HasOptions (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.TypeChecking.Names.NamesT m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Agda.TypeChecking.Names.NamesT m) instance Agda.Utils.FileId.MonadFileId m => Agda.Utils.FileId.MonadFileId (Agda.TypeChecking.Names.NamesT m) instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.TypeChecking.Names.NamesT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Base.MonadReduce m => Agda.TypeChecking.Monad.Base.MonadReduce (Agda.TypeChecking.Names.NamesT m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Base.MonadTCEnv m => Agda.TypeChecking.Monad.Base.MonadTCEnv (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Base.MonadTCM m => Agda.TypeChecking.Monad.Base.MonadTCM (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Base.MonadTCState m => Agda.TypeChecking.Monad.Base.MonadTCState (Agda.TypeChecking.Names.NamesT m) instance Control.Monad.Trans.Class.MonadTrans Agda.TypeChecking.Names.NamesT instance (Agda.TypeChecking.Monad.Builtin.HasBuiltins m, Agda.TypeChecking.Monad.Signature.HasConstInfo m, Agda.TypeChecking.Monad.Context.MonadAddContext m, Agda.Utils.FileId.MonadFileId m, Agda.TypeChecking.Monad.Base.MonadReduce m) => Agda.TypeChecking.Monad.Pure.PureTCM (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Monad.Base.ReadTCState m => Agda.TypeChecking.Monad.Base.ReadTCState (Agda.TypeChecking.Names.NamesT m) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.TypeChecking.Names.AbsN a) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Names.AbsN module Agda.TypeChecking.Primitive.Base (-->) :: HasOptions m => m Type -> m Type -> m Type infixr 4 --> (.-->) :: HasOptions m => m Type -> m Type -> m Type infixr 4 .--> (..-->) :: HasOptions m => m Type -> m Type -> m Type infixr 4 ..--> garr :: HasOptions m => (Relevance -> Relevance) -> m Type -> m Type -> m Type gpi :: (MonadAddContext m, MonadDebug m) => ArgInfo -> String -> m Type -> m Type -> m Type hPi :: (MonadAddContext m, MonadDebug m) => String -> m Type -> m Type -> m Type nPi :: (MonadAddContext m, MonadDebug m) => String -> m Type -> m Type -> m Type hPi' :: forall (m :: Type -> Type). (MonadAddContext m, MonadDebug m) => String -> NamesT m Type -> (NamesT m Term -> NamesT m Type) -> NamesT m Type nPi' :: forall (m :: Type -> Type). (MonadAddContext m, MonadDebug m) => String -> NamesT m Type -> (NamesT m Term -> NamesT m Type) -> NamesT m Type pPi' :: forall (m :: Type -> Type). (MonadAddContext m, HasBuiltins m, MonadDebug m) => String -> NamesT m Term -> (NamesT m Term -> NamesT m Type) -> NamesT m Type -- | Turn a Pi type into one whose domain is annotated finite, i.e., -- one that represents a Partial element rather than an actual -- function. toFinitePi :: Type -> Type el' :: Applicative m => m Term -> m Term -> m Type els :: Applicative m => m Sort -> m Term -> m Type el's :: Applicative m => m Term -> m Term -> m Type elInf :: Functor m => m Term -> m Type elSSet :: Functor m => m Term -> m Type nolam :: Term -> Term varM :: Applicative m => Int -> m Term gApply :: Applicative m => Hiding -> m Term -> m Term -> m Term gApply' :: Applicative m => ArgInfo -> m Term -> m Term -> m Term (<@>) :: Applicative m => m Term -> m Term -> m Term infixl 9 <@> (<#>) :: Applicative m => m Term -> m Term -> m Term infixl 9 <#> (<..>) :: Applicative m => m Term -> m Term -> m Term (<@@>) :: Applicative m => m Term -> (m Term, m Term, m Term) -> m Term list :: TCM Term -> TCM Term tMaybe :: TCM Term -> TCM Term io :: TCM Term -> TCM Term path :: TCM Term -> TCM Term el :: Functor m => m Term -> m Type -- | The universe Set0 as a type. tset :: Applicative m => m Type -- | SizeUniv as a sort. sSizeUniv :: Sort -- | SizeUniv as a type. tSizeUniv :: Applicative m => m Type tLevelUniv :: Applicative m => m Type -- | Abbreviation: argN = Arg defaultArgInfo. argN :: e -> Arg e domN :: e -> Dom e -- | Abbreviation: argH = hide Arg -- defaultArgInfo. argH :: e -> Arg e domH :: e -> Dom e -- | Nothing is returned for trusted primitives (those for which the -- type is taken from the declaration). lookupPossiblyTrustedPrimitiveFunction :: PrimitiveId -> TCM (Maybe Type, PrimFun) -- | An error is raised for trusted primitives. lookupPrimitiveFunction :: PrimitiveId -> TCM PrimitiveImpl lookupPrimitiveFunctionQ :: QName -> TCM (PrimitiveId, Maybe Type, PrimFun) getBuiltinName :: (HasBuiltins m, MonadReduce m) => BuiltinId -> m (Maybe QName) -- | Convert a name in Term form back to QName. getQNameFromTerm :: forall (m :: Type -> Type). MonadReduce m => Term -> MaybeT m QName isBuiltin :: (HasBuiltins m, MonadReduce m) => QName -> BuiltinId -> m Bool data SigmaKit SigmaKit :: QName -> ConHead -> QName -> QName -> SigmaKit [sigmaName] :: SigmaKit -> QName [sigmaCon] :: SigmaKit -> ConHead [sigmaFst] :: SigmaKit -> QName [sigmaSnd] :: SigmaKit -> QName getSigmaKit :: (HasBuiltins m, HasConstInfo m) => m (Maybe SigmaKit) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Base.SigmaKit instance GHC.Internal.Show.Show Agda.TypeChecking.Primitive.Base.SigmaKit module Agda.TypeChecking.Quote -- | Parse quote. quotedName :: (MonadTCError m, MonadAbsToCon m) => Expr -> m QName data QuotingKit QuotingKit :: (Term -> ReduceM Term) -> (Type -> ReduceM Term) -> (Dom Type -> ReduceM Term) -> (Definition -> ReduceM Term) -> (forall a. () => (a -> ReduceM Term) -> [a] -> ReduceM Term) -> QuotingKit [quoteTermWithKit] :: QuotingKit -> Term -> ReduceM Term [quoteTypeWithKit] :: QuotingKit -> Type -> ReduceM Term [quoteDomWithKit] :: QuotingKit -> Dom Type -> ReduceM Term [quoteDefnWithKit] :: QuotingKit -> Definition -> ReduceM Term [quoteListWithKit] :: QuotingKit -> forall a. () => (a -> ReduceM Term) -> [a] -> ReduceM Term quotingKit :: TCM QuotingKit quoteString :: String -> Term quoteName :: QName -> Term quoteNat :: Integer -> Term quoteConName :: ConHead -> Term quoteMeta :: TopLevelModuleName -> MetaId -> Term quoteTerm :: Term -> TCM Term quoteType :: Type -> TCM Term quoteDom :: Dom Type -> TCM Term quoteDefn :: Definition -> TCM Term quoteList :: [Term] -> TCM Term -- | Implementations of the basic primitives of Cubical Agda: The interval -- and its operations. module Agda.TypeChecking.Primitive.Cubical.Base -- | Checks that the correct variant of Cubical Agda is activated. Note -- that --cubical=erased "counts as" --cubical in -- erased contexts. requireCubical :: Cubical -> TCM () -- | Our good friend the interval type. primIntervalType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Type -- | Implements both the min connection and conjunction on -- the cofibration classifier. primIMin' :: TCM PrimitiveImpl -- | Implements both the max connection and disjunction on -- the cofibration classifier. primIMax' :: TCM PrimitiveImpl -- | Negation on the interval. Negation satisfies De Morgan's laws, and -- their implementation is handled here. primINeg' :: TCM PrimitiveImpl -- | A helper for evaluating max on the interval in TCM&co. imax :: HasBuiltins m => m Term -> m Term -> m Term -- | A helper for evaluating min on the interval in TCM&co. imin :: HasBuiltins m => m Term -> m Term -> m Term -- | A helper for evaluating neg on the interval in TCM&co. ineg :: HasBuiltins m => m Term -> m Term data Command DoTransp :: Command DoHComp :: Command -- | Our Kan operations are transp and hcomp. The -- KanOperation record stores the data associated with a Kan operation on -- arbitrary types: A cofibration and an element of that type. data KanOperation -- | A transport problem consists of a cofibration, marking where the -- transport is constant, and a term to move from the fibre over i0 to -- the fibre over i1. TranspOp :: Blocked (Arg Term) -> Arg Term -> KanOperation -- | When this cofibration holds, the transport must definitionally be the -- identity. This is handled generically by primTransHComp but -- specific Kan operations may still need it. [kanOpCofib] :: KanOperation -> Blocked (Arg Term) -- | This is the term in A i0 which we are transporting. [kanOpBase] :: KanOperation -> Arg Term -- | A composition problem consists of a partial element and a base. -- Semantically, this is justified by the types being Kan fibrations, -- i.e., having the lifting property against trivial cofibrations. While -- the specified cofibration may not be trivial, (φ ∨ ~ r) for r ∉ φ is -- *always* a trivial cofibration. HCompOp :: Blocked (Arg Term) -> Arg Term -> Arg Term -> KanOperation -- | When this cofibration holds, the transport must definitionally be the -- identity. This is handled generically by primTransHComp but -- specific Kan operations may still need it. [kanOpCofib] :: KanOperation -> Blocked (Arg Term) -- | The partial element itself [kanOpSides] :: KanOperation -> Arg Term -- | This is the term in A i0 which we are transporting. [kanOpBase] :: KanOperation -> Arg Term -- | The built-in name associated with a particular Kan operation. kanOpName :: KanOperation -> String -- | For the Kan operations in Glue and hcomp {Type}, we -- optimise evaluation a tiny bit by differentiating the term produced -- when evaluating a Kan operation by itself vs evaluating it under -- unglue. (See headStop below.) data TermPosition Head :: TermPosition Eliminated :: TermPosition -- | Kan operations for the "unstable" type formers (Glue, -- hcomp {Type}) are computed "negatively": they never actually -- produce a glue φ t a term. Instead, we block the computation -- unless such a term would reduce further, which happens in two cases: -- -- headStop :: PureTCM m => TermPosition -> m Term -> m Bool -- | Are we looking at a family of things, or at a single thing? data FamilyOrNot a IsFam :: a -> FamilyOrNot a [famThing] :: FamilyOrNot a -> a IsNot :: a -> FamilyOrNot a [famThing] :: FamilyOrNot a -> a familyOrNot :: IsString p => FamilyOrNot a -> p -- | Build a partial element. The type of the resulting partial element can -- depend on the computed extent, which we denote by φ here. -- Note that φ is the n-ary disjunction of all the ψs. combineSys :: forall (m :: Type -> Type). HasBuiltins m => NamesT m Term -> NamesT m Term -> [(NamesT m Term, NamesT m Term)] -> NamesT m Term -- | Build a partial element, and compute its extent. See combineSys -- for the details. combineSys' :: forall (m :: Type -> Type). HasBuiltins m => NamesT m Term -> NamesT m Term -> [(NamesT m Term, NamesT m Term)] -> NamesT m (Term, Term) -- | Helper function for constructing the type of fibres of a function over -- a given point. fiber :: forall (m :: Type -> Type). (HasBuiltins m, HasConstInfo m) => NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -- | Helper function for constructing the filler of a given composition -- problem. hfill :: forall (m :: Type -> Type). HasBuiltins m => NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -- | Decompose an interval expression φ : I into a set of possible -- assignments for the variables mentioned in φ, together any -- leftover neutral terms that could not be put into IntervalView -- form. decomposeInterval' :: HasBuiltins m => Term -> m [(IntMap BoolSet, [Term])] -- | Decompose an interval expression i : I as in -- decomposeInterval', but discard any inconsistent mappings. decomposeInterval :: HasBuiltins m => Term -> m [(IntMap Bool, [Term])] reduce2Lam :: Term -> ReduceM (Blocked Term) -- | Are we looking at an application of the Sub type? If so, -- return: * The type we're an extension of * The extent * The partial -- element. isCubicalSubtype :: PureTCM m => Type -> m (Maybe (Term, Term, Term, Term)) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Cubical.Base.Command instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Primitive.Cubical.Base.FamilyOrNot a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Cubical.Base.TermPosition instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Primitive.Cubical.Base.FamilyOrNot instance GHC.Internal.Base.Functor Agda.TypeChecking.Primitive.Cubical.Base.FamilyOrNot instance Agda.TypeChecking.Reduce.Reduce a => Agda.TypeChecking.Reduce.Reduce (Agda.TypeChecking.Primitive.Cubical.Base.FamilyOrNot a) instance GHC.Internal.Show.Show Agda.TypeChecking.Primitive.Cubical.Base.Command instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Primitive.Cubical.Base.FamilyOrNot a) instance GHC.Internal.Show.Show Agda.TypeChecking.Primitive.Cubical.Base.TermPosition instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Primitive.Cubical.Base.FamilyOrNot module Agda.TypeChecking.Primitive.Cubical.Glue -- | Define a "ghcomp" version of gcomp. Normal comp looks like: -- -- comp^i A [ phi -> u ] u0 = hcomp^i A(1/i) [ phi -> forward A i u -- ] (forward A 0 u0) -- -- So for "gcomp" we compute: -- -- gcomp^i A [ phi -> u ] u0 = hcomp^i A(1/i) [ phi -> forward A i -- u, ~ phi -> forward A 0 u0 ] (forward A 0 u0) -- -- The point of this is that gcomp does not produce any empty systems (if -- phi = 0 it will reduce to "forward A 0 u". mkGComp :: forall (m :: Type -> Type). HasBuiltins m => String -> NamesT m (NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term) -- | Perform the Kan operations for a Glue φ A (T , e) type. doGlueKanOp :: PureTCM m => KanOperation -> FamilyOrNot (Arg Term, Arg Term, Arg Term, Arg Term, Arg Term, Arg Term) -> TermPosition -> m (Maybe Term) primGlue' :: TCM PrimitiveImpl -- | The implementation of prim_glue, the introduction form for -- Glue types. prim_glue' :: TCM PrimitiveImpl -- | The implementation of prim_unglue, the elimination form for -- Glue types. prim_unglue' :: TCM PrimitiveImpl module Agda.TypeChecking.Primitive.Cubical.HCompU -- | Perform the Kan operations for an hcomp {A = Type} {φ} u u0 -- type. doHCompUKanOp :: PureTCM m => KanOperation -> FamilyOrNot (Arg Term, Arg Term, Arg Term, Arg Term) -> TermPosition -> m (Maybe Term) -- | The implementation of prim_glueU, the introduction form for -- hcomp types. prim_glueU' :: TCM PrimitiveImpl -- | The implementation of prim_unglueU, the elimination form for -- hcomp types. prim_unglueU' :: TCM PrimitiveImpl module Agda.TypeChecking.Primitive.Cubical debugClause :: String -> Clause -> TCM () -- | Compute Kan operations in a type of dependent paths. doPathPKanOp :: KanOperation -> FamilyOrNot (Arg Term) -> FamilyOrNot (Arg Term, Arg Term, Arg Term) -> ReduceM (Reduced MaybeReducedArgs Term) -- | Implementation of Kan operations for Pi types. The implementation of -- transp and hcomp for Pi types has many -- commonalities, so most of it is shared between the two cases. doPiKanOp :: KanOperation -> ArgName -> FamilyOrNot (Dom Type, Abs Type) -> ReduceM (Maybe Term) -- | Γ, Δ^I, i : I |- expS |Δ| : Γ, Δ expS :: Nat -> Substitution expTelescope :: Type -> Telescope -> Telescope fromCType :: CType -> Type fromLType :: LType -> Type hcomp :: forall (m :: Type -> Type). (HasBuiltins m, MonadError TCErr m, MonadReduce m) => NamesT m Type -> [(NamesT m Term, NamesT m Term)] -> NamesT m Term -> NamesT m Term lTypeLevel :: LType -> Level -- | Construct a helper for CCHM composition, with a string indicating what -- function uses it. mkComp :: forall (m :: Type -> Type). HasBuiltins m => String -> NamesT m (NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term) -- | Construct an application of buitlinComp. Use instead of mkComp -- if reducing directly to hcomp + transport would be problematic. mkCompLazy :: forall (m :: Type -> Type). HasBuiltins m => String -> NamesT m (NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term) pathTelescope' :: (PureTCM m, MonadError (Closure Type) m) => Telescope -> [Arg Term] -> [Arg Term] -> m Telescope -- | CCHM primComp is implemented in terms of hcomp and -- transport. The definition of it comes from mkComp. primComp :: TCM PrimitiveImpl primFaceForall' :: TCM PrimitiveImpl primHComp' :: TCM PrimitiveImpl primPOr :: TCM PrimitiveImpl primPartial' :: TCM PrimitiveImpl primPartialP' :: TCM PrimitiveImpl primSubOut' :: TCM PrimitiveImpl primTrans' :: TCM PrimitiveImpl primTransHComp :: Command -> [Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term) redReturnNoSimpl :: a -> ReduceM (Reduced a' a) toCType :: MonadReduce m => Type -> m (Maybe CType) toLType :: MonadReduce m => Type -> m (Maybe LType) trFillPathPTel' :: NamesT TCM (Abs (Abs Telescope)) -> [NamesT TCM Term] -> [NamesT TCM Term] -> NamesT TCM Term -> [NamesT TCM Term] -> NamesT TCM Term -> NamesT TCM [Arg Term] trFillPathTel' :: NamesT TCM (Abs Telescope) -> [NamesT TCM Term] -> [NamesT TCM Term] -> NamesT TCM Term -> [NamesT TCM Term] -> NamesT TCM Term -> NamesT TCM [Arg Term] -- | Like transpTel but performing a transpFill. trFillTel :: Abs Telescope -> Term -> Args -> Term -> ExceptT (Closure (Abs Type)) TCM Args trFillTel' :: forall (m :: Type -> Type). (PureTCM m, MonadError TCErr m) => Bool -> Abs Telescope -> Term -> Args -> Term -> ExceptT (Closure (Abs Type)) m Args transpPathPTel' :: NamesT TCM (Abs (Abs Telescope)) -> [NamesT TCM Term] -> [NamesT TCM Term] -> NamesT TCM Term -> [NamesT TCM Term] -> NamesT TCM [Arg Term] transpPathTel' :: NamesT TCM (Abs Telescope) -> [NamesT TCM Term] -> [NamesT TCM Term] -> NamesT TCM Term -> [NamesT TCM Term] -> NamesT TCM [Arg Term] transpSys :: forall (m :: Type -> Type). (HasBuiltins m, MonadError TCErr m, MonadReduce m) => NamesT m (Abs Type) -> [(NamesT m Term, NamesT m Term)] -> NamesT m Term -> NamesT m Term -> NamesT m Term transpSysTel' :: forall (m :: Type -> Type). (PureTCM m, MonadError TCErr m) => Bool -> Abs Telescope -> [(Term, Abs [Term])] -> Term -> Args -> ExceptT (Closure (Abs Type)) m Args -- | Tries to primTransp a whole telescope of arguments, following -- the rule for Σ types. If a type in the telescope does not support -- transp, transpTel throws it as an exception. transpTel :: Abs Telescope -> Term -> Args -> ExceptT (Closure (Abs Type)) TCM Args transpTel' :: forall (m :: Type -> Type). (PureTCM m, MonadError TCErr m) => Bool -> Abs Telescope -> Term -> Args -> ExceptT (Closure (Abs Type)) m Args tryTranspError :: TCM a -> TCM (Either (Closure (Abs Type)) a) -- | A Type that either has sort Type l or is a closed -- definition. Such a type supports some version of transp. In particular -- we want to allow the Interval as a ClosedType. data CType ClosedType :: Sort -> QName -> CType LType :: LType -> CType type LM (m :: Type -> Type) a = NamesT ExceptT Closure Abs Type m a -- | A Type with sort Type l Such a type supports both -- hcomp and transp. data LType LEl :: Level -> Term -> LType data TranspError CannotTransp :: Closure (Abs Type) -> TranspError [errorType] :: TranspError -> Closure (Abs Type) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Cubical.CType instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Cubical.LType instance GHC.Internal.Exception.Type.Exception Agda.TypeChecking.Primitive.Cubical.TranspError instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Primitive.Cubical.CType instance GHC.Internal.Show.Show Agda.TypeChecking.Primitive.Cubical.CType instance GHC.Internal.Show.Show Agda.TypeChecking.Primitive.Cubical.LType instance GHC.Internal.Show.Show Agda.TypeChecking.Primitive.Cubical.TranspError instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Primitive.Cubical.CType instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Primitive.Cubical.LType -- | Primitive functions, such as addition on builtin integers. module Agda.TypeChecking.Primitive -- | buildList A ts builds a list of type List A. Assumes -- that the terms ts all have type A. buildList :: TCM ([Term] -> Term) fromLiteral :: (Literal -> Maybe a) -> TCM (FromTermFunction a) fromReducedTerm :: (Term -> Maybe a) -> TCM (FromTermFunction a) -- | Used for both primForce and primForceLemma. genPrimForce :: TCM Type -> (Term -> Arg Term -> Term) -> TCM PrimitiveImpl getRefl :: TCM (Arg Term -> Term) -- | Get the ArgInfo of the principal argument of BUILTIN REFL. -- -- Returns Nothing for e.g. data Eq {a} {A : Set a} (x : A) -- : A → Set a where refl : Eq x x -- -- Returns Just ... for e.g. data Eq {a} {A : Set a} : (x y -- : A) → Set a where refl : ∀ x → Eq x x getReflArgInfo :: ConHead -> TCM (Maybe ArgInfo) -- | Converts MetaIds to natural numbers. metaToNat :: MetaId -> Nat mkPrimFun1 :: (PrimType a, FromTerm a, PrimType b, ToTerm b) => (a -> b) -> TCM PrimitiveImpl mkPrimFun1TCM :: (FromTerm a, ToTerm b) => TCM Type -> (a -> ReduceM b) -> TCM PrimitiveImpl mkPrimFun2 :: (PrimType a, FromTerm a, ToTerm a, PrimType b, FromTerm b, PrimType c, ToTerm c) => (a -> b -> c) -> TCM PrimitiveImpl mkPrimFun3 :: (PrimType a, FromTerm a, ToTerm a, PrimType b, FromTerm b, ToTerm b, PrimType c, FromTerm c, PrimType d, ToTerm d) => (a -> b -> c -> d) -> TCM PrimitiveImpl mkPrimFun4 :: (PrimType a, FromTerm a, ToTerm a, PrimType b, FromTerm b, ToTerm b, PrimType c, FromTerm c, ToTerm c, PrimType d, FromTerm d, PrimType e, ToTerm e) => (a -> b -> c -> d -> e) -> TCM PrimitiveImpl -- | mkPrimInjective takes two Set0 a and b and -- a function f of type a -> b and outputs a -- primitive internalizing the fact that f is injective. mkPrimInjective :: Type -> Type -> QName -> TCM PrimitiveImpl mkPrimLevelMax :: TCM PrimitiveImpl mkPrimLevelSuc :: TCM PrimitiveImpl mkPrimLevelZero :: TCM PrimitiveImpl primCharToNatInjective :: TCM PrimitiveImpl -- |
--   primEraseEquality : {a : Level} {A : Set a} {x y : A} -> x ≡ y -> x ≡ y
--   
primEraseEquality :: TCM PrimitiveImpl primFloatToWord64Injective :: TCM PrimitiveImpl primForce :: TCM PrimitiveImpl primForceLemma :: TCM PrimitiveImpl primLockUniv' :: TCM PrimitiveImpl primMetaToNatInjective :: TCM PrimitiveImpl primQNameToWord64sInjective :: TCM PrimitiveImpl primQrec :: TCM PrimFun primRewriteNoMatch :: TCM PrimitiveImpl primStringFromListInjective :: TCM PrimitiveImpl primStringToListInjective :: TCM PrimitiveImpl primWord64ToNatInjective :: TCM PrimitiveImpl -- | If the type is Nothing, then the type of the given primitive is -- "trusted", i.e. taken from the primitive declaration in the Agda file. primitiveFunctions :: Map PrimitiveId (TCM (Maybe Type, PrimFun)) toTermTCM :: ToTerm a => TCM (a -> TCM Term) class FromTerm a fromTerm :: FromTerm a => TCM (FromTermFunction a) type FromTermFunction a = Arg Term -> ReduceM Reduced MaybeReduced Arg Term a type Fun a = a -> a newtype Lvl Lvl :: Integer -> Lvl [unLvl] :: Lvl -> Integer newtype Nat Nat :: Integer -> Nat [unNat] :: Nat -> Integer type Op a = a -> a -> a type Pred a = a -> Bool class PrimType a => PrimTerm a primTerm :: PrimTerm a => a -> TCM Term class PrimType a primType :: PrimType a => a -> TCM Type ($dmprimType) :: (PrimType a, PrimTerm a) => a -> TCM Type type Rel a = a -> a -> Bool class ToTerm a toTerm :: ToTerm a => TCM (a -> ReduceM Term) instance GHC.Internal.Enum.Enum Agda.TypeChecking.Primitive.Nat instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Lvl instance GHC.Internal.Classes.Eq Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.FromTerm GHC.Internal.Types.Bool instance Agda.TypeChecking.Primitive.FromTerm GHC.Internal.Types.Char instance Agda.TypeChecking.Primitive.FromTerm GHC.Internal.Types.Double instance Agda.TypeChecking.Primitive.FromTerm GHC.Internal.Bignum.Integer.Integer instance (Agda.TypeChecking.Primitive.ToTerm a, Agda.TypeChecking.Primitive.FromTerm a) => Agda.TypeChecking.Primitive.FromTerm [a] instance Agda.TypeChecking.Primitive.FromTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.FromTerm a => Agda.TypeChecking.Primitive.FromTerm (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.FromTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.FromTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.FromTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.FromTerm Data.Text.Internal.Text instance Agda.TypeChecking.Primitive.FromTerm GHC.Internal.Word.Word64 instance GHC.Internal.Real.Integral Agda.TypeChecking.Primitive.Nat instance GHC.Internal.Num.Num Agda.TypeChecking.Primitive.Nat instance GHC.Internal.Classes.Ord Agda.TypeChecking.Primitive.Lvl instance GHC.Internal.Classes.Ord Agda.TypeChecking.Primitive.Nat instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Primitive.Lvl instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.PrimTerm GHC.Internal.Types.Bool instance Agda.TypeChecking.Primitive.PrimTerm GHC.Internal.Types.Char instance Agda.TypeChecking.Primitive.PrimTerm GHC.Internal.Types.Double instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimTerm (a -> b) instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Common.Fixity' instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm (GHC.Internal.Types.IO a) instance Agda.TypeChecking.Primitive.PrimTerm GHC.Internal.Bignum.Integer.Integer instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm [a] instance Agda.TypeChecking.Primitive.PrimTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.PrimTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.PrimTerm Data.Text.Internal.Text instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimTerm (a, b) instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.PrimTerm GHC.Internal.Word.Word64 instance Agda.TypeChecking.Primitive.PrimType GHC.Internal.Types.Bool instance Agda.TypeChecking.Primitive.PrimType GHC.Internal.Types.Char instance Agda.TypeChecking.Primitive.PrimType GHC.Internal.Types.Double instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimType (a -> b) instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Common.Fixity' instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType (GHC.Internal.Types.IO a) instance Agda.TypeChecking.Primitive.PrimType GHC.Internal.Bignum.Integer.Integer instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType [a] instance Agda.TypeChecking.Primitive.PrimType Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.PrimType Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.PrimType Data.Text.Internal.Text instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimType (a, b) instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.PrimType GHC.Internal.Word.Word64 instance GHC.Internal.Real.Real Agda.TypeChecking.Primitive.Nat instance Agda.Syntax.Internal.Generic.TermLike Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.Associativity instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.Primitive.ToTerm GHC.Internal.Types.Bool instance Agda.TypeChecking.Primitive.ToTerm GHC.Internal.Types.Char instance Agda.TypeChecking.Primitive.ToTerm (Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Primitive.ToTerm GHC.Internal.Types.Double instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.Fixity instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.Fixity' instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.FixityLevel instance Agda.TypeChecking.Primitive.ToTerm GHC.Internal.Bignum.Integer.Integer instance Agda.TypeChecking.Primitive.ToTerm a => Agda.TypeChecking.Primitive.ToTerm [a] instance Agda.TypeChecking.Primitive.ToTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.ToTerm a => Agda.TypeChecking.Primitive.ToTerm (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.ToTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Internal.Term instance Agda.TypeChecking.Primitive.ToTerm Data.Text.Internal.Text instance (Agda.TypeChecking.Primitive.ToTerm a, Agda.TypeChecking.Primitive.ToTerm b) => Agda.TypeChecking.Primitive.ToTerm (a, b) instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.ToTerm GHC.Internal.Word.Word64 module Agda.TypeChecking.Modalities -- | The second argument is the definition of the first. checkModality' :: QName -> Definition -> TCM (Maybe TypeError) -- | The second argument is the definition of the first. checkModality :: QName -> Definition -> TCM () -- | Checks that the given implicitely inserted arguments, are used in a -- modally correct way. checkModalityArgs :: Definition -> Args -> TCM () -- | Compile-time irrelevance. -- -- In type theory with compile-time irrelevance à la Pfenning (LiCS -- 2001), variables in the context are annotated with relevance -- attributes. @ Γ = r₁x₁:A₁, ..., rⱼxⱼ:Aⱼ To handle -- irrelevant projections, we also record the current relevance attribute -- in the judgement. For instance, this attribute is equal to to -- Irrelevant if we are in an irrelevant position, like an -- irrelevant argument. Γ ⊢r t : A Only relevant -- variables can be used: @ -- -- (Relevant x : A) ∈ Γ -------------------- Γ ⊢r x : A @ Irrelevant -- global declarations can only be used if r = Irrelevant@. -- -- When we enter a r'-relevant function argument, we compose the -- r with r' and (left-)divide the attributes in the -- context by r'. @ Γ ⊢r t : (r' x : A) → B r' Γ ⊢(r'·r) u : -- A --------------------------------------------------------- Γ ⊢r t u : -- B[u/x] No surprises for abstraction: @ -- -- Γ, (r' x : A) ⊢r : B ----------------------------- Γ ⊢r λxt : (r' x : -- A) → B @@ -- -- This is different for runtime irrelevance (erasure) which is -- `flat', meaning that once one is in an irrelevant context, -- all new assumptions will be usable, since they are turned relevant -- once entering the context. See Conor McBride (WadlerFest 2016), for a -- type system in this spirit: -- -- We use such a rule for runtime-irrelevance: @ Γ, (q q') x : A ⊢q t -- : B ------------------------------ Γ ⊢q λxt : (q' x : A) → B @ -- -- Conor's system is however set up differently, with a very different -- variable rule: -- -- @@ -- -- (q x : A) ∈ Γ -------------- Γ ⊢q x : A -- -- Γ, (q·p) x : A ⊢q t : B ----------------------------- Γ ⊢q λxt : (p x -- : A) → B -- -- Γ ⊢q t : (p x : A) → B Γ' ⊢qp u : A -- ------------------------------------------------- Γ + Γ' ⊢q t u : -- B[u/x] @@ module Agda.TypeChecking.Irrelevance checkIrrelevanceAllowed :: LensRelevance a => a -> TCM () checkAllIrrelevanceAllowed :: (Traversable f, LensRelevance a) => f a -> TCM () -- | Check whether something can be used in a position of the given -- relevance. -- -- This is a substitute for double-checking that only makes sure -- relevances are correct. See issue #2640. -- -- Used in unifier ( unifyStep Solution{}). -- -- At the moment, this implements McBride-style irrelevance, where -- Pfenning-style would be the most accurate thing. However, these two -- notions only differ how they handle bound variables in a term. Here, -- we are only concerned in the free variables, used meta-variables, and -- used (irrelevant) definitions. class UsableRelevance a usableRel :: (UsableRelevance a, ReadTCState m, HasConstInfo m, MonadAddContext m) => Relevance -> a -> m Bool -- | Check whether something can be used in a position of the given -- modality. -- -- This is a substitute for double-checking that only makes sure -- modalities are correct. See issue #2640. -- -- Used in unifier ( unifyStep Solution{}). -- -- This uses McBride-style modality checking. It does not differ from -- Pfenning-style if we are only interested in the modality of the free -- variables, used meta-variables, and used definitions. class UsableModality a usableMod :: (UsableModality a, HasConstInfo m, MonadAddContext m, MonadReduce m, MonadError Blocker m) => Modality -> a -> m Bool usableModAbs :: (Subst a, MonadAddContext m, UsableModality a, HasConstInfo m, MonadReduce m, MonadError Blocker m) => ArgInfo -> Modality -> Abs a -> m Bool usableAtModality' :: MonadConstraint TCM => Maybe Sort -> WhyCheckModality -> Modality -> Term -> TCM () usableAtModality :: MonadConstraint TCM => WhyCheckModality -> Modality -> Term -> TCM () -- | Given a partitioning of the context into the local context, telescope -- of of pattern variables and pattern-lambda bound variables, return -- whether the given variable is one of the pattern variables. isPatternVar :: Nat -> Nat -> Nat -> Bool -- | Compute whether a type is a definitional singleton or might become one -- after a substitution or after the addition of some rewrite rules -- Assumes type passed in has been reduced (otherwise will be even more -- conservative than necessary). isDefSing :: (PureTCM m, MonadBlock m) => Nat -> Nat -> Type -> m DefSing isDefSing' :: (PureTCM m, MonadBlock m) => Nat -> Nat -> Dom Type -> m DefSing -- | Is a type a proposition? (Needs reduction.) isPropM :: (LensSort a, PrettyTCM a, PureTCM m, MonadBlock m) => a -> m Bool isIrrelevantOrPropM :: (LensRelevance a, LensSort a, PrettyTCM a, PureTCM m, MonadBlock m) => a -> m Bool allIrrelevantOrPropTel :: (PureTCM m, MonadBlock m) => Telescope -> m Bool -- | Is a type fibrant (i.e. Type, Prop)? isFibrant :: (LensSort a, PureTCM m, MonadBlock m) => a -> m Bool isFibrant' :: (LensSort a, PureTCM m) => a -> m (Either Blocker Bool) -- | Cofibrant types are those that could be the domain of a fibrant pi -- type. (Notion by C. Sattler). isCoFibrantSort :: (LensSort a, PureTCM m) => a -> m (Either Blocker Bool) instance Agda.TypeChecking.Irrelevance.UsableModality a => Agda.TypeChecking.Irrelevance.UsableModality (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Irrelevance.UsableModality a => Agda.TypeChecking.Irrelevance.UsableModality (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Irrelevance.UsableModality a => Agda.TypeChecking.Irrelevance.UsableModality (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Irrelevance.UsableModality Agda.Syntax.Internal.Level instance Agda.TypeChecking.Irrelevance.UsableModality a => Agda.TypeChecking.Irrelevance.UsableModality [a] instance Agda.TypeChecking.Irrelevance.UsableModality Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Irrelevance.UsableModality Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Irrelevance.UsableModality a, Agda.TypeChecking.Irrelevance.UsableModality b) => Agda.TypeChecking.Irrelevance.UsableModality (a, b) instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableModality (Agda.Syntax.Internal.Type' a) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Irrelevance.UsableRelevance a) => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.Level instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance [a] instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Irrelevance.UsableRelevance a, Agda.TypeChecking.Irrelevance.UsableRelevance b) => Agda.TypeChecking.Irrelevance.UsableRelevance (a, b) instance (Agda.TypeChecking.Irrelevance.UsableRelevance a, Agda.TypeChecking.Irrelevance.UsableRelevance b, Agda.TypeChecking.Irrelevance.UsableRelevance c) => Agda.TypeChecking.Irrelevance.UsableRelevance (a, b, c) instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Type' a) module Agda.TypeChecking.Records mkCon :: ConHead -> ConInfo -> Args -> Term -- | Order the fields of a record construction. orderFields :: HasRange a => QName -> (Arg Name -> a) -> [Arg Name] -> [(Name, a)] -> Writer [RecordFieldWarning] [a] -- | Raise generated RecordFieldWarnings as warnings. warnOnRecordFieldWarnings :: Writer [RecordFieldWarning] a -> TCM a -- | Raise generated RecordFieldWarnings as errors. failOnRecordFieldWarnings :: Writer [RecordFieldWarning] a -> TCM a -- | Order the fields of a record construction. Raise generated -- RecordFieldWarnings as warnings. orderFieldsWarn :: HasRange a => QName -> (Arg Name -> a) -> [Arg Name] -> [(Name, a)] -> TCM [a] -- | Order the fields of a record construction. Raise generated -- RecordFieldWarnings as errors. orderFieldsFail :: HasRange a => QName -> (Arg Name -> a) -> [Arg Name] -> [(Name, a)] -> TCM [a] -- | A record field assignment record{xs = es} might not mention -- all visible fields. insertMissingFields inserts placeholders -- for the missing visible fields and returns the values in order of the -- fields in the record declaration. insertMissingFields :: HasRange a => QName -> (Name -> a) -> [FieldAssignment' a] -> [Arg Name] -> Writer [RecordFieldWarning] [NamedArg a] -- | A record field assignment record{xs = es} might not mention -- all visible fields. insertMissingFields inserts placeholders -- for the missing visible fields and returns the values in order of the -- fields in the record declaration. insertMissingFieldsWarn :: HasRange a => QName -> (Name -> a) -> [FieldAssignment' a] -> [Arg Name] -> TCM [NamedArg a] -- | A record field assignment record{xs = es} might not mention -- all visible fields. insertMissingFields inserts placeholders -- for the missing visible fields and returns the values in order of the -- fields in the record declaration. insertMissingFieldsFail :: HasRange a => QName -> (Name -> a) -> [FieldAssignment' a] -> [Arg Name] -> TCM [NamedArg a] -- | Check if a name refers to a record. If yes, return record definition. isRecord :: (HasCallStack, HasConstInfo m) => QName -> m (Maybe RecordData) -- | Get the definition for a record. Throws an exception if the name does -- not refer to a record or the record is abstract. getRecordDef :: (HasCallStack, HasConstInfo m, ReadTCState m, MonadError TCErr m) => QName -> m RecordData -- | Get the record name belonging to a field name. getRecordOfField :: QName -> TCM (Maybe QName) -- | Get the field names of a record. getRecordFieldNames :: (HasCallStack, HasConstInfo m, ReadTCState m, MonadError TCErr m) => QName -> m [Dom Name] recordFieldNames :: RecordData -> [Dom Name] -- | Find all records with at least the given fields. findPossibleRecords :: [Name] -> TCM [QName] -- | Get the field names belonging to a record type. getRecordTypeFields :: HasCallStack => Type -> TCM [Dom QName] -- | Returns the given record type's constructor name (with an empty -- range). getRecordConstructor :: (HasCallStack, HasConstInfo m, ReadTCState m, MonadError TCErr m) => QName -> m ConHead -- | Reduce a type and check whether it is a record type. Succeeds only if -- type is not blocked by a meta var. If yes, return its name, -- parameters, and definition. isRecordType :: (HasCallStack, PureTCM m) => Type -> m (Maybe (QName, Args, RecordData)) -- | Reduce a type and check whether it is a record type. Succeeds only if -- type is not blocked by a meta var. If yes, return its name, -- parameters, and definition. If no, return the reduced type (unless it -- is blocked). tryRecordType :: (HasCallStack, PureTCM m) => Type -> m (Either (Blocked Type) (QName, Args, RecordData)) -- | Get the original projection info for name. origProjection :: (HasCallStack, HasConstInfo m) => QName -> m (QName, Definition, Maybe Projection) -- | getDefType f t computes the type of (possibly -- projection-(like)) function f whose first argument has type -- t. The parameters for f are extracted from -- t. Nothing if f is projection(like) but -- t is not a datarecordaxiom type. -- -- Precondition: t is reduced. -- -- See also: getConType getDefType :: PureTCM m => QName -> Type -> m (Maybe Type) -- | Apply a projection to an expression with a known type, returning the -- type of the projected value. The given type should either be a record -- type or a type eligible for the principal argument of a -- projection-like function. shouldBeProjectible :: (PureTCM m, MonadTCError m, MonadBlock m) => Term -> Type -> ProjOrigin -> QName -> m Type -- | The analogue of piApply. If v is a value of record -- type t with field f, then projectTyped v t -- f returns the type of f v. And also the record type (as -- first result). -- -- Works also for projection-like definitions f. In this case, -- the first result is not a record type. -- -- Precondition: t is reduced. projectTyped :: PureTCM m => Term -> Type -> ProjOrigin -> QName -> m (Maybe (Dom Type, Term, Type)) -- | Typing of an elimination. data ElimType -- | Type of the argument. ArgT :: Dom Type -> ElimType ProjT :: Dom Type -> Type -> ElimType -- | The type of the record which is eliminated. [projTRec] :: ElimType -> Dom Type -- | The type of the field. [projTField] :: ElimType -> Type -- | Given a head and its type, compute the types of the eliminations. typeElims :: Type -> Term -> Elims -> TCM [ElimType] -- | Given a term with a given type and a list of eliminations, returning -- the type of the term applied to the eliminations. eliminateType :: PureTCM m => m Empty -> Term -> Type -> Elims -> m Type eliminateType' :: PureTCM m => m Empty -> (Elims -> Term) -> Type -> Elims -> m Type -- | Check if a name refers to an eta expandable record. -- -- The answer is no for a record type with an erased constructor unless -- the current quantity is "erased". isEtaRecord :: (HasCallStack, HasConstInfo m) => QName -> m Bool isEtaRecordDef :: RecordData -> Bool isEtaCon :: (HasCallStack, HasConstInfo m) => QName -> m Bool -- | Going under one of these does not count as a decrease in size for the -- termination checker. isEtaOrCoinductiveRecordConstructor :: (HasCallStack, HasConstInfo m) => QName -> m Bool -- | Check if a name refers to a record which is not coinductive. -- (Projections are then size-preserving) isInductiveRecord :: (HasCallStack, HasConstInfo m) => QName -> m Bool -- | Check if a type is an eta expandable record and return the record -- identifier and the parameters. isEtaRecordType :: (HasCallStack, HasConstInfo m) => Type -> m (Maybe (QName, Args)) -- | Check if a name refers to a record constructor. If yes, return record -- definition. isRecordConstructor :: (HasCallStack, HasConstInfo m) => QName -> m (Maybe (QName, RecordData)) isEtaRecordConstructor :: (HasCallStack, HasConstInfo m) => QName -> m (Maybe (QName, RecordData)) -- | Eta should be off for unguarded recursive records. Projections do not -- preserve guardedness. Eta can be forced with the ETA_EQUALITY -- pragma. unguardedRecord :: QName -> TCM () -- | Check whether record type is marked as recursive. -- -- Precondition: record type identifier exists in signature. isRecursiveRecord :: QName -> TCM Bool -- |
--   etaExpandBoundVar i = (Δ, σ, τ)
--   
-- -- Precondition: The current context is Γ = Γ₁, x:R pars, Γ₂ -- where |Γ₂| = i and R is a eta-expandable record type -- with constructor c and fields Γ'. -- -- Postcondition: Δ = Γ₁, Γ', Γ₂[c Γ'] and Γ ⊢ σ : Δ -- and Δ ⊢ τ : Γ. etaExpandBoundVar :: Int -> TCM (Maybe (Telescope, Substitution, Substitution)) -- |
--   expandRecordVar i Γ = (Δ, σ, τ, Γ')
--   
-- -- Precondition: Γ = Γ₁, x:R pars, Γ₂ where |Γ₂| = i -- and R is a eta-expandable record type with constructor -- c and fields Γ'. -- -- Postcondition: Δ = Γ₁, Γ', Γ₂[c Γ'] and Γ ⊢ σ : Δ -- and Δ ⊢ τ : Γ. expandRecordVar :: PureTCM m => Int -> Telescope -> m (Maybe (Telescope, Substitution, Substitution, Telescope)) -- | Precondition: variable list is ordered descendingly. Can be empty. expandRecordVarsRecursively :: [Int] -> Telescope -> TCM (Telescope, Substitution, Substitution) -- |
--   curryAt v (Γ (y : R pars) -> B) n =
--        (  v -> λ Γ ys → v Γ (c ys)            {- curry   -}
--        ,  v -> λ Γ y → v Γ (p1 y) ... (pm y)  {- uncurry -}
--        , Γ (ys : As) → B[c ys / y]
--        )
--   
-- -- where n = size Γ. curryAt :: Type -> Int -> TCM (Term -> Term, Term -> Term, Type) -- | etaExpand r pars u computes the eta expansion of record value -- u at record type r pars. -- -- The first argument r should be the name of an eta-expandable -- record type. Given -- --
--   record R : Set where field x : A; y : B; .z : C
--   
-- -- and r : R, -- --
--   etaExpand R [] r = (tel, [R.x r, R.y r, R.z r])
--   
-- -- where tel is the record telescope instantiated at the -- parameters pars. etaExpandRecord :: HasConstInfo m => QName -> Args -> Term -> m (Maybe (Telescope, Args)) -- | Eta expand a record regardless of whether it's an eta-record or not. forceEtaExpandRecord :: HasConstInfo m => QName -> Args -> Term -> m (Maybe (Telescope, Args)) -- | Eta-expand a value at the given record type. etaExpandRecord' :: HasConstInfo m => Bool -> QName -> Args -> Term -> m (Maybe (Telescope, Args)) -- | Eta-expand a value at the given eta record type. etaExpandRecord_ :: HasConstInfo m => QName -> Args -> RecordData -> Term -> m (Maybe (Telescope, ConHead, ConInfo, Args)) -- | Eta-expand a value at the given record type. etaExpandRecord'_ :: HasConstInfo m => Bool -> QName -> Args -> RecordData -> Term -> m (Maybe (Telescope, ConHead, ConInfo, Args)) -- | The fields should be eta contracted already. -- -- We can eta contract if all fields f = ... are irrelevant or -- all fields f are the projection f v of the same -- value v, but we need at least one relevant field to find the -- value v. -- -- If all fields are erased, we cannot eta-contract. etaContractRecord :: HasConstInfo m => QName -> ConHead -> ConInfo -> Args -> m Term -- | Is the type a hereditarily singleton record type? May return a -- blocking metavariable. -- -- Precondition: The name should refer to a record type, and the -- arguments should be the parameters to the type. isSingletonRecord :: (PureTCM m, MonadBlock m) => QName -> Args -> m Bool isSingletonRecordModuloRelevance :: (PureTCM m, MonadBlock m) => QName -> Args -> m Bool -- | Return the unique (closed) inhabitant if exists. In case of counting -- irrelevance in, the returned inhabitant contains dummy terms. isSingletonRecord' :: (PureTCM m, MonadBlock m) => Bool -> QName -> Args -> Set QName -> m (Maybe Term) -- | Check whether a type has a unique inhabitant and return it. Can be -- blocked by a metavar. isSingletonType :: (PureTCM m, MonadBlock m) => Type -> m (Maybe Term) -- | Check whether a type has a unique inhabitant (irrelevant parts -- ignored). Can be blocked by a metavar. isSingletonTypeModuloRelevance :: (PureTCM m, MonadBlock m) => Type -> m Bool isSingletonType' :: (PureTCM m, MonadBlock m) => Bool -> Type -> Set QName -> m (Maybe Term) -- | Checks whether the given term (of the given type) is -- beta-eta-equivalent to a variable. Returns just the de Bruijn-index of -- the variable if it is, or nothing otherwise. isEtaVar :: PureTCM m => Term -> Type -> m (Maybe Int) -- | Replace projection patterns by the original projections. class NormaliseProjP a normaliseProjP :: (NormaliseProjP a, HasConstInfo m) => a -> m a instance Agda.TypeChecking.Records.NormaliseProjP a => Agda.TypeChecking.Records.NormaliseProjP (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Records.NormaliseProjP Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Records.NormaliseProjP a => Agda.TypeChecking.Records.NormaliseProjP [a] instance Agda.TypeChecking.Records.NormaliseProjP a => Agda.TypeChecking.Records.NormaliseProjP (Agda.Syntax.Common.Named_ a) instance Agda.TypeChecking.Records.NormaliseProjP (Agda.Syntax.Internal.Pattern' x) instance Agda.TypeChecking.Records.NormaliseProjP a => Agda.TypeChecking.Records.NormaliseProjP (x, a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Records.ElimType module Agda.TypeChecking.Rules.LHS.Problem type FlexibleVars = [FlexibleVar Nat] -- | When we encounter a flexible variable in the unifier, where did it -- come from? The alternatives are ordered such that we will assign the -- higher one first, i.e., first we try to assign a DotFlex, -- then... data FlexibleVarKind -- | From a record pattern (ConP). Saves the FlexibleVarKind -- of its subpatterns. RecordFlex :: [FlexibleVarKind] -> FlexibleVarKind -- | From a hidden formal argument or underscore (WildP). ImplicitFlex :: FlexibleVarKind -- | From a dot pattern (DotP). DotFlex :: FlexibleVarKind -- | From a non-record constructor or literal (ConP or LitP). OtherFlex :: FlexibleVarKind -- | Flexible variables are equipped with information where they come from, -- in order to make a choice which one to assign when two flexibles are -- unified. data FlexibleVar a FlexibleVar :: ArgInfo -> IsForced -> FlexibleVarKind -> Maybe Int -> a -> FlexibleVar a [flexArgInfo] :: FlexibleVar a -> ArgInfo [flexForced] :: FlexibleVar a -> IsForced [flexKind] :: FlexibleVar a -> FlexibleVarKind [flexPos] :: FlexibleVar a -> Maybe Int [flexVar] :: FlexibleVar a -> a allFlexVars :: [IsForced] -> Telescope -> FlexibleVars data FlexChoice ChooseLeft :: FlexChoice ChooseRight :: FlexChoice ChooseEither :: FlexChoice ExpandBoth :: FlexChoice class ChooseFlex a chooseFlex :: ChooseFlex a => a -> a -> FlexChoice -- | A user pattern together with an internal term that it should be equal -- to after splitting is complete. Special cases: * User pattern is a -- variable but internal term isn't: this will be turned into an as -- pattern. * User pattern is a dot pattern: this pattern won't trigger -- any splitting but will be checked for equality after all splitting is -- complete and as patterns have been bound. * User pattern is an absurd -- pattern: emptiness of the type will be checked after splitting is -- complete. * User pattern is an annotated wildcard: type annotation -- will be checked after splitting is complete. data ProblemEq ProblemEq :: Pattern -> Term -> Dom Type -> ProblemEq [problemInPat] :: ProblemEq -> Pattern [problemInst] :: ProblemEq -> Term [problemType] :: ProblemEq -> Dom Type -- | The user patterns we still have to split on. data Problem a Problem :: [ProblemEq] -> [NamedArg Pattern] -> (LHSState a -> TCM a) -> Problem a -- | User patterns which are typed (including the ones generated from -- implicit arguments). [_problemEqs] :: Problem a -> [ProblemEq] -- | List of user patterns which could not yet be typed. Example: f : -- (b : Bool) -> if b then Nat else Nat -> Nat f true = zero f -- false zero = zero f false (suc n) = n In this sitation, for -- clause 2, we construct an initial problem problemEqs = [false = -- b] problemRestPats = [zero] As we instantiate b to -- false, the targetType reduces to Nat -> -- Nat and we can move pattern zero over to -- problemEqs. [_problemRestPats] :: Problem a -> [NamedArg Pattern] -- | The code that checks the RHS. [_problemCont] :: Problem a -> LHSState a -> TCM a problemEqs :: forall a f. Functor f => ([ProblemEq] -> f [ProblemEq]) -> Problem a -> f (Problem a) problemRestPats :: forall a f. Functor f => ([NamedArg Pattern] -> f [NamedArg Pattern]) -> Problem a -> f (Problem a) problemCont :: forall a f. Functor f => ((LHSState a -> TCM a) -> f (LHSState a -> TCM a)) -> Problem a -> f (Problem a) problemInPats :: Problem a -> [Pattern] data AsBinding AsB :: Name -> Term -> Dom Type -> AsBinding data DotPattern Dot :: Expr -> Term -> Dom Type -> DotPattern data AbsurdPattern Absurd :: Range -> Dom Type -> AbsurdPattern data AnnotationPattern Ann :: Expr -> Type -> AnnotationPattern -- | State worked on during the main loop of checking a lhs. [Ulf Norell's -- PhD, page. 35] data LHSState a LHSState :: Telescope -> [NamedArg DeBruijnPattern] -> Problem a -> Arg Type -> [Maybe Int] -> Bool -> MatchPrio -> LHSState a -- | The types of the pattern variables. [_lhsTel] :: LHSState a -> Telescope -- | Patterns after splitting. The de Bruijn indices refer to positions in -- the list of abstract syntax patterns in the problem, counted from the -- back (right-to-left). [_lhsOutPat] :: LHSState a -> [NamedArg DeBruijnPattern] -- | User patterns of supposed type delta. [_lhsProblem] :: LHSState a -> Problem a -- | Type eliminated by problemRestPats in the problem. Can be -- Irrelevant to indicate that we came by an irrelevant projection -- and, hence, the rhs must be type-checked in irrelevant mode. [_lhsTarget] :: LHSState a -> Arg Type -- | have we splitted with a PartialFocus? [_lhsPartialSplit] :: LHSState a -> [Maybe Int] -- | Have we split on any indexed inductive types? [_lhsIndexedSplit] :: LHSState a -> Bool -- | The match priority attached to the next split. The priority -- approximates causality, i.e. some splits (higher prio value) become -- available only after certain splits (lower prio value) have already -- been made. This information is used in the matcher for the -- non-compiled clauses to determine whether a DontKnow -- dominates a No (mismatch). The lower prio value is dominant -- in case of conflict. See issues #2964 and #3054, #8559. [_lhsMatchPrio] :: LHSState a -> MatchPrio lhsTel :: forall a f. Functor f => (Telescope -> f Telescope) -> LHSState a -> f (LHSState a) lhsOutPat :: forall a f. Functor f => ([NamedArg DeBruijnPattern] -> f [NamedArg DeBruijnPattern]) -> LHSState a -> f (LHSState a) lhsProblem :: forall a f. Functor f => (Problem a -> f (Problem a)) -> LHSState a -> f (LHSState a) lhsTarget :: forall a f. Functor f => (Arg Type -> f (Arg Type)) -> LHSState a -> f (LHSState a) data LeftoverPatterns LeftoverPatterns :: IntMap [(Arg Name, PatVarPosition)] -> [AsBinding] -> [DotPattern] -> [AbsurdPattern] -> [AnnotationPattern] -> [Pattern] -> LeftoverPatterns [patternVariables] :: LeftoverPatterns -> IntMap [(Arg Name, PatVarPosition)] [asPatterns] :: LeftoverPatterns -> [AsBinding] [dotPatterns] :: LeftoverPatterns -> [DotPattern] [absurdPatterns] :: LeftoverPatterns -> [AbsurdPattern] [typeAnnotations] :: LeftoverPatterns -> [AnnotationPattern] [otherPatterns] :: LeftoverPatterns -> [Pattern] -- | Classify remaining patterns after splitting is complete into pattern -- variables, as patterns, dot patterns, and absurd patterns. -- Precondition: there are no more constructor patterns. getLeftoverPatterns :: (PureTCM m, MonadFresh NameId m) => [ProblemEq] -> m LeftoverPatterns -- | Build a renaming for the internal patterns using variable names from -- the user patterns. If there are multiple user names for the same -- internal variable, the unused ones are returned as as-bindings. Names -- that are not also module parameters are preferred over those that are. getUserVariableNames :: Telescope -> IntMap [(Arg Name, PatVarPosition)] -> ([Maybe Name], [AsBinding]) instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex a => Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.TypeChecking.Rules.LHS.Problem.FlexibleVarKind instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.Syntax.Common.Hiding instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex GHC.Internal.Types.Int instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.TypeChecking.Monad.Base.IsForced instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex a => Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex [a] instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex a => Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.Syntax.Common.Origin instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.LHS.Problem.FlexibleVarKind instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.LHS.Problem.PatVarPosition instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar instance GHC.Internal.Base.Functor Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.Syntax.Common.LensArgInfo (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance Agda.Syntax.Common.LensHiding (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance Agda.Syntax.Common.LensModality (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance Agda.Syntax.Common.LensOrigin (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance GHC.Internal.Base.Monoid Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Internal.Base.Monoid Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance Agda.Utils.Null.Null Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Rules.LHS.Problem.PatVarPosition instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.AbsurdPattern instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.AnnotationPattern instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.DotPattern instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Rules.LHS.Problem.LHSState a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.MatchPrio instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.ProblemEq instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Problem.FlexibleVarKind instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Problem.PatVarPosition instance GHC.Internal.Show.Show (Agda.TypeChecking.Rules.LHS.Problem.Problem a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Rules.LHS.Problem.AbsurdPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Rules.LHS.Problem.DotPattern instance Agda.TypeChecking.Substitute.Class.Subst (Agda.TypeChecking.Rules.LHS.Problem.Problem a) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar module Agda.TypeChecking.Rules.LHS.Unify.Types data Equality Equal :: Dom Type -> Term -> Term -> Equality [_eqType] :: Equality -> Dom Type [_eqLeft] :: Equality -> Term [_eqRight] :: Equality -> Term eqConstructorForm :: HasBuiltins m => Equality -> m Equality eqUnLevel :: HasBuiltins m => Equality -> m Equality data UnifyState UState :: Telescope -> FlexibleVars -> Telescope -> [Arg Term] -> [Arg Term] -> UnifyState -- | Don't reduce! [varTel] :: UnifyState -> Telescope [flexVars] :: UnifyState -> FlexibleVars -- | Can be reduced eagerly. [eqTel] :: UnifyState -> Telescope -- | Ends up in dot patterns (should not be reduced eagerly). [eqLHS] :: UnifyState -> [Arg Term] -- | Ends up in dot patterns (should not be reduced eagerly). [eqRHS] :: UnifyState -> [Arg Term] lensVarTel :: Lens' UnifyState Telescope lensEqTel :: Lens' UnifyState Telescope initUnifyState :: PureTCM m => Telescope -> FlexibleVars -> Type -> Args -> Args -> m UnifyState isUnifyStateSolved :: UnifyState -> Bool varCount :: UnifyState -> Int -- | Get the type of the i'th variable in the given state getVarType :: Int -> UnifyState -> Dom Type getVarTypeUnraised :: Int -> UnifyState -> Dom Type eqCount :: UnifyState -> Int -- | Get the k'th equality in the given state. The left- and right-hand -- sides of the equality live in the varTel telescope, and the type of -- the equality lives in the varTel++eqTel telescope getEquality :: Int -> UnifyState -> Equality getReducedEquality :: (MonadReduce m, MonadAddContext m) => Int -> UnifyState -> m Equality -- | As getEquality, but with the unraised type getEqualityUnraised :: Int -> UnifyState -> Equality getReducedEqualityUnraised :: (MonadReduce m, MonadAddContext m) => Int -> UnifyState -> m Equality -- | Instantiate the k'th variable (from the left) with the given value. -- Returns Nothing if there is a cycle. solveVar :: Int -> DeBruijnPattern -> UnifyState -> Maybe (UnifyState, PatternSubstitution, Permutation) applyUnder :: Int -> Telescope -> Term -> Telescope dropAt :: Int -> [a] -> [a] -- | Solve the k'th equation with the given value, which can depend on -- regular variables but not on other equation variables. solveEq :: Int -> Term -> UnifyState -> (UnifyState, PatternSubstitution) data UnifyStep Deletion :: Int -> Type -> Term -> Term -> UnifyStep [deleteAt] :: UnifyStep -> Int [deleteType] :: UnifyStep -> Type [deleteLeft] :: UnifyStep -> Term [deleteRight] :: UnifyStep -> Term Solution :: Int -> Dom Type -> FlexibleVar Int -> Term -> Either () () -> UnifyStep [solutionAt] :: UnifyStep -> Int [solutionType] :: UnifyStep -> Dom Type [solutionVar] :: UnifyStep -> FlexibleVar Int [solutionTerm] :: UnifyStep -> Term -- | side of the equation where the variable is. [solutionSide] :: UnifyStep -> Either () () Injectivity :: Int -> Type -> QName -> Args -> Args -> ConHead -> UnifyStep [injectAt] :: UnifyStep -> Int [injectType] :: UnifyStep -> Type [injectDatatype] :: UnifyStep -> QName [injectParameters] :: UnifyStep -> Args [injectIndices] :: UnifyStep -> Args [injectConstructor] :: UnifyStep -> ConHead Conflict :: Int -> Type -> QName -> Args -> Term -> Term -> UnifyStep [conflictAt] :: UnifyStep -> Int [conflictType] :: UnifyStep -> Type [conflictDatatype] :: UnifyStep -> QName [conflictParameters] :: UnifyStep -> Args [conflictLeft] :: UnifyStep -> Term [conflictRight] :: UnifyStep -> Term Cycle :: Int -> Type -> QName -> Args -> Int -> Term -> UnifyStep [cycleAt] :: UnifyStep -> Int [cycleType] :: UnifyStep -> Type [cycleDatatype] :: UnifyStep -> QName [cycleParameters] :: UnifyStep -> Args [cycleVar] :: UnifyStep -> Int [cycleOccursIn] :: UnifyStep -> Term EtaExpandVar :: FlexibleVar Int -> QName -> Args -> UnifyStep [expandVar] :: UnifyStep -> FlexibleVar Int [expandVarRecordType] :: UnifyStep -> QName [expandVarParameters] :: UnifyStep -> Args EtaExpandEquation :: Int -> QName -> Args -> UnifyStep [expandAt] :: UnifyStep -> Int [expandRecordType] :: UnifyStep -> QName [expandParameters] :: UnifyStep -> Args LitConflict :: Int -> Type -> Literal -> Literal -> UnifyStep [litConflictAt] :: UnifyStep -> Int [litType] :: UnifyStep -> Type [litConflictLeft] :: UnifyStep -> Literal [litConflictRight] :: UnifyStep -> Literal StripSizeSuc :: Int -> Term -> Term -> UnifyStep [stripAt] :: UnifyStep -> Int [stripArgLeft] :: UnifyStep -> Term [stripArgRight] :: UnifyStep -> Term SkipIrrelevantEquation :: Int -> UnifyStep [skipIrrelevantAt] :: UnifyStep -> Int TypeConInjectivity :: Int -> QName -> Args -> Args -> UnifyStep [typeConInjectAt] :: UnifyStep -> Int [typeConstructor] :: UnifyStep -> QName [typeConArgsLeft] :: UnifyStep -> Args [typeConArgsRight] :: UnifyStep -> Args data UnifyLogEntry UnificationStep :: UnifyState -> UnifyStep -> UnifyOutput -> UnifyLogEntry type UnifyLog = [(UnifyLogEntry, UnifyState)] -- | This variant of UnifyLog is used to ensure that tell is -- not expensive. type UnifyLog' = DList (UnifyLogEntry, UnifyState) data UnifyOutput UnifyOutput :: PatternSubstitution -> PatternSubstitution -> Maybe Permutation -> UnifyOutput [unifySubst] :: UnifyOutput -> PatternSubstitution [unifyProof] :: UnifyOutput -> PatternSubstitution [unifySolutionPerm] :: UnifyOutput -> Maybe Permutation type UnifyLogT (m :: Type -> Type) a = WriterT UnifyLog' m a type UnifyStepT (m :: Type -> Type) a = WriterT UnifyOutput m a tellUnifySubst :: MonadWriter UnifyOutput m => PatternSubstitution -> m () tellUnifyProof :: MonadWriter UnifyOutput m => PatternSubstitution -> m () tellUnifySolutionPerm :: MonadWriter UnifyOutput m => Permutation -> m () writeUnifyLog :: MonadWriter UnifyLog' m => (UnifyLogEntry, UnifyState) -> m () runUnifyLogT :: Monad m => UnifyLogT m a -> m (a, UnifyLog) instance GHC.Internal.Base.Monoid Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyOutput instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyState instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyStep instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyState instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyOutput instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyState instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Unify.Types.UnifyStep -- | Functions for building the left inverse part of a UnifyEquiv. module Agda.TypeChecking.Rules.LHS.Unify.LeftInverse data DigestedUnifyStep DSolution :: Int -> Dom Type -> FlexibleVar Int -> Term -> Either () () -> DigestedUnifyStep DEtaExpandVar :: FlexibleVar Int -> QName -> Args -> DigestedUnifyStep data DigestedUnifyLogEntry DUnificationStep :: UnifyState -> DigestedUnifyStep -> UnifyOutput -> DigestedUnifyLogEntry type DigestedUnifyLog = [(DigestedUnifyLogEntry, UnifyState)] -- | Pre-process a UnifyLog so that we catch unsupported steps early. digestUnifyLog :: UnifyLog -> Either NoLeftInv DigestedUnifyLog data NoLeftInv UnsupportedYet :: UnifyStep -> NoLeftInv [badStep] :: NoLeftInv -> UnifyStep Illegal :: UnifyStep -> NoLeftInv [badStep] :: NoLeftInv -> UnifyStep NoCubical :: NoLeftInv WithKEnabled :: NoLeftInv -- | splitting on a Strict Set. SplitOnStrict :: NoLeftInv -- | splitting on a @♭ argument SplitOnFlat :: NoLeftInv UnsupportedCxt :: NoLeftInv CantTransport :: Closure (Abs Type) -> NoLeftInv CantTransport' :: Closure Type -> NoLeftInv -- | Build the left inverse part of a UnifyEquiv (τ, -- leftInv). buildLeftInverse :: UnifyState -> UnifyLog -> TCM (Either NoLeftInv (Substitution, Substitution)) type Retract = (Telescope, Substitution, Substitution, Substitution) termsS :: DeBruijn a => Impossible -> [a] -> Substitution' a composeRetract :: Retract -> Term -> Retract -> TCM (Either (Closure (Abs Type)) Retract) -- | Build the left inverse corresponding to a single unification step. buildEquiv :: DigestedUnifyLogEntry -> UnifyState -> TCM (Either NoLeftInv (Retract, Term)) explainStep :: MonadPretty m => UnifyStep -> m Doc instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Unify.LeftInverse.DigestedUnifyStep instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Unify.LeftInverse.NoLeftInv instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Unify.LeftInverse.NoLeftInv -- | Pattern matcher used in the reducer for clauses that have not been -- compiled to case trees yet. module Agda.TypeChecking.Patterns.Match -- | Result of matching a pattern against a term. data Match a -- | Matches with the given substitution for the pattern variables. Yes :: Simplification -> IntMap (Arg a) -> Match a -- | Mismatch where the constructor/literal pattern has the given priority. No :: MatchPrio -> Match a -- | Stuck where the constructor/literal pattern has the given priority. If -- matching is inconclusive we also want to know whether it is on a lazy -- pattern and whether it is due to a particular meta variable. DontKnow :: MatchPrio -> OnlyLazy -> Blocked () -> Match a matchedArgs :: Empty -> Int -> IntMap (Arg a) -> [Arg a] matchedArgs' :: Int -> IntMap (Arg a) -> [Maybe (Arg a)] -- | Builds a proper substitution from an IntMap produced by -- match(Co)patterns buildSubstitution :: DeBruijn a => Impossible -> Int -> IntMap (Arg a) -> Substitution' a -- | Whether the inconclusive matches are only on lazy patterns. data OnlyLazy OnlyLazy :: OnlyLazy NonLazy :: OnlyLazy -- | Instead of zipWithM, we need to use this lazy version of -- combining pattern matching computations. foldMatch :: forall m p v. (IsProjP p, MonadMatch m) => (p -> v -> m (Match Term, v)) -> [p] -> [v] -> m (Match Term, [v]) mergeElim :: Elim -> Arg Term -> Elim mergeElims :: [Elim] -> [Arg Term] -> [Elim] type MonadMatch (m :: Type -> Type) = PureTCM m -- | matchCopatterns ps es matches spine es against -- copattern spine ps. -- -- Returns Yes and a substitution for the pattern variables (in -- form of IntMap Term) if matching was successful. -- -- Returns No if there was a constructor or projection mismatch. -- -- Returns DontKnow if an argument could not be evaluated to -- constructor form because of a blocking meta variable. -- -- In any case, also returns spine es in reduced form (with all -- the weak head reductions performed that were necessary to come to a -- decision). matchCopatterns :: MonadMatch m => [NamedArg DeBruijnPattern] -> [Elim] -> m (Match Term, [Elim]) -- | Match a single copattern. matchCopattern :: MonadMatch m => DeBruijnPattern -> Elim -> m (Match Term, Elim) matchPatterns :: MonadMatch m => [NamedArg DeBruijnPattern] -> [Arg Term] -> m (Match Term, [Arg Term]) -- | Match a single pattern. matchPattern :: MonadMatch m => DeBruijnPattern -> Arg Term -> m (Match Term, Arg Term) yesSimplification :: Match a -> Match a -- | Match a single pattern. matchPatternP :: MonadMatch m => DeBruijnPattern -> Arg DeBruijnPattern -> m (Match DeBruijnPattern) matchPatternsP :: MonadMatch m => [NamedArg DeBruijnPattern] -> [Arg DeBruijnPattern] -> m (Match DeBruijnPattern) -- | Does the pattern perform a match that could fail? properlyMatching :: HasConstInfo m => Pattern' a -> m Bool properlyMatching' :: HasConstInfo m => Bool -> Bool -> Pattern' a -> m Bool instance GHC.Internal.Base.Functor Agda.TypeChecking.Patterns.Match.Match instance GHC.Internal.Base.Monoid (Agda.TypeChecking.Patterns.Match.Match a) instance GHC.Internal.Base.Monoid Agda.TypeChecking.Patterns.Match.OnlyLazy instance Agda.Utils.Null.Null (Agda.TypeChecking.Patterns.Match.Match a) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Patterns.Match.Match a) instance GHC.Internal.Base.Semigroup (Agda.TypeChecking.Patterns.Match.Match a) instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Patterns.Match.OnlyLazy instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Patterns.Match.Match a) instance GHC.Internal.Show.Show Agda.TypeChecking.Patterns.Match.OnlyLazy module Agda.TypeChecking.Functions -- | Expand a clause to the maximal arity, by inserting variable patterns -- and applying the body to variables. Return the arity and the expanded -- clause. etaExpandClause :: PureTCM tcm => Clause -> tcm (Int, Clause) -- | Get the name of defined symbol of the head normal form of a term. -- Returns Nothing if no such head exists. getDef :: Term -> TCM (Maybe QName) -- | Computing the occurrence graph for a mutual block. This is used to -- compute polarities of arguments and to check positivity. -- -- -- -- The occurrence graph is imprecise in several ways. -- -- -- -- Lastly, applications of mutual names to arguments is handled in a -- rather imprecise way. See Issue 1984 for illustration: -- --
--   mutual
--     record Fun (A : Set) (B : A → Set) : Set where
--       field fun : (x : A) → B x
--   
--     data U : Set where
--       Π : (A : U) (B : El A → U) → U
--   
--     El : U → Set
--     El (Π A B) = Fun (El A) (λ x → El (B x))
--   
-- -- In this case: -- -- -- -- In short, when we apply a mutual name to an argument, we view that as -- if the argument was substituted inside the body of the mutual -- name definition. -- -- Hence, Fun "occurs" in Fun, and it does so -- negatively. This is kinda bogus, because Fun could be moved -- outside of the mutual block. -- -- A potential fix of this issue would be to first split the mutual block -- into strongly connected components based on only QName occurrences, -- and afterwards do the current occurrence analysis for each sub-block. -- -- Immutable representation -- -- Instead of using the mutable hashtable, we use immutable "generic" -- graphs from Unidirectional for printing warnings and debug -- messages, and also to define tests in internal property tests. One -- reason is convenience. Another reason is that the previous (less -- optimized) implementation before PR 8411 used the generic graphs, and -- we just reuse the old implementation for printing. See -- toGenericGraph and fromGenericGraph. module Agda.TypeChecking.Positivity.OccurrenceAnalysis data Node -- | Definition site of a mutual definition pattern DefNode :: () => QName -> Node -- | Occurrence of the nth definition argument inside the definition. pattern ArgNode :: () => QName -> Int -> Node data Edge a Edge :: Occurrence -> a -> Edge a -- | Meaning of the graph: the keys in the outer NodeMap occur in the keys -- of the inner NodeMap. type OccGraph = NodeMap NodeMap Edge OccursWhere buildOccurrenceGraph :: [QName] -> TCM (OccGraph, Mutuals) -- | Strongly connected components, in reverse topological order. stronglyConnComp :: OccGraph -> IO [SCC Node] -- | Search for transitive occurrences through the occurrence graph. We -- compute the oplus sum of all paths from the source to the -- target. This is not as bad as it sounds, becuse a) we can -- short-circuit a search when a Mixed path is found b) only 4 -- possible Occurrences remain, (discounting Mixed and -- Unused) and we can use a DFS where each node is visited at most -- 4 times, for each Occurence of the path to the node from the -- source. transitiveOccurrence :: OccGraph -> Node -> Node -> IO Occurrence adjacencyList :: OccGraph -> IO [(Node, Node, Edge OccursWhere)] -- | Getting the "found" and "not found" branches as arguments. We do this -- to fuse away the Maybe in the lookup result. lookupNode :: Node -> NodeMap v -> (v -> IO a) -> IO a -> IO a -- | Convert to generic Utils graph, for the purpose of testing and warning -- rendering. toGenericGraph :: OccGraph -> Graph Node (Edge OccursWhere) -- | Make a graph from a generic one. We use this in testing in -- Internal.TypeChecking.Positivity where it's much more convenient to -- generate immutable graphs. Note: we ignore occurrence location info. fromGenericGraph :: Graph Node (Edge a) -> OccGraph instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (Agda.Syntax.Common.Arg a) instance (Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences x, Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a) => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (Agda.TypeChecking.Telescope.Boundary' x a) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences GHC.Internal.Types.Int instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.Syntax.Internal.Level instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences [a] instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences a, Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences b) => Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences (a, b) instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.Syntax.Internal.Type instance Agda.TypeChecking.Positivity.OccurrenceAnalysis.ComputeOccurrences Agda.TypeChecking.Positivity.OccurrenceAnalysis.TypedTerm instance GHC.Internal.Classes.Eq Agda.TypeChecking.Positivity.OccurrenceAnalysis.Seen instance GHC.Internal.Exception.Type.Exception Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Data.Hashable.Class.Hashable Agda.TypeChecking.Positivity.OccurrenceAnalysis.Seen instance Agda.TypeChecking.Pretty.PrettyTCMWithNode (Agda.TypeChecking.Positivity.Occurrence.Edge Agda.TypeChecking.Positivity.Occurrence.OccursWhere) instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.OccurrenceAnalysis.DefArgInEnv instance GHC.Internal.Show.Show Agda.TypeChecking.Positivity.OccurrenceAnalysis.Seen -- | Check that a datatype is strictly positive. module Agda.TypeChecking.Positivity -- | Check that the datatypes in the mutual block containing the given -- declarations are strictly positive. -- -- Find polarity of datatypes parameters and indices. -- -- Also add information about positivity and recursivity of records to -- the signature. checkStrictlyPositive :: MutualInfo -> Set QName -> TCM () getDefArity :: Definition -> TCM Int hasDefinition :: Defn -> Bool isDatatype :: Definition -> Maybe (PositivityCheck, DataOrRecord) preprocessBlock :: [QName] -> TCM (Maybe [(QName, Int, Maybe (PositivityCheck, DataOrRecord), Bool)]) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Positivity.Occurrence.Node instance Agda.TypeChecking.Pretty.PrettyTCM (Data.Sequence.Internal.Seq Agda.TypeChecking.Positivity.Warnings.OccursWhere) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.TypeChecking.Pretty.PrettyTCMWithNode (Agda.TypeChecking.Positivity.Occurrence.Edge a) -- | Dropping initial arguments (`parameters') from a function -- which can be easily reconstructed from its principal argument. -- -- A function which has such parameters is called ``projection-like''. -- -- The motivation for this optimization comes from the use of nested -- records. -- -- First, let us look why proper projections need not store the -- parameters: The type of a projection f is of the form f -- : Γ → R Γ → C where R is the record type and C -- is the type of the field f. Given a projection application -- p pars u we know that the type of the principal argument -- u is u : R pars thus, the parameters pars -- are redundant in the projection application if we can always infer the -- type of u. For projections, this is case, because the -- principal argument u must be neutral; otherwise, if it was a -- record value, we would have a redex, yet Agda maintains a β-normal -- form. -- -- The situation for projections can be generalized to -- ``projection-like'' functions f. Conditions: -- --
    --
  1. The type of f is of the form f : Γ → D Γ → ... -- for some type constructor D which can never reduce.
  2. --
  3. For every reduced welltyped application f pars u ..., the -- type of u is inferable.
  4. --
-- -- This then allows pars to be dropped always. -- -- Condition 2 is approximated by a bunch of criteria, for details see -- function makeProjection. -- -- Typical projection-like functions are compositions of projections -- which arise from nested records. -- -- Notes: -- --
    --
  1. This analysis could be dualized to ``constructor-like'' functions -- whose parameters are reconstructable from the target type. But such -- functions would need to be fully applied.
  2. --
  3. A more general analysis of which arguments are reconstructible can -- be found inJason C. Reed, Redundancy elimination for LF LFTMP -- 2004.
  4. --
module Agda.TypeChecking.ProjectionLike -- | View for a Def f (Apply a : es) where -- isRelevantProjection f. Used for projection-like fs. data ProjectionView -- | A projection or projection-like function, applied to its principal -- argument ProjectionView :: QName -> Arg Term -> Elims -> ProjectionView [projViewProj] :: ProjectionView -> QName [projViewSelf] :: ProjectionView -> Arg Term [projViewSpine] :: ProjectionView -> Elims -- | Just a lone projection-like function, missing its principal argument -- (from which we could infer the parameters). LoneProjectionLike :: QName -> ArgInfo -> ProjectionView -- | Not a projection or projection-like thing. NoProjection :: Term -> ProjectionView -- | Semantics of ProjectionView. unProjView :: ProjectionView -> Term -- | Top-level ProjectionView (no reduction). projView :: HasConstInfo m => Term -> m ProjectionView -- | Reduce away top-level projection like functions. (Also reduces -- projections, but they should not be there, since Internal is in -- lambda- and projection-beta-normal form.) reduceProjectionLike :: PureTCM m => Term -> m Term -- | How to treat lone projection-like functions (i.e. those that miss -- their principal argument) in elimView. data LoneProjectionLikeToLambda -- | Turn lone projection-like functions into lambdas. LoneProjectionLikeToLambda :: LoneProjectionLikeToLambda -- | Leave lone projection-like functions as they are. KeepLoneProjectionLike :: LoneProjectionLikeToLambda -- | Turn prefix projection-like function application into postfix ones. -- This does just one layer, such that the top spine contains the -- projection-like functions as projections. Used in -- compareElims in TypeChecking.Conversion and in -- Agda.TypeChecking.CheckInternal. -- -- With LoneProjectionLikeToLambda, a lone projection like -- function will be turned into a lambda-abstraction, expecting the -- principal argument. If the KeepLoneProjectionLike, it will be -- returned unaltered. -- -- No precondition. Preserves constructorForm, since it really does only -- something on (applications of) projection-like functions. elimView :: PureTCM m => LoneProjectionLikeToLambda -> Term -> m Term -- | Which Def heads are eligible for the principle argument of a -- projection-like function? They need to be injective, which is the case -- for data, record, and axiom. eligibleForProjectionLike :: HasConstInfo m => QName -> m Bool -- | Turn a definition into a projection if it looks like a projection. -- -- Conditions for projection-likeness of f: -- --
    --
  1. The type of f must be of the shape Γ → D Γ → C -- for D a name (Def) which is -- eligibleForProjectionLike: data record -- postulate.
  2. --
-- -- None of the parameters may be irrelevant (issue #8686). -- --
    --
  1. The application of f should only get stuck if the principal -- argument is inferable (neutral). Thus:
  2. --
-- -- a. f cannot have absurd clauses (which are stuck even if the -- principal argument is a constructor). -- -- b. f cannot be abstract as it does not reduce outside -- abstract blocks (always stuck). -- -- c. f cannot match on other arguments than the principal -- argument. -- -- d. f cannot match deeply. -- -- e. fs body may not mention the parameters. -- -- f. A rhs of f cannot be a record expression, since this will -- be translated to copatterns by recordExpressionsToCopatterns. Thus, an -- application of f waiting for a projection can be stuck even -- when the principal argument is a constructor. -- -- g. f cannot be an irrelevant definition (Andreas, 2022-03-07, -- #5809), as those are not reduced. -- -- For internal reasons: -- --
    --
  1. f cannot be constructor headed
  2. --
  3. f cannot be recursive, since we have not implemented a -- function which goes through the bodies of the f and the -- mutually recursive functions and drops the parameters from all -- applications of f.
  4. --
-- -- Examples for these reasons: see -- testSucceedNotProjectionLike.agda makeProjection :: QName -> TCM () -- | Infer type of a neutral term. See also infer in -- Agda.TypeChecking.CheckInternal, which has a very similar -- logic but also type checks all arguments. -- -- Precondition: the term is not a projection-like function in prefix -- (Def) form. inferNeutral :: (PureTCM m, MonadBlock m) => Term -> m Type -- | Compute the head type of a Def application. For projection-like -- functions this requires inferring the type of the principal argument. computeDefType :: (PureTCM m, MonadBlock m) => QName -> Elims -> m Type instance GHC.Internal.Classes.Eq Agda.TypeChecking.ProjectionLike.LoneProjectionLikeToLambda -- | This module contains the rules for Agda's sort system viewed as a pure -- type system (pts). The specification of a pts consists of a set of -- axioms of the form s1 : s2 specifying when a sort fits in -- another sort, and a set of rules of the form (s1,s2,s3) -- specifying that a pi type with domain in s1 and codomain in -- s2 itself fits into sort s3. -- -- To ensure unique principal types, the axioms and rules of Agda's pts -- are given by two partial functions univSort' and -- piSort' (see Agda.TypeChecking.Substitute). If these -- functions return Nothing, a constraint is added to ensure -- that the sort will be computed eventually. -- -- One upgrade over the standard definition of a pts is that in -- a rule (s1,s2,s3), in Agda the sort s2 can depend on -- a variable of some type in s1. This is needed to support -- Agda's universe polymorphism where we can have e.g. a function of type -- ∀ {ℓ} → Set ℓ. module Agda.TypeChecking.Sort -- | Infer the sort of another sort. If we can compute the bigger sort -- straight away, return that. Otherwise, return UnivSort s and -- add a constraint to ensure we can compute the sort eventually. inferUnivSort :: PureTCM m => Sort -> m Sort sortFitsIn :: Sort -> Sort -> TCM () hasBiggerSort :: Sort -> TCM () -- | Infer the sort of a Pi type. If we can compute the sort straight away, -- return that. Otherwise, return a PiSort. Note that this -- function does NOT check PTS constraints, use hasPTSRule for -- that inferPiSort :: MonadConstraint m => Dom Type -> Abs Type -> m Sort -- | As inferPiSort, but for a nondependent function type. inferFunSort :: MonadConstraint m => Dom Type -> Type -> m Sort -- | hasPTSRule a x.s checks that we can form a Pi-type (x : -- a) -> b where b : s. hasPTSRule :: Dom Type -> Abs Sort -> TCM () -- | Recursively check that an iterated function type constructed by -- telePi is well-sorted. checkTelePiSort :: Telescope -> Sort -> TCM () ifIsSort :: (MonadReduce m, MonadBlock m) => Type -> (Sort -> m a) -> m a -> m a ifNotSort :: (MonadReduce m, MonadBlock m) => Type -> m a -> (Sort -> m a) -> m a -- | Result is in reduced form. shouldBeSort :: (PureTCM m, MonadBlock m, MonadError TCErr m) => Type -> m Sort -- | Reconstruct the sort of a term. -- -- Precondition: given term is a well-sorted type. sortOf :: (PureTCM m, MonadConstraint m) => Term -> m Sort -- | Reconstruct the minimal sort of a type (ignoring the sort annotation). sortOfType :: (PureTCM m, MonadConstraint m) => Type -> m Sort module Agda.TypeChecking.Pretty.Warning applyFlagsToTCWarnings :: HasOptions m => Set TCWarning -> m (Set TCWarning) -- | Depending which flags are set, one may happily ignore some warnings. applyFlagsToTCWarningsPreserving :: HasOptions m => Set WarningName -> Set TCWarning -> m (Set TCWarning) -- | If there are several warnings, remove the unsolved-constraints warning -- in case there are no interesting constraints to list. filterTCWarnings :: Set TCWarning -> TCM [TCWarning] getAllUnsolvedWarnings :: (MonadWarning m, MonadTCM m) => m [TCWarning] -- | Collect all warnings that have accumulated in the state. getAllWarnings :: (MonadWarning m, MonadTCM m) => WhichWarnings -> m (Set TCWarning) getAllWarningsOfTCErr :: TCErr -> TCM (Set TCWarning) getAllWarningsPreserving :: (MonadWarning m, MonadTCM m) => Set WarningName -> WhichWarnings -> m (Set TCWarning) prettyDuplicateFields :: MonadPretty m => List1 Name -> m Doc prettyTCWarnings :: Set TCWarning -> TCM String prettyTCWarnings' :: Set TCWarning -> TCM [Doc] prettyTooManyFields :: MonadPretty m => QName -> [Name] -> List1 Name -> m Doc prettyWarning :: MonadPretty m => Warning -> m Doc -- | Turns warnings, if any, into errors. tcWarningsToError :: TopLevelModuleNameWithSourceFile -> [TCWarning] -> TCM () instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.DataOrRecord_ instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.RewriteSource instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.SerialisableRewriteSource instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.TCWarning instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Warning -- | Imperfect discrimination trees for indexing data by internal syntax. module Agda.TypeChecking.DiscrimTree -- | Insert a value into the discrimination tree, turning variables into -- rigid locals or wildcards depending on the given scope. insertDT :: (Ord a, PrettyTCM a) => Int -> Term -> a -> DiscrimTree a -> TCM (DiscrimTree a) -- | Look up a Term in the given discrimination tree, treating local -- variables as rigid symbols. The returned set is guaranteed to contain -- everything that could overlap the given key. lookupDT :: (Ord a, PrettyTCM a) => Term -> DiscrimTree a -> TCM (QueryResult a) -- | Look up a Term in the given discrimination tree, treating local -- variables as wildcards. lookupUnifyDT :: (Ord a, PrettyTCM a) => Term -> DiscrimTree a -> TCM (QueryResult a) data QueryResult a QueryResult :: Set a -> Blocker -> QueryResult a [resultValues] :: QueryResult a -> Set a [resultBlocker] :: QueryResult a -> Blocker -- | Remove a set of values from the discrimination tree. The tree is -- rebuilt so that cases with no leaves are removed. deleteFromDT :: Ord a => Set a -> DiscrimTree a -> DiscrimTree a instance GHC.Internal.Classes.Ord a => GHC.Internal.Base.Monoid (Agda.TypeChecking.DiscrimTree.QueryResult a) instance GHC.Internal.Classes.Ord a => GHC.Internal.Base.Semigroup (Agda.TypeChecking.DiscrimTree.QueryResult a) module Agda.TypeChecking.Datatypes -- | Get true constructor with record fields. getConHead :: (HasCallStack, HasConstInfo m) => QName -> m (Either SigError ConHead) isConstructor :: (HasCallStack, HasConstInfo m) => QName -> m Bool -- | Get true constructor with fields, expanding literals to constructors -- if possible. getConForm :: HasCallStack => QName -> TCM (Either SigError ConHead) -- | Augment constructor with record fields (preserve constructor name). -- The true constructor might only surface via reduce. getOrigConHead :: HasCallStack => QName -> TCM ConHead -- | Get the name of the datatype constructed by a given constructor. -- Precondition: The argument must refer to a constructor getConstructorData :: (HasCallStack, HasConstInfo m) => QName -> m QName -- | Is the datatype of this constructor a Higher Inductive Type? -- Precondition: The argument must refer to a constructor of a datatype -- or record. consOfHIT :: (HasCallStack, HasConstInfo m) => QName -> m Bool -- | Is this a path constructor (of a higher inductive type)? Precondition: -- The argument must refer to a constructor of a datatype or record. isPathCons :: (HasCallStack, HasConstInfo m) => QName -> m Bool -- | getFullyAppliedConType c t computes the constructor -- parameters from data type t and returns them plus the -- instantiated type of constructor c. -- -- Nothing if t is not a data/record type or does not -- have a constructor c. -- -- Precondition: t is reduced. getFullyAppliedConType :: PureTCM m => ConHead -> Type -> m (Maybe ((QName, Type, Args), Type)) -- | Make sure a constructor is fully applied and infer the type of the -- constructor. Raises a type error if the constructor does not belong to -- the given type. fullyApplyCon :: (PureTCM m, MonadBlock m, MonadTCError m) => ConHead -> Elims -> Type -> (QName -> Type -> Args -> Type -> Elims -> Telescope -> Type -> m a) -> m a -- | Like fullyApplyCon, but calls the given fallback function if -- it encounters something other than a datatype. fullyApplyCon' :: (PureTCM m, MonadBlock m) => ConHead -> Elims -> Type -> (QName -> Type -> Args -> Type -> Elims -> Telescope -> Type -> m a) -> (Type -> m a) -> m a -- | getConType c t computes the constructor parameters from type -- t and returns them plus the instantiated type of constructor -- c. This works also if t is a function type ending in -- a data/record type; the term from which c comes need not be -- fully applied -- -- Nothing if t is not a data/record type or does not -- have a constructor c. getConType :: (PureTCM m, MonadBlock m) => ConHead -> Type -> m (Maybe ((QName, Type, Args), Type)) data ConstructorInfo -- | Arity of the data constructor. DataCon :: Arity -> ConstructorInfo RecordCon :: PatternOrCopattern -> HasEta -> Arity -> [Dom QName] -> ConstructorInfo -- | Return the number of non-parameter arguments to a constructor (arity). -- In case of record constructors, also return the field names (plus -- other info). getConstructorInfo :: (HasCallStack, HasConstInfo m) => QName -> m ConstructorInfo getConstructorInfo' :: (HasCallStack, HasConstInfo m) => QName -> m (Maybe ConstructorInfo) -- | Check if a name refers to a datatype or a record with a named -- constructor. isDatatype :: QName -> TCM Bool -- | Check if a name refers to a datatype or a record. isDataOrRecordType :: QName -> TCM (Maybe DataOrRecord) -- | Precodition: Term is reduced. isDataOrRecord :: Term -> TCM (Maybe (QName, DataOrRecord)) getNumberOfParameters :: (HasCallStack, HasConstInfo m) => QName -> m (Maybe Nat) -- | This is a simplified version of isDatatype from -- Coverage, useful when we do not want to import the module. getDatatypeArgs :: (HasCallStack, HasConstInfo m) => Type -> m (Maybe (QName, Args, Args)) getNotErasedConstructors :: QName -> TCM [QName] -- | Precondition: Name is a data or record type. getConstructors :: QName -> TCM [QName] -- | Nothing if not data or record type name. getConstructors' :: QName -> TCM (Maybe [QName]) -- | Nothing if not data or record definition. getConstructors_ :: Defn -> Maybe [QName] -- | Various utility functions dealing with the non-linear, higher-order -- patterns used for rewrite rules. module Agda.TypeChecking.Rewriting.NonLinPattern -- | Turn a term into a non-linear pattern, treating the free variables as -- pattern variables. The first two arguments indicate whether the -- pattern we are under is definitionally singular. Specifically, the -- first tracks the definitional singularity of the last -- |PDef|/|PBoundVar| match, while the second tracks the current -- definitional singularity. The third argument and fourth arguments, k0 -- and k1, partition the context into three chunks: the local context, -- the telescope of of pattern variables associated with the rewrite and -- the pattern-lambda bound variables. The fifth argument is the type of -- the term. class PatternFrom a b patternFrom :: PatternFrom a b => DefSing -> DefSing -> Int -> Int -> TypeOf a -> a -> TCM b -- | Convert from a non-linear pattern to a term. class NLPatToTerm p a nlPatToTerm :: (NLPatToTerm p a, PureTCM m) => p -> m a ($dmnlPatToTerm) :: forall p' a' (f :: Type -> Type) m. (NLPatToTerm p a, NLPatToTerm p' a', Traversable f, p ~ f p', a ~ f a', PureTCM m) => p -> m a data PatVars PatVars :: VarSet -> VarSet -> PatVars -- | Variables bound in never definitionally singular contexts [neverSingPatVars] :: PatVars -> VarSet -- | Variables bound in possibly definitionally singular contexts [maybeSingPatVars] :: PatVars -> VarSet -- | Gather the set of pattern variables of a non-linear pattern class NLPatVars a nlPatVarsUnder :: NLPatVars a => Int -> a -> PatVars ($dmnlPatVarsUnder) :: forall p (f :: Type -> Type). (NLPatVars a, NLPatVars p, Foldable f, Functor f, a ~ f p) => Int -> a -> PatVars nlPatVars :: NLPatVars a => a -> PatVars -- | Get all symbols that a non-linear pattern matches against class GetMatchables a getMatchables :: GetMatchables a => a -> [QName] ($dmgetMatchables) :: forall (f :: Type -> Type) a'. (GetMatchables a, Foldable f, GetMatchables a', a ~ f a') => a -> [QName] blockOnMetasIn :: (MonadBlock m, AllMetas t) => t -> m () assertPi :: Type -> TCM (Dom Type, Abs Type) errNotPi :: Type -> TCM a assertPath :: Type -> TCM (Sort, QName, Arg Term, Arg Term, Arg Term, Arg Term) errNotPath :: Type -> TCM a assertProjOf :: QName -> Type -> TCM (Dom Type, Abs Type) errNotProjOf :: QName -> Type -> TCM a assertConOf :: ConHead -> Type -> TCM Type errNotConOf :: ConHead -> Type -> TCM a instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rewriting.NonLinPattern.PatVars instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables a => Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables a => Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables a => Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables a => Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables Agda.TypeChecking.Monad.Base.GlobalRewriteRule instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables a => Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables [a] instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables a, Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables b) => Agda.TypeChecking.Rewriting.NonLinPattern.GetMatchables (a, b) instance GHC.Internal.Base.Monoid Agda.TypeChecking.Rewriting.NonLinPattern.PatVars instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm p a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm (Agda.Syntax.Internal.Abs p) (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm p a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm (Agda.Syntax.Common.Arg p) (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm p a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm (Agda.Syntax.Internal.Dom p) (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm p a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm (Agda.Syntax.Internal.Elim.Elim' p) (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm Agda.Syntax.Common.Nat Agda.Syntax.Internal.Term instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm p a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm [p] [a] instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm Agda.Syntax.Internal.NLPSort Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm Agda.Syntax.Internal.NLPType Agda.Syntax.Internal.Type instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm Agda.Syntax.Internal.NLPat Agda.Syntax.Internal.Level instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatToTerm Agda.Syntax.Internal.NLPat Agda.Syntax.Internal.Term instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars a => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars Agda.Syntax.Internal.PElims instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars Agda.Syntax.Internal.NLPType instance Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars Agda.Syntax.Internal.NLPat instance (Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars a, Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars b) => Agda.TypeChecking.Rewriting.NonLinPattern.NLPatVars (a, b) instance Agda.Utils.Null.Null Agda.TypeChecking.Rewriting.NonLinPattern.PatVars instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom a b => Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom a b => Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom (Agda.Syntax.Internal.Dom a) (Agda.Syntax.Internal.Dom b) instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom Agda.Syntax.Internal.Level Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom Agda.Syntax.Internal.Elims Agda.Syntax.Internal.PElims instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom Agda.Syntax.Internal.Sort Agda.Syntax.Internal.NLPSort instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom Agda.Syntax.Internal.Term Agda.Syntax.Internal.NLPat instance Agda.TypeChecking.Rewriting.NonLinPattern.PatternFrom Agda.Syntax.Internal.Type Agda.Syntax.Internal.NLPType instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Rewriting.NonLinPattern.PatVars instance Agda.Utils.Singleton.Singleton (Agda.Syntax.Internal.DefSing, GHC.Internal.Types.Int) Agda.TypeChecking.Rewriting.NonLinPattern.PatVars -- | Code which replaces pattern matching on record constructors with uses -- of projection functions. module Agda.TypeChecking.RecordPatterns translateCompiledClauses :: (HasConstInfo m, MonadChange m) => QName -> CompiledClauses -> m CompiledClauses -- | Bottom-up procedure to record-pattern-translate split tree. translateSplitTree :: SplitTree -> TCM SplitTree -- | Take a record pattern and yield a list of projections corresponding to -- the pattern variables, from left to right. -- -- E.g. for (x , (y , z)) we return [ fst, fst . snd, snd . -- snd ]. -- -- Precondition: it must be a record pattern. If the record does not have -- eta, warning ShouldBeEtaRecordPattern is raised. recordPatternToProjections :: DeBruijnPattern -> TCM [Term -> Term] recordRHSToCopatterns :: (MonadChange m, PureTCM m) => Clause -> m [Clause] instance Agda.TypeChecking.RecordPatterns.DropFrom a => Agda.TypeChecking.RecordPatterns.DropFrom [a] instance Agda.TypeChecking.RecordPatterns.DropFrom (Agda.TypeChecking.Coverage.SplitTree.SplitTree' c) instance Agda.TypeChecking.RecordPatterns.DropFrom (c, Agda.TypeChecking.Coverage.SplitTree.SplitTree' c) -- | A constructor argument is forced if it appears as pattern variable in -- an index of the target. -- -- For instance x is forced in sing and n is -- forced in zero and suc: -- --
--   data Sing {a}{A : Set a} : A -> Set where
--     sing : (x : A) -> Sing x
--   
--   data Fin : Nat -> Set where
--     zero : (n : Nat) -> Fin (suc n)
--     suc  : (n : Nat) (i : Fin n) -> Fin (suc n)
--   
-- -- At runtime, forced constructor arguments may be erased as they can be -- recovered from dot patterns. For instance, unsing : {A : Set} (x -- : A) -> Sing x -> A unsing .x (sing x) = x can become -- unsing x sing = x and proj : (n : Nat) (i : Fin n) -> -- Nat proj .(suc n) (zero n) = n proj .(suc n) (suc n i) = n -- becomes proj (suc n) zero = n proj (suc n) (suc i) = n -- -- This module implements the analysis of which constructor arguments are -- forced. The process of moving the binding site of forced arguments is -- implemented in the unifier (see the Solution step of -- Agda.TypeChecking.Rules.LHS.Unify.unifyStep). -- -- Forcing is a concept from pattern matching and thus builds on the -- concept of equality (I) used there (closed terms, extensional) which -- is different from the equality (II) used in conversion checking and -- the constraint solver (open terms, intensional). -- -- Up to issue 1441 (Feb 2015), the forcing analysis here relied on the -- wrong equality (II), considering type constructors as injective. This -- is unsound for program extraction, but ok if forcing is only used to -- decide which arguments to skip during conversion checking. -- -- From now on, forcing uses equality (I) and does not search for forced -- variables under type constructors. This may lose some savings during -- conversion checking. If this turns out to be a problem, the old -- forcing could be brought back, using a new modality Skip to -- indicate that this is a relevant argument but still can be skipped -- during conversion checking as it is forced by equality (II). module Agda.TypeChecking.Forcing -- | Given the type of a constructor (excluding the parameters), decide -- which arguments are forced. computeForcingAnnotations :: QName -> Type -> TCM [IsForced] isForced :: IsForced -> Bool nextIsForced :: [IsForced] -> (IsForced, [IsForced]) instance GHC.Internal.Base.Applicative Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Agda.TypeChecking.Forcing.ForcedVariables a => Agda.TypeChecking.Forcing.ForcedVariables (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Forcing.ForcedVariables a => Agda.TypeChecking.Forcing.ForcedVariables (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Forcing.ForcedVariables a => Agda.TypeChecking.Forcing.ForcedVariables [a] instance Agda.TypeChecking.Forcing.ForcedVariables Agda.Syntax.Internal.Term instance GHC.Internal.Base.Functor Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Agda.Interaction.Options.HasOptions.HasOptions Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.TypeChecking.Forcing.ForcedVariableCollection' instance GHC.Internal.Base.Monad Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Control.Monad.Reader.Class.MonadReader Agda.TypeChecking.Forcing.ForcedVariableContext Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Agda.TypeChecking.Monad.Base.MonadReduce Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Control.Monad.State.Class.MonadState Agda.TypeChecking.Forcing.ForcedVariableState Agda.TypeChecking.Forcing.ForcedVariableCollection' instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.TypeChecking.Forcing.ForcedVariableCollection' instance GHC.Internal.Base.Monoid Agda.TypeChecking.Forcing.ForcedVariableCollection instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.TypeChecking.Forcing.ForcedVariableCollection' instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Forcing.ForcedVariableCollection instance Agda.Utils.Singleton.Singleton (Agda.Syntax.Common.Nat, Agda.Syntax.Common.Modality) Agda.TypeChecking.Forcing.ForcedVariableCollection module Agda.TypeChecking.Coverage.SplitPattern type SplitPattern = Pattern' SplitPatVar -- | For each variable in the patterns of a split clause, we remember the -- de Bruijn-index and the literals excluded by previous matches. data SplitPatVar SplitPatVar :: PatVarName -> Int -> [Literal] -> SplitPatVar [splitPatVarName] :: SplitPatVar -> PatVarName [splitPatVarIndex] :: SplitPatVar -> Int [splitExcludedLits] :: SplitPatVar -> [Literal] fromSplitPattern :: NamedArg SplitPattern -> NamedArg DeBruijnPattern fromSplitPatterns :: [NamedArg SplitPattern] -> [NamedArg DeBruijnPattern] toSplitPatterns :: [NamedArg DeBruijnPattern] -> [NamedArg SplitPattern] toSplitPSubst :: PatternSubstitution -> SplitPSubstitution applySplitPSubst :: TermSubst a => SplitPSubstitution -> a -> a -- | A pattern that matches anything (modulo eta). isTrivialPattern :: HasConstInfo m => Pattern' a -> m Bool instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.TypeChecking.Coverage.SplitPattern.SplitPatVar instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Coverage.SplitPattern.SplitPatVar instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Coverage.SplitPattern.SplitPatVar instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Coverage.SplitPattern.SplitPatVar instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.SplitPattern.SplitPatVar instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Coverage.SplitPattern.SplitPattern -- | Given -- --
    --
  1. the function clauses cs
  2. --
  3. the patterns ps of the split clause
  4. --
-- -- we want to compute a variable index (in the split clause) to split on -- next. -- -- The matcher here checks whether the split clause is covered by one of -- the given clauses cs or whether further splitting is needed -- (and when yes, where). module Agda.TypeChecking.Coverage.Match -- | If matching is inconclusive (Block) we want to know which -- variables or projections are blocking the match. data Match a -- | Matches unconditionally. Yes :: a -> Match a -- | Definitely does not match. No :: Match a Block :: BlockedOnResult -> BlockingVars -> Match a -- | BlockedOnProj o if the clause has a result split. [blockedOnResult] :: Match a -> BlockedOnResult -- | BlockingVar i cs ls o means variable i is blocked on -- constructors cs and literals ls. [blockedOnVars] :: Match a -> BlockingVars -- | Match the given patterns against a list of clauses. -- -- If successful, return the index of the covering clause. match :: PureTCM m => [Clause] -> [NamedArg SplitPattern] -> m (Match (Nat, SplitInstantiation)) matchClause :: PureTCM m => [NamedArg SplitPattern] -> Clause -> m MatchResult -- | Variable blocking a match. data BlockingVar BlockingVar :: Nat -> [ConHead] -> [Literal] -> Bool -> Bool -> BlockingVar -- | De Bruijn index of variable blocking the match. [blockingVarNo] :: BlockingVar -> Nat -- | Constructors in this position. [blockingVarCons] :: BlockingVar -> [ConHead] -- | Literals in this position. [blockingVarLits] :: BlockingVar -> [Literal] -- | True if at least one clause has a variable pattern in this position. [blockingVarOverlap] :: BlockingVar -> Bool -- | True if at least one clause has a lazy pattern in this position. [blockingVarLazy] :: BlockingVar -> Bool type BlockingVars = [BlockingVar] -- | Missing elimination blocking a match. data BlockedOnResult -- | Blocked on unsplit projection. BlockedOnProj :: Bool -> BlockedOnResult -- | True if there are also matching clauses without an unsplit copattern. [blockedOnResultOverlap] :: BlockedOnResult -> Bool -- | Blocked on unintroduced argument. BlockedOnApply :: ApplyOrIApply -> BlockedOnResult -- | Is the unintroduced argument an IApply pattern? [blockedOnResultIApply] :: BlockedOnResult -> ApplyOrIApply NotBlockedOnResult :: BlockedOnResult setBlockingVarOverlap :: BlockingVar -> BlockingVar data ApplyOrIApply IsApply :: ApplyOrIApply IsIApply :: ApplyOrIApply instance GHC.Internal.Base.Functor Agda.TypeChecking.Coverage.Match.Match instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Coverage.Match.BlockingVar instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.Match.BlockingVar module Agda.TypeChecking.Conversion.Pure pureConversion :: TCM b -> (Blocker -> TCM b) -> (a -> TCM b) -> TCM a -> TCM b -- | Run conversion without modifying constraint or meta state. A state -- modification instead throws a pattern violation. runPureConversion :: TCM a -> TCM a -- | Don't catch pattern violation. pureEqualTerm :: Type -> Term -> Term -> TCM Bool -- | Compare terms, catch and return pattern violation. pureBlockOrEqualTerm :: Type -> Term -> Term -> TCM (Either Blocker Bool) pureBlockOrEqualTermPureTCM :: PureTCM m => Type -> Term -> Term -> m (Either Blocker Bool) pureBlockOrEqualType :: Type -> Type -> TCM (Either Blocker Bool) pureBlockOrEqualTypePureTCM :: PureTCM m => Type -> Type -> m (Either Blocker Bool) pureCompareAs :: Comparison -> CompareAs -> Term -> Term -> TCM Bool -- | Non-linear matching of the lhs of a rewrite rule against a neutral -- term. -- -- Given a lhs -- -- Δ ⊢ lhs : B -- -- and a candidate term -- -- Γ ⊢ t : A -- -- we seek a substitution Γ ⊢ σ : Δ such that -- -- Γ ⊢ B[σ] = A and Γ ⊢ lhs[σ] = t : A module Agda.TypeChecking.Rewriting.NonLinMatch -- | Monad for non-linear matching. newtype NLM a NLM :: ExceptT Blocked_ (StateT NLMState ReduceM) a -> NLM a [unNLM] :: NLM a -> ExceptT Blocked_ (StateT NLMState ReduceM) a data NLMState NLMState :: Sub -> PostponedEquations -> NLMState [_nlmSub] :: NLMState -> Sub [_nlmEqs] :: NLMState -> PostponedEquations nlmSub :: Lens' NLMState Sub nlmEqs :: Lens' NLMState PostponedEquations runNLM :: MonadReduce m => NLM () -> m (Either Blocked_ NLMState) matchingBlocked :: Blocked_ -> NLM () -- | Add substitution i |-> v : a to result of matching. tellSub :: Relevance -> Int -> Type -> Term -> NLM () tellEq :: Telescope -> Context -> Type -> Term -> Term -> NLM () type Sub = IntMap (Relevance, Term) -- | Matching against a term produces a constraint which we have to verify -- after applying the substitution computed by matching. data PostponedEquation PostponedEquation :: Context -> Type -> Term -> Term -> PostponedEquation -- | Context of free variables in the equation [eqFreeVars] :: PostponedEquation -> Context -- | Type of the equation, living in same context as the rhs. [eqType] :: PostponedEquation -> Type -- | Term from pattern, living in pattern context. [eqLhs] :: PostponedEquation -> Term -- | Term from scrutinee, living in context where matching was invoked. [eqRhs] :: PostponedEquation -> Term type PostponedEquations = [PostponedEquation] -- | Match a non-linear pattern against a neutral term, returning a -- substitution. class Match a b match :: Match a b => Relevance -> Telescope -> Context -> TypeOf b -> a -> b -> NLM () extendContext :: MonadAddContext m => Context -> ArgName -> Dom Type -> m Context makeSubstitution :: Telescope -> Sub -> Maybe Substitution checkPostponedEquations :: PureTCM m => Substitution -> PostponedEquations -> m (Maybe Blocked_) nonLinMatch :: (PureTCM m, Match a b) => Telescope -> TypeOf b -> a -> b -> m (Either Blocked_ Substitution) -- | Typed βη-equality, also handles empty record types. Returns -- Nothing if the terms are equal, or `Just b` if the terms are -- not (where b contains information about possible metas blocking the -- comparison) equal :: PureTCM m => Type -> Term -> Term -> m (Maybe Blocked_) -- | Utility function for getting the name and type of a head term (i.e. a -- Def or Con with no arguments) Fails on variable heads getTypedHead :: PureTCM m => Term -> m (Maybe (QName, Type)) -- | Utility function for getting the type of a head term. Includes a case -- for variables (which are valid heads of local rewrite rules) getLocalHeadType :: PureTCM m => Term -> m (Maybe (Maybe QName, Type)) instance GHC.Internal.Base.Alternative Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance GHC.Internal.Base.Applicative Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance GHC.Internal.Base.Functor Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Builtin.HasBuiltins Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.Interaction.Options.HasOptions.HasOptions Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Rewriting.NonLinMatch.Match a b => Agda.TypeChecking.Rewriting.NonLinMatch.Match (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match a b => Agda.TypeChecking.Rewriting.NonLinMatch.Match (Agda.Syntax.Internal.Dom a) (Agda.Syntax.Internal.Dom b) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match [Agda.Syntax.Internal.Elim.Elim' Agda.Syntax.Internal.NLPat] Agda.Syntax.Internal.Elims instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.Syntax.Internal.NLPSort Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.Syntax.Internal.NLPType Agda.Syntax.Internal.Type instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.Syntax.Internal.NLPat Agda.Syntax.Internal.Level instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.Syntax.Internal.NLPat Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.Context.MonadAddContext Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Base.MonadBlock Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Control.Monad.Error.Class.MonadError Agda.Syntax.Internal.Blocked_ Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance GHC.Internal.Control.Monad.Fail.MonadFail Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.Utils.FileId.MonadFileId Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance GHC.Internal.Base.Monad Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance GHC.Internal.Base.MonadPlus Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Base.MonadReduce Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Control.Monad.State.Class.MonadState Agda.TypeChecking.Rewriting.NonLinMatch.NLMState Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.Utils.Null.Null Agda.TypeChecking.Rewriting.NonLinMatch.NLMState instance Agda.TypeChecking.Monad.Pure.PureTCM Agda.TypeChecking.Rewriting.NonLinMatch.NLM instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.TypeChecking.Rewriting.NonLinMatch.NLM -- | Implementation of conversion checking errors which can reify part of -- the context leading to the actual failure as terms. module Agda.TypeChecking.Conversion.Errors -- | Throw a floating ConversionError, given the arguments of -- compareAs. failConversion :: (MonadTCError m, HasBuiltins m) => Comparison -> Term -> Term -> CompareAs -> m a -- | mismatchedProjections t1 v1 e1 t2 v2 e2 raises a -- floating conversion-checking error (as per failConversion) -- indicating that the terms v1 and v2 (which have type -- t1 and t2 respectively, and are typically neutral) -- disagree on the last elimination in their spines. -- -- The further eliminations e1 and e2 are treated as -- "uncompared" context for the error message. mismatchedProjections :: (MonadError TCErr m, PureTCM m) => Type -> Term -> Elims -> Type -> Term -> Elims -> m a -- | Add some call stack context to floating ConversionErrors thrown -- from the continuation. -- -- This function should be placed on the outside of -- addContext, and the changes to the context should be reflected -- in the ConversionZipper. addConversionContext :: MonadTCError m => (ConversionZipper -> ConversionZipper) -> m a -> m a -- | Replaces any floating ConversionErrors raised by the -- continuation with the one generated (as per failConversion) -- from the given arguments. nowConversionChecking :: (MonadTCError m, HasBuiltins m) => Comparison -> Term -> Term -> CompareAs -> m a -> m a -- | Freeze ConversionErrors thrown by the continuation. -- -- This function should be placed on the inside of context -- updates. cutConversionErrors :: (MonadPretty m, MonadError TCErr m) => m a -> m a -- | A conversion checking failure. -- -- A conversion checking error can be in two states (according to its -- convErrCtx): it is either Finished or Floating. -- -- A Finished conversion-checking error packages a pair of unequal -- terms, which are well-typed in the context that the error was raised -- in, with sufficient information for printing an informative error -- message. Finished errors will not accumulate further call stack -- information. -- -- A Floating conversion-checking error is subject to be modified -- as the conversion checker's call stack unwinds, by appending to its -- ConversionZipper. Some frames in a ConversionZipper -- alter the context in which the terms convErrLhs and -- convErrRhs should be interpreted. Floating errors can be -- re-raised as Finished errors using cutConversionErrors. -- This means that any code which catches those errors will have types -- valid directly in the TypeError closure, but no more context -- will be accumulated for them. data ConversionError ConversionError :: Comparison -> FailedCompareAs -> Term -> Term -> ConversionErrorContext -> ConversionError -- | Were we checking for equality or subtyping? [convErrCmp] :: ConversionError -> Comparison -- | Were we comparing against a known type when conversion checking -- failed? [convErrTys] :: ConversionError -> FailedCompareAs -- | The LHS of the comparison (if CmpLeq, the subtype). [convErrLhs] :: ConversionError -> Term -- | The RHS of the comparison (if CmpLeq, the supertype). [convErrRhs] :: ConversionError -> Term -- | Call stack information about this error. [convErrCtx] :: ConversionError -> ConversionErrorContext -- | A "zipper-like" representation of the edges between comparing a normal -- form and comparing one of its immediate subterms in the conversion -- checker's call graph. data ConversionZipper -- | Thrown at the failing call. ConvStop :: ConversionZipper -- | A call to compare the body of a function-typed value. ConvLam :: Dom Type -> Abs () -> ArgName -> ConversionZipper -> ConversionZipper -- | A call to compare the domain of a pair of pi types. ConvDom :: Dom ConversionZipper -> Abs Type -> Abs Type -> ConversionZipper -- | A call to compare the codomain of a pair of pi types. ConvCod :: Dom Type -> ArgName -> ConversionZipper -> ConversionZipper -- | A call to compare an argument to a function. ConvApply :: Term -> Abs Type -> Arg ConversionZipper -> [Elim] -> [Elim] -> ConversionZipper -- | Context for a conversion checking error. data ConversionErrorContext -- | It still makes sense to collect call stack information for this error. Floating :: ConversionZipper -> ConversionErrorContext -- | We can not, or do not want to, keep collecting call stack information -- for this error. Stores "crystallised" information about the actual -- failing comparison to use as context in error rendering. Finished :: HereOrThere -> Maybe HeadMismatch -> ConversionErrorContext -- | The failing version of CompareAs. data FailedCompareAs -- | The conversion checker failed in a typed context. -- -- While the conversion checker is homogeneous (so AsTermsOf only -- stores a single type), a failing argument comparison early in the -- spine of a dependent function can cause the reconstructed "context" -- terms to be heterogeneous. FailAsTermsOf :: Type -> Type -> FailedCompareAs -- | The conversion checker failed in a type-insensitive context. FailAsTypes :: FailedCompareAs instance GHC.Internal.Generics.Generic Agda.TypeChecking.Conversion.Errors.ConversionError instance GHC.Internal.Generics.Generic Agda.TypeChecking.Conversion.Errors.ConversionErrorContext instance GHC.Internal.Generics.Generic Agda.TypeChecking.Conversion.Errors.ConversionZipper instance GHC.Internal.Generics.Generic Agda.TypeChecking.Conversion.Errors.FailedCompareAs instance GHC.Internal.Generics.Generic Agda.TypeChecking.Conversion.Errors.HeadMismatch instance GHC.Internal.Generics.Generic Agda.TypeChecking.Conversion.Errors.HereOrThere instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.ConversionError instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.ConversionErrorContext instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.ConversionZipper instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.FailedCompareAs instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.HeadMismatch instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.HereOrThere instance Control.DeepSeq.NFData Agda.TypeChecking.Conversion.Errors.WhyUnequalTypes instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Conversion.Errors.ConversionError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Conversion.Errors.ConversionZipper instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Conversion.Errors.FailedCompareAs instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.ConversionError instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.ConversionErrorContext instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.ConversionZipper instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.FailedCompareAs instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.HeadMismatch instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.HereOrThere instance GHC.Internal.Show.Show Agda.TypeChecking.Conversion.Errors.WhyUnequalTypes -- | Convert errors to their names. module Agda.TypeChecking.Errors.Names -- | Print the name of a TypeError. typeErrorString :: TypeError -> String -- | Compute the name of a TypeError. typeErrorName :: TypeError -> ErrorName declarationExceptionName :: DeclarationException' -> DeclarationException_ execErrorName :: ExecError -> ExecError_ ghcBackendErrorName :: GHCBackendError -> GHCBackendError_ jsBackendErrorName :: JSBackendError -> JSBackendError_ impossibleConstructorErrorName :: NegativeUnification -> NegativeUnification_ interactionErrorName :: InteractionError -> InteractionError_ missingTypeSignatureInfoName :: MissingTypeSignatureInfo -> DataRecOrFun_ notAHaskellTypeErrorName :: WhyNotAHaskellType -> NotAHaskellType_ splitErrorName :: SplitError -> SplitError_ unquotableName :: CannotQuote -> CannotQuote_ unquoteErrorName :: UnquoteError -> UnquoteError_ -- | The monad for the termination checker. -- -- The termination monad TerM is an extension of the type -- checking monad TCM by an environment with information needed by -- the termination checker. module Agda.Termination.Monad -- | The target of the function we are checking. data Target -- | The target of recursion is a record, data, or -- unreducible Def. TargetDef :: QName -> Target -- | We are termination-checking a record. TargetRecord :: Target -- | None of the above two or unknown. TargetOther :: Target -- | The current guardedness level. type Guarded = Order -- | The termination environment. data TerEnv TerEnv :: Maybe QName -> Maybe QName -> CutOff -> QName -> MutualNames -> Set QName -> Bool -> Target -> ListInf Bool -> Bool -> Int -> MaskedDeBruijnPatterns -> Int -> Guarded -> Bool -> VarSet -> Map (QName, [QName]) Node -> IntMap QName -> Map QName [[QName]] -> Map (QName, [QName]) (ListInf Bool) -> TerEnv -- | The name of size successor, if any. [terSizeSuc] :: TerEnv -> Maybe QName -- | The name of the delay constructor (sharp), if any. [terSharp] :: TerEnv -> Maybe QName -- | Depth at which to cut off the structural order. [terCutOff] :: TerEnv -> CutOff -- | The name of the function we are currently checking. [terCurrent] :: TerEnv -> QName -- | The names of the functions in the mutual block we are checking. This -- includes the internally generated functions (with, extendedlambda, -- coinduction). [terMutual] :: TerEnv -> MutualNames -- | The list of name actually appearing in the file (abstract syntax). -- Excludes the internally generated functions. [terUserNames] :: TerEnv -> Set QName -- | Does the actual clause result from with-inlining? (If yes, it may be -- ill-typed.) [terHaveInlinedWith] :: TerEnv -> Bool -- | Target type of the function we are currently termination checking. -- Only the constructors of Target are considered guarding. [terTarget] :: TerEnv -> Target -- | Only consider the notMasked False arguments for -- establishing termination. See issue #1023. [terMaskArgs] :: TerEnv -> ListInf Bool -- | Only consider guardedness if False (not masked). [terMaskResult] :: TerEnv -> Bool -- | How many SIZELT relations do we have in the context (= clause -- telescope). Used to approximate termination for metas in call args. [_terSizeDepth] :: TerEnv -> Int -- | The patterns of the clause we are checking. [terPatterns] :: TerEnv -> MaskedDeBruijnPatterns -- | Number of additional binders we have gone under (and consequently need -- to raise the patterns to compare to terms). Updated during call graph -- extraction, hence strict. [terPatternsRaise] :: TerEnv -> Int -- | The current guardedness status. Changes as we go deeper into the term. -- Updated during call graph extraction, hence strict. [terGuarded] :: TerEnv -> Guarded -- | When extracting usable size variables during construction of the call -- matrix, can we take the variable for use with SIZELT constraints from -- the context? Yes, if we are under an inductive constructor. No, if we -- are under a record constructor. (See issue #1015). [terUseSizeLt] :: TerEnv -> Bool -- | Pattern variables that can be compared to argument variables using -- SIZELT. [terUsableVars] :: TerEnv -> VarSet -- | Map from (name, [projection]) to call-graph node. (See issue #8596 for -- why projected names merit distinct nodes). [terProjectedNameToNode] :: TerEnv -> Map (QName, [QName]) Node -- | Map from call-graph node back to function names. [terNodeToName] :: TerEnv -> IntMap QName -- | Map from function names to the list of all available projection paths. [terNameToProjections] :: TerEnv -> Map QName [[QName]] -- | Precomputed argument mask per (name, [projection]) pair, if -- --without-K. [terProjectedNameToMaskArgs] :: TerEnv -> Map (QName, [QName]) (ListInf Bool) -- | An empty termination environment. -- -- Values are set to a safe default meaning that with these initial -- values the termination checker will not miss termination errors it -- would have seen with better settings of these values. -- -- Values that do not have a safe default are set to -- IMPOSSIBLE. defaultTerEnv :: TerEnv -- | Termination monad service class. class (Functor m, Monad m) => MonadTer (m :: Type -> Type) terAsk :: MonadTer m => m TerEnv terLocal :: MonadTer m => (TerEnv -> TerEnv) -> m a -> m a terAsks :: MonadTer m => (TerEnv -> a) -> m a -- | Termination monad. newtype TerM a TerM :: ReaderT TerEnv TCM a -> TerM a [terM] :: TerM a -> ReaderT TerEnv TCM a -- | Generic run method for termination monad. runTer :: TerEnv -> TerM a -> TCM a -- | Run TerM computation in default environment (created from options). runTerDefault :: TerM a -> TCM a terGetSizeSuc :: TerM (Maybe QName) terGetCurrent :: TerM QName terSetCurrent :: QName -> TerM a -> TerM a terGetSharp :: TerM (Maybe QName) terGetCutOff :: TerM CutOff terGetMutual :: TerM MutualNames terGetUserNames :: TerM (Set QName) terGetTarget :: TerM Target terSetTarget :: Target -> TerM a -> TerM a terGetHaveInlinedWith :: TerM Bool terSetHaveInlinedWith :: TerM a -> TerM a terGetMaskArgs :: TerM (ListInf Bool) terSetMaskArgs :: ListInf Bool -> TerM a -> TerM a terGetMaskResult :: TerM Bool terSetMaskResult :: Bool -> TerM a -> TerM a terGetPatterns :: TerM MaskedDeBruijnPatterns terSetPatterns :: MaskedDeBruijnPatterns -> TerM a -> TerM a terRaise :: TerM a -> TerM a terGetGuarded :: TerM Guarded terModifyGuarded :: (Order -> Order) -> TerM a -> TerM a terSetGuarded :: Order -> TerM a -> TerM a terUnguarded :: TerM a -> TerM a -- | Lens for _terSizeDepth. terSizeDepth :: Lens' TerEnv Int -- | Lens for terUsableVars. terGetUsableVars :: TerM VarSet terModifyUsableVars :: (VarSet -> VarSet) -> TerM a -> TerM a terSetUsableVars :: VarSet -> TerM a -> TerM a terGetProjectedNameToNode :: TerM (Map (QName, [QName]) Node) terSetProjectedNameToNode :: Map (QName, [QName]) Node -> TerM a -> TerM a terGetNodeToName :: TerM (IntMap QName) terSetNodeToName :: IntMap QName -> TerM a -> TerM a terGetNameToProjections :: TerM (Map QName [[QName]]) terSetNameToProjections :: Map QName [[QName]] -> TerM a -> TerM a terGetProjectedNameToMaskArgs :: TerM (Map (QName, [QName]) (ListInf Bool)) terSetProjectedNameToMaskArgs :: Map (QName, [QName]) (ListInf Bool) -> TerM a -> TerM a -- | Lens for terUseSizeLt. terGetUseSizeLt :: TerM Bool terModifyUseSizeLt :: (Bool -> Bool) -> TerM a -> TerM a terSetUseSizeLt :: Bool -> TerM a -> TerM a -- | Compute usable vars from patterns and run subcomputation. withUsableVars :: UsableSizeVars a => a -> TerM b -> TerM b -- | Set terUseSizeLt when going under constructor c. conUseSizeLt :: QName -> TerM a -> TerM a -- | Set terUseSizeLt for arguments following projection q. -- We disregard j<i after a non-coinductive projection. However, the -- projection need not be recursive (Issue 1470). projUseSizeLt :: QName -> TerM a -> TerM a -- | For termination checking purposes flat should not be considered a -- projection. That is, it flat doesn't preserve either structural order -- or guardedness like other projections do. Andreas, 2012-06-09: the -- same applies to projections of recursive records. isProjectionButNotCoinductive :: MonadTCM tcm => QName -> tcm Bool -- | Is the given elimination anything but a coinductive projection? elimNotCoinductive :: MonadTCM tcm => Elim' t -> tcm Bool -- | Check whether a projection belongs to a coinductive record and is -- actually recursive. E.g. @ isCoinductiveProjection (Stream.head) = -- return False -- -- isCoinductiveProjection (Stream.tail) = return True @ isCoinductiveProjection :: MonadTCM tcm => Bool -> QName -> tcm Bool -- | How long is the path to the deepest atomic pattern? patternDepth :: Pattern' a -> Int -- | A dummy pattern used to mask a pattern that cannot be used for -- structural descent. unusedVar :: DeBruijnPattern -- | Extract variables from DeBruijnPatterns that could witness a -- decrease via a SIZELT constraint. -- -- These variables must be under an inductive constructor (with no record -- constructor in the way), or after a coinductive projection (with no -- inductive one in the way). class UsableSizeVars a usableSizeVars :: UsableSizeVars a => a -> TerM VarSet type MaskedDeBruijnPatterns = [Masked DeBruijnPattern] data Masked a Masked :: Bool -> a -> Masked a -- | True if thing not eligible for structural descent. [getMask] :: Masked a -> Bool -- | Thing. [getMasked] :: Masked a -> a masked :: a -> Masked a notMasked :: a -> Masked a -- | Call paths. -- -- The call information is stored as free monoid over CallInfo, -- giving us constant-time concatenation. Once the information is -- complete, it can be converted to a non-empty list. (This should only -- be done once, as this operation is linear-time.) data CallPath CallPath :: QName -> BinTree CallInfo -> CallPath [callPathStart] :: CallPath -> QName [callPathSteps] :: CallPath -> BinTree CallInfo -- | The calls making up the call path. callInfos :: CallPath -> [CallInfo] -- | A very crude way of estimating the SIZELT chains i > j -- > k in context. Returns 3 in this case. Overapproximates. class TerSetSizeDepth b terSetSizeDepth :: TerSetSizeDepth b => b -> TerM a -> TerM a instance GHC.Internal.Base.Applicative Agda.Termination.Monad.TerM instance Agda.Utils.Functor.Decoration Agda.Termination.Monad.Masked instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.Termination.Monad.Masked a) instance GHC.Internal.Classes.Eq Agda.Termination.Monad.Target instance GHC.Internal.Data.Foldable.Foldable Agda.Termination.Monad.Masked instance GHC.Internal.Base.Functor Agda.Termination.Monad.Masked instance GHC.Internal.Base.Functor Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Builtin.HasBuiltins Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.Termination.Monad.TerM instance Agda.Interaction.Options.HasOptions.HasOptions Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Context.MonadAddContext Agda.Termination.Monad.TerM instance Agda.Utils.Benchmark.MonadBench Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.Termination.Monad.TerM instance Control.Monad.Error.Class.MonadError Agda.TypeChecking.Monad.Base.TCErr Agda.Termination.Monad.TerM instance Agda.Utils.FileId.MonadFileId Agda.Termination.Monad.TerM instance GHC.Internal.Control.Monad.IO.Class.MonadIO Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.MonadReduce Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Statistics.MonadStatistics Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.MonadTCM Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.MonadTCState Agda.Termination.Monad.TerM instance GHC.Internal.Base.Monad Agda.Termination.Monad.TerM instance Agda.Termination.Monad.MonadTer Agda.Termination.Monad.TerM instance GHC.Internal.Base.Monoid Agda.Termination.Monad.CallPath instance GHC.Internal.Base.Monoid m => GHC.Internal.Base.Monoid (Agda.Termination.Monad.TerM m) instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.Termination.Monad.Masked a) instance Agda.Syntax.Common.Pretty.Pretty Agda.Termination.Monad.CallPath instance Agda.TypeChecking.Pretty.PrettyTCM cinfo => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Termination.CallMatrix.CMSet cinfo) instance Agda.TypeChecking.Pretty.PrettyTCM cinfo => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Termination.CallGraph.CallGraph cinfo) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Termination.CallMatrix.CallMatrix instance Agda.TypeChecking.Pretty.PrettyTCM cinfo => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Termination.CallMatrix.CallMatrixAug cinfo) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Termination.Monad.CallPath instance Agda.TypeChecking.Pretty.PrettyTCM cinfo => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Termination.CallGraph.Call cinfo) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Termination.Monad.Masked a) instance Agda.TypeChecking.Monad.Pure.PureTCM Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.Termination.Monad.TerM instance GHC.Internal.Base.Semigroup Agda.Termination.Monad.CallPath instance GHC.Internal.Base.Semigroup m => GHC.Internal.Base.Semigroup (Agda.Termination.Monad.TerM m) instance GHC.Internal.Show.Show Agda.Termination.Monad.CallPath instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.Termination.Monad.Masked a) instance GHC.Internal.Show.Show Agda.Termination.Monad.Target instance Agda.Termination.Monad.TerSetSizeDepth Agda.Syntax.Internal.ListTel instance Agda.Termination.Monad.TerSetSizeDepth Agda.Syntax.Internal.Telescope instance GHC.Internal.Data.Traversable.Traversable Agda.Termination.Monad.Masked instance Agda.Termination.Monad.UsableSizeVars [Agda.Syntax.Internal.DeBruijnPattern] instance Agda.Termination.Monad.UsableSizeVars Agda.Termination.Monad.MaskedDeBruijnPatterns instance Agda.Termination.Monad.UsableSizeVars (Agda.Termination.Monad.Masked Agda.Syntax.Internal.DeBruijnPattern) instance Agda.Termination.Monad.UsableSizeVars Agda.Syntax.Internal.DeBruijnPattern module Agda.TypeChecking.Errors renderError :: MonadTCM tcm => TCErr -> tcm String prettyError :: MonadTCM tcm => TCErr -> tcm Doc -- | Pretty-print error ShadowedModule and return the range of the -- shadowed module. prettyShadowedModule :: MonadPretty m => Name -> List1 ModuleName -> m (m Doc, Range) tcErrString :: TCErr -> String prettyTCWarnings' :: Set TCWarning -> TCM [Doc] prettyTCWarnings :: Set TCWarning -> TCM String -- | Turns warnings, if any, into errors. tcWarningsToError :: TopLevelModuleNameWithSourceFile -> [TCWarning] -> TCM () -- | Depending which flags are set, one may happily ignore some warnings. applyFlagsToTCWarningsPreserving :: HasOptions m => Set WarningName -> Set TCWarning -> m (Set TCWarning) applyFlagsToTCWarnings :: HasOptions m => Set TCWarning -> m (Set TCWarning) getAllUnsolvedWarnings :: (MonadWarning m, MonadTCM m) => m [TCWarning] getAllWarningsPreserving :: (MonadWarning m, MonadTCM m) => Set WarningName -> WhichWarnings -> m (Set TCWarning) -- | Collect all warnings that have accumulated in the state. getAllWarnings :: (MonadWarning m, MonadTCM m) => WhichWarnings -> m (Set TCWarning) getAllWarningsOfTCErr :: TCErr -> TCM (Set TCWarning) -- | Drops the filename component of the qualified name. dropTopLevelModule :: MonadPretty m => QName -> m QName -- | Produces a function which drops the filename component of the -- qualified name. topLevelModuleDropper :: (MonadDebug m, MonadTCEnv m, ReadTCState m) => m (QName -> QName) explainWhyInScope :: MonadPretty m => WhyInScopeData -> m Doc class Verbalize a verbalize :: Verbalize a => a -> String -- | Indefinite article. newtype Indefinite a Indefinite :: a -> Indefinite a -- | Number rendered as an ordinal (1st, 2nd, etc) newtype Ordinal Ordinal :: Int -> Ordinal instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.ExecError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.GHCBackendError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.InteractionError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.JSBackendError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.MissingTypeSignatureInfo instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.NegativeUnification instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.SplitError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.TCErr instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Types.TopLevelModuleNameWithSourceFile instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.TypeError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.UnificationFailure instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.UnquoteError instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.Cohesion instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.Hiding instance Agda.TypeChecking.Errors.Verbalize a => Agda.TypeChecking.Errors.Verbalize (Agda.TypeChecking.Errors.Indefinite a) instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.ModalPolarity instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.Modality instance Agda.TypeChecking.Errors.Verbalize Agda.TypeChecking.Errors.Ordinal instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.PolarityModality instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.Quantity instance Agda.TypeChecking.Errors.Verbalize Agda.Syntax.Common.Relevance module Agda.TypeChecking.Pretty.Constraint prettyConstraint :: MonadPretty m => ProblemConstraint -> m Doc interestingConstraint :: MonadPretty m => ProblemConstraint -> m Bool prettyInterestingConstraints :: MonadPretty m => [ProblemConstraint] -> m [Doc] prettyRangeConstraint :: (MonadPretty m, Foldable f, Null (f ProblemId)) => Range -> f ProblemId -> Blocker -> Doc -> m Doc instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.ProblemConstraint module Agda.TypeChecking.SizedTypes -- | Check whether a type is either not a SIZELT or a SIZELT that is -- non-empty. checkSizeLtSat :: Term -> TCM () -- | Precondition: Term is reduced and not blocked. Throws a -- patternViolation if undecided checkSizeNeverZero :: Term -> TCM Bool -- | Checks that a size variable is ensured to be > 0. E.g. -- variable i cannot be zero in context (i : Size) (j : -- Size< ↑ ↑ i) (k : Size< j) (k' : Size< k). Throws a -- patternViolation if undecided. checkSizeVarNeverZero :: Int -> TCM Bool -- | Check whether a variable in the context is bounded by a size -- expression. If x : Size< a, then a is returned. isBounded :: PureTCM m => Nat -> m BoundedSize isBoundedProjVar :: ProjectedVar -> TCM BoundedSize isBoundedSizeType :: PureTCM m => Type -> m BoundedSize -- | Whenever we create a bounded size meta, add a constraint expressing -- the bound. First argument is the new meta and must be a -- MetaV{}. In boundedSizeMetaHook v tel a, -- tel includes the current context. boundedSizeMetaHook :: (MonadConstraint m, MonadAddContext m, HasBuiltins m) => Term -> Telescope -> Type -> m () -- | trySizeUniv cmp t m n x els1 y els2 is called as a last -- resort when conversion checking m cmp n : t failed -- for definitions m = x els1 and n = y els2, where the -- heads x and y are not equal. -- -- trySizeUniv accounts for subtyping between SIZELT and SIZE, -- like Size< i =< Size. -- -- If it does not succeed it reports failure of conversion check. trySizeUniv :: Comparison -> CompareAs -> Term -> Term -> QName -> Elims -> QName -> Elims -> TCM () -- | Compute the deep size view of a term. Precondition: sized types are -- enabled. deepSizeView :: (PureTCM m, MonadTCError m) => Term -> m DeepSizeView sizeMaxView :: PureTCM m => Term -> m SizeMaxView -- | Compare two sizes. compareSizes :: Comparison -> Term -> Term -> TCM () -- | Compare two sizes in max view. compareMaxViews :: Comparison -> SizeMaxView -> SizeMaxView -> TCM () -- | compareBelowMax u vs checks u <= max vs. -- Precondition: size vs >= 2 compareBelowMax :: DeepSizeView -> SizeMaxView -> TCM () compareSizeViews :: Comparison -> DeepSizeView -> DeepSizeView -> TCM () -- | If envAssignMetas then postpone as constraint, otherwise, fail -- hard. Failing is required if we speculatively test several -- alternatives. giveUp :: Comparison -> Type -> Term -> Term -> TCM () -- | Checked whether a size constraint is trivial (like X <= -- X+1). trivial :: Term -> Term -> TCM Bool -- | Test whether a problem consists only of size constraints. isSizeProblem :: (ReadTCState m, HasOptions m, HasBuiltins m) => ProblemId -> m Bool -- | Test whether a constraint speaks about sizes. isSizeConstraint :: (HasOptions m, HasBuiltins m) => (Comparison -> Bool) -> Closure Constraint -> m Bool mkIsSizeConstraint :: (Term -> Maybe BoundedSize) -> (Comparison -> Bool) -> Closure Constraint -> Bool isSizeConstraint_ :: (Type -> Bool) -> (Comparison -> Bool) -> Closure Constraint -> Bool -- | Take out all size constraints of the given direction (DANGER!). takeSizeConstraints :: (Comparison -> Bool) -> TCM [ProblemConstraint] -- | Find the size constraints of the matching direction. getSizeConstraints :: (Comparison -> Bool) -> TCM [ProblemConstraint] -- | Return a list of size metas and their context. getSizeMetas :: Bool -> TCM [(MetaId, Type, Telescope)] -- | Atomic size expressions. data OldSizeExpr -- | A size meta applied to de Bruijn indices. SizeMeta :: MetaId -> [Int] -> OldSizeExpr -- | A de Bruijn index. Rigid :: Int -> OldSizeExpr -- | Size constraints we can solve. data OldSizeConstraint -- | Leq a +n b represents a =< b + n. Leq a -n -- b represents a + n =< b. Leq :: OldSizeExpr -> Int -> OldSizeExpr -> OldSizeConstraint -- | Compute a set of size constraints that all live in the same context -- from constraints over terms of type size that may live in different -- contexts. -- -- cf. simplifyLevelConstraint oldComputeSizeConstraints :: [ProblemConstraint] -> TCM [OldSizeConstraint] -- | Turn a constraint over de Bruijn indices into a size constraint. oldComputeSizeConstraint :: Constraint -> TCM (Maybe OldSizeConstraint) -- | Turn a term with de Bruijn indices into a size expression with offset. -- -- Throws a patternViolation if the term isn't a proper size -- expression. oldSizeExpr :: Term -> TCM (OldSizeExpr, Int) -- | Compute list of size metavariables with their arguments appearing in a -- constraint. flexibleVariables :: OldSizeConstraint -> [(MetaId, [Int])] -- | Convert size constraint into form where each meta is applied to -- indices 0,1,..,n-1 where n is the arity of that -- meta. -- -- X[σ] <= t becomes X[id] <= t[σ^-1] -- -- X[σ] ≤ Y[τ] becomes X[id] ≤ Y[τ[σ^-1]] or -- X[σ[τ^1]] ≤ Y[id] whichever is defined. If none is defined, -- we give up. oldCanonicalizeSizeConstraint :: OldSizeConstraint -> Maybe OldSizeConstraint instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.OldSizeExpr instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.OldSizeConstraint instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.SizedTypes.OldSizeExpr instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.OldSizeConstraint instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.OldSizeExpr -- | Computing the polarity (variance) of function arguments, for the sake -- of subtyping. module Agda.TypeChecking.Polarity -- | Main function of this module. computePolarity :: [QName] -> TCM () -- | What is the polarity of a function composition? composePol :: Polarity -> Polarity -> Polarity -- | Get the next polarity from a list, Invariant if empty. nextPolarity :: [Polarity] -> (Polarity, [Polarity]) -- | Replace Nonvariant by Covariant. (Arbitrary bias, but -- better than Invariant, see issue 1596). purgeNonvariant :: [Polarity] -> [Polarity] polFromOcc :: Occurrence -> Polarity instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Level' a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity [a] instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.PlusLevel' a) instance Agda.TypeChecking.Polarity.HasPolarity Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Polarity.HasPolarity a, Agda.TypeChecking.Polarity.HasPolarity b) => Agda.TypeChecking.Polarity.HasPolarity (a, b) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Type'' t a) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monoid (Agda.TypeChecking.Polarity.LeastPolarity m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Semigroup (Agda.TypeChecking.Polarity.LeastPolarity m) instance GHC.Internal.Base.Monad m => Agda.Utils.Singleton.Singleton Agda.TypeChecking.Monad.Base.Types.Polarity (Agda.TypeChecking.Polarity.LeastPolarity m) -- | Injectivity, or more precisely, "constructor headedness", is a -- property of functions defined by pattern matching that helps us solve -- constraints involving blocked applications of such functions. -- Blocked shall mean here that pattern matching is blocked on a -- meta variable, and constructor headedness lets us learn more about -- that meta variable. -- -- Consider the simple example: isZero : Nat -> Bool isZero zero -- = true isZero (suc n) = false This function is -- constructor-headed, meaning that all rhss are headed by a distinct -- constructor. Thus, on a constraint like isZero ?X = false : Bool -- involving an application of isZero that is blocked on -- meta variable ?X, we can exploit injectivity and learn that -- ?X = suc ?Y for a new meta-variable ?Y. -- -- Which functions qualify for injectivity? -- --
    --
  1. The function needs to have at least one non-absurd clause that has -- a proper match, meaning that the function can actually be blocked on a -- meta. Proper matches are these patterns:
  2. --
-- -- -- -- Projection patterns (ProjP) are excluded because metas cannot -- occupy their place! -- --
    --
  1. All the clauses that satisfy (1.) need to be headed by a distinct -- constructor.
  2. --
module Agda.TypeChecking.Injectivity headSymbol :: Term -> TCM (Maybe TermHead) -- | Is this a matchable definition, or constructor, which reduces based on -- interval substitutions? isUnstableDef :: PureTCM m => QName -> m Bool -- | Do a full whnf and treat neutral terms as rigid. Used on the arguments -- to an injective functions and to the right-hand side. Only returns -- heads which are stable under interval substitution, i.e. NOT path -- constructors or generated hcomp/transp! headSymbol' :: (PureTCM m, MonadError TCErr m) => Term -> m (Maybe TermHead) -- | Does deBruijn variable i correspond to a top-level argument, and if so -- which one (index from the left). topLevelArg :: Clause -> Int -> Maybe TermHead -- | Join a list of inversion maps. joinHeadMaps :: [InversionMap c] -> InversionMap c -- | Update the heads of an inversion map. updateHeads :: Monad m => (TermHead -> [c] -> m TermHead) -> InversionMap c -> m (InversionMap c) checkInjectivity :: QName -> [Clause] -> TCM FunctionInverse -- | Precondition: all the given clauses are non-absurd and contain a -- proper match. checkInjectivity' :: QName -> [Clause] -> TCM FunctionInverse -- | If a clause is over-applied we can't trust the head (Issue 2944). For -- instance, the clause might be `f ps = u , v` and the actual call `f vs -- .fst`. In this case the head will be the head of u rather -- than `_,_`. checkOverapplication :: HasConstInfo m => Elims -> InversionMap Clause -> m (InversionMap Clause) -- | Turn variable heads, referring to top-level argument positions, into -- proper heads. These might still be VarHead, but in that case -- they refer to deBruijn variables. Checks that the instantiated heads -- are still rigid and distinct. instantiateVarHeads :: (PureTCM m, MonadError TCErr m) => QName -> Elims -> InversionMap c -> m (Maybe (InversionMap c)) -- | Argument should be in weak head normal form. functionInverse :: (PureTCM m, MonadError TCErr m) => Term -> m InvView data InvView Inv :: QName -> [Elim] -> InversionMap Clause -> InvView NoInv :: InvView -- | Precondition: The first term must be blocked on the given meta and the -- second must be neutral. useInjectivity :: CompareDirection -> Blocker -> CompareAs -> Term -> Term -> TCM () -- | The second argument should be a blocked application and the third -- argument the inverse of the applied function. invertFunction :: Comparison -> Term -> InvView -> TermHead -> TCM () -> TCM () -> (Term -> TCM ()) -> TCM () forcePiUsingInjectivity :: Type -> TCM Type -- | Functions for inserting implicit arguments at the right places. module Agda.TypeChecking.Implicit -- | Split a given Pi Type until you reach the given named argument, -- returning the number of arguments skipped to reach the right plicity -- and name. splitImplicitBinderT :: HasRange a => NamedArg a -> Type -> TCM (Telescope, Type) -- | implicitArgs n expand t generates up to n implicit -- argument metas (unbounded if n<0), as long as t -- is a function type and expand holds on the hiding info of its -- domain. implicitArgs :: Int -> (Hiding -> Bool) -> Type -> TCM (Args, Type) -- | implicitNamedArgs n expand t generates up to n named -- implicit arguments metas (unbounded if n<0), as long as -- t is a function type and expand holds on the hiding -- and name info of its domain. implicitNamedArgs :: Int -> (Hiding -> ArgName -> Bool) -> Type -> TCM (NamedArgs, Type) -- | Make sure there are no head constraints attached to the eliminations -- and just return the eliminations. noHeadConstraints :: [CheckedArg] -> TCM [Elim] noHeadConstraint :: CheckedArg -> TCM Elim -- | implicitCheckedArgs n expand t generates up to n -- named implicit arguments metas (unbounded if n<0), as long -- as t is a function type and expand holds on the -- hiding and name info of its domain. implicitCheckedArgs :: Int -> (Hiding -> ArgName -> Bool) -> Type -> TCM ([Named_ CheckedArg], Type) -- | makeLockConstraint u funType(El _ (Pi (Dom{ domInfo=info, -- unDom=a }) _)) creates a CheckLockedVars constraint for -- lock u : a if getLock info == IsLock _@. -- -- Precondition: Type is reduced. makeLockConstraint :: Type -> Term -> TCM (Maybe (Abs Constraint)) -- | Create a metavariable of MetaKind. newMetaArg :: MetaKind -> ArgName -> Comparison -> Dom Type -> TCM (MetaId, Term) -- | Create a questionmark (always UnificationMeta). newInteractionMetaArg :: ArgInfo -> ArgName -> Comparison -> Type -> TCM (MetaId, Term) -- | Possible results of insertImplicit. data ImplicitInsertion -- | Success: this many implicits have to be inserted (list can be empty). ImpInsert :: [Dom ()] -> ImplicitInsertion -- | Error: hidden argument where there should have been a non-hidden -- argument. BadImplicits :: ImplicitInsertion -- | Error: bad named argument. NoSuchName :: ArgName -> ImplicitInsertion pattern NoInsertNeeded :: ImplicitInsertion -- | If the next given argument is a and the expected arguments -- are ts insertImplicit' a ts returns the prefix of -- ts that precedes a. -- -- If a is named but this name does not appear in ts, -- the NoSuchName exception is thrown. insertImplicit :: NamedArg e -> [Dom a] -> ImplicitInsertion -- | If the next given argument is a and the expected arguments -- are ts insertImplicit' a ts returns the prefix of -- ts that precedes a. -- -- If a is named but this name does not appear in ts, -- the NoSuchName exception is thrown. insertImplicit' :: NamedArg e -> [Dom ArgName] -> ImplicitInsertion instance GHC.Internal.Show.Show Agda.TypeChecking.Implicit.ImplicitInsertion module Agda.TypeChecking.Rules.LHS.Implicit implicitP :: ArgInfo -> NamedArg Pattern -- | Insert implicit patterns in a list of patterns. Even if -- DontExpandLast, trailing SIZELT patterns are inserted. insertImplicitPatterns :: (PureTCM m, MonadError TCErr m, MonadFresh NameId m, MonadTrace m) => ExpandHidden -> [NamedArg Pattern] -> Telescope -> m [NamedArg Pattern] -- | Insert trailing SizeLt patterns, if any. insertImplicitSizeLtPatterns :: PureTCM m => Type -> m [NamedArg Pattern] -- | Insert implicit patterns in a list of patterns. Even if -- DontExpandLast, trailing SIZELT patterns are inserted. insertImplicitPatternsT :: (PureTCM m, MonadError TCErr m, MonadFresh NameId m, MonadTrace m) => ExpandHidden -> [NamedArg Pattern] -> Type -> m [NamedArg Pattern] module Agda.TypeChecking.Rules.LHS.ProblemRest -- | Rename the variables in a telescope using the names from a given -- pattern. -- -- If there are not at least as many patterns as entries as in the -- telescope, the names of the remaining entries in the telescope are -- unchanged. If there are too many patterns, there should be a type -- error later. useNamesFromPattern :: [NamedArg Pattern] -> Telescope -> Telescope useNamesFromProblemEqs :: (PureTCM m, MonadFresh NameId m) => [ProblemEq] -> Telescope -> m Telescope useOriginFrom :: (LensOrigin a, LensOrigin b) => [a] -> [b] -> [a] -- | Are there any untyped user patterns left? noProblemRest :: Problem a -> Bool -- | Construct an initial LHSState from user patterns. Example: @ -- -- Case : {A : Set} → Maybe A → Set → Set → Set Case nothing B C = B Case -- (just _) B C = C -- -- sample : {A : Set} (m : Maybe A) → Case m Bool (Maybe A → Bool) sample -- (just a) (just b) = true sample (just a) nothing = false sample -- nothing = true The problem generated for the first clause of -- sample with patterns just a, just b would be: -- lhsTel = [A : Set, m : Maybe A] lhsOutPat = [A, "m"] lhsProblem -- = Problem [A = _, "just a" = "a"] ["_", "just a"] ["just b"] [] -- lhsTarget = "Case m Bool (Maybe A -> Bool)" @ initLHSState :: Telescope -> [ProblemEq] -> [NamedArg Pattern] -> Type -> (LHSState a -> TCM a) -> TCM (LHSState a) -- | Try to move patterns from the problem rest into the problem. Possible -- if type of problem rest has been updated to a function type. updateProblemRest :: (PureTCM m, MonadError TCErr m, MonadTrace m, MonadFresh NameId m) => LHSState a -> m (LHSState a) module Agda.TypeChecking.InstanceArguments -- | findInstance m (v,a)s tries to instantiate on of the types -- as of the candidate terms vs to the type t -- of the metavariable m. If successful, meta m is -- solved with the instantiation of v. If unsuccessful, the -- constraint is regenerated, with possibly reduced candidate set. The -- list of candidates is equal to Nothing when the type of the -- meta wasn't known when the constraint was generated. In that case, try -- to find its type again. findInstance :: MetaId -> Maybe [Candidate] -> TCM () isInstanceConstraint :: Constraint -> Bool solveAwakeInstanceConstraints :: TCM () shouldPostponeInstanceSearch :: (ReadTCState m, HasOptions m) => m Bool postponeInstanceConstraints :: TCM a -> TCM a flushInstanceConstraints :: TCM () -- | Entry point for tcGetInstances primitive getInstanceCandidates :: MetaId -> TCM (Either Blocker [Candidate]) -- | Try to solve the instance definitions whose type is not yet known, -- report an error if it doesn't work and return the instance table -- otherwise. getInstanceDefs :: TCM InstanceTable data OutputTypeName OutputTypeName :: QName -> OutputTypeName OutputTypeVar :: OutputTypeName OutputTypeVisiblePi :: OutputTypeName OutputTypeNameNotYetKnown :: Blocker -> OutputTypeName NoOutputTypeName :: OutputTypeName -- | Strips all hidden and instance Pi's and return the argument telescope, -- the head term, and its name, if possible. getOutputTypeName :: Type -> TCM (Telescope, Term, OutputTypeName) -- | Register the definition with the given type as an instance. Issue -- warnings if instance is unusable. addTypedInstance :: KwRange -> QName -> Type -> TCM () -- | Like addTypedInstance, but delete any existing entries for the -- given name from the discrimination tree. readdTypedInstance :: KwRange -> QName -> Type -> TCM () -- | Register the definition with the given type as an instance. addTypedInstance' :: Bool -> Bool -> Maybe InstanceInfo -> KwRange -> QName -> Type -> TCM () -- | Prune an Interface to remove any instances that would be -- inapplicable in child modules. -- -- While in a section with visible arguments, we add any instances -- defined locally to the instance table: you have to be able to find -- them, after all! Conservatively, all of the local variables are turned -- into FlexKs, i.e., wildcards. -- -- But when we leave such a section, these instances have no more value: -- even though they might technically be in scope, their types are -- malformed, since they have visible pis. -- -- This function deletes these instances from the instance tree in the -- given signature to save on serialisation time *and* time spent -- checking for candidate validity in client modules. It can't do this -- directly in the TC state to prevent these instances from going out of -- scope before interaction (see #7196). pruneTemporaryInstances :: Interface -> TCM Interface resolveInstanceHead :: KwRange -> QName -> TCM () instance GHC.Internal.Show.Show Agda.TypeChecking.InstanceArguments.YesNo module Agda.TypeChecking.Constraints addConstraintTCM :: Blocker -> Constraint -> TCM () wakeConstraintsTCM :: (ProblemConstraint -> WakeUp) -> TCM () -- | Add all constraints belonging to the given problem to the current -- problem(s). stealConstraintsTCM :: ProblemId -> TCM () -- | Error out with NonFatalErrors -- UnsolvedConstraints if the computation produced blocking -- constraints. -- -- WARNING: this does not mean that the given computation cannot -- constrain the solution space further. It can well do so, by solving -- metas. noConstraints :: (MonadConstraint m, MonadWarning m, MonadFresh ProblemId m) => m a -> m a -- | As noConstraints but also fail for non-blocking constraints. reallyNoConstraints :: (MonadConstraint m, MonadWarning m, MonadFresh ProblemId m) => m a -> m a -- | Error out with NonFatalErrors -- UnsolvedConstraints when given computation produced -- constraints (True) or blocking constraints (False). noConstraints' :: (MonadConstraint m, MonadWarning m, MonadFresh ProblemId m) => Bool -> m a -> m a -- | Run a computation that should succeeds without constraining the -- solution space, i.e., not add any information about meta-variables. nonConstraining :: (MonadConstraint m, MonadFresh ProblemId m, MonadWarning m) => m a -> m a -- | Create a fresh problem for the given action. newProblem :: (MonadFresh ProblemId m, MonadConstraint m) => m a -> m (ProblemId, a) newProblem_ :: (MonadFresh ProblemId m, MonadConstraint m) => m a -> m ProblemId -- | Create a fresh problem for the given action. Don't wake problems after -- the action finishes. newProblemDontWake_ :: (MonadFresh ProblemId m, MonadConstraint m) => m a -> m ProblemId ifNoConstraints :: TCM a -> (a -> TCM b) -> (ProblemId -> a -> TCM b) -> TCM b ifNoConstraints_ :: TCM () -> TCM a -> (ProblemId -> TCM a) -> TCM a -- | guardConstraint c blocker tries to solve blocker -- first. If successful without constraints, it moves on to solve -- c, otherwise it adds a c to the constraint pool, -- blocked by the problem generated by blocker. guardConstraint :: Constraint -> TCM () -> TCM () whenConstraints :: TCM () -> TCM () -> TCM () -- | Wake up the constraints depending on the given meta. wakeupConstraints :: MonadMetaSolver m => MetaId -> m () -- | Wake up all constraints not blocked on a problem. wakeupConstraints_ :: TCM () -- | Solve awake constraints matching the predicate. If the second argument -- is True solve constraints even if already isSolvingConstraints. solveSomeAwakeConstraintsTCM :: (ProblemConstraint -> Bool) -> Bool -> TCM () solveConstraintTCM :: Constraint -> TCM () solveConstraint_ :: Constraint -> TCM () checkTypeCheckingProblem :: TypeCheckingProblem -> TCM Term debugConstraints :: TCM () updateBlocker :: PureTCM m => Blocker -> m Blocker addAndUnblocker :: (PureTCM m, MonadBlock m) => Blocker -> m a -> m a addOrUnblocker :: (PureTCM m, MonadBlock m) => Blocker -> m a -> m a withReduced :: (Reduce a, IsMeta a, PureTCM m, MonadBlock m) => a -> (a -> m b) -> m b instance Agda.TypeChecking.Monad.Constraints.MonadConstraint Agda.TypeChecking.Monad.Base.TCM -- | Unification algorithm for specializing datatype indices, as described -- in "Unifiers as Equivalences: Proof-Relevant Unification of -- Dependently Typed Data" by Jesper Cockx, Dominique Devriese, and Frank -- Piessens (ICFP 2016). -- -- This is the unification algorithm used for checking the left-hand side -- of clauses (see Agda.TypeChecking.Rules.LHS), coverage -- checking (see Agda.TypeChecking.Coverage) and indirectly also -- for interactive case splitting (see -- Agda.Interaction.MakeCase). -- -- A unification problem (of type UnifyState) consists of: -- --
    --
  1. A telescope varTel of free variables, some or all of -- which are flexible (as indicated by flexVars).
  2. --
  3. A telescope eqTel containing the types of the -- equations.
  4. --
  5. Left- and right-hand sides for each equation: varTel ⊢ eqLHS : -- eqTel and varTel ⊢ eqRHS : eqTel.
  6. --
-- -- The unification algorithm can end in three different ways: (type -- UnificationResult): -- -- -- -- The unification algorithm itself consists of two parts: -- --
    --
  1. A *unification strategy* takes a unification problem and produces -- a list of suggested unification rules (of type UnifyStep). -- Strategies can be constructed by composing simpler strategies (see for -- example the definition of completeStrategyAt).
  2. --
  3. The *unification engine* unifyStep takes a unification -- rule and tries to apply it to the given state, writing the result to -- the UnifyOutput on a success.
  4. --
-- -- The unification steps (of type UnifyStep) are the following: -- -- -- -- Higher-dimensional unification (new, does not yet appear in any -- paper): If an equation of the form c us =?= c vs : D pars is -- is encountered where c : Δc → D pars js is a constructor of -- an indexed datatype D pars : Φ → Set ℓ, it is in general -- unsound to just simplify this equation to us =?= vs : Δc. For -- this reason, the injectivity rule in the paper restricts the indices -- is to be distinct variables that are bound in the telescope -- eqTel. But we can be more general by introducing new -- variables ks to the telescope eqTel and equating -- these to is: Δ₁(x : D pars is)Δ₂ ≃ Δ₁(ks : Φ)(x : D pars -- ks)(ps : is ≡Φ ks)Δ₂ Since ks are distinct variables, -- it's now possible to apply injectivity to the equation x, -- resulting in the following new equation telescope: Δ₁(ys : Δc)(ps -- : is ≡Φ js[Δc ↦ ys])Δ₂ Now we can solve the equations -- ps by recursively calling the unification algorithm with -- flexible variables Δ₁(ys : Δc). This is called -- *higher-dimensional unification* since we are unifying equality proofs -- rather than terms. If the higher-dimensional unification succeeds, the -- resulting telescope serves as the new equation telescope for the -- original unification problem. module Agda.TypeChecking.Rules.LHS.Unify -- | Result of unifyIndices. type UnificationResult = UnificationResult' (Telescope, PatternSubstitution, [NamedArg DeBruijnPattern]) data UnificationResult' a -- | Unification succeeded. Unifies :: a -> UnificationResult' a -- | Terms are not unifiable. NoUnify :: NegativeUnification -> UnificationResult' a -- | Unification got blocked on a metavariable UnifyBlocked :: Blocker -> UnificationResult' a -- | Some other error happened, unification got stuck. UnifyStuck :: [UnificationFailure] -> UnificationResult' a data NoLeftInv UnsupportedYet :: UnifyStep -> NoLeftInv [badStep] :: NoLeftInv -> UnifyStep Illegal :: UnifyStep -> NoLeftInv [badStep] :: NoLeftInv -> UnifyStep NoCubical :: NoLeftInv WithKEnabled :: NoLeftInv -- | splitting on a Strict Set. SplitOnStrict :: NoLeftInv -- | splitting on a @♭ argument SplitOnFlat :: NoLeftInv UnsupportedCxt :: NoLeftInv CantTransport :: Closure (Abs Type) -> NoLeftInv CantTransport' :: Closure Type -> NoLeftInv unifyIndices' :: Maybe NoLeftInv -> Telescope -> FlexibleVars -> Type -> Args -> Args -> TCM FullUnificationResult -- | Unify indices. -- -- In unifyIndices gamma flex a us vs, -- -- -- -- The result is the most general unifier of us and vs. unifyIndices :: Maybe NoLeftInv -> Telescope -> FlexibleVars -> Type -> Args -> Args -> TCM UnificationResult instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.LHS.Unify.RetryNormalised instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Rules.LHS.Unify.UnificationResult' instance GHC.Internal.Base.Functor Agda.TypeChecking.Rules.LHS.Unify.UnificationResult' instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.LHS.Unify.RetryNormalised instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Rules.LHS.Unify.UnificationResult' a) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Rules.LHS.Unify.UnificationResult' -- | The occurs check for unification. Does pruning on the fly. -- -- When hitting a meta variable: -- -- -- -- We also check modality usability for all bound variables; see issue -- 8570. In the example there, we elaborate a term as a type (using -- resourcing rules for types), but then solve a term metavariable with -- it. Hence, well-resourcing needs to be re-checked when we solve the -- metavariable. module Agda.TypeChecking.MetaVars.Occurs data PruneResult -- | the kill list is empty or only Falses NothingToPrune :: PruneResult -- | there is no possible kill (because of type dep.) PrunedNothing :: PruneResult -- | managed to kill some args in the list PrunedSomething :: PruneResult -- | all prescribed kills where performed PrunedEverything :: PruneResult -- | killArgs [k1,...,kn] X prunes argument i from -- metavar X if ki==True. Pruning is carried out -- whenever > 0 arguments can be pruned. killArgs :: [Bool] -> MetaId -> TCM PruneResult -- | When assigning m xs := v, check that m does not -- occur in v and that the free variables of v are -- contained in xs. occursCheck :: MetaId -> VarMap -> Term -> TCM Term -- | prune m' vs xs attempts to remove all arguments from -- vs whose free variables are not contained in xs. If -- successful, m' is solved by the new, pruned meta variable and -- we return True else False. -- -- Issue 1147: If any of the meta args vs is matchable, e.g., is -- a constructor term, we cannot prune, because the offending variables -- could be removed by reduction for a suitable instantiation of the meta -- variable. prune :: MetaId -> Args -> (Nat -> Bool) -> TCM PruneResult -- | Check whether any of the variables (given as de Bruijn indices) occurs -- *definitely* in the term in a rigid position. Reduces the term -- successively to remove variables in dead subterms. This fixes issue -- 1386. rigidVarsNotContainedIn :: (PureTCM m, AnyRigid a) => a -> (Nat -> Bool) -> m Bool instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.MetaVars.Occurs.AnyRigid a) => Agda.TypeChecking.MetaVars.Occurs.AnyRigid (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid a => Agda.TypeChecking.MetaVars.Occurs.AnyRigid (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid a => Agda.TypeChecking.MetaVars.Occurs.AnyRigid (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid a => Agda.TypeChecking.MetaVars.Occurs.AnyRigid (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid Agda.Syntax.Internal.Level instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid a => Agda.TypeChecking.MetaVars.Occurs.AnyRigid [a] instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid Agda.Syntax.Internal.Sort instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid Agda.Syntax.Internal.Term instance (Agda.TypeChecking.MetaVars.Occurs.AnyRigid a, Agda.TypeChecking.MetaVars.Occurs.AnyRigid b) => Agda.TypeChecking.MetaVars.Occurs.AnyRigid (a, b) instance Agda.TypeChecking.MetaVars.Occurs.AnyRigid Agda.Syntax.Internal.Type instance GHC.Internal.Classes.Eq Agda.TypeChecking.MetaVars.Occurs.PruneResult instance GHC.Internal.Classes.Eq Agda.TypeChecking.MetaVars.Occurs.UnfoldStrategy instance Agda.TypeChecking.Free.Base.LensFlexRig Agda.TypeChecking.MetaVars.Occurs.OccursCxt () instance Agda.Syntax.Common.LensModality Agda.TypeChecking.MetaVars.Occurs.OccursCxt instance Agda.Syntax.Common.LensQuantity Agda.TypeChecking.MetaVars.Occurs.OccursCxt instance Agda.Syntax.Common.LensRelevance Agda.TypeChecking.MetaVars.Occurs.OccursCxt instance Agda.TypeChecking.MetaVars.Occurs.Occurs a => Agda.TypeChecking.MetaVars.Occurs.Occurs (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.Clause instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.MetaVars.Occurs.Occurs a => Agda.TypeChecking.MetaVars.Occurs.Occurs (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.Level instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.Elims instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.Sort instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.Term instance Agda.TypeChecking.MetaVars.Occurs.Occurs Agda.Syntax.Internal.Type instance GHC.Internal.Show.Show Agda.TypeChecking.MetaVars.Occurs.PruneResult instance GHC.Internal.Show.Show Agda.TypeChecking.MetaVars.Occurs.UnfoldStrategy module Agda.TypeChecking.Lock isTimeless :: Type -> TCM Bool checkLockedVars :: Term -> Type -> Arg Term -> Type -> TCM () -- | If the first argument is a lock variable, check that all variables in -- the given set are either earlier than this variable or are timeless. checkEarlierThan :: Term -> VarSet -> TCM Bool module Agda.TypeChecking.MetaVars -- | Find position of a value in a list. Used to change metavar argument -- indices during assignment. -- -- reverse is necessary because we are directly abstracting over -- the list. findIdx :: Eq a => [a] -> a -> Maybe Int -- | Does the given local meta-variable have a twin meta-variable? hasTwinMeta :: MetaId -> TCM Bool -- | Check whether a meta variable is a place holder for a blocked term. isBlockedTerm :: MetaId -> TCM Bool isEtaExpandable :: [MetaClass] -> MetaId -> TCM Bool -- | Performing the meta variable assignment. -- -- The instantiation should not be an InstV and the MetaId -- should point to something Open or a BlockedConst. -- Further, the meta variable may not be Frozen. assignTerm :: MetaId -> [Arg ArgName] -> Term -> TCM () -- | Skip frozen check. Used for eta expanding frozen metas. assignTermTCM' :: MetaId -> [Arg ArgName] -> Term -> TCM () -- | Create a sort meta that cannot be instantiated with Inf (Setω). newSortMetaBelowInf :: TCM Sort -- | Create a sort meta that may be instantiated with Inf (Setω). newSortMeta :: TCM Sort -- | Create a sort meta that may be instantiated with Inf (Setω). newSortMetaCtx :: MonadMetaSolver m => Args -> m Sort newTypeMeta' :: Comparison -> Sort -> TCM Type newTypeMeta :: Sort -> TCM Type newTypeMeta_ :: TCM Type newLevelMeta :: TCM Level -- | newInstanceMeta s t cands creates a new instance metavariable -- of type the output type of t with name suggestion s. newInstanceMeta :: MetaNameSuggestion -> Type -> TCM (MetaId, Term) newInstanceMetaCtx :: MetaNameSuggestion -> Type -> Args -> TCM (MetaId, Term) -- | Create a new value meta with specific dependencies, possibly -- η-expanding in the process. newNamedValueMeta :: RunMetaOccursCheck -> MetaNameSuggestion -> Comparison -> Type -> TCM (MetaId, Term) -- | Create a new value meta with specific dependencies without -- η-expanding. newNamedValueMeta' :: RunMetaOccursCheck -> MetaNameSuggestion -> Comparison -> Type -> TCM (MetaId, Term) newValueMetaOfKind :: MetaInfo -> RunMetaOccursCheck -> Comparison -> Type -> TCM (MetaId, Term) -- | Create a new metavariable, possibly η-expanding in the process. newValueMeta :: RunMetaOccursCheck -> Comparison -> Type -> TCM (MetaId, Term) newValueMetaCtx :: Frozen -> RunMetaOccursCheck -> Comparison -> Type -> Telescope -> Permutation -> Args -> TCM (MetaId, Term) -- | Create a new value meta without η-expanding. newValueMeta' :: RunMetaOccursCheck -> Comparison -> Type -> TCM (MetaId, Term) newValueMetaCtx' :: Frozen -> RunMetaOccursCheck -> Comparison -> Type -> Telescope -> Permutation -> Args -> TCM (MetaId, Term) newTelMeta :: Telescope -> TCM Args type Condition = Dom Type -> Abs Type -> Bool trueCondition :: Condition newArgsMeta :: Type -> TCM Args newArgsMeta' :: Condition -> Type -> TCM Args newArgsMetaCtx :: Type -> Telescope -> Permutation -> Args -> TCM Args newArgsMetaCtx'' :: MetaNameSuggestion -> Frozen -> Condition -> Type -> Telescope -> Permutation -> Args -> TCM Args newArgsMetaCtx' :: Frozen -> Condition -> Type -> Telescope -> Permutation -> Args -> TCM Args -- | Create a metavariable of record type. This is actually one -- metavariable for each field. newRecordMeta :: QName -> Args -> TCM Term newRecordMetaCtx :: MetaNameSuggestion -> Frozen -> QName -> Args -> Telescope -> Permutation -> Args -> TCM Term newQuestionMark :: InteractionId -> Comparison -> Type -> TCM (MetaId, Term) newQuestionMark' :: (Comparison -> Type -> TCM (MetaId, Term)) -> InteractionId -> Comparison -> Type -> TCM (MetaId, Term) -- | Construct a blocked constant if there are constraints. blockTerm :: Type -> TCM Term -> TCM Term blockTermOnProblem :: Type -> Term -> ProblemId -> TCM Term blockTypeOnProblem :: Type -> ProblemId -> TCM Type -- | unblockedTester t returns a Blocker for t. -- -- Auxiliary function used when creating a postponed type checking -- problem. unblockedTester :: Type -> TCM Blocker -- | Create a postponed type checking problem e : t that waits for -- type t to unblock (become instantiated or its constraints -- resolved). postponeTypeCheckingProblem_ :: TypeCheckingProblem -> TCM Term -- | Create a postponed type checking problem e : t that waits for -- conditon unblock. A new meta is created in the current -- context that has as instantiation the postponed type checking problem. -- An UnBlock constraint is added for this meta, which links to -- this meta. postponeTypeCheckingProblem :: TypeCheckingProblem -> Blocker -> TCM Term -- | Type of the term that is produced by solving the -- TypeCheckingProblem. problemType :: TypeCheckingProblem -> Type -- | Eta-expand a local meta-variable, if it is of the specified kind. -- Don't do anything if the meta-variable is a blocked term. etaExpandMetaTCM :: [MetaClass] -> MetaId -> TCM () -- | Eta expand blocking metavariables of record type, and reduce the -- blocked thing. etaExpandBlocked :: (MonadMetaSolver m, IsMeta t, Reduce t) => Blocked t -> m (Blocked t) -- | Is the term an rewrite function? Does not need to do reduction -- because of syntactic restrictions on the placement of rewrite isRewPi :: Term -> Bool assignWrapper :: MonadMetaSolver m => CompareDirection -> MetaId -> Elims -> Term -> m () -> m () allRewDoms :: Tele (Dom Type) -> [RewDom] -- | Gets the set of variables constrained by local rewrite rules -- -- We specifically care about variables that occur exactly as LHSs of -- local rewrite rules. Unification problems under such local rewrite -- rules might appear outside the pattern fragment after rewriting -- arguments, but if the argument is constrained in the meta's context, -- we know it is uniquely determined up to defeq and can proceed. rewConstrained :: Tele (Dom Type) -> TCM VarSet -- | Miller pattern unification: -- -- assign dir x vs v a solves problem x vs <=(dir) v : -- a for meta x if vs are distinct variables -- (linearity check) and v depends only on these variables and -- does not contain x itself (occurs check). -- -- This is the basic story, but we have added some features: -- --
    --
  1. Pruning.
  2. --
  3. Benign cases of non-linearity.
  4. --
  5. vs may contain record patterns.
  6. --
-- -- For a reference to some of these extensions, read Andreas Abel and -- Brigitte Pientka's TLCA 2011 paper. assign :: CompareDirection -> MetaId -> Args -> Term -> CompareAs -> TCM () -- | Is the given metavariable application secretly an interaction point -- application? Ugly. isInteractionMetaB :: MonadPretty m => MetaId -> Args -> m (Maybe (MetaId, InteractionId, Args)) -- | assignMeta m x t ids u solves x ids = u for meta -- x of type t, where term u lives in a -- context of length m. Precondition: ids is linear. assignMeta :: Int -> MetaId -> Type -> [Int] -> Term -> TCM () -- | assignMeta' m x t ids u solves x = [ids]u for meta -- x of type t, where term u lives in a -- context of length m, and ids is a partial -- substitution. assignMeta' :: Int -> MetaId -> Type -> Int -> SubstCand -> Term -> TCM () -- | Check that the instantiation of the given metavariable fits the type -- of the metavariable. If the metavariable is not yet instantiated, add -- a constraint to check the instantiation later. checkMetaInst :: MetaId -> TCM () -- | Check that the instantiation of the metavariable with the given term -- is well-typed. checkSolutionForMeta :: MetaId -> MetaVariable -> Term -> Type -> TCM () -- | Given two types a and b with a <: b, -- check that a == b. checkSubtypeIsEqual :: Type -> Type -> TCM () -- | Turn the assignment problem _X args <= SizeLt u into -- _X args = SizeLt (_Y args) and constraint _Y args <= -- u. subtypingForSizeLt :: CompareDirection -> MetaId -> MetaVariable -> Type -> Args -> Term -> (Term -> TCM ()) -> TCM () -- | Eta-expand bound variables like z in X (fst z). expandProjectedVars :: (Pretty a, PrettyTCM a, NoProjectedVar a, ReduceAndEtaContract a, PrettyTCM b, TermSubst b) => a -> b -> (a -> b -> TCM c) -> TCM c -- | Eta-expand a de Bruijn index of record type in context and passed -- term(s). etaExpandProjectedVar :: (PrettyTCM a, TermSubst a) => Int -> a -> TCM c -> (a -> TCM c) -> TCM c -- | Check whether one of the meta args is a projected var. class NoProjectedVar a noProjectedVar :: NoProjectedVar a => a -> Either ProjectedVar () ($dmnoProjectedVar) :: forall b (t :: Type -> Type). (NoProjectedVar a, NoProjectedVar b, Foldable t, t b ~ a) => a -> Either ProjectedVar () -- | Normalize just far enough to be able to eta-contract maximally. class (TermLike a, TermSubst a, Reduce a) => ReduceAndEtaContract a reduceAndEtaContract :: ReduceAndEtaContract a => a -> TCM a ($dmreduceAndEtaContract) :: forall (f :: Type -> Type) b. (ReduceAndEtaContract a, Traversable f, ReduceAndEtaContract b, f b ~ a) => a -> TCM a type FVs = VarSet type SubstCand = [(Int, Term)] -- | Turn non-det substitution into proper substitution, if possible. -- Otherwise, raise the error. checkLinearity :: SubstCand -> ExceptT () TCM SubstCand type Res = [(Arg Nat, Term)] -- | Exceptions raised when substitution cannot be inverted. data InvertExcept -- | Cannot recover. CantInvert :: Term -> InvertExcept -- | A potentially neutral arg: can't invert, but can try pruning. NeutralArg :: InvertExcept -- | Try to eta-expand var to remove projs. ProjVar :: ProjectedVar -> InvertExcept -- | Check that arguments args to a metavar are in pattern -- fragment. Assumes all arguments already in whnf and eta-reduced. -- Parameters are represented as Vars so checkArgs -- really checks that all args are Vars and returns the -- "substitution" to be applied to the rhs of the equation to solve. (If -- args is considered a substitution, its inverse is returned.) -- -- The returned list might not be ordered. Linearity, i.e., whether the -- substitution is deterministic, has to be checked separately. inverseSubst' :: (Term -> Bool) -> Tele (Dom Type) -> Args -> ExceptT InvertExcept TCM SubstCand -- | If the given metavariable application represents a face, return: -- -- -- -- Put concisely, a face constraint is an equation in the pattern -- fragment modulo the presence of endpoints (i0 and -- i1) in the telescope. In more detail, a face constraint has -- the form -- --
--   ?0 Δ (i = i0) (j = i0) Γ (k = i1) Θ (l = i0) = t
--   
-- -- where all the greek letters consist entirely of distinct bound -- variables (and, of course, arbitrarily many endpoints are allowed -- between each substitution fragment). isFaceConstraint :: MetaId -> Args -> TCM (Maybe (MetaVariable, IntMap Bool, SubstCand, Substitution)) -- | Record a "face" equation onto an interaction point into the actual -- interaction point boundary. Takes all the same arguments as -- assignMeta'. tryAddBoundary :: CompareDirection -> MetaId -> InteractionId -> Args -> Term -> CompareAs -> TCM () -- | Turn open metas into postulates. -- -- Preconditions: -- --
    --
  1. We are inTopContext.
  2. --
  3. envCurrentModule is set to the top-level module.
  4. --
openMetasToPostulates :: TCM () -- | Sort metas in dependency order. dependencySortMetas :: [MetaId] -> TCM (Maybe [MetaId]) instance Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver Agda.TypeChecking.Monad.Base.TCM instance Agda.TypeChecking.MetaVars.NoProjectedVar a => Agda.TypeChecking.MetaVars.NoProjectedVar (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.MetaVars.NoProjectedVar a => Agda.TypeChecking.MetaVars.NoProjectedVar [a] instance Agda.TypeChecking.MetaVars.NoProjectedVar Agda.Syntax.Internal.Term instance Agda.TypeChecking.MetaVars.ReduceAndEtaContract a => Agda.TypeChecking.MetaVars.ReduceAndEtaContract (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.MetaVars.ReduceAndEtaContract a => Agda.TypeChecking.MetaVars.ReduceAndEtaContract [a] instance Agda.TypeChecking.MetaVars.ReduceAndEtaContract Agda.Syntax.Internal.Term -- | Solving size constraints under hypotheses. -- -- The size solver proceeds as follows: -- --
    --
  1. Get size constraints, cluster into connected components.
  2. --
-- -- All size constraints that mention the same metas go into the same -- cluster. Each cluster can be solved by itself. -- -- Constraints that do not fit our format are ignored. We check whether -- our computed solution fulfills them as well in the last step. -- --
    --
  1. Find a joint context for each cluster.
  2. --
-- -- Each constraint comes with its own typing context, which contains size -- hypotheses j : Size< i. We need to find a common super -- context in which all constraints of a cluster live, and raise all -- constraints to this context. -- -- There might not be a common super context. Then we are screwed, since -- our solver is not ready to deal with such a situation. We will -- blatantly refuse to solve this cluster and blame it on the user. -- --
    --
  1. Convert the joint context into a hypothesis graph.
  2. --
-- -- This is straightforward. Each de Bruijn index becomes a rigid -- variable, each typing assumption j : Size< i becomes an -- arc. -- --
    --
  1. Convert the constraints into a constraint graph.
  2. --
-- -- Here we need to convert MetaVs into flexible variables. -- --
    --
  1. Run the solver
  2. --
  3. Convert the solution into meta instantiations.
  4. --
  5. Double-check whether the constraints are solved.
  6. --
module Agda.TypeChecking.SizedTypes.Solve -- | Flag to control the behavior of size solver. data DefaultToInfty -- | Instantiate all unconstrained size variables to ∞. DefaultToInfty :: DefaultToInfty -- | Leave unconstrained size variables unsolved. DontDefaultToInfty :: DefaultToInfty -- | Solve size constraints involving hypotheses. solveSizeConstraints :: DefaultToInfty -> TCM () -- | TODO: this does not actually work! -- -- We would like to use a constraint c created in context -- Δ from module N in the current context Γ -- and current module M. -- -- Δ is module tel Δ₁ of N extended by some -- local bindings Δ₂. Γ is the current context. The -- module parameter substitution from current M to N be -- Γ ⊢ σ : Δ₁. -- -- If M == N, we do not need the parameter substitution. We try -- raising. -- -- We first strengthen Δ ⊢ c to live in Δ₁ and obtain -- c₁ = strengthen Δ₂ c. We then transport c₁ to -- Γ and obtain c₂ = applySubst σ c₁. -- -- This works for different modules, but if M == N we should not -- strengthen and then weaken, because strengthening is a partial -- operation. We should rather lift the substitution σ by -- Δ₂ and then raise by Γ₂ - Δ₂. This "raising" might -- be a strengthening if Γ₂ is shorter than Δ₂. -- -- (TODO: If the module substitution does not exist, because N -- is not a parent of M, we cannot use the constraint, as it has -- been created in an unrelated context.) castConstraintToCurrentContext' :: Closure Constraint -> MaybeT TCM Constraint -- | A hazardous hack, may the Gods have mercy on us. -- -- To cast to the current context, we match the context of the given -- constraint by CtxId, and as fallback, by variable name -- (douh!). -- -- This hack lets issue 2046 go through. castConstraintToCurrentContext :: ProblemConstraint -> MaybeT TCM ProblemConstraint -- | Return the size metas occurring in the simplified constraints. A -- constraint like ↑ _j =< ∞ : Size simplifies to nothing, so -- _j would not be in this set. solveSizeConstraints_ :: DefaultToInfty -> [ProblemConstraint] -> TCM (Set MetaId) -- | Solve a cluster of constraints sharing some metas. solveCluster :: DefaultToInfty -> List1 (ProblemConstraint, HypSizeConstraint) -> TCM () -- | Collect constraints from a typing context, looking for SIZELT -- hypotheses. getSizeHypotheses :: Context -> TCM [(Nat, SizeConstraint)] -- | Convert size constraint into form where each meta is applied to -- indices n-1,...,1,0 where n is the arity of that -- meta. -- -- X[σ] <= t becomes X[id] <= t[σ^-1] -- -- X[σ] ≤ Y[τ] becomes X[id] ≤ Y[τ[σ^-1]] or -- X[σ[τ^1]] ≤ Y[id] whichever is defined. If none is defined, -- we give up. -- -- Cf. SizedTypes.oldCanonicalizeSizeConstraint. -- -- Fixes (the rather artificial) issue 300. But it is unsound when pruned -- metas occur and triggers issue 1914. Thus we deactivate it. This needs -- to be properly implemented, possibly using the metaPermuatation of -- each meta variable. canonicalizeSizeConstraint :: SizeConstraint -> Maybe SizeConstraint -- | Turn a constraint over de Bruijn indices into a size constraint. computeSizeConstraint :: ProblemConstraint -> TCM (Maybe HypSizeConstraint) -- | Turn a term into a size expression. -- -- Returns Nothing if the term isn't a proper size expression. sizeExpr :: Term -> TCM (Maybe DBSizeExpr) instance GHC.Internal.Classes.Eq Agda.TypeChecking.SizedTypes.Solve.DefaultToInfty instance GHC.Internal.Classes.Ord Agda.TypeChecking.SizedTypes.Solve.DefaultToInfty instance GHC.Internal.Show.Show Agda.TypeChecking.SizedTypes.Solve.DefaultToInfty instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.SizedTypes.Syntax.SizeConstraint instance Agda.TypeChecking.Substitute.Class.Subst (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' Agda.TypeChecking.SizedTypes.Syntax.NamedRigid Agda.TypeChecking.SizedTypes.Syntax.SizeMeta) instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.SizedTypes.Syntax.SizeMeta -- | SplitClause and CoverResult types. module Agda.TypeChecking.Coverage.SplitClause data SplitClause SClause :: Telescope -> [NamedArg SplitPattern] -> Substitution' SplitPattern -> Map CheckpointId Substitution -> Maybe (Dom Type) -> SplitClause -- | Type of variables in scPats. [scTel] :: SplitClause -> Telescope -- | The patterns leading to the currently considered branch of the split -- tree. [scPats] :: SplitClause -> [NamedArg SplitPattern] -- | Substitution from scTel to old context. Only needed directly -- after split on variable: * To update scTarget * To rename other -- split variables when splitting on multiple variables. scSubst -- is not `transitive', i.e., does not record the substitution -- from the original context to scTel over a series of splits. It -- is freshly computed after each split by computeNeighborhood; -- also splitResult, which does not split on a variable, should -- reset it to the identity idS, lest it be applied to -- scTarget again, leading to Issue 1294. [scSubst] :: SplitClause -> Substitution' SplitPattern -- | We need to keep track of the module parameter checkpoints for the -- clause for the purpose of inferring missing instance clauses. [scCheckpoints] :: SplitClause -> Map CheckpointId Substitution -- | The type of the rhs, living in context scTel. -- fixTargetType computes the new scTarget by applying -- substitution scSubst. [scTarget] :: SplitClause -> Maybe (Dom Type) data UnifyEquiv UE :: Telescope -> Telescope -> Telescope -> [Term] -> [Term] -> PatternSubstitution -> Substitution -> Substitution -> UnifyEquiv [infoTel0] :: UnifyEquiv -> Telescope [infoTel] :: UnifyEquiv -> Telescope [infoEqTel] :: UnifyEquiv -> Telescope [infoEqLHS] :: UnifyEquiv -> [Term] [infoEqRHS] :: UnifyEquiv -> [Term] [infoRho] :: UnifyEquiv -> PatternSubstitution [infoTau] :: UnifyEquiv -> Substitution [infoLeftInv] :: UnifyEquiv -> Substitution data IInfo TheInfo :: UnifyEquiv -> IInfo NoInfo :: IInfo -- | A Covering is the result of splitting a SplitClause. data Covering Covering :: Arg Nat -> [(SplitTag, (SplitClause, IInfo))] -> Covering -- | De Bruijn level (counting dot patterns) of argument we split on. [covSplitArg] :: Covering -> Arg Nat -- | Covering clauses, indexed by constructor/literal these clauses share. [covSplitClauses] :: Covering -> [(SplitTag, (SplitClause, IInfo))] -- | Project the split clauses out of a covering. splitClauses :: Covering -> [SplitClause] -- | Create a split clause from a clause in internal syntax. Used by -- make-case. clauseToSplitClause :: Clause -> SplitClause data CoverResult CoverResult :: SplitTree -> IntSet -> [(Telescope, [NamedArg DeBruijnPattern])] -> [Clause] -> IntSet -> CoverResult [coverSplitTree] :: CoverResult -> SplitTree [coverUsedClauses] :: CoverResult -> IntSet [coverMissingClauses] :: CoverResult -> [(Telescope, [NamedArg DeBruijnPattern])] -- | The set of patterns used as cover. [coverPatterns] :: CoverResult -> [Clause] [coverNoExactClauses] :: CoverResult -> IntSet instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Coverage.SplitClause.SplitClause instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.SplitClause.IInfo instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.SplitClause.SplitClause instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.SplitClause.UnifyEquiv module Agda.TypeChecking.Coverage.Cubical createMissingIndexedClauses :: QName -> Arg Nat -> BlockingVar -> SplitClause -> [(SplitTag, (SplitClause, IInfo))] -> [Clause] -> TCM ([(SplitTag, CoverResult)], [Clause]) covFillTele :: QName -> Abs Telescope -> Term -> Args -> Term -> TCM [Term] createMissingTrXTrXClause :: QName -> QName -> Arg Nat -> BlockingVar -> SplitClause -> TCM Clause createMissingTrXHCompClause :: QName -> QName -> Arg Nat -> BlockingVar -> SplitClause -> TCM Clause createMissingTrXConClause :: QName -> QName -> Arg Nat -> BlockingVar -> SplitClause -> QName -> UnifyEquiv -> TCM Clause -- | Append an hcomp clause to the clauses of a function. createMissingHCompClause :: QName -> Arg Nat -> BlockingVar -> SplitClause -> SplitClause -> [Clause] -> TCM ([(SplitTag, CoverResult)], [Clause]) module Agda.TypeChecking.Conversion -- | When comparing argument spines (in compareElims) where the first -- arguments don't match, we keep going, substituting the -- anti-unification of the two terms in the telescope. More precisely: -- -- @ (u = v : A)[pid] w = antiUnify pid A u v us = vs : Δ[w/x] -- ------------------------------------------------------------- u us = v -- vs : (x : A) Δ @ -- -- The simplest case of anti-unification is to return a fresh -- metavariable (created by blockTermOnProblem), but if there's shared -- structure between the two terms we can expose that. -- -- This is really a crutch that lets us get away with things that -- otherwise would require heterogenous conversion checking. See for -- instance issue #2384. antiUnify :: ProblemId -> Type -> Term -> Term -> TCM Term antiUnifyArgs :: ProblemId -> Dom Type -> Arg Term -> Arg Term -> TCM (Arg Term) antiUnifyElims :: ProblemId -> Type -> Term -> Elims -> Elims -> TCM Term antiUnifyType :: ProblemId -> Type -> Type -> TCM Type -- | Try to assign meta. If meta is projected, try to eta-expand and run -- conversion check again. assignE :: CompareDirection -> MetaId -> Elims -> Term -> CompareAs -> (Term -> Term -> TCM ()) -> TCM () bothAbsurd :: QName -> QName -> TCM Bool -- | coerce v a b coerces v : a to type b, -- returning a v' : b with maybe extra hidden applications or -- hidden abstractions. -- -- In principle, this function can host coercive subtyping, but currently -- it only tries to fix problems with hidden function types. coerce :: Comparison -> Term -> Type -> Type -> TCM Term -- | Account for situations like k : (Size< j) <= (Size< k + -- 1) -- -- Actually, the semantics is (Size<= k) ∩ (Size< j) ⊆ rhs -- which gives a disjunctive constraint. Mmmh, looks like stuff TODO. -- -- For now, we do a cheap heuristics. coerceSize :: Comparison -> Term -> Type -> Type -> TCM () -- | Type-directed equality on argument lists compareArgs :: [Polarity] -> [IsForced] -> Type -> Term -> Args -> Args -> TCM () -- | Type directed equality on terms or types. compareAs :: Comparison -> CompareAs -> Term -> Term -> TCM () compareAs' :: Comparison -> CompareAs -> Term -> Term -> TCM () compareAsDir :: CompareDirection -> CompareAs -> Term -> Term -> TCM () -- | Syntax directed equality on atomic values compareAtom :: Comparison -> CompareAs -> Term -> Term -> TCM () compareAtomDir :: CompareDirection -> CompareAs -> Term -> Term -> TCM () -- | Check whether a1 cmp a2 and continue in context -- extended by a1. compareDom :: Comparison -> Dom Type -> Dom Type -> Abs Type -> Abs Type -> TCM () -> TCM () -> TCM () -- | compareElims pols a v els1 els2 performs type-directed -- equality on eliminator spines. t is the type of the head -- v. -- -- Note: since TCM is lazy in return values from (>>=), it -- is important that compareElims in non-tail position be called as -- () <- compareElims pols a v e1 e2 so that any internal -- invariants upheld by returning IMPOSSIBLE actually get -- checked. compareElims :: [Polarity] -> [IsForced] -> Type -> Term -> [Elim] -> [Elim] -> TCM () compareInterval :: Comparison -> Type -> Term -> Term -> TCM () -- | Compare two terms in irrelevant position. This always succeeds. -- However, we can dig for solutions of irrelevant metas in the terms we -- compare. (Certainly not the systematic solution, that'd be proof -- search...) compareIrrelevant :: Type -> Term -> Term -> TCM () compareLevel :: Comparison -> Level -> Level -> TCM () -- | Check whether x xArgs cmp y yArgs compareMetas :: Comparison -> CompareAs -> MetaId -> Elims -> MetaId -> Elims -> TCM () compareSort :: Comparison -> Sort -> Sort -> TCM () -- | Type directed equality on values. compareTerm :: Comparison -> Type -> Term -> Term -> TCM () compareTerm' :: Comparison -> Type -> Term -> Term -> TCM () compareTermOnFace :: Comparison -> Term -> Type -> Term -> Term -> TCM () compareTermOnFace' :: (Substitution -> Comparison -> Type -> Term -> Term -> TCM ()) -> Comparison -> Term -> Type -> Term -> Term -> TCM () -- | Equality on Types compareType :: Comparison -> Type -> Type -> TCM () compareWithPol :: Polarity -> (Comparison -> a -> a -> TCM ()) -> a -> a -> TCM () -- | Compute the head type of an elimination. For projection-like functions -- this requires inferring the type of the principal argument. computeElimHeadType :: QName -> Elims -> Elims -> TCM Type -- | Compute the type of a rewrite rule head. For projection-like -- functions, this requires inferring the type of the principal argument, -- using the eliminations. computeRewHeadType :: Int -> RewriteHead -> Elims -> Elims -> TCM Type -- | Ignore errors in irrelevant context. convError :: TypeError -> TCM () equalAtom :: CompareAs -> Term -> Term -> TCM () equalLevel :: Level -> Level -> TCM () -- | Check that the first sort equal to the second. equalSort :: Sort -> Sort -> TCM () equalTerm :: Type -> Term -> Term -> TCM () -- | equalTermOnFace φ A u v = _ , φ ⊢ u = v : A equalTermOnFace :: Term -> Type -> Term -> Term -> TCM () equalType :: Type -> Type -> TCM () forallFaceMaps :: Term -> (IntMap Bool -> Blocker -> Term -> TCM a) -> (IntMap Bool -> Substitution -> TCM a) -> TCM [a] -- | guardPointerEquality x y s m behaves as m if -- x and y are equal as pointers, or does nothing -- otherwise. Use with care, see the documentation for -- unsafeComparePointers guardPointerEquality :: a -> a -> String -> TCM () -> TCM () -- | intersectVars us vs checks whether all relevant elements in -- us and vs are variables, and if yes, returns a prune -- list which says True for arguments which are different and -- can be pruned. intersectVars :: Elims -> Elims -> Maybe [Bool] isCanonical :: [Conj] -> Bool -- | leqConj r q = r ≤ q in the I lattice, when r and q are conjuctions. ' -- (∧ r_i) ≤ (∧ q_j) iff ' (∧ r_i) ∧ (∧ q_j) = (∧ r_i) iff ' {r_i | i} ∪ -- {q_j | j} = {r_i | i} iff ' {q_j | j} ⊆ {r_i | i} leqConj :: Conj -> Conj -> TCM Bool -- | leqInterval r q = r ≤ q in the I lattice. (∨ r_i) ≤ (∨ q_j) iff ∀ i. ∃ -- j. r_i ≤ q_j leqInterval :: [Conj] -> [Conj] -> TCM Bool leqLevel :: Level -> Level -> TCM () -- | Check that the first sort is less or equal to the second. -- -- We can put SizeUniv below Inf, but otherwise, it is -- unrelated to the other universes. leqSort :: Sort -> Sort -> TCM () leqType :: Type -> Type -> TCM () polFromCmp :: Comparison -> Polarity -- | Check if to lists of arguments are the same (and all variables). -- Precondition: the lists have the same length. sameVars :: Elims -> Elims -> Bool -- | Try whether a computation runs without errors or new constraints (may -- create new metas, though). Restores state upon failure. tryConversion :: TCM () -> TCM Bool -- | Try whether a computation runs without errors or new constraints (may -- create new metas, though). Return Just the result upon success. -- Return Nothing and restore state upon failure. tryConversion' :: TCM a -> TCM (Maybe a) type Conj = (IntMap BoolSet, [Term]) -- | Throw a floating ConversionError, given the arguments of -- compareAs. failConversion :: (MonadTCError m, HasBuiltins m) => Comparison -> Term -> Term -> CompareAs -> m a module Agda.TypeChecking.Rules.Builtin -- | Bind a builtin thing to an expression. bindBuiltin :: BuiltinId -> ResolvedName -> TCM () -- | Bind a builtin thing to a new name. -- -- Since their type is closed, it does not matter whether we are in a -- parameterized module when we declare them. We simply ignore the -- parameters. bindBuiltinNoDef :: BuiltinId -> QName -> TCM () builtinKindOfName :: BuiltinId -> Maybe KindOfName -- | bindPostulatedName builtin q m checks that q is a -- postulated name, and binds the builtin builtin to the term -- m q def, where def is the current Definition -- of q. bindPostulatedName :: BuiltinId -> ResolvedName -> (QName -> Definition -> TCM Term) -> TCM () isUntypedBuiltin :: BuiltinId -> Bool bindUntypedBuiltin :: BuiltinId -> QName -> ResolvedName -> TCM () -- | Checking local or global confluence of rewrite rules. -- -- For checking LOCAL CONFLUENCE of a given rewrite rule f ps ↦ -- v, we construct critical pairs involving this as the main rule by -- searching for: -- --
    --
  1. *Different* rules f ps' ↦ ... where ps and -- ps' can be unified.
  2. --
  3. Subpatterns g qs of ps and rewrite rules g -- qs' ↦ ... where qs and qs' can be unified.
  4. --
-- -- Each of these leads to a *critical pair* v₁ f us -- -- v₂, which should satisfy v₁ = v₂. -- -- For checking GLOBAL CONFLUENCE, we check the following two properties: -- --
    --
  1. For any two left-hand sides of the rewrite rules that overlap -- (either at the root position or at a subterm), the most general -- unifier of the two left-hand sides is again a left-hand side of a -- rewrite rule. For example, if there are two rules suc m + n = suc -- (m + n) and m + suc n = suc (m + n), then there should -- also be a rule suc m + suc n = suc (suc (m + n)).
  2. --
  3. Each rewrite rule should satisfy the *triangle property*: For any -- rewrite rule u ↦ w and any single-step parallel unfolding -- u => v, we should have another single-step parallel -- unfolding v => w.
  4. --
module Agda.TypeChecking.Rewriting.Confluence -- | Check confluence of the given rewrite rules wrt all other rewrite -- rules (also amongst themselves). checkConfluenceOfRules :: ConfluenceCheck -> [GlobalRewriteRule] -> TCM () -- | Check confluence of the clauses of the given function wrt rewrite -- rules of the constructors they match against checkConfluenceOfClauses :: ConfluenceCheck -> QName -> TCM () sortRulesOfSymbol :: QName -> TCM () instance Agda.TypeChecking.Rewriting.Confluence.AllHoles (Agda.Syntax.Internal.Abs Agda.Syntax.Internal.Term) instance Agda.TypeChecking.Rewriting.Confluence.AllHoles (Agda.Syntax.Internal.Abs Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Rewriting.Confluence.AllHoles p => Agda.TypeChecking.Rewriting.Confluence.AllHoles (Agda.Syntax.Common.Arg p) instance Agda.TypeChecking.Rewriting.Confluence.AllHoles p => Agda.TypeChecking.Rewriting.Confluence.AllHoles (Agda.Syntax.Internal.Dom p) instance Agda.TypeChecking.Rewriting.Confluence.AllHoles Agda.Syntax.Internal.Level instance Agda.TypeChecking.Rewriting.Confluence.AllHoles Agda.Syntax.Internal.Elims instance Agda.TypeChecking.Rewriting.Confluence.AllHoles [Agda.Syntax.Internal.PlusLevel] instance Agda.TypeChecking.Rewriting.Confluence.AllHoles Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Rewriting.Confluence.AllHoles Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Rewriting.Confluence.AllHoles Agda.Syntax.Internal.Term instance Agda.TypeChecking.Rewriting.Confluence.AllHoles Agda.Syntax.Internal.Type instance GHC.Internal.Base.Functor Agda.TypeChecking.Rewriting.Confluence.OneHole instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars a => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars a => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars a => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars a => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars Agda.Syntax.Internal.Level instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars a => Agda.TypeChecking.Rewriting.Confluence.MetasToVars [a] instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars a => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Rewriting.Confluence.MetasToVars a, Agda.TypeChecking.Rewriting.Confluence.MetasToVars b) => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (a, b) instance (Agda.TypeChecking.Rewriting.Confluence.MetasToVars a, Agda.TypeChecking.Rewriting.Confluence.MetasToVars b, Agda.TypeChecking.Rewriting.Confluence.MetasToVars c) => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (a, b, c) instance (Agda.TypeChecking.Rewriting.Confluence.MetasToVars a, Agda.TypeChecking.Rewriting.Confluence.MetasToVars b, Agda.TypeChecking.Rewriting.Confluence.MetasToVars c, Agda.TypeChecking.Rewriting.Confluence.MetasToVars d) => Agda.TypeChecking.Rewriting.Confluence.MetasToVars (a, b, c, d) instance Agda.TypeChecking.Rewriting.Confluence.MetasToVars Agda.Syntax.Internal.Type instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Rewriting.Confluence.ParallelReduce a) => Agda.TypeChecking.Rewriting.Confluence.ParallelReduce (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce a => Agda.TypeChecking.Rewriting.Confluence.ParallelReduce (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce a => Agda.TypeChecking.Rewriting.Confluence.ParallelReduce (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce a => Agda.TypeChecking.Rewriting.Confluence.ParallelReduce (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce a => Agda.TypeChecking.Rewriting.Confluence.ParallelReduce [a] instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce Agda.Syntax.Internal.Term instance Agda.TypeChecking.Rewriting.Confluence.ParallelReduce a => Agda.TypeChecking.Rewriting.Confluence.ParallelReduce (Agda.Syntax.Internal.Type' a) -- | Rewriting with arbitrary rules. -- -- The user specifies a relation symbol by the pragma {-# BUILTIN -- REWRITE rel #-} where rel should be of type Δ → -- (lhs rhs : A) → Set i. -- -- Then the user can add rewrite rules by the pragma {-# REWRITE q -- #-} where q should be a closed term of type Γ → rel -- us lhs rhs. -- -- We then intend to add a rewrite rule Γ ⊢ lhs ↦ rhs : B to -- the signature where B = A[us/Δ]. -- -- To this end, we normalize lhs, which should be of the form -- f ts for a Def-symbol f (postulate, -- function, data, record, constructor). Further, FV(ts) = -- dom(Γ). The rule q :: Γ ⊢ f ts ↦ rhs : B is added to the -- signature to the definition of f. -- -- When reducing a term Ψ ⊢ f vs is stuck, we try the rewrites -- for f, by trying to unify vs with ts. This -- is for now done by substituting fresh metas Xs for the bound variables -- in ts and checking equality with vs Ψ ⊢ (f -- ts)[XsΓ] = f vs : B[XsΓ] If successful (no open -- metas/constraints), we replace f vs by rhs[Xs/Γ] and -- continue reducing. module Agda.TypeChecking.Rewriting -- | Require '--rewriting' for global REWRITE rules requireOptionRewriting :: TCM () -- | Check that the name given to the BUILTIN REWRITE is actually a -- relation symbol. I.e., its type should be of the form Δ → (lhs : -- A) (rhs : B) → Set ℓ. Note: we do not care about -- hiding/non-hiding of lhs and rhs. verifyBuiltinRewrite :: Term -> Type -> TCM () -- | Deconstructing a type into Δ → t → t' → core. data RelView RelView :: Telescope -> ListTel -> Dom Type -> Dom Type -> Type -> RelView -- | The whole telescope Δ, t, t'. [relViewTel] :: RelView -> Telescope -- | Δ. [relViewDelta] :: RelView -> ListTel -- | t. [relViewType] :: RelView -> Dom Type -- | t'. [relViewType'] :: RelView -> Dom Type -- | core. [relViewCore] :: RelView -> Type -- | Deconstructing a type into Δ → t → t' → core. Returns -- Nothing if not enough argument types. relView :: Type -> TCM (Maybe RelView) -- | Check the given rewrite rules and add them to the signature. addRewriteRules :: [QName] -> TCM () -- | Get domain of rewrite relation. rewriteRelationDom :: QName -> TCM (ListTel, Dom Type) checkEquationValid :: RewriteSource -> RewriteAnn -> Type -> TCM (Maybe LocalEquation) checkIsRewriteRelation :: RewriteSource -> Type -> MaybeT TCM LocalEquation -- | Check the validity of q : Γ → rel us lhs rhs as rewrite rule -- Γ ⊢ lhs ↦ rhs : B where B = A[us/Δ]. Remember that -- rel : Δ → A → A → Set i, so rel us : (lhs rhs : A[us/Δ]) -- → Set i. Returns the checked rewrite rule to be added to the -- signature. checkRewriteRule :: QName -> TCM (Maybe GlobalRewriteRule) checkLocalRewriteRule :: RewriteSource -> LocalEquation -> TCM (Maybe RewriteRule) checkRewriteRule' :: LocalEquation -> RewriteSource -> MaybeT TCM RewriteRule checkRewConstraint :: LocalEquation -> TCM () -- | rewriteWith t f es rew where f : t tries to rewrite -- f es with rew, returning the reduct if successful. rewriteWith :: Type -> (Elims -> Term) -> RewriteRule -> Elims -> ReduceM (Either (Blocked Term) Term) -- | rewrite b v rules es tries to rewrite v applied to -- es with the rewrite rules rules. b is the -- default blocking tag. rewrite :: Blocked_ -> (Elims -> Term) -> RewriteRules -> Elims -> ReduceM (Reduced (Blocked Term) Term) -- | This module implements the Agda Abstract Machine used for compile-time -- reduction. It's a call-by-need environment machine with an implicit -- heap maintained using STRefs. See the AM type below -- for a description of the machine. -- -- Some other tricks that improves performance: -- -- -- -- A big chunk of the time during reduction is spent looking up -- definitions in the signature. Any long-running reduction will use only -- a handful definitions though, so memoising getConstInfo is a big win. -- -- -- -- Since we memoise getConstInfo we can do some preprocessing of the -- definitions, returning a CompactDef instead of a -- Definition. In particular we streamline the case trees used for -- matching in a few ways: -- -- -- -- None of these changes would make sense to incorporate into the actual -- case trees. The first two loses information that we need in other -- places and the third would complicate a lot of code working with case -- trees. -- -- CompactDef also has a special representation for -- built-in/primitive functions that can be implemented as pure functions -- from Literals. module Agda.TypeChecking.Reduce.Fast -- | The entry point to the reduction machine. fastReduce :: Term -> ReduceM (Blocked Term) fastNormalise :: Term -> ReduceM Term instance GHC.Internal.Classes.Eq a => GHC.Internal.Classes.Eq (Agda.TypeChecking.Reduce.Fast.ElimZipper a) instance GHC.Internal.Classes.Eq Agda.TypeChecking.Reduce.Fast.Normalisation instance GHC.Internal.Data.Foldable.Foldable Agda.TypeChecking.Reduce.Fast.ElimZipper instance GHC.Internal.Base.Functor Agda.TypeChecking.Reduce.Fast.ElimZipper instance GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (Agda.TypeChecking.Reduce.Fast.ElimZipper a) instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.CatchallFrame s) instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.Closure s) instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.ControlStack s) instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.Eval s) instance Agda.Syntax.Common.Pretty.Pretty a => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.FastCase a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.Reduce.Fast.FastCompiledClauses instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.Match s) instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.MatchStack s) instance Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Reduce.Fast.Pointer s) instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Agda.TypeChecking.Reduce.Fast.ElimZipper a) instance GHC.Internal.Data.Traversable.Traversable Agda.TypeChecking.Reduce.Fast.ElimZipper instance Agda.Utils.Zipper.Zipper (Agda.TypeChecking.Reduce.Fast.ElimZipper (Agda.TypeChecking.Reduce.Fast.Pointer s)) -- | This module implements the type checking part of generalisable -- variables. When we get here we have a type checking problem for a type -- (or telescope) containing a known set of generalisable variables and -- we need to produce a well typed type (or telescope) with the correct -- generalisations. For instance, given -- --
--   variable
--     A  : Set
--     n  : Nat
--     xs : Vec A n
--   
--   foo : SomeType xs
--   
-- -- generalisation should produce {A : Set} {n : Nat} {xs : Vec A n} → -- SomeType xs for the type of foo. -- -- The functions generalizeType and generalizeTelescope -- don't have access to the abstract syntax to be type checked -- (SomeType xs in the example). Instead they are provided a -- type checking action that delivers a Type or a -- Telescope. The challenge is setting up a context in which -- SomeType xs can be type checked successfully by this action, -- without knowing what the telescope of generalised variables will be. -- Once we have computed this telescope the result needs to be -- transformed into a well typed type abstracted over it. -- -- At no point are we allowed to cheat! Any transformation between -- well typed terms needs to be done by well typed substitutions. -- -- The key idea is to run the type checking action in the context of a -- single variable of an unknown type. Once we know what variables to -- generalise over this type is instantiated to a fresh record type with -- a field for each generalised variable. Turning the result of action -- into something valid in the context of the generalised variables is -- then a simple substitution unpacking the record variable. -- -- In more detail, generalisation proceeds as follows: -- -- -- --
--   (genTel : _GenTel)
--   
-- -- -- --
--   (genTel : _GenTel) ⊢
--     _A  : Set
--     _n  : Nat
--     _xs : Vec _A _n
--   
-- -- -- --
--   (genTel : _GenTel) ⊢ SomeType (_xs genTel)
--   
-- -- -- --
--   {A : Set} {n : Nat} {xs : Vec A n}
--   
-- -- -- --
--   record GeneralizeTel : Set₁ where
--     constructor mkGeneralizeTel
--     field
--       A  : Set
--       n  : Nat
--       xs : Vec A n
--   
-- -- -- --
--   _A  := λ genTel → genTel .A
--   _n  := λ genTel → genTel .n
--   _xs := λ genTel → genTel .xs
--   
-- -- -- --
--   {A : Set} {n : Nat} {xs : Vec A n} ⊢ [mkGeneralizeTel A n xs / genTel] : (genTel : GeneralizeTel)
--   
-- -- -- --
--   {A : Set} {n : Nat} {xs : Vec A n} → SomeType (_xs (mkGeneralizeTel A n xs)) ==
--   {A : Set} {n : Nat} {xs : Vec A n} → SomeType xs
--   
-- -- module Agda.TypeChecking.Generalize -- | Generalize a type over a set of (used) generalizable variables. generalizeType :: Set QName -> TCM Type -> TCM ([Maybe QName], Type) -- | Allow returning additional information from the type checking action. generalizeType' :: Set QName -> TCM (Type, a) -> TCM ([Maybe QName], Type, a) -- | Generalize a telescope over a set of generalizable variables. generalizeTelescope :: Map QName Name -> (forall a1. () => (Telescope -> TCM a1) -> TCM a1) -> ([Maybe Name] -> Telescope -> TCM a) -> TCM a module Agda.TypeChecking.Rules.Data -- | Type check a datatype definition. Assumes that the type has already -- been checked. checkDataDef :: DefInfo -> QName -> PositivityCheck -> UniverseCheck -> DataDefParams -> [Constructor] -> TCM () -- | Make sure that the target universe admits data type definitions. E.g. -- IUniv, SizeUniv etc. do not accept new -- constructions. checkDataSort :: QName -> Sort -> TCM () -- | Ensure that the type is a sort. If it is not directly a sort, compare -- it to a newSortMetaBelowInf. forceSort :: Type -> TCM Sort -- | Type check a constructor declaration. Checks that the constructor -- targets the datatype and that it fits inside the declared sort. -- Returns the non-linear parameters. checkConstructor :: QName -> UniverseCheck -> Telescope -> Nat -> Sort -> Constructor -> TCM IsPathCons defineCompData :: QName -> ConHead -> Telescope -> [QName] -> Telescope -> Type -> Boundary -> TCM CompKit -- | Define projections for non-indexed data types (families don't work -- yet). Of course, these projections are partial functions in general. -- -- Precondition: we are in the context Γ of the data type parameters. defineProjections :: QName -> ConHead -> Telescope -> [QName] -> Telescope -> Type -> TCM () freshAbstractQName'_ :: String -> TCM QName -- | I am not sure what the generated transport functions should look like -- in the presence of local rewrite rule parameters. The easiest solution -- is to just refuse to generate the transport function, and throw a type -- error. checkNoLocalRewrites :: QName -> TCM () checkNoLocalRewrites' :: QName -> Tele (Dom Type) -> TCM () -- | Defines and returns the name of the transpIx function. defineTranspIx :: QName -> TCM (Maybe QName) defineTranspFun :: QName -> Maybe QName -> [QName] -> IsHIT -> TCM (Maybe QName) defineConClause :: QName -> Bool -> Maybe QName -> Nat -> Nat -> Telescope -> Telescope -> Substitution -> Type -> [QName] -> TCM [Clause] defineKanOperationForFields :: Command -> Maybe Term -> (Term -> QName -> Term) -> QName -> Telescope -> Telescope -> [Arg QName] -> Type -> TCM (Maybe ((QName, Telescope, Type, [Dom Type], [Term]), Substitution)) defineTranspForFields :: Maybe Term -> (Term -> QName -> Term) -> QName -> Telescope -> Tele (Dom CType) -> [Arg QName] -> Type -> TCM ((QName, Telescope, Type, [Dom Type], [Term]), Substitution) defineHCompForFields :: (Term -> QName -> Term) -> QName -> Telescope -> Tele (Dom LType) -> [Arg QName] -> LType -> TCM ((QName, Telescope, Type, [Dom Type], [Term]), Substitution) getGeneralizedParameters :: Set Name -> QName -> TCM [Maybe Name] -- | Bind the named generalized parameters. bindGeneralizedParameters :: [Maybe Name] -> Type -> (Telescope -> Type -> TCM a) -> TCM a -- | Bind the parameters of a datatype. -- -- We allow omission of hidden parameters at the definition site. -- Example: data D {a} (A : Set a) : Set a data D A where c : A -- -> D A bindParameters :: Int -> [LamBinding] -> Type -> (Telescope -> Type -> TCM a) -> TCM a bindParameter :: Int -> [LamBinding] -> Name -> Dom Type -> Abs Type -> (Telescope -> Type -> TCM a) -> TCM a -- | Check that the arguments to a constructor fits inside the sort of the -- datatype. The third argument is the type of the constructor. -- -- When --without-K is active and the type is fibrant the -- procedure also checks that the type is usable at the current modality. -- See #4784 and #5434. -- -- As a side effect, return the arity of the constructor. fitsIn :: DataOrRecord_ -> QName -> UniverseCheck -> [IsForced] -> Type -> Sort -> TCM Int -- | When --without-K is enabled, we should check that the sorts of the -- index types fit into the sort of the datatype. checkIndexSorts :: Sort -> Telescope -> TCM () -- | Return the parameters that share variables with the indices -- nonLinearParameters :: Int -> Type -> TCM [Int] -- nonLinearParameters nPars t = -- -- Check that a type constructs something of the given datatype. The -- first argument is the number of parameters to the datatype and the -- second the number of additional non-parameters in the context (1 when -- generalizing, 0 otherwise). constructs :: Int -> Int -> Type -> QName -> TCM IsPathCons -- | Is the type coinductive? Returns Nothing if the answer cannot -- be determined. isCoinductive :: Type -> TCM (Maybe Bool) -- | A bidirectional type checker for internal syntax. -- -- Performs checking on unreduced terms. With the exception that -- projection-like function applications have to be reduced since they -- break bidirectionality. module Agda.TypeChecking.CheckInternal -- | Entry point for e.g. checking WithFunctionType. checkType :: Type -> TCM () -- | Infer type of a neutral term. infer :: Term -> TCM Type -- | inferSpine action t hd es checks that spine es -- eliminates value hd [] of type t and returns the -- remaining type (target of elimination), the transformed eliminations, -- and the transformed term. -- -- The transformed term is not simply hd applied to the -- transformed eliminations: elimViewAction brings prefix -- applications of projection-like functions into post-fix form, and that -- has to be undone when rebuilding the term, or we hand back a term in a -- representation the conversion checker cannot relate to the original -- one (issues #8336 and #8771). inferSpine :: Action -> Type -> (Elims -> Term) -> Elims -> TCM (Type, Elims, Term) class CheckInternal a checkInternal' :: CheckInternal a => Action -> a -> Comparison -> TypeOf a -> TCM a checkInternal :: CheckInternal a => a -> Comparison -> TypeOf a -> TCM () inferInternal' :: CheckInternal a => Action -> a -> TCM a inferInternal :: CheckInternal a => a -> TCM () -- | checkInternal traverses the whole Term, and we can use -- this traversal to modify the term. data Action Action :: (Type -> Term -> TCM Term) -> (Type -> Term -> TCM Term) -> (Modality -> Modality -> Modality) -> (Term -> TCM Term) -> Action -- | Called on each subterm before the checker runs. [preAction] :: Action -> Type -> Term -> TCM Term -- | Called on each subterm after the type checking. [postAction] :: Action -> Type -> Term -> TCM Term -- | Called for each ArgInfo. The first Modality is from -- the type, the second from the term. [modalityAction] :: Action -> Modality -> Modality -> Modality -- | Called for bringing projection-like funs in post-fix form [elimViewAction] :: Action -> Term -> TCM Term -- | The default action is to not change the Term at all. defaultAction :: Action eraseUnusedAction :: Action instance Agda.TypeChecking.CheckInternal.CheckInternal Agda.Syntax.Internal.Level instance Agda.TypeChecking.CheckInternal.CheckInternal Agda.Syntax.Internal.Elims instance Agda.TypeChecking.CheckInternal.CheckInternal Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.CheckInternal.CheckInternal Agda.Syntax.Internal.Sort instance Agda.TypeChecking.CheckInternal.CheckInternal Agda.Syntax.Internal.Term instance Agda.TypeChecking.CheckInternal.CheckInternal Agda.Syntax.Internal.Type -- | Reconstruct dropped parameters from constructors. Used by -- with-abstraction to avoid ill-typed abstractions (#745). Note that the -- term is invalid after parameter reconstruction. Parameters need to be -- dropped again before using it. module Agda.TypeChecking.ReconstructParameters reconstructParametersInType :: Type -> TCM Type reconstructParametersInType' :: Action -> Type -> TCM Type reconstructParametersInTel :: Telescope -> TCM Telescope reconstructParametersInEqView :: EqualityView -> TCM EqualityView reconstructParameters :: Type -> Term -> TCM Term reconstructParameters' :: Action -> Type -> Term -> TCM Term reconstructAction :: Action reconstructAction' :: Action -> Action reconstruct :: Type -> Term -> TCM Term extractParameters :: QName -> Type -> TCM Args dropParameters :: TermLike a => a -> TCM a -- | Functions for abstracting terms over other terms. module Agda.TypeChecking.Abstract -- | abstractType r a v b[v] = b where v : a. abstractType :: Range -> Type -> Term -> Type -> TCM Type -- | piAbstractTerm NotHidden v a b[v] = (w : a) -> b[w] -- piAbstractTerm Hidden v a b[v] = {w : a} -> b[w] piAbstractTerm :: ArgInfo -> Term -> Type -> Type -> TCM Type -- |
--   piAbstract (v, a) b[v] = (w : a) -> b[w]
--   
-- -- For the inspect idiom, it does something special: piAbstract (v, -- a) b[v, refl v] = (w : a) (w' : Eq a w v) -> b[w, w'] (Not all -- refl v@ subterms are abstracted: see caveat below.) -- -- For rewrite, it does something special: piAbstract (prf, -- Eq a v v') b[v,prf] = (w : a) (w' : Eq a w v') -> b[w, w'] piAbstract :: Arg (Term, EqualityView) -> Type -> TCM Type -- | isPrefixOf u v = Just es if v == u applyE es. class IsPrefixOf a isPrefixOf :: IsPrefixOf a => a -> a -> Maybe Elims abstractTerm :: Type -> Term -> Type -> Term -> TCM Term class AbsTerm a -- |
--   subst j u . absTerm j u == id
--   
absTerm :: AbsTerm a => Nat -> Term -> a -> a -- | This swaps var 0 and var 1. swap01 :: TermSubst a => a -> a class EqualSy a equalSy :: EqualSy a => a -> a -> Bool instance (Agda.TypeChecking.Substitute.Class.TermSubst a, Agda.TypeChecking.Abstract.AbsTerm a) => Agda.TypeChecking.Abstract.AbsTerm (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Level instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm [a] instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (GHC.Internal.Maybe.Maybe a) instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Abstract.AbsTerm a, Agda.TypeChecking.Abstract.AbsTerm b) => Agda.TypeChecking.Abstract.AbsTerm (a, b) instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Type instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Abstract.EqualSy a) => Agda.TypeChecking.Abstract.EqualSy (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Abstract.EqualSy a => Agda.TypeChecking.Abstract.EqualSy (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Abstract.EqualSy a => Agda.TypeChecking.Abstract.EqualSy (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Abstract.EqualSy a => Agda.TypeChecking.Abstract.EqualSy (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.Level instance Agda.TypeChecking.Abstract.EqualSy a => Agda.TypeChecking.Abstract.EqualSy [a] instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.Term instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.Type instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Elims instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Args instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Term module Agda.TypeChecking.With -- | Split pattern variables according to with-expressions. splitTelForWith :: Telescope -> Type -> List1 (Arg (Term, EqualityView)) -> (Telescope, Telescope, Permutation, Type, List1 (Arg (Term, EqualityView))) -- | Abstract with-expressions vs to generate type for with-helper -- function. -- -- Each EqualityType, coming from a rewrite, will turn -- into 2 abstractions. withFunctionType :: Telescope -> List1 (Arg (Term, EqualityView)) -> Telescope -> Type -> Boundary -> TCM (Type, (Nat1, Nat)) -- | Count the number of arguments introduced into the type of the -- with-function. countWithArgs :: (Functor f, Foldable f) => f EqualityView -> Nat1 -- | Count the number of with-patterns in the with-clause that need to be -- transformed to regular patterns in the **current round** of -- with-abstraction (important for nested with). countWithPats :: (Functor f, Foldable f) => f (Arg (Term, EqualityView)) -> Nat1 -- | From a list of with and rewrite expressions and -- their types, compute the list of final with expressions -- (after expanding the rewrites). withArguments :: List1 (Arg (Term, EqualityView)) -> TCM (List1 (Arg Term)) -- | Compute the clauses for the with-function given the original patterns. buildWithFunction :: [Name] -> QName -> QName -> Type -> Telescope -> [NamedArg DeBruijnPattern] -> Nat -> Substitution -> Permutation -> Nat -> Nat -> List1 SpineClause -> TCM (List1 SpineClause) -- |
--   stripWithClausePatterns cxtNames parent f t Δ qs np π ps = ps'
--   
-- -- Example: -- --
--   record Stream (A : Set) : Set where
--     coinductive
--     constructor delay
--     field       force : A × Stream A
--   
--   record SEq (s t : Stream A) : Set where
--     coinductive
--     field
--       ~force : let a , as = force s
--                    b , bs = force t
--                in  a ≡ b × SEq as bs
--   
--   test : (s : Nat × Stream Nat) (t : Stream Nat) → SEq (delay s) t → SEq t (delay s)
--   ~force (test (a     , as) t p) with force t
--   ~force (test (suc n , as) t p) | b , bs = ?
--   
-- -- With function: -- --
--   f : (t : Stream Nat) (w : Nat × Stream Nat) (a : Nat) (as : Stream Nat)
--       (p : SEq (delay (a , as)) t) → (fst w ≡ a) × SEq (snd w) as
--   
--   Δ  = t a as p   -- reorder to bring with-relevant (= needed) vars first
--   π  = a as t p → Δ
--   qs = (a     , as) t p ~force
--   ps = (suc n , as) t p ~force
--   ps' = (suc n) as t p
--   
-- -- Resulting with-function clause is: -- --
--   f t (b , bs) (suc n) as t p
--   
-- -- Note: stripWithClausePatterns factors ps through -- qs, thus -- --
--   ps = qs[ps']
--   
-- -- where [..] is to be understood as substitution. The -- projection patterns have vanished from ps' (as they -- are already in qs). stripWithClausePatterns :: [Name] -> QName -> QName -> Type -> Telescope -> [NamedArg DeBruijnPattern] -> Nat -> Permutation -> [NamedArg Pattern] -> TCM ([ProblemEq], [NamedArg Pattern]) -- | Is the first name equal to the constructorForm of any -- disambiguation of the second name? elemConForms :: ConHead -> AmbiguousQName -> TCM Bool -- | Construct the display form for a with function. It will display -- applications of the with function as applications to the original -- function. For instance, -- --
--   aux a b c
--   
--   
-- -- as -- --
--   f (suc a) (suc b) | c
--   
--   
withDisplayForm :: QName -> QName -> Telescope -> Telescope -> Nat -> [NamedArg DeBruijnPattern] -> Permutation -> Permutation -> TCM DisplayForm patsToElims :: [NamedArg DeBruijnPattern] -> [Elim' DisplayTerm] module Agda.Termination.TermCheck -- | Entry point: Termination check a single declaration. -- -- Precondition: envMutualBlock must be set correctly. termDecl :: Declaration -> TCM Result -- | Entry point: Termination check the current mutual block. termMutual :: [QName] -> TCM Result -- | The result of termination checking a module. Must be a Monoid -- and have Singleton. type Result = [TerminationError] instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls (Agda.Syntax.Internal.Abs a) instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls (Agda.Syntax.Common.Arg a) instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls (Agda.Syntax.Internal.Dom a) instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Level instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls [a] instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.PlusLevel instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Sort instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls (Agda.Syntax.Internal.Tele a) instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Term instance (Agda.Termination.TermCheck.ExtractCalls a, Agda.Termination.TermCheck.ExtractCalls b) => Agda.Termination.TermCheck.ExtractCalls (a, b) instance (Agda.Termination.TermCheck.ExtractCalls a, Agda.Termination.TermCheck.ExtractCalls b, Agda.Termination.TermCheck.ExtractCalls c) => Agda.Termination.TermCheck.ExtractCalls (a, b, c) instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Type instance Agda.Termination.TermCheck.TermToPattern Agda.Syntax.Internal.Term Agda.Syntax.Internal.DeBruijnPattern -- | Sanity checking for internal syntax. Mostly checking variable scoping. module Agda.Syntax.Internal.SanityCheck sanityCheckVars :: (Pretty a, Free a) => Telescope -> a -> TCM () -- | Check that Γ ⊢ ρ : Δ. sanityCheckSubst :: (Pretty a, Free a) => Telescope -> Substitution' a -> Telescope -> TCM () module Agda.Syntax.IdiomBrackets parseIdiomBracketsSeq :: Range -> Maybe QName -> [Expr] -> ScopeM Expr -- | Desugaring for do-notation. Uses whatever `_>>=_` and -- `_>>_` happen to be in scope. -- -- Example: -- -- ``` foo = do x ← m₁ m₂ just y ← m₃ where nothing → m₄ let z = t m₅ ``` -- desugars to ``` foo = m₁ >>= λ x → m₂ >> m₃ >>= λ -- where just y → let z = t in m₅ nothing → m₄ ``` module Agda.Syntax.DoNotation desugarDoNotation :: Maybe QName -> List1 DoStmt -> ScopeM Expr module Agda.Interaction.Monad -- | Interaction monad. data IM a runIM :: IM a -> TCM a -- | Line reader. The line reader history is not stored between sessions. readline :: String -> IM (Maybe String) instance GHC.Internal.Base.Applicative Agda.Interaction.Monad.IM instance GHC.Internal.Base.Functor Agda.Interaction.Monad.IM instance Agda.Interaction.Options.HasOptions.HasOptions Agda.Interaction.Monad.IM instance Control.Monad.Error.Class.MonadError Agda.TypeChecking.Monad.Base.TCErr Agda.Interaction.Monad.IM instance Agda.Utils.FileId.MonadFileId Agda.Interaction.Monad.IM instance GHC.Internal.Base.Monad Agda.Interaction.Monad.IM instance GHC.Internal.Control.Monad.IO.Class.MonadIO Agda.Interaction.Monad.IM instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.Interaction.Monad.IM instance Agda.TypeChecking.Monad.Base.MonadTCM Agda.Interaction.Monad.IM instance Agda.TypeChecking.Monad.Base.MonadTCState Agda.Interaction.Monad.IM instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.Interaction.Monad.IM module Agda.Interaction.Highlighting.Vim vimFile :: FilePath -> FilePath escape :: String -> String wordBounded :: String -> String keyword :: String -> [String] -> String match :: String -> List1 String -> String matches :: [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] toVim :: NamesInScope -> String generateVimFile :: FilePath -> TCM () -- | Extract highlighting syntax from abstract syntax. -- -- Implements one big fold over abstract syntax. module Agda.Interaction.Highlighting.FromAbstract -- | Create highlighting info for some piece of syntax. runHighlighter :: Hilite a => TopLevelModuleName -> NameKinds -> a -> HighlightingInfoBuilder -- | A function mapping names to the kind of name they stand for. type NameKinds = QName -> Maybe NameKind instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.Arg a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.ArgInfo instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.BindName instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Abstract.Binder' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Abstract.Clause' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.DataDefParams instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Declaration instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.TypeChecking.Monad.Base.DisambiguatedName instance (Agda.Interaction.Highlighting.FromAbstract.Hilite a, Agda.Interaction.Highlighting.FromAbstract.Hilite b) => Agda.Interaction.Highlighting.FromAbstract.Hilite (GHC.Internal.Data.Either.Either a b) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.Erased instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Expr instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.GeneralizeTelescope instance (Agda.Interaction.Highlighting.FromAbstract.Hilite m, Agda.Interaction.Highlighting.FromAbstract.Hilite n, Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo m), Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo n)) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.ImportDirective' m n) instance (Agda.Interaction.Highlighting.FromAbstract.Hilite m, Agda.Interaction.Highlighting.FromAbstract.Hilite n) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.ImportedName' m n) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.LHS instance (Agda.Interaction.Highlighting.FromAbstract.Hilite a, Agda.Syntax.Abstract.Name.IsProjP a) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Abstract.LHSCore' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.LamBinding instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.LetBinding instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite [a] instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Literal.Literal instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (GHC.Internal.Maybe.Maybe a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.Modality instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.ModuleApplication instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Info.ModuleInfo instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Name.ModuleName instance (Agda.Interaction.Highlighting.FromAbstract.Hilite a, Agda.Syntax.Position.HasRange n) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.Named n a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Utils.List1.List1 a) instance (Agda.Interaction.Highlighting.FromAbstract.Hilite a, Agda.Syntax.Abstract.Name.IsProjP a) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Abstract.Pattern' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Pragma instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.ProblemEq instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Name.QName instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.Quantity instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.RHS instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.Ranged a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.RecordConName instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.RecordDirectives instance (Agda.Interaction.Highlighting.FromAbstract.Hilite m, Agda.Interaction.Highlighting.FromAbstract.Hilite n, Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo m), Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo n)) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.Renaming' m n) instance Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo Agda.Syntax.Abstract.Name.QName) instance Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo Agda.Syntax.Abstract.Name.ModuleName) instance (Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo m), Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo n)) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Interaction.Highlighting.FromAbstract.RenamingTo (Agda.Syntax.Common.ImportedName' m n)) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Scope.Base.ResolvedName instance (Agda.Syntax.Position.HasRange n, Agda.Interaction.Highlighting.FromAbstract.Hilite p, Agda.Interaction.Highlighting.FromAbstract.Hilite e) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.RewriteEqn' x n p e) instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Concrete.TacticAttribute' a) instance (Agda.Interaction.Highlighting.FromAbstract.Hilite a, Agda.Interaction.Highlighting.FromAbstract.Hilite b) => Agda.Interaction.Highlighting.FromAbstract.Hilite (a, b) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.TypedBinding instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.TypedBindingInfo instance (Agda.Interaction.Highlighting.FromAbstract.Hilite m, Agda.Interaction.Highlighting.FromAbstract.Hilite n) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.Using' m n) instance Agda.Interaction.Highlighting.FromAbstract.Hilite GHC.Internal.Base.Void instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.WhereDeclarations instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.WithHiding a) instance GHC.Internal.Base.Monoid Agda.Interaction.Highlighting.FromAbstract.Hiliter -- | Generates data used for precise syntax highlighting. module Agda.Interaction.Highlighting.Generate -- | Highlighting levels. data Level -- | Full highlighting. Should only be used after typechecking has -- completed successfully. Full :: Level -- | Highlighting without disambiguation of overloaded constructors. Partial :: Level -- | Generate syntax highlighting information for the given declaration, -- and (if appropriate) print it. If the boolean is True, then the -- state is additionally updated with the new highlighting info (in case -- of a conflict new info takes precedence over old info). -- -- The procedure makes use of some of the highlighting info corresponding -- to stTokens (that corresponding to the interval covered by the -- declaration). If the boolean is True, then this highlighting -- info is additionally removed from the data structure that -- stTokens refers to. generateAndPrintSyntaxInfo :: Declaration -> Level -> Bool -> TCM () -- | Generate and return the syntax highlighting information for the tokens -- in the given file. generateTokenInfo :: AbsolutePath -> TCM HighlightingInfo -- | Generate and return the syntax highlighting information for the tokens -- in the given file. generateTokenInfoFromSource :: RangeFile -> String -> TCM HighlightingInfo -- | Generate and return the syntax highlighting information for the tokens -- in the given string, which is assumed to correspond to the given -- range. generateTokenInfoFromString :: Range -> String -> TCM HighlightingInfo printSyntaxInfo :: Range -> TCM () -- | Prints syntax highlighting info for an error. printErrorInfo :: TCErr -> TCM () -- | Generate highlighting for error. errorHighlighting :: TCErr -> TCM HighlightingInfoBuilder -- | Generates and prints syntax highlighting information for unsolved -- meta-variables and certain unsolved constraints. printUnsolvedInfo :: TCM () -- | Lispify and print the given highlighting information. printHighlightingInfo :: MonadTrace m => RemoveTokenBasedHighlighting -> HighlightingInfo -> m () -- | highlightAsTypeChecked rPre r m runs m and returns -- its result. Additionally, some code may be highlighted: -- -- highlightAsTypeChecked :: MonadTrace m => Range -> Range -> m a -> m a -- | Highlight a warning. We do not generate highlighting for unsolved -- metas and constraints, as that gets handled in bulk after -- typechecking. highlightWarning :: TCWarning -> TCM () -- | Generate syntax highlighting for warnings. warningHighlighting :: TCWarning -> HighlightingInfoBuilder computeUnsolvedInfo :: TCM HighlightingInfoBuilder storeDisambiguatedConstructor :: Induction -> QName -> TCM () storeDisambiguatedProjection :: QName -> TCM () -- | Store a disambiguation of record field tags for the purpose of -- highlighting. disambiguateRecordFields :: [Name] -> [QName] -> TCM () instance Agda.Utils.Singleton.Collection Agda.Syntax.Abstract.Views.KName Agda.Interaction.Highlighting.Generate.NameKindBuilder instance GHC.Internal.Base.Monoid Agda.Interaction.Highlighting.Generate.NameKindBuilder instance GHC.Internal.Base.Semigroup Agda.Interaction.Highlighting.Generate.NameKindBuilder instance Agda.Utils.Singleton.Singleton Agda.Syntax.Abstract.Views.KName Agda.Interaction.Highlighting.Generate.NameKindBuilder module Agda.TypeChecking.Rules.LHS -- | Check a LHS. Main function. -- -- checkLeftHandSide a ps a ret checks that user patterns -- ps eliminate the type a of the defined function, and -- calls continuation ret if successful. checkLeftHandSide :: Call -> Range -> LetOrClause -> [NamedArg Pattern] -> Type -> IsWithFunction Substitution -> [ProblemEq] -> (LHSResult -> TCM a) -> TCM a -- | Result of checking the LHS of a clause. data LHSResult LHSResult :: Nat -> Telescope -> [NamedArg DeBruijnPattern] -> Bool -> Arg Type -> Substitution -> [AsBinding] -> IntSet -> Bool -> LHSResult -- | The number of original module parameters. These are present in the the -- patterns. [lhsParameters] :: LHSResult -> Nat -- | Δ : The types of the pattern variables, in internal dependency order. -- Corresponds to clauseTel. Like the other components (e.g. -- lhsBodyType), this telescope lives in the ambient context. To -- print it, we need not drop Δ from the ambient context. [lhsVarTele] :: LHSResult -> Telescope -- | The patterns in internal syntax. [lhsPatterns] :: LHSResult -> [NamedArg DeBruijnPattern] -- | Whether the LHS has at least one absurd pattern. [lhsHasAbsurd] :: LHSResult -> Bool -- | The type of the body. Is bσ if Γ is defined. -- Irrelevant to indicate the rhs must be checked in irrelevant -- mode. [lhsBodyType] :: LHSResult -> Arg Type -- | Substitution version of lhsPatterns, only up to the first -- projection pattern. Δ |- lhsPatSubst : Γ. Where Γ is -- the argument telescope of the function. This is used to update -- inherited dot patterns in with-function clauses. [lhsPatSubst] :: LHSResult -> Substitution -- | As-bindings from the left-hand side. Return instead of bound since we -- want them in where's and right-hand sides, but not in with-clauses -- (Issue 2303). [lhsAsBindings] :: LHSResult -> [AsBinding] -- | have we done a partial split? [lhsPartialSplit] :: LHSResult -> IntSet -- | have we split on an indexed type? [lhsIndexedSplit] :: LHSResult -> Bool -- | Bind as patterns bindAsPatterns :: [AsBinding] -> TCM a -> TCM a -- | A pattern is flexible if it is dotted or implicit, or a record pattern -- with only flexible subpatterns. class IsFlexiblePattern a maybeFlexiblePattern :: forall (m :: Type -> Type). (IsFlexiblePattern a, HasConstInfo m) => a -> MaybeT m FlexibleVarKind isFlexiblePattern :: (IsFlexiblePattern a, HasConstInfo m) => a -> m Bool type DataOrRecord = DataOrRecord' InductionAndEta checkSortOfSplitVar :: (MonadTCM m, PureTCM m, MonadError TCErr m, LensSort a, PrettyTCM a, LensSort ty, PrettyTCM ty) => DataOrRecord -> a -> Telescope -> Maybe ty -> m () -- | Are we checking the LHS of a let-pattern binding or a function clause? data LetOrClause -- | Checking a pattern bound by a let. LetLHS :: LetOrClause -- | Checking the LHS of a clause of the function with the given -- QName. ClauseLHS :: QName -> LetOrClause -- | Compute substitution from the out patterns ps buildLHSSubstitutions :: Context -> NAPs -> IsWithFunction (Arity, Substitution) -> (Substitution, Substitution) checkAbsurdPattern :: AbsurdPattern -> TCM () instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Rules.LHS.LHSResult instance Agda.TypeChecking.Rules.LHS.IsFlexiblePattern a => Agda.TypeChecking.Rules.LHS.IsFlexiblePattern (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Rules.LHS.IsFlexiblePattern a => Agda.TypeChecking.Rules.LHS.IsFlexiblePattern [a] instance Agda.TypeChecking.Rules.LHS.IsFlexiblePattern a => Agda.TypeChecking.Rules.LHS.IsFlexiblePattern (Agda.Syntax.Common.Named name a) instance Agda.TypeChecking.Rules.LHS.IsFlexiblePattern (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Rules.LHS.IsFlexiblePattern Agda.Syntax.Abstract.Pattern module Agda.TypeChecking.IApplyConfluence checkIApplyConfluence_ :: QName -> TCM () -- | checkIApplyConfluence f (Clause {namedClausePats = ps}) -- checks that f ps reduces in a way that agrees with -- IApply reductions. checkIApplyConfluence :: QName -> Clause -> TCM () -- | current context is of the form Γ.Δ unifyElims :: Args -> Args -> (Substitution -> [(Term, Term)] -> TCM a) -> TCM a -- | Like unifyElims but Γ is from the meta's -- MetaInfo and the context extension Δ is taken from -- the Closure. unifyElimsMeta :: MetaId -> Args -> Closure Constraint -> ([(Term, Term)] -> Constraint -> TCM a) -> TCM a -- | Common syntax highlighting functions for Emacs and JSON module Agda.Interaction.Highlighting.Common -- | Converts the aspect and otherAspects fields to strings -- that are friendly to editors. toAtoms :: Aspects -> [String] -- | Choose which method to use based on HighlightingInfo and -- HighlightingMethod chooseHighlightingMethod :: HighlightingInfo -> HighlightingMethod -> HighlightingMethod -- | Encoding stuff into JSON values in TCM module Agda.Interaction.JSON -- | Right-to-left composition of Kleisli arrows. -- (>=>), with the arguments flipped. -- -- Note how this operator resembles function composition -- (.): -- --
--   (.)   ::            (b ->   c) -> (a ->   b) -> a ->   c
--   (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
--   
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c infixr 1 <=< -- | Left-to-right composition of Kleisli arrows. -- -- '(bs >=> cs) a' can be understood as the -- do expression -- --
--   do b <- bs a
--      cs b
--   
-- -- or in terms of (>>=) as -- --
--   bs a >>= cs
--   
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 >=> decode' :: FromJSON a => ByteString -> Maybe a decodeFileStrict :: FromJSON a => FilePath -> IO (Maybe a) decodeFileStrict' :: FromJSON a => FilePath -> IO (Maybe a) decodeStrict' :: FromJSON a => ByteString -> Maybe a eitherDecode' :: FromJSON a => ByteString -> Either String a eitherDecodeFileStrict :: FromJSON a => FilePath -> IO (Either String a) eitherDecodeFileStrict' :: FromJSON a => FilePath -> IO (Either String a) eitherDecodeStrict' :: FromJSON a => ByteString -> Either String a encode :: ToJSON a => a -> ByteString encodeFile :: ToJSON a => FilePath -> a -> IO () throwDecode' :: (FromJSON a, MonadThrow m) => ByteString -> m a throwDecodeStrict' :: (FromJSON a, MonadThrow m) => ByteString -> m a decode :: FromJSON a => ByteString -> Maybe a decodeStrict :: FromJSON a => ByteString -> Maybe a decodeStrictText :: FromJSON a => Text -> Maybe a eitherDecode :: FromJSON a => ByteString -> Either String a eitherDecodeStrict :: FromJSON a => ByteString -> Either String a eitherDecodeStrictText :: FromJSON a => Text -> Either String a throwDecode :: (FromJSON a, MonadThrow m) => ByteString -> m a throwDecodeStrict :: (FromJSON a, MonadThrow m) => ByteString -> m a throwDecodeStrictText :: (FromJSON a, MonadThrow m) => Text -> m a pairs :: Series -> Encoding foldable :: (Foldable t, ToJSON a) => t a -> Encoding (.!=) :: Parser (Maybe a) -> a -> Parser a (.:) :: FromJSON a => Object -> Key -> Parser a (.:!) :: FromJSON a => Object -> Key -> Parser (Maybe a) (.:!=) :: FromJSON a => Object -> Key -> Parser a (.:?) :: FromJSON a => Object -> Key -> Parser (Maybe a) (.:?=) :: FromJSON a => Object -> Key -> Parser a fromJSON :: FromJSON a => Value -> Result a genericFromJSONKey :: (Generic a, GFromJSONKey (Rep a)) => JSONKeyOptions -> FromJSONKeyFunction a genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a omittedField1 :: (FromJSON1 f, FromJSON a) => Maybe (f a) omittedField2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Maybe (f a b) parseIndexedJSON :: (Value -> Parser a) -> Int -> Value -> Parser a parseJSON1 :: (FromJSON1 f, FromJSON a) => Value -> Parser (f a) parseJSON2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Value -> Parser (f a b) withArray :: String -> (Array -> Parser a) -> Value -> Parser a withBool :: String -> (Bool -> Parser a) -> Value -> Parser a withEmbeddedJSON :: String -> (Value -> Parser a) -> Value -> Parser a withObject :: String -> (Object -> Parser a) -> Value -> Parser a withScientific :: String -> (Scientific -> Parser a) -> Value -> Parser a withText :: String -> (Text -> Parser a) -> Value -> Parser a () :: Parser a -> JSONPathElement -> Parser a camelTo2 :: Char -> String -> String defaultJSONKeyOptions :: JSONKeyOptions defaultOptions :: Options defaultTaggedObject :: SumEncoding object :: [Pair] -> Value genericLiftToEncoding :: (Generic1 f, GToJSON' Encoding One (Rep1 f)) => Options -> (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding genericLiftToJSON :: (Generic1 f, GToJSON' Value One (Rep1 f)) => Options -> (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value genericToEncoding :: (Generic a, GToJSON' Encoding Zero (Rep a)) => Options -> a -> Encoding genericToJSON :: (Generic a, GToJSON' Value Zero (Rep a)) => Options -> a -> Value genericToJSONKey :: (Generic a, GToJSONKey (Rep a)) => JSONKeyOptions -> ToJSONKeyFunction a omitField1 :: (ToJSON1 f, ToJSON a) => f a -> Bool omitField2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Bool toEncoding1 :: (ToJSON1 f, ToJSON a) => f a -> Encoding toEncoding2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Encoding toJSON1 :: (ToJSON1 f, ToJSON a) => f a -> Value toJSON2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Value type Encoding = Encoding' Value fromEncoding :: Encoding' tag -> Builder data Series data Key type GToEncoding = GToJSON' Encoding type GToJSON = GToJSON' Value data FromArgs arity a class FromJSON a parseJSON :: FromJSON a => Value -> Parser a parseJSONList :: FromJSON a => Value -> Parser [a] omittedField :: FromJSON a => Maybe a class FromJSON1 (f :: Type -> Type) liftParseJSON :: FromJSON1 f => Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) liftParseJSONList :: FromJSON1 f => Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a] liftOmittedField :: FromJSON1 f => Maybe a -> Maybe (f a) class FromJSON2 (f :: Type -> Type -> Type) liftParseJSON2 :: FromJSON2 f => Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b) liftParseJSONList2 :: FromJSON2 f => Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [f a b] liftOmittedField2 :: FromJSON2 f => Maybe a -> Maybe b -> Maybe (f a b) class FromJSONKey a fromJSONKey :: FromJSONKey a => FromJSONKeyFunction a fromJSONKeyList :: FromJSONKey a => FromJSONKeyFunction [a] data FromJSONKeyFunction a [FromJSONKeyCoerce] :: forall a. Coercible Text a => FromJSONKeyFunction a [FromJSONKeyText] :: forall a. (Text -> a) -> FromJSONKeyFunction a [FromJSONKeyTextParser] :: forall a. (Text -> Parser a) -> FromJSONKeyFunction a [FromJSONKeyValue] :: forall a. (Value -> Parser a) -> FromJSONKeyFunction a class GFromJSON arity (f :: Type -> Type) class (ConstructorNames f, SumFromString f) => GFromJSONKey (f :: Type -> Type) data One data Zero newtype AesonException AesonException :: String -> AesonException type Array = Vector Value newtype DotNetTime DotNetTime :: UTCTime -> DotNetTime [fromDotNetTime] :: DotNetTime -> UTCTime data JSONKeyOptions type JSONPath = [JSONPathElement] type Object = KeyMap Value data Options data SumEncoding TaggedObject :: String -> String -> SumEncoding [tagFieldName] :: SumEncoding -> String [contentsFieldName] :: SumEncoding -> String UntaggedValue :: SumEncoding ObjectWithSingleField :: SumEncoding TwoElemArray :: SumEncoding data Value Object :: Object -> Value Array :: Array -> Value String :: Text -> Value Number :: Scientific -> Value Bool :: Bool -> Value Null :: Value class GToJSON' enc arity (f :: Type -> Type) class GetConName f => GToJSONKey (f :: k -> Type) class KeyValue e kv | kv -> e explicitToField :: KeyValue e kv => (v -> e) -> Key -> v -> kv class KeyValue e kv => KeyValueOmit e kv | kv -> e (.?=) :: (KeyValueOmit e kv, ToJSON v) => Key -> v -> kv explicitToFieldOmit :: KeyValueOmit e kv => (v -> Bool) -> (v -> e) -> Key -> v -> kv data ToArgs res arity a class ToJSON a toJSON :: ToJSON a => a -> Value toEncoding :: ToJSON a => a -> Encoding toJSONList :: ToJSON a => [a] -> Value toEncodingList :: ToJSON a => [a] -> Encoding omitField :: ToJSON a => a -> Bool class ToJSON1 (f :: Type -> Type) liftToJSON :: ToJSON1 f => (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value liftToJSONList :: ToJSON1 f => (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [f a] -> Value liftToEncoding :: ToJSON1 f => (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding liftToEncodingList :: ToJSON1 f => (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding liftOmitField :: ToJSON1 f => (a -> Bool) -> f a -> Bool class ToJSON2 (f :: Type -> Type -> Type) liftToJSON2 :: ToJSON2 f => (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value liftToJSONList2 :: ToJSON2 f => (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value liftToEncoding2 :: ToJSON2 f => (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding liftToEncodingList2 :: ToJSON2 f => (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding liftOmitField2 :: ToJSON2 f => (a -> Bool) -> (b -> Bool) -> f a b -> Bool class ToJSONKey a toJSONKey :: ToJSONKey a => ToJSONKeyFunction a toJSONKeyList :: ToJSONKey a => ToJSONKeyFunction [a] data ToJSONKeyFunction a ToJSONKeyText :: (a -> Key) -> (a -> Encoding' Key) -> ToJSONKeyFunction a ToJSONKeyValue :: (a -> Value) -> (a -> Encoding) -> ToJSONKeyFunction a -- | The JSON version ofPrettyTCM, for encoding JSON value in TCM class EncodeTCM a encodeTCM :: EncodeTCM a => a -> TCM Value ($dmencodeTCM) :: (EncodeTCM a, ToJSON a) => a -> TCM Value -- | TCM monadic version of object obj :: [TCM Pair] -> TCM Value -- | A handy alternative of obj with kind specified kind :: Text -> [TCM Pair] -> TCM Value -- | A handy alternative of object with kind specified kind' :: Text -> [Pair] -> Value -- | A key-value pair for encoding a JSON object. (.=) :: ToJSON a => Text -> a -> Pair -- | Abbreviation of `_ #= encodeTCM _` (@=) :: EncodeTCM a => Text -> a -> TCM Pair -- | Pairs a key with a value wrapped in TCM (#=) :: ToJSON a => Text -> TCM a -> TCM Pair instance Agda.Interaction.JSON.EncodeTCM GHC.Internal.Types.Bool instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.Pretty.Doc instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.Pretty.DocTree instance Agda.Interaction.JSON.EncodeTCM GHC.Internal.Types.Int instance Agda.Interaction.JSON.EncodeTCM a => Agda.Interaction.JSON.EncodeTCM [a] instance Agda.Interaction.JSON.EncodeTCM GHC.Internal.Base.String instance Agda.Interaction.JSON.EncodeTCM a => Agda.Interaction.JSON.EncodeTCM (GHC.Internal.Maybe.Maybe a) instance Agda.Interaction.JSON.EncodeTCM Data.Aeson.Types.Internal.Value instance Agda.Interaction.JSON.EncodeTCM GHC.Internal.Word.Word32 instance Data.Aeson.Types.ToJSON.ToJSON Agda.Utils.FileName.AbsolutePath instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.Pretty.Doc instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.Pretty.DocTree -- | Functions which give precise syntax highlighting info in JSON format. module Agda.Interaction.Highlighting.JSON -- | Turns syntax highlighting information into a JSON value jsonifyHighlightingInfo :: HighlightingInfo -> RemoveTokenBasedHighlighting -> HighlightingMethod -> ModuleToSource -> Maybe FilePath -> IO Value instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.Aspect.TokenBased instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.Aspect.TokenBased -- | Functions which give precise syntax highlighting info to Emacs. module Agda.Interaction.Highlighting.Emacs -- | Highlighting information. -- -- Note the invariant which values of this type should satisfy -- (highlightingInfoInvariant). -- -- This is a type synonym in order to make it easy to change to another -- representation. type HighlightingInfo = RangeMap Aspects -- | Turns syntax highlighting information into a list of S-expressions. lispifyHighlightingInfo :: HighlightingInfo -> RemoveTokenBasedHighlighting -> HighlightingMethod -> ModuleToSource -> Maybe FilePath -> IO (Lisp String) -- | Run showAspects on a whole RangeMap. lispifyHighlightingInfo_ :: ModuleToSource -> HighlightingInfo -> [Lisp String] -- | Formats the TokenBased tag for the Emacs backend. No quotes are -- added. lispifyTokenBased :: TokenBased -> Lisp String -- | Code for instructing Emacs to do things module Agda.Interaction.EmacsCommand -- | displayInfo header content append m displays content -- with header header in some suitable way in the Agda -- information buffer. If append is True, then the -- content is appended to previous content (if any), otherwise any -- previous content is deleted. If m is Just -- ModuleToSource then content is rendered with -- annotations, otherwise annotations in content are discarded -- and just the text is displayed. displayInfo :: String -> DocTree -> Bool -> Maybe ModuleToSource -> Lisp String -- | Clear the running info buffer. clearRunningInfo :: Lisp String -- | Display running information about what the type-checker is up to. displayRunningInfo :: DocTree -> Maybe ModuleToSource -> Lisp String displayVerboseInfo :: DocTree -> Maybe ModuleToSource -> Lisp String module Agda.Compiler.Treeless.Unused usedArguments :: QName -> TTerm -> TCM [ArgUsage] stripUnusedArguments :: [ArgUsage] -> TTerm -> TTerm module Agda.Compiler.Treeless.Simplify simplifyTTerm :: EvaluationStrategy -> TTerm -> TCM TTerm instance GHC.Internal.Classes.Eq Agda.Compiler.Treeless.Simplify.Atom instance GHC.Internal.Classes.Ord Agda.Compiler.Treeless.Simplify.Atom instance GHC.Internal.Show.Show Agda.Compiler.Treeless.Simplify.Atom -- | Ensures that all occurences of an abstract name share the same -- concrete name. -- -- Apply this transformation if your backend uses concrete names for -- identification purposes! -- -- The identity of an abstract name is only the nameId, the concrete name -- is only a naming suggestion. If renaming imports are used, the -- concrete name may change. This transformation makes sure that all -- occurences of an abstract name share the same concrete name. -- -- This transfomation should be run as the last transformation. module Agda.Compiler.Treeless.NormalizeNames normalizeNames :: TTerm -> TCM TTerm module Agda.Compiler.Treeless.Identity detectIdentityFunctions :: QName -> TTerm -> TCM TTerm instance GHC.Internal.Base.Semigroup Agda.Compiler.Treeless.Identity.IdentityIn module Agda.Compiler.Treeless.Erase eraseTerms :: QName -> EvaluationStrategy -> TTerm -> TCM TTerm -- | Takes the name of the data/record type. computeErasedConstructorArgs :: QName -> TCM () isErasable :: QName -> TCM Bool instance GHC.Internal.Classes.Eq Agda.Compiler.Treeless.Erase.TypeInfo instance GHC.Internal.Show.Show Agda.Compiler.Treeless.Erase.TypeInfo -- | Converts case matches on literals to if cascades with equality -- comparisons. module Agda.Compiler.Treeless.EliminateLiteralPatterns eliminateLiteralPatterns :: TTerm -> TCM TTerm data BuiltinKit BuiltinKit :: Maybe QName -> Maybe QName -> BuiltinKit [nat] :: BuiltinKit -> Maybe QName [int] :: BuiltinKit -> Maybe QName transform :: BuiltinKit -> TTerm -> TTerm -- | Eliminates case defaults by adding an alternative for all possible -- constructors. Literal cases are preserved as-is. module Agda.Compiler.Treeless.EliminateDefaults eliminateCaseDefaultAtTopLevelIfPresent :: TTerm -> TCM TTerm trAlt :: TAlt -> TCM TAlt eliminateCaseDefaults :: TTerm -> TCM TTerm -- | Translates the Agda builtin nat datatype to arbitrary-precision -- integers. -- -- Philipp, 20150921: At the moment, this optimization is the reason that -- there is a TAPlus alternative. For Haskell, this can easily be -- translated to guards. However, in the long term it would be easier for -- the backends if these things were translated directly to a less-than -- primitive and if-then-else expressions or similar. This would require -- us to add some internal Bool-datatype as compiler-internal type and a -- primitive less-than function, which will be much easier once Treeless -- is used for whole modules. -- -- Ulf, 2015-09-21: No, actually we need the n+k patterns, or at least -- guards. Representing them with if-then-else would make it a lot harder -- to do optimisations that analyse case tree, like impossible case -- elimination. -- -- Ulf, 2015-10-30: Guards are actually a better primitive. Fixed that. module Agda.Compiler.Treeless.Builtin translateBuiltins :: TTerm -> TCM TTerm module Agda.Compiler.MAlonzo.Coerce -- | Insert unsafeCoerce (in the form of TCoerce) everywhere it's -- needed in the right-hand side of a definition. addCoercions :: HasConstInfo m => TTerm -> m TTerm -- | The number of retained arguments after erasure. erasedArity :: HasConstInfo m => QName -> m Nat -- | A command which calls a compiler module Agda.Compiler.CallCompiler -- | Calls a compiler: -- -- callCompiler :: Bool -> FilePath -> [String] -> Maybe FilePath -> Maybe TextEncoding -> TCM () -- | Generalisation of callCompiler where the raised exception is -- returned. callCompiler' :: FilePath -> [String] -> Maybe FilePath -> Maybe TextEncoding -> TCM (Maybe String) -- | Translation from Agda.Syntax.Concrete to -- Agda.Syntax.Abstract. Involves scope analysis, figuring out -- infix operator precedences and tidying up definitions. module Agda.Syntax.Translation.ConcreteToAbstract -- | Things that can be translated to abstract syntax are instances of this -- class. class ToAbstract c where { type AbsOfCon c; } toAbstract :: ToAbstract c => c -> ScopeM (AbsOfCon c) -- | This operation does not affect the scope, i.e. the original scope is -- restored upon completion. localToAbstract :: ToAbstract c => c -> (AbsOfCon c -> ScopeM b) -> ScopeM b concreteToAbstract_ :: ToAbstract c => c -> ScopeM (AbsOfCon c) concreteToAbstract :: ToAbstract c => ScopeInfo -> c -> ScopeM (AbsOfCon c) -- | Temporary data type to scope check a file. data TopLevel a TopLevel :: SourceFile -> TopLevelModuleName -> a -> TopLevel a -- | The file from which we loaded this module. [topLevelSourceFile] :: TopLevel a -> SourceFile -- | The expected module name (coming from the import statement that -- triggered scope checking this file). [topLevelExpectedName] :: TopLevel a -> TopLevelModuleName -- | The file content. [topLevelTheThing] :: TopLevel a -> a data TopLevelInfo TopLevelInfo :: [Declaration] -> ScopeInfo -> TopLevelInfo [topLevelDecls] :: TopLevelInfo -> [Declaration] -- | as seen from inside the module [topLevelScope] :: TopLevelInfo -> ScopeInfo -- | The top-level module name. topLevelModuleName :: TopLevelInfo -> ModuleName -- | Declaration open import Agda.Primitive using (Set) when -- optImportSorts. Prop is added when optProp, and -- SSet when optTwoLevel. importPrimitives :: ScopeM [Declaration] -- | Raises an error if the list of attributes contains an unsupported -- attribute. checkAttributes :: Attributes -> ScopeM () instance Agda.Syntax.Translation.ConcreteToAbstract.AddGeneralizable Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Translation.ConcreteToAbstract.AddGeneralizable Agda.Syntax.Scope.Base.ResolvedName instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms (Agda.Syntax.Common.NamedArg a) instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms Agda.Syntax.Concrete.Binder instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms (Agda.Syntax.Concrete.LamBinding' a) instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms [a] instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms (Agda.Syntax.Common.Named_ a) instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms Agda.Syntax.Concrete.TypedBinding instance GHC.Internal.Classes.Eq Agda.Syntax.Translation.ConcreteToAbstract.LetDefOrigin instance GHC.Internal.Base.Functor Agda.Syntax.Translation.ConcreteToAbstract.NewName instance Agda.Syntax.Translation.ConcreteToAbstract.LivesInCurrentModule Agda.Syntax.Abstract.Name.AbstractName instance Agda.Syntax.Translation.ConcreteToAbstract.LivesInCurrentModule Agda.Syntax.Abstract.Name.QName instance GHC.Internal.Show.Show Agda.Syntax.Translation.ConcreteToAbstract.LetDefOrigin instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.AbstractRHS instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.Arg c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Concrete.Binder' (Agda.Syntax.Translation.ConcreteToAbstract.NewName Agda.Syntax.Concrete.BoundName)) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.CLHSCore instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.CPattern instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Definitions.Types.Clause instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.DataConstrDecl instance (Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c1, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c2) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (GHC.Internal.Data.Either.Either c1 c2) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Expr instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Concrete.FieldAssignment' c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.GenTel instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.GenTelAndType instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.HoleContent instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.LHSCore instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Abstract.LHSCore' Agda.Syntax.Concrete.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.LeftHandSide instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.LetDefs instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract [c] instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (GHC.Internal.Maybe.Maybe c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.MaybeOldQName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.Named name c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.NewModuleName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.NewModuleQName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.NewName Agda.Syntax.Concrete.Name.Name) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.NewName Agda.Syntax.Concrete.BoundName) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Utils.List1.List1 c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.OldModuleName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.OldQName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.PatName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Abstract.Pattern' Agda.Syntax.Concrete.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Pragma instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.RHS instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.Ranged c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.RecordConstructorType instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.RewriteEqn' () Agda.Syntax.Abstract.BindName Agda.Syntax.Abstract.Pattern Agda.Syntax.Abstract.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.RewriteEqn instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.RightHandSide instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.TopLevel [Agda.Syntax.Concrete.Declaration]) instance (Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c1, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c2) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (c1, c2) instance (Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c1, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c2, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c3) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (c1, c2, c3) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract () instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.WithHiding c) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.WithHidingInfo Agda.Syntax.Concrete.Pattern) instance Agda.Syntax.Translation.ConcreteToAbstract.ToQName Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Translation.ConcreteToAbstract.ToQName Agda.Syntax.Concrete.Name.QName module Agda.TypeChecking.Unquote agdaTermType :: TCM Type agdaTypeType :: TCM Type qNameType :: TCM Type data Dirty Dirty :: Dirty Clean :: Dirty type UnquoteState = (Dirty, TCState) type UnquoteM = ReaderT Context StateT UnquoteState WriterT [QName] ExceptT UnquoteError TCM type UnquoteRes a = Either UnquoteError ((a, UnquoteState), [QName]) unpackUnquoteM :: UnquoteM a -> Context -> UnquoteState -> TCM (UnquoteRes a) packUnquoteM :: (Context -> UnquoteState -> TCM (UnquoteRes a)) -> UnquoteM a runUnquoteM :: UnquoteM a -> TCM (Either UnquoteError (a, [QName])) liftU1 :: (TCM (UnquoteRes a) -> TCM (UnquoteRes b)) -> UnquoteM a -> UnquoteM b liftU2 :: (TCM (UnquoteRes a) -> TCM (UnquoteRes b) -> TCM (UnquoteRes c)) -> UnquoteM a -> UnquoteM b -> UnquoteM c inOriginalContext :: UnquoteM a -> UnquoteM a isCon :: ConHead -> TCM (Maybe Term) -> UnquoteM Bool isDef :: QName -> TCM (Maybe Term) -> UnquoteM Bool reduceQuotedTerm :: Term -> UnquoteM Term class Unquote a unquote :: Unquote a => Term -> UnquoteM a -- | Unquote an Arg Term assuming the ArgInfo -- does not contain information. (This means, it should be visible, -- relevant, etc., like defaultArg). unquoteN :: (HasCallStack, Unquote a) => Arg Term -> UnquoteM a choice :: Monad m => [(m Bool, m a)] -> m a -> m a ensureDef :: QName -> UnquoteM QName ensureCon :: QName -> UnquoteM QName pickName :: Type -> String unquoteString :: Term -> UnquoteM String unquoteNString :: Arg Term -> UnquoteM Text data ErrorPart StrPart :: String -> ErrorPart TermPart :: Expr -> ErrorPart PattPart :: Pattern -> ErrorPart NamePart :: QName -> ErrorPart -- | We do a little bit of work here to make it possible to generate nice -- layout for multi-line error messages. Specifically we split the parts -- into lines (indicated by n in a string part) and vcat all the lines. renderErrorParts :: [ErrorPart] -> TCM Doc -- | Argument should be a term of type Term → TCM A for some A. -- Returns the resulting term of type A. The second argument is -- the term for the hole, which will typically be a metavariable. This is -- passed to the computation (quoted). unquoteTCM :: Term -> Term -> UnquoteM Term evalTCM :: Term -> UnquoteM Term type ExeArg = Text type StdIn = Text type StdOut = Text type StdErr = Text -- | Raise an error if the --allow-exec option was not specified. requireAllowExec :: TCM () -- | Convert an ExitCode to an Agda natural number. exitCodeToNat :: ExitCode -> Nat -- | Call a trusted executable with the given arguments and input. -- -- Returns the exit code, stdout, and stderr. tcExec :: ExeName -> [ExeArg] -> StdIn -> TCM Term instance GHC.Internal.Classes.Eq Agda.TypeChecking.Unquote.Dirty instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Unquote.ErrorPart instance Agda.TypeChecking.Unquote.Unquote a => Agda.TypeChecking.Unquote.Unquote (Agda.Syntax.Reflected.Abs a) instance Agda.TypeChecking.Unquote.Unquote a => Agda.TypeChecking.Unquote.Unquote (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.Unquote.Unquote GHC.Internal.Types.Bool instance Agda.TypeChecking.Unquote.Unquote GHC.Internal.Types.Char instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Reflected.Clause instance Agda.TypeChecking.Unquote.Unquote a => Agda.TypeChecking.Unquote.Unquote (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Unquote.Unquote GHC.Internal.Types.Double instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Reflected.Elim instance Agda.TypeChecking.Unquote.Unquote Agda.TypeChecking.Unquote.ErrorPart instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Common.Hiding instance Agda.TypeChecking.Unquote.Unquote GHC.Internal.Bignum.Integer.Integer instance Agda.TypeChecking.Unquote.Unquote a => Agda.TypeChecking.Unquote.Unquote [a] instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Literal.Literal instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Common.Modality instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Reflected.Pattern instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Common.Quantity instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Common.Relevance instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Reflected.Sort instance Agda.TypeChecking.Unquote.Unquote Agda.Syntax.Reflected.Term instance Agda.TypeChecking.Unquote.Unquote Data.Text.Internal.Text instance (Agda.TypeChecking.Unquote.Unquote a, Agda.TypeChecking.Unquote.Unquote b) => Agda.TypeChecking.Unquote.Unquote (a, b) instance Agda.TypeChecking.Unquote.Unquote GHC.Internal.Word.Word64 module Agda.TypeChecking.Rules.Term -- | Check that an expression is a type. isType :: Expr -> Sort -> TCM Type -- | Check that an expression is a type. * If c == CmpEq, the -- given sort must be the minimal sort. * If c == CmpLeq, the -- given sort may be any bigger sort. isType' :: Comparison -> Expr -> Sort -> TCM Type -- | Check that an expression is a type and infer its (minimal) sort. isType_ :: Expr -> TCM Type checkLevel :: NamedArg Expr -> TCM Level -- | Ensure that a (freshly created) function type does not inhabit -- SizeUniv. Precondition: When noFunctionsIntoSize t -- tBlame is called, we are in the context of tBlame in -- order to print it correctly. Not being in context of t should -- not matter, as we are only checking whether its sort reduces to -- SizeUniv. -- -- Currently UNUSED since SizeUniv is turned off (as of 2016). -- -- Check that an expression is a type which is equal to a given type. isTypeEqualTo :: Expr -> Type -> TCM Type leqType_ :: Type -> Type -> TCM () -- | We track whether a module telescope came from a data declaration -- because data telescopes cannot contain tactic arguments (because they -- result in slightly weird behaviour w.r.t. checking parameters of -- constructors are fully general) data ModTelOrigin ModTelData :: ModTelOrigin ModTelNotData :: ModTelOrigin checkGeneralizeTelescope :: ModTelOrigin -> Maybe ModuleName -> GeneralizeTelescope -> ([Maybe Name] -> Telescope -> TCM a) -> TCM a -- | Type check a (module) telescope. Binds the variables defined by the -- telescope. checkTelescope :: ModTelOrigin -> Telescope -> (Telescope -> TCM a) -> TCM a -- | Type check the telescope of a dependent function type. Binds the -- resurrected variables defined by the telescope. The returned telescope -- is unmodified (not resurrected). checkPiTelescope :: Telescope -> (Telescope -> TCM a) -> TCM a -- | Flag to control resurrection on domains. data LamOrPi -- | We are checking a module telescope. We pass into the type world to -- check the domain type. This resurrects the whole context. LamNotPi :: ModTelOrigin -> LamOrPi -- | We are checking a telescope in a Pi-type. We stay in the term world, -- but add resurrected domains to the context to check the remaining -- domains and codomain of the Pi-type. PiNotLam :: LamOrPi -- | Type check a telescope. Binds the variables defined by the telescope. checkTelescope' :: LamOrPi -> Telescope -> (Telescope -> TCM a) -> TCM a -- | Check the domain of a function type. Used in -- checkTypedBindings and to typecheck A.Fun cases. checkDomain :: (LensLock a, LensModality a, LensRewriteAnn a, LensRelevance a) => LamOrPi -> Maybe Name -> List1 a -> Expr -> TCM (Maybe RewDom, Type) checkPiDomain :: (LensLock a, LensModality a, LensRewriteAnn a, LensRelevance a) => Maybe Name -> List1 a -> Expr -> TCM (Maybe RewDom, Type) -- | Check a typed binding and extends the context with the bound -- variables. The telescope passed to the continuation is valid in the -- original context. -- -- Parametrized by a flag whether we check a typed lambda or a Pi. This -- flag is needed for irrelevance. checkTypedBindings :: LamOrPi -> TypedBinding -> (Telescope -> TCM a) -> TCM a -- | After a typed binding has been checked, add the patterns it binds addTypedPatterns :: List1 (NamedArg Binder) -> TCM a -> TCM a -- | Check a tactic attribute. Should have type Term → TC ⊤. checkTacticAttribute :: LamOrPi -> Ranged Expr -> TCM Term checkPath :: NamedArg Binder -> Type -> Expr -> Type -> TCM Term -- | Type check a lambda expression. "checkLambda bs e ty" means ( bs -> -- e) : ty checkLambda :: Comparison -> TypedBinding -> Expr -> Type -> TCM Term checkLambda' :: Comparison -> Range -> TypedBindingInfo -> List1 (NamedArg Binder) -> Type -> Expr -> Type -> TCM Term userOmittedModalities :: List1 (NamedArg Name) -> TCM Bool -- | Check that modality info in lambda is compatible with modality coming -- from the function type. If lambda has no user-given modality, copy -- that of function type. lambdaModalityCheck :: (LensAnnotation dom, LensModality dom) => dom -> ArgInfo -> TCM ArgInfo -- | Check that irrelevance info in lambda is compatible with irrelevance -- coming from the function type. If lambda has no user-given relevance, -- copy that of function type. lambdaIrrelevanceCheck :: LensRelevance dom => dom -> ArgInfo -> TCM ArgInfo -- | Check that quantity info in lambda is compatible with quantity coming -- from the function type. If lambda has no user-given quantity, copy -- that of function type. lambdaQuantityCheck :: LensQuantity dom => dom -> ArgInfo -> TCM ArgInfo lambdaAnnotationCheck :: LensAnnotation dom => dom -> ArgInfo -> TCM ArgInfo -- | Check that cohesion info in lambda is compatible with cohesion coming -- from the function type. If lambda has no user-given cohesion, copy -- that of function type. lambdaCohesionCheck :: LensCohesion dom => dom -> ArgInfo -> TCM ArgInfo -- | Check that polarity info in lambda is compatible with polarity coming -- from the function type. If lambda has no user-given polarity, copy -- that of function type. lambdaPolarityCheck :: LensModalPolarity dom => dom -> ArgInfo -> TCM ArgInfo lambdaAddContext :: MonadAddContext m => Name -> ArgName -> Dom Type -> m a -> m a -- | Checking a lambda whose domain type has already been checked. checkPostponedLambda :: Comparison -> Arg (List1 (WithHiding Name), Maybe Type) -> Expr -> Type -> TCM Term checkPostponedLambda0 :: Comparison -> Arg ([WithHiding Name], Maybe Type) -> Expr -> Type -> TCM Term -- | Insert hidden lambda until the hiding info of the domain type matches -- the expected hiding info. Throws WrongHidingInLambda insertHiddenLambdas :: Hiding -> Type -> (Blocker -> Type -> TCM Term) -> (Type -> TCM Term) -> TCM Term -- | checkAbsurdLambda i h e t checks absurd lambda against type -- t. Precondition: e = AbsurdLam i h checkAbsurdLambda :: Comparison -> ExprInfo -> Hiding -> Expr -> Type -> TCM Term makeAbsurdLambda :: Range -> Dom Type -> Abs Type -> TCM QName -- | checkExtendedLambda i di erased qname cs e t check pattern -- matching lambda. Precondition: e = ExtendedLam i di erased qname -- cs checkExtendedLambda :: Comparison -> ExprInfo -> DefInfo -> Erased -> QName -> List1 Clause -> Expr -> Type -> TCM Term -- | Run a computation. -- -- -- -- Note that the returned meta might only exists in the state where the -- error was thrown, thus, be an invalid MetaId in the current -- state. catchIlltypedPatternBlockedOnMeta :: TCM a -> ((TCErr, Blocker) -> TCM a) -> TCM a -- | Picks up record field assignments from modules that export a -- definition that has the same name as the missing field. expandModuleAssigns :: [Either Assign ModuleName] -> [Name] -> TCM Assigns -- | checkRecordExpression fs e t checks record construction -- against type t. Precondition e = Rec _ fs. checkRecordExpression :: Comparison -> RecordAssigns -> Expr -> Type -> TCM Term guessRecordType :: Comparison -> Expr -> [Name] -> Type -> TCM Term -- |
--   checkRecordUpdate cmp ei recexpr fs e t
--   
-- -- Preconditions: e = RecUpdate ei recexpr fs and t is -- reduced. checkRecordUpdate :: Comparison -> KwRange -> ExprInfo -> Expr -> Assigns -> Expr -> Type -> TCM Term checkLiteral :: Literal -> Type -> TCM Term -- | Same as appView, but produces correct Hiding when -- constructing the AppView from a postfix projection. appViewM :: Expr -> TCM AppView -- | Remove top layers of scope info of expression and set the scope -- accordingly in the TCState. scopedExpr :: Expr -> TCM Expr -- | Type check an expression. checkExpr :: Expr -> Type -> TCM Term checkExpr' :: Comparison -> Expr -> Type -> TCM Term doQuoteTerm :: Comparison -> Term -> Type -> TCM Term -- | Unquote a TCM computation in a given hole. unquoteM :: Expr -> Term -> Type -> TCM () -- | Run a tactic `tac : Term → TC ⊤` in a hole (second argument) of the -- type given by the third argument. Runs the continuation if successful. unquoteTactic :: Term -> Term -> Type -> TCM () -- | Check an interaction point without arguments. checkQuestionMark :: (Comparison -> Type -> TCM (MetaId, Term)) -> Comparison -> Type -> MetaInfo -> InteractionId -> TCM Term -- | Check an underscore without arguments. checkUnderscore :: MetaInfo -> Comparison -> Type -> TCM Term -- | Type check a meta variable. checkMeta :: MetaInfo -> (Comparison -> Type -> TCM (MetaId, Term)) -> Comparison -> Type -> TCM Term -- | Infer the type of a meta variable. If it is a new one, we create a new -- meta for its type. inferMeta :: MetaInfo -> (Comparison -> Type -> TCM (MetaId, Term)) -> TCM (Elims -> Term, Type) -- | Type check a meta variable. If its type is not given, we return its -- type, or a fresh one, if it is a new meta. If its type is given, we -- check that the meta has this type, and we return the same type. checkOrInferMeta :: MetaInfo -> (Comparison -> Type -> TCM (MetaId, Term)) -> Maybe (Comparison, Type) -> TCM (Term, Type) -- | Turn a domain-free binding (e.g. lambda) into a domain-full one, by -- inserting an underscore for the missing type. domainFree :: ArgInfo -> Binder' Name -> LamBinding -- | Check arguments whose value we already know. -- -- This function can be used to check user-supplied parameters we have -- already computed by inference. -- -- Precondition: The type t of the head has enough domains. checkKnownArguments :: [NamedArg Expr] -> Args -> Type -> TCM (Args, Type) -- | Check an argument whose value we already know. checkKnownArgument :: NamedArg Expr -> Args -> Type -> TCM (Args, Type) -- | Check a single argument. checkNamedArg :: NamedArg Expr -> Type -> TCM Term -- | Infer the type of an expression. Implemented by checking against a -- meta variable. Except for neutrals, for them a polymorphic type is -- inferred. inferExpr :: Expr -> TCM (Term, Type) inferExpr' :: ExpandHidden -> Expr -> TCM (Term, Type) defOrVar :: Expr -> Bool -- | Used to check aliases f = e. Switches off ExpandLast -- for the checking of top-level application. checkDontExpandLast :: Comparison -> Expr -> Type -> TCM Term -- | Check whether a de Bruijn index is bound by a module telescope. isModuleFreeVar :: Int -> TCM Bool -- | Infer the type of an expression, and if it is of the form {tel} -- -> D vs for some datatype D then insert the hidden -- arguments. Otherwise, leave the type polymorphic. inferExprForWith :: Arg Expr -> TCM (Term, Type) checkLetBindings' :: Foldable t => t LetBinding -> TCM a -> TCM a checkLetBinding' :: LetBinding -> TCM a -> TCM a -- | Version of checkLetBinding which traces the fact that we're checking -- each binding in the Call. checkLetBinding :: LetBinding -> TCM a -> TCM a checkLetBindings :: Foldable t => t LetBinding -> TCM a -> TCM a instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.Term.LamOrPi instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.Term.ModTelOrigin instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.Term.LamOrPi instance GHC.Internal.Show.Show Agda.TypeChecking.Rules.Term.ModTelOrigin -- | Handling of the INFINITY, SHARP and FLAT builtins. module Agda.TypeChecking.Rules.Builtin.Coinduction -- | The type of ∞. typeOfInf :: TCM Type -- | The type of ♯_. typeOfSharp :: TCM Type -- | The type of ♭. typeOfFlat :: TCM Type -- | Binds the INFINITY builtin, but does not change the type's definition. bindBuiltinInf :: ResolvedName -> TCM () -- | Binds the SHARP builtin, and changes the definitions of INFINITY and -- SHARP. bindBuiltinSharp :: ResolvedName -> TCM () -- | Binds the FLAT builtin, and changes its definition. bindBuiltinFlat :: ResolvedName -> TCM () -- | Coverage checking, case splitting, and splitting for refine tactics. module Agda.TypeChecking.Coverage data SplitClause SClause :: Telescope -> [NamedArg SplitPattern] -> Substitution' SplitPattern -> Map CheckpointId Substitution -> Maybe (Dom Type) -> SplitClause -- | Type of variables in scPats. [scTel] :: SplitClause -> Telescope -- | The patterns leading to the currently considered branch of the split -- tree. [scPats] :: SplitClause -> [NamedArg SplitPattern] -- | Substitution from scTel to old context. Only needed directly -- after split on variable: * To update scTarget * To rename other -- split variables when splitting on multiple variables. scSubst -- is not `transitive', i.e., does not record the substitution -- from the original context to scTel over a series of splits. It -- is freshly computed after each split by computeNeighborhood; -- also splitResult, which does not split on a variable, should -- reset it to the identity idS, lest it be applied to -- scTarget again, leading to Issue 1294. [scSubst] :: SplitClause -> Substitution' SplitPattern -- | We need to keep track of the module parameter checkpoints for the -- clause for the purpose of inferring missing instance clauses. [scCheckpoints] :: SplitClause -> Map CheckpointId Substitution -- | The type of the rhs, living in context scTel. -- fixTargetType computes the new scTarget by applying -- substitution scSubst. [scTarget] :: SplitClause -> Maybe (Dom Type) -- | Create a split clause from a clause in internal syntax. Used by -- make-case. clauseToSplitClause :: Clause -> SplitClause -- | Add more patterns to split clause if the target type is a function -- type. Returns the domains of the function type (if any). insertTrailingArgs :: Bool -> SplitClause -> TCM (Telescope, SplitClause) -- | A Covering is the result of splitting a SplitClause. data Covering Covering :: Arg Nat -> [(SplitTag, (SplitClause, IInfo))] -> Covering -- | De Bruijn level (counting dot patterns) of argument we split on. [covSplitArg] :: Covering -> Arg Nat -- | Covering clauses, indexed by constructor/literal these clauses share. [covSplitClauses] :: Covering -> [(SplitTag, (SplitClause, IInfo))] -- | Project the split clauses out of a covering. splitClauses :: Covering -> [SplitClause] -- | Top-level function for checking pattern coverage. -- -- Effects: -- -- coverageCheck :: QName -> Type -> [Clause] -> TCM SplitTree -- | Top-level function for eliminating redundant clauses in the -- interactive case splitter isCovered :: QName -> [Clause] -> SplitClause -> TCM Bool -- | Entry point from Interaction.MakeCase. splitClauseWithAbsurd :: SplitClause -> Nat -> TCM (Either SplitError (Either SplitClause Covering)) -- | Entry point from TypeChecking.Empty and -- Interaction.BasicOps. splitLast CoInductive is used -- in the refine tactics. splitLast :: Induction -> Telescope -> [NamedArg DeBruijnPattern] -> TCM (Either SplitError Covering) -- | splitResult for MakeCase, tries to introduce IApply or ProjP -- copatterns splitResult :: QName -> SplitClause -> TCM (Either SplitError [SplitClause]) normaliseProjP :: (NormaliseProjP a, HasConstInfo m) => a -> m a instance GHC.Internal.Classes.Eq Agda.TypeChecking.Coverage.AllowPartialCover instance GHC.Internal.Classes.Eq Agda.TypeChecking.Coverage.InferMissing instance GHC.Internal.Classes.Eq Agda.TypeChecking.Coverage.InsertTrailing instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Coverage.SplitClause.SplitClause instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.AllowPartialCover instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.InferMissing instance GHC.Internal.Show.Show Agda.TypeChecking.Coverage.InsertTrailing module Agda.TypeChecking.Empty -- | Check whether a type is empty. isEmptyType :: MonadTCM tcm => Dom Type -> tcm Bool -- | Check whether some type in a telescope is empty. isEmptyTel :: MonadTCM tcm => Telescope -> tcm Bool -- | Ensure that a type is empty. This check may be postponed as emptiness -- constraint. ensureEmptyType :: Range -> Dom Type -> TCM () -- | Check whether one of the types in the given telescope is -- constructor-less and if yes, return its index in the telescope (0 = -- leftmost). checkEmptyTel :: Range -> Telescope -> TCM (Either ErrorNonEmpty Int) instance GHC.Internal.Base.Monoid Agda.TypeChecking.Empty.ErrorNonEmpty instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Empty.ErrorNonEmpty module Agda.TypeChecking.CompiledClause.Compile data RunRecordPatternTranslation RunRecordPatternTranslation :: RunRecordPatternTranslation DontRunRecordPatternTranslation :: RunRecordPatternTranslation compileClauses' :: QName -> RunRecordPatternTranslation -> [Clause] -> Maybe SplitTree -> TCM CompiledClauses -- | Process function clauses into case tree. This involves: 1. Coverage -- checking, generating a split tree. 2. Translation of lhs record -- patterns into rhs uses of projection. Update the split tree. 3. -- Generating a case tree from the split tree. Phases 1. and 2. are -- skipped if Nothing. compileClauses :: Maybe (QName, Type) -> [Clause] -> TCM (Maybe SplitTree, Bool, CompiledClauses) -- | Stripped-down version of Clause used in clause compiler. data Cl Cl :: ClauseNumber -> ClauseRecursive -> [Arg Pattern] -> Maybe Term -> Cl -- | Which original Clause did this clause come from? [clNumber] :: Cl -> ClauseNumber -- | Does the clause body contain calls to the mutually recursive -- functions? [clRecursive] :: Cl -> ClauseRecursive -- | Pattern variables are considered in left-to-right order. [clPats] :: Cl -> [Arg Pattern] [clBody] :: Cl -> Maybe Term type Cls = [Cl] -- | Strip down a clause. Don't forget to apply the substitution to the dot -- patterns! unBruijn :: (ClauseNumber, Clause) -> Cl compileWithSplitTree :: SplitTree -> Cls -> CompiledClauses compile :: Cls -> CompiledClauses -- | Get the index of the next argument we need to split on. This the -- number of the first pattern that does a (non-lazy) match in the first -- clause. Or the first lazy match where all clauses agree on the -- constructor, if there are no non-lazy matches. nextSplit :: Cl -> Cls -> Maybe (Bool, Arg Int) -- | Is is not a variable pattern? And if yes, is it a record pattern -- and/or a fallThrough one? properSplit :: Pattern' a -> Maybe Bool -- | Is this a variable pattern? -- -- Maintain invariant: isVar = isNothing . properSplit! isVar :: Pattern' a -> Bool -- | splitOn single n cs will force expansion of catch-alls if -- single. splitOn :: Bool -> Int -> Cls -> Case Cls splitC :: Int -> Cl -> Case Cl -- | Expand catch-alls that appear before actual matches. -- -- Example: -- --
--   true  y
--   x     false
--   false y
--   
-- -- will expand the catch-all x to false. -- -- Catch-alls need also to be expanded if they come before/after a record -- pattern, otherwise we get into trouble when we want to eliminate -- splits on records later. -- -- Another example (see Issue 1650): f (x, (y, z)) true = a f _ -- false = b Split tree: 0 (first argument of f) - 1 (second -- component of the pair) - 3 (last argument of f) -- true -> a - -- false -> b We would like to get the following case tree: -- case 0 of _,_ -> case 1 of _,_ -> case 3 of true -> a; false -- -> b _ -> case 3 of true -> a; false -> b _ -> case 3 -- of true -> a; false -> b -- -- Example from issue #2168: f x false = a f false = _ -> b f x -- true = c case tree: f x y = case y of true -> case x of -- true -> c false -> b false -> a -- -- Example from issue #3628: f i j k (i = i0)(k = i1) = base f i j k -- (j = i1) = base case tree: f i j k o = case i of i0 -> -- case k of i1 -> base _ -> case j of i1 -> base _ -> case j -- of i1 -> base expandCatchalls :: Bool -> Int -> Cls -> Cls -- | Make sure (by eta-expansion) that clause has arity at least n -- where n is also the length of the provided list. ensureNPatterns :: Int -> [ArgInfo] -> Cl -> Cl substBody :: Subst a => Int -> Int -> SubstArg a -> a -> a instance GHC.Internal.Classes.Eq Agda.TypeChecking.CompiledClause.Compile.RunRecordPatternTranslation instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance Agda.Syntax.Common.Pretty.Pretty Agda.TypeChecking.CompiledClause.Compile.Cl instance GHC.Internal.Show.Show Agda.TypeChecking.CompiledClause.Compile.Cl module Agda.TypeChecking.Rules.Record.Cubical addCompositionForRecord :: QName -> EtaEquality -> ConHead -> Telescope -> [Arg QName] -> Telescope -> Type -> TCM () module Agda.TypeChecking.Rules.Record -- |
--   checkRecDef i name con ps contel fields
--   
-- -- checkRecDef :: DefInfo -> QName -> PositivityCheck -> UniverseCheck -> ForceRecordEta -> RecordDirectives -> DataDefParams -> Expr -> [Field] -> TCM () -- | checkRecordProjections m r q tel ftel fs. -- -- checkRecordProjections :: ModuleName -> QName -> Bool -> ConHead -> Telescope -> Telescope -> [Declaration] -> TCM () module Agda.TypeChecking.Rules.Def checkFunDef :: DefInfo -> QName -> [Clause] -> TCM () checkMacroType :: Type -> TCM () -- | A single clause without arguments and without type signature is an -- alias. isAlias :: [Clause] -> Type -> Maybe (Expr, Maybe Expr, MetaId) -- | Check a trivial definition of the form f = e checkAlias :: Type -> ArgInfo -> DefInfo -> QName -> Expr -> Maybe Expr -> TCM () -- | Type check a definition by pattern matching. checkFunDef' :: Type -> ArgInfo -> Maybe ExtLamInfo -> DefInfo -> QName -> [Clause] -> TCM () -- | Type check a definition by pattern matching. checkFunDefS :: Type -> ArgInfo -> Maybe ExtLamInfo -> IsWithFunction (QName, Substitution, Map Name LetBinding) -> DefInfo -> QName -> [Clause] -> TCM () -- | Set funTerminates according to termination info in -- TCEnv, which comes from a possible termination pragma. useTerPragma :: Definition -> TCM Definition -- | Modify all the LHSCores of the given piece of syntax. (Used -- to insert patterns for rewrite or the inspect idiom) class HasLHSCores a mapLHSCores :: HasLHSCores a => (LHSCore -> LHSCore) -> a -> a -- | Insert some names into the with-clauses LHS of the given RHS. (Used -- for the inspect idiom) insertInspects :: List1 (Arg (Maybe BindName)) -> LHSCore -> LHSCore -- | Insert some with-patterns into the with-clauses LHS of the given RHS. -- (Used for rewrite) insertPatterns :: List1 (Arg Pattern) -> RHS -> RHS -- | Insert with-patterns before the trailing with patterns. If there are -- none, append the with-patterns. insertPatternsLHSCore :: List1 (Arg Pattern) -> LHSCore -> LHSCore -- | Parameters for creating a with-function. type WithFunctionProblem = IsWithFunction WithFunctionProblemData data WithFunctionProblemData WithFunctionProblemData :: QName -> QName -> Type -> Telescope -> Telescope -> Telescope -> List1 (Arg (Term, EqualityView)) -> Type -> [NamedArg DeBruijnPattern] -> Nat -> Permutation -> Permutation -> Permutation -> List1 Clause -> Substitution -> Map Name LetBinding -> WithFunctionProblemData -- | Parent function name. [wfParentName] :: WithFunctionProblemData -> QName -- | With function name. [wfName] :: WithFunctionProblemData -> QName -- | Type of the parent function. [wfParentType] :: WithFunctionProblemData -> Type -- | Context of the parent patterns. [wfParentTel] :: WithFunctionProblemData -> Telescope -- | Types of arguments to the with function before the with expressions -- (needed vars). [wfBeforeTel] :: WithFunctionProblemData -> Telescope -- | Types of arguments to the with function after the with expressions -- (unneeded vars). [wfAfterTel] :: WithFunctionProblemData -> Telescope -- | With and rewrite expressions and their types. [wfExprs] :: WithFunctionProblemData -> List1 (Arg (Term, EqualityView)) -- | Type of the right hand side. [wfRHSType] :: WithFunctionProblemData -> Type -- | Parent patterns. [wfParentPats] :: WithFunctionProblemData -> [NamedArg DeBruijnPattern] -- | Number of module parameters in parent patterns [wfParentParams] :: WithFunctionProblemData -> Nat -- | Permutation resulting from splitting the telescope into needed and -- unneeded vars. [wfPermSplit] :: WithFunctionProblemData -> Permutation -- | Permutation reordering the variables in the parent pattern. [wfPermParent] :: WithFunctionProblemData -> Permutation -- | Final permutation (including permutation for the parent clause). [wfPermFinal] :: WithFunctionProblemData -> Permutation -- | The given clauses for the with function [wfClauses] :: WithFunctionProblemData -> List1 Clause -- | Substitution to generate call for the parent. [wfCallSubst] :: WithFunctionProblemData -> Substitution -- | The let-bindings in scope of the parent (in the parent context). [wfLetBindings] :: WithFunctionProblemData -> Map Name LetBinding checkSystemCoverage :: QName -> [Int] -> Type -> [Clause] -> TCM System data ClausesPostChecks CPC :: IntSet -> ClausesPostChecks -- | Which argument indexes have a partial split. [cpcPartialSplits] :: ClausesPostChecks -> IntSet -- | The LHS part of checkClause. checkClauseLHS :: Type -> IsWithFunction Substitution -> SpineClause -> (LHSResult -> TCM a) -> TCM a -- | Type check a function clause. checkClause :: Type -> IsWithFunction (QName, Substitution, Map Name LetBinding) -> SpineClause -> TCM (Clause, ClausesPostChecks) -- | Generate the abstract pattern corresponding to Refl getReflPattern :: TCM Pattern -- | Type check the with and rewrite lhss and/or the rhs. checkRHS :: LHSInfo -> QName -> [NamedArg Pattern] -> Type -> LHSResult -> RHS -> TCM (Maybe Term, WithFunctionProblem) checkWithRHS :: QName -> QName -> Type -> LHSResult -> List1 (Arg (Term, EqualityView)) -> List1 Clause -> TCM (Maybe Term, WithFunctionProblem) -- | Invoked in empty context. checkWithFunction :: [Name] -> WithFunctionProblem -> TCM (Maybe Term) -- | Type check a where clause. checkWhere :: WhereDeclarations -> TCM a -> TCM a -- | Enter a new section during type-checking. newSection :: Erased -> ModuleName -> GeneralizeTelescope -> TCM a -> TCM a -- | Set the current clause number. atClause :: QName -> Int -> Type -> IsWithFunction Substitution -> SpineClause -> TCM a -> TCM a instance Agda.TypeChecking.Rules.Def.HasLHSCores Agda.Syntax.Abstract.Clause instance Agda.TypeChecking.Rules.Def.HasLHSCores Agda.Syntax.Abstract.LHS instance Agda.TypeChecking.Rules.Def.HasLHSCores Agda.Syntax.Abstract.RHS instance GHC.Internal.Base.Monoid Agda.TypeChecking.Rules.Def.ClausesPostChecks instance GHC.Internal.Base.Semigroup Agda.TypeChecking.Rules.Def.ClausesPostChecks module Agda.TypeChecking.Rules.Application -- | checkArguments cmp exph hd args t0 t k tries -- checkArgumentsE cmp exph hd args t0 t. If it succeeds, it -- continues k with the returned results. If it fails, it -- registers a postponed typechecking problem and returns the resulting -- new meta variable. -- -- Checks e := ((hd : t0) args) : t. checkArguments :: Comparison -> ExpandHidden -> Expr -> [NamedArg Expr] -> Type -> Type -> (ArgsCheckState CheckedTarget -> TCM Term) -> TCM Term -- | Check that a list of arguments fits a telescope. Inserts hidden -- arguments as necessary. Returns the type-checked arguments and the -- remaining telescope. checkArguments_ :: Comparison -> ExpandHidden -> Expr -> [NamedArg Expr] -> Telescope -> TCM (Elims, Telescope) -- | checkApplication hd args e t checks an application. -- Precondition: Application hs args = appView e -- -- checkApplication disambiguates constructors (and continues to -- checkConstructorApplication) and resolves pattern synonyms. checkApplication :: Comparison -> Expr -> Args -> Expr -> Type -> TCM Term -- | Precondition: Application hd args = appView e. inferApplication :: ExpandHidden -> Expr -> Args -> Expr -> TCM (Term, Type) -- | Checking the type of an overloaded projection application. See -- inferOrCheckProjAppToKnownPrincipalArg. checkProjAppToKnownPrincipalArg :: Comparison -> Expr -> ProjOrigin -> AmbiguousQName -> Expr -> Args -> Type -> Int -> Term -> Type -> PrincipalArgTypeMetas -> TCM Term -- | Retry a constructor disambiguation. disambiguateConstructor' :: ConstructorDisambiguationData -> (ConHead -> TCM Term) -> TCM Term univChecks :: Univ -> TCM () suffixToLevel :: Suffix -> Integer module Agda.Compiler.ToTreeless -- | Converts compiled clauses to treeless syntax. -- -- Note: Do not use any of the concrete names in the returned term for -- identification purposes! If you wish to do so, first apply the -- Agda.Compiler.Treeless.NormalizeNames transformation. toTreelessWith :: CCConfig -> QName -> TCM (Maybe TTerm) closedTermToTreeless :: CCConfig -> Term -> TCM TTerm data Pipeline FixedPoint :: Int -> Pipeline -> Pipeline Sequential :: [Pipeline] -> Pipeline SinglePass :: CompilerPass -> Pipeline data CompilerPass CompilerPass :: String -> Int -> String -> (EvaluationStrategy -> TTerm -> TCM TTerm) -> CompilerPass [passTag] :: CompilerPass -> String [passVerbosity] :: CompilerPass -> Int [passName] :: CompilerPass -> String [passCode] :: CompilerPass -> EvaluationStrategy -> TTerm -> TCM TTerm compilerPass :: String -> Int -> String -> (EvaluationStrategy -> TTerm -> TCM TTerm) -> Pipeline type CCConfig = (EvaluationStrategy, CCSubst, BuildPipeline) data CCSubst EraseUnused :: CCSubst IgnoreUnused :: CCSubst -- | Default compiler pipeline -- -- Backends may use different pipelines compilerPipeline :: BuildPipeline -- | Create default CCConfig using default pipeline mkDefaultCCConfig :: EvaluationStrategy -> CCConfig -- | Convert to treeless using default pipeline toTreeless :: EvaluationStrategy -> QName -> TCM (Maybe TTerm) instance GHC.Internal.Classes.Eq Agda.Compiler.ToTreeless.CCSubst module Agda.Interaction.MakeCase type CaseContext = Maybe ExtLamInfo -- | For the names the user enters for case-splitting, there can be -- different actions depending on what the name resolved to. data SplitAction -- | De Bruijn index of a pattern variable bound to a value, turn into dot -- pattern. RevealDotPattern :: Name -> SplitAction -- | De Bruijn index of a hidden argument, make this argument visible. RevealHiddenVariable :: Int -> SplitAction -- | De Bruijn index of an unconstrained pattern variable, split on it. SplitOnVariable :: Int -> SplitAction splitActionToEither3 :: SplitAction -> Either3 Name Int Int -- | Parse variables (visible or hidden), returning their de Bruijn -- indices. Used in makeCase. parseVariables :: QName -> Context -> [AsBinding] -> InteractionId -> Range -> [String] -> TCM [SplitAction] -- | Lookup the clause for an interaction point in the signature. Returns -- the CaseContext, the previous clauses, the clause itself, and a list -- of the remaining ones. type ClauseZipper = ([Clause], Clause, [Clause]) getClauseZipperForIP :: QName -> Int -> TCM (CaseContext, ClauseZipper) recheckAbstractClause :: Type -> IsWithFunction Substitution -> SpineClause -> TCM (Clause, Context, [AsBinding]) -- | Entry point for case splitting tactic. makeCase :: InteractionId -> Range -> String -> TCM (QName, CaseContext, [Clause]) -- | Make the given pattern variables visible by marking their origin as -- CaseSplit and pattern origin as PatOSplit in the -- SplitClause. makePatternVarsVisible :: [Name] -> [Nat] -> SplitClause -> SplitClause -- | If a copattern split yields no clauses, we must be at an empty record -- type. In this case, replace the rhs by record{} makeRHSEmptyRecord :: RHS -> RHS -- | Make clause with no rhs (because of absurd match). makeAbsurdClause :: QName -> ExpandedEllipsis -> SplitClause -> TCM Clause -- | Drop hidden patterns introduced by generalization with an unparsable -- name. If we drop one, we need to make the next non-dropped hidden -- pattern named. filterOutGeneralizedVarPatterns :: [NamedArg DeBruijnPattern] -> [NamedArg DeBruijnPattern] makeNamedArgUserWritten :: NamedArg a -> NamedArg a -- | Unparseable variable names are those that contain a .. isGeneralizedVarName :: PatVarName -> Bool -- | Make a clause with a question mark as rhs. makeAbstractClause :: QName -> RHS -> ExpandedEllipsis -> SplitClause -> TCM Clause anyEllipsisVar :: QName -> SpineClause -> [Name] -> TCM Bool instance GHC.Internal.Show.Show Agda.Interaction.MakeCase.SplitAction module Agda.TypeChecking.Rules.Decl -- | Cached checkDecl checkDeclCached :: Declaration -> TCM () -- | Type check a sequence of declarations. checkDecls :: [Declaration] -> TCM () -- | Type check a single declaration. checkDecl :: Declaration -> TCM () mutualChecks :: MutualInfo -> Declaration -> MutualId -> Set QName -> TCM () -- | Check if there is a inferred eta record type in the mutual block. If -- yes, repeat the record pattern translation for all function -- definitions in the block. This is necessary since the original record -- pattern translation will have skipped record patterns of the new -- record types (as eta was off for them). See issue #2308 (and #2197). revisitRecordPatternTranslation :: [QName] -> TCM () type FinalChecks = Maybe TCM () checkUnquoteDecl :: MutualInfo -> [DefInfo] -> [QName] -> Expr -> TCM FinalChecks checkUnquoteDef :: [DefInfo] -> [QName] -> Expr -> TCM () -- | Run a reflected TCM computatation expected to define a given list of -- names. unquoteTop :: [QName] -> Expr -> TCM [QName] -- | Instantiate all metas in Definition associated to QName. -- Makes sense after freezing metas. Some checks, like free variable -- analysis, are not in TCM, so they will be more precise (see -- issue 1099) after meta instantiation. Precondition: name has been -- added to signature already. instantiateDefinitionType :: QName -> TCM () data HighlightModuleContents DontHightlightModuleContents :: HighlightModuleContents DoHighlightModuleContents :: HighlightModuleContents -- | Highlight a declaration. Called after checking a mutual block (to -- ensure we have the right definitions for all names). For modules -- inside mutual blocks we haven't highlighted their contents, but for -- modules not in a mutual block we have. Hence the flag. highlight_ :: HighlightModuleContents -> Declaration -> TCM () -- | Termination check a declaration. checkTermination_ :: Declaration -> TCM () -- | Check a set of mutual names for positivity. checkPositivity_ :: MutualInfo -> Set QName -> TCM () -- | Check a set of mutual names for constructor-headedness. checkInjectivity_ :: Set QName -> TCM () -- | Check a set of mutual names for projection likeness. -- -- Only a single, non-abstract function can be projection-like. Making an -- abstract function projection-like would break the invariant that the -- type of the principle argument of a projection-like function is always -- inferable. checkProjectionLikeness_ :: Set QName -> TCM () -- | Freeze metas created by given computation if in abstract mode. whenAbstractFreezeMetasAfter :: DefInfo -> TCM a -> TCM a checkGeneralize :: Set QName -> DefInfo -> ArgInfo -> QName -> Expr -> TCM () -- | Type check an axiom. -- -- Data and record type signatures need to remember the generalized -- parameters for when checking the corresponding definition, so for -- these we pass in the parameter telescope separately. checkAxiom :: Maybe GeneralizeTelescope -> KindOfName -> DefInfo -> ArgInfo -> Maybe PragmaPolarities -> QName -> Expr -> TCM () -- | Type check a primitive function declaration. checkPrimitive :: DefInfo -> QName -> Arg Expr -> TCM () -- | Check a pragma. checkPragma :: Range -> Pragma -> TCM () -- | Type check a bunch of mutual inductive recursive definitions. -- -- All definitions which have so far been assigned to the given mutual -- block are returned. checkMutual :: MutualInfo -> List1 Declaration -> TCM (MutualId, Set QName) checkSig :: KindOfName -> DefInfo -> Erased -> QName -> GeneralizeTelescope -> Expr -> TCM () -- | Type check the type signature of an inductive or recursive definition. checkTypeSignature :: TypeSignature -> TCM () checkTypeSignature' :: Maybe GeneralizeTelescope -> TypeSignature -> TCM () -- | Type check a module. checkSection :: Erased -> ModuleName -> GeneralizeTelescope -> [Declaration] -> TCM () -- | Helper for checkSectionApplication. -- -- Matches the arguments of the module application with the module -- parameters. -- -- Returns the remaining module parameters as an open telescope. Warning: -- the returned telescope is not the final result, an actual -- instantiation of the parameters does not occur. checkModuleArity :: ModuleName -> Telescope -> [NamedArg Expr] -> TCM Telescope -- | Checks local rewrite rule constraints are satisfied definitionally and -- returns the telescope with all local rewrite rules removed addRewConstraints :: Telescope -> TCM Telescope -- | Check an application of a section. checkSectionApplication :: ModuleInfo -> Erased -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> ImportDirective -> TCM () -- | Check an application of a section. (Do not invoke this procedure -- directly, use checkSectionApplication.) checkSectionApplication' :: ModuleInfo -> Erased -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> TCM () -- | Checks that open public is not used in hard compile-time -- mode. checkImportDirective :: ImportDirective -> TCM () class ShowHead a showHead :: ShowHead a => a -> String debugPrintDecl :: Declaration -> TCM () instance GHC.Internal.Classes.Eq Agda.TypeChecking.Rules.Decl.HighlightModuleContents instance Agda.TypeChecking.Rules.Decl.ShowHead Agda.Syntax.Abstract.Declaration module Agda.TheTypeChecker -- | Type check a sequence of declarations. checkDecls :: [Declaration] -> TCM () -- | Type check a single declaration. checkDecl :: Declaration -> TCM () -- | Cached checkDecl checkDeclCached :: Declaration -> TCM () -- | Infer the type of an expression. Implemented by checking against a -- meta variable. Except for neutrals, for them a polymorphic type is -- inferred. inferExpr :: Expr -> TCM (Term, Type) -- | Type check an expression. checkExpr :: Expr -> Type -> TCM Term module Agda.Interaction.BasicOps -- | Parses an expression. parseExpr :: Range -> String -> TCM Expr parseExprIn :: InteractionId -> Range -> String -> TCM Expr giveExpr :: UseForce -> Maybe InteractionId -> MetaId -> Expr -> TCM Term -- | After a give, redo termination etc. checks for function which was -- complemented. redoChecks :: Maybe InteractionId -> TCM () -- | Auxiliary definition for give and elaborate_give. give_ :: Bool -> UseForce -> InteractionId -> Expr -> TCM Term -- | Try to fill hole by expression. -- -- Returns the given expression unchanged (for convenient generalization -- to refine). give :: UseForce -> InteractionId -> Expr -> TCM Expr -- | Try to fill hole by elaborated expression. elaborate_give :: Rewrite -> UseForce -> InteractionId -> Expr -> TCM Expr -- | Try to refine hole by expression e. -- -- This amounts to successively try to give e, e ?, -- e ? ?, ... Returns the successfully given expression. refine :: UseForce -> InteractionId -> Expr -> TCM Expr -- | Evaluate the given expression in the current environment evalInCurrent :: ComputeMode -> Expr -> TCM Expr evalInMeta :: InteractionId -> ComputeMode -> Expr -> TCM Expr -- | Modifier for interactive commands, specifying the amount of -- normalization in the output. normalForm :: (Reduce t, Simplify t, Instantiate t, Normalise t) => Rewrite -> t -> TCM t -- | Evaluate the given expression in the current environment with allowed -- reductions modified according to ComputeMode. computeInCurrent :: ComputeMode -> Expr -> TCM Expr -- | Modify the allowed reductions according to ComputeMode. withComputeIgnoreAbstract :: MonadTCEnv m => ComputeMode -> m a -> m a computeIgnoreAbstract :: ComputeMode -> Bool computeWrapInput :: ComputeMode -> String -> String showComputed :: ComputeMode -> Expr -> TCM Doc -- | Modifier for interactive commands, specifying whether safety checks -- should be ignored. outputFormId :: OutputForm a b -> b reifyElimToExpr :: MonadReify m => Elim -> m Expr prettyConstraints :: [Closure Constraint] -> TCM [OutputForm Expr Expr] namedMetaOf :: OutputConstraint Expr a -> a getConstraintsMentioning :: Rewrite -> MetaId -> TCM [OutputForm Expr Expr] stripConstraintPids :: Constraints -> Constraints -- | Converts an InteractionId to a MetaId. interactionIdToMetaId :: ReadTCState m => InteractionId -> m MetaId -- | Get meta solutions and constraints. getConstraints :: Rewrite -> TCM [OutputForm Expr Expr] -- | Reify the boundary of an interaction point as something that can be -- shown to the user. getIPBoundary :: Rewrite -> InteractionId -> TCM [IPFace' Expr] typeAndFacesInMeta :: InteractionId -> Rewrite -> Expr -> TCM (Expr, [IPFace' Expr]) -- | Goals and Warnings getGoals :: TCM Goals getGoals' :: Rewrite -> Rewrite -> TCM Goals -- | Print open metas nicely. prettyGoals :: Goals -> TCM Doc getWarningsAndNonFatalErrors :: TCM WarningsAndNonFatalErrors -- | Collecting the context of the given meta-variable. getResponseContext :: Rewrite -> InteractionId -> TCM [ResponseContextEntry] -- | getSolvedInteractionPoints True returns all solutions, even -- if just solved by another, non-interaction meta. -- -- getSolvedInteractionPoints False only returns metas that are -- solved by a non-meta. getSolvedInteractionPoints :: Bool -> Rewrite -> TCM [(InteractionId, MetaId, Expr)] typeOfMetaMI :: Rewrite -> MetaId -> TCM (OutputConstraint Expr NamedMeta) typeOfMeta :: Rewrite -> InteractionId -> TCM (OutputConstraint Expr InteractionId) typeOfMeta' :: Rewrite -> (InteractionId, MetaId) -> TCM (OutputConstraint Expr InteractionId) typesOfVisibleMetas :: Rewrite -> TCM [OutputConstraint Expr InteractionId] typesOfHiddenMetas :: Rewrite -> TCM [OutputConstraint Expr NamedMeta] -- | Create type of application of new helper function that would solve the -- goal. metaHelperType :: Rewrite -> InteractionId -> Range -> String -> TCM (OutputConstraint' Expr Name) -- | Gives a list of names and corresponding types. This list includes not -- only the local variables in scope, but also the let-bindings. contextOfMeta :: InteractionId -> Rewrite -> TCM [ResponseContextEntry] -- | Returns the type of the expression in the current environment We wake -- up irrelevant variables just in case the user want to invoke that -- command in an irrelevant context. typeInCurrent :: Rewrite -> Expr -> TCM Expr typeInMeta :: InteractionId -> Rewrite -> Expr -> TCM Expr -- | The intro tactic. -- -- Returns the terms (as strings) that can be used to refine the goal. -- Uses the coverage checker to find out which constructors are possible. introTactic :: Bool -> InteractionId -> TCM [String] -- | Runs the given computation as if in an anonymous goal at the end of -- the top-level module. -- -- Sets up current module, scope, and context. atTopLevel :: TCM a -> TCM a -- | Parse a name. parseName :: Range -> String -> TCM QName -- | Check whether an expression is a (qualified) identifier. isQName :: Expr -> Maybe QName isName :: Expr -> Maybe Name -- | Returns the contents of the given module or record. moduleContents :: Rewrite -> Range -> String -> TCM ([Name], Telescope, [(Name, Type)]) -- | Returns the contents of the given record identifier. getRecordContents :: Rewrite -> Expr -> TCM ([Name], Telescope, [(Name, Type)]) -- | Returns the contents of the given module. getModuleContents :: Rewrite -> Maybe QName -> TCM ([Name], Telescope, [(Name, Type)]) whyInScope :: FilePath -> String -> TCM WhyInScopeData instance Agda.Syntax.Common.Pretty.Pretty c => Agda.Syntax.Common.Pretty.Pretty (Agda.TypeChecking.Monad.Base.Types.IPFace' c) instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Interaction.Base.OutputConstraint' a b) instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Interaction.Output.OutputConstraint a b) instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.Syntax.Common.Pretty.Pretty (Agda.Interaction.Output.OutputForm a b) instance (Agda.Syntax.Common.Pretty.Pretty a, Agda.Syntax.Common.Pretty.Pretty b) => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Interaction.Output.OutputForm a b) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.Constraint instance Agda.Syntax.Translation.InternalToAbstract.Reify a => Agda.Syntax.Translation.InternalToAbstract.Reify (Agda.TypeChecking.Monad.Base.IPBoundary' a) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.TypeChecking.Monad.Base.IPBoundary' a) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete b) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Interaction.Base.OutputConstraint' a b) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete b) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Interaction.Output.OutputConstraint a b) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete b) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Interaction.Output.OutputForm a b) module Agda.Mimer.Options type MilliSeconds = Integer data HintMode Unqualified :: HintMode AllModules :: HintMode Module :: HintMode NoHints :: HintMode data Options Options :: MilliSeconds -> HintMode -> Int -> Bool -> [QName] -> Options [optTimeout] :: Options -> MilliSeconds [optHintMode] :: Options -> HintMode -- | Skip the first this many solutions [optSkip] :: Options -> Int -- | List solutions instead of filling the hole [optList] :: Options -> Bool [optExplicitHints] :: Options -> [QName] parseOptions :: InteractionId -> Range -> String -> TCM Options parseTime :: String -> Int hintExprToQName :: Expr -> Maybe QName firstOr :: a -> [a] -> a data Token T :: String -> Token M :: Token U :: Token C :: Token L :: Token S :: String -> Token H :: String -> Token readTokens :: [String] -> [Token] instance GHC.Internal.Classes.Eq Agda.Mimer.Options.HintMode instance GHC.Internal.Classes.Eq Agda.Mimer.Options.Token instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Options.HintMode instance GHC.Internal.Show.Show Agda.Mimer.Options.HintMode instance GHC.Internal.Show.Show Agda.Mimer.Options.Options instance GHC.Internal.Show.Show Agda.Mimer.Options.Token module Agda.Mimer.Types data MimerResult -- | Returns String rather than Expr because the give action -- expects a string. MimerExpr :: String -> MimerResult MimerList :: [(Int, String)] -> MimerResult MimerNoResult :: MimerResult isNoResult :: MimerResult -> Bool data SearchStepResult ResultExpr :: Expr -> SearchStepResult OpenBranch :: SearchBranch -> SearchStepResult NoSolution :: SearchStepResult data SearchBranch SearchBranch :: TCState -> [Goal] -> Int -> Map CheckpointId ComponentCache -> Map Name Int -> SearchBranch [sbTCState] :: SearchBranch -> TCState [sbGoals] :: SearchBranch -> [Goal] [sbCost] :: SearchBranch -> Int [sbCache] :: SearchBranch -> Map CheckpointId ComponentCache -- | Number of times each component has been used [sbComponentsUsed] :: SearchBranch -> Map Name Int data Goal Goal :: MetaId -> Goal [goalMeta] :: Goal -> MetaId -- | Take the first goal off a search branch. Precondition: the set of -- goals is non-empty. nextGoal :: SearchBranch -> (Goal, SearchBranch) type ComponentCache = Map Component Maybe [Component] -- | Components that are not changed during search. Components that do -- change (local variables and let bindings) are stored in each -- SearchBranch. data BaseComponents BaseComponents :: [Component] -> [Component] -> [Component] -> [Component] -> [Component] -> [Component] -> Maybe Component -> [Component] -> [Open Component] -> Open [(Term, NoSubst Term Int)] -> BaseComponents [hintFns] :: BaseComponents -> [Component] [hintDataTypes] :: BaseComponents -> [Component] [hintRecordTypes] :: BaseComponents -> [Component] -- | Excluding those producing Level [hintAxioms] :: BaseComponents -> [Component] -- | A definition in a where clause [hintLevel] :: BaseComponents -> [Component] -- | Variables that are candidates for arguments to recursive calls [hintProjections] :: BaseComponents -> [Component] [hintThisFn] :: BaseComponents -> Maybe Component -- | Functions mutually defined with the one we are defining (#8783). [hintMutualFns] :: BaseComponents -> [Component] [hintLetVars] :: BaseComponents -> [Open Component] -- | Variable terms and which argument they come from [hintRecVars] :: BaseComponents -> Open [(Term, NoSubst Term Int)] type CompId = Int data Component Component :: CompId -> Maybe Name -> Nat -> Term -> Type -> RecCall -> [MetaId] -> Cost -> Component -- | Unique id for the component. Used for the cache. [compId] :: Component -> CompId -- | Used for keeping track of how many times a component has been used [compName] :: Component -> Maybe Name -- | How many arguments should be dropped (e.g. constructor parameters) [compPars] :: Component -> Nat [compTerm] :: Component -> Term [compType] :: Component -> Type -- | Is this a (mutually) recursive call? [compRec] :: Component -> RecCall [compMetas] :: Component -> [MetaId] [compCost] :: Component -> Cost -- | Is a component a call to the function we are defining or a function -- mutually defined with it? Such calls are only generated with -- structurally smaller arguments. data RecCall -- | Not a recursive call. NotRecCall :: RecCall -- | Recursive call to the function we are defining. An argument needs to -- be structurally smaller than the parameter in the same position. SelfCall :: RecCall -- | Call to a function mutually defined with the one we are defining -- (#8783). As arguments of different functions need not correspond by -- position, we accept any structurally smaller variable in any position. MutualCall :: RecCall mkComponent :: CompId -> [MetaId] -> Cost -> Maybe Name -> Nat -> Term -> Type -> Component mkComponentQ :: CompId -> Cost -> QName -> Nat -> Term -> Type -> Component noName :: Maybe Name addCost :: Cost -> Component -> Component deleteCompMeta :: MetaId -> Component -> Component data SearchOptions SearchOptions :: BaseComponents -> HintMode -> MilliSeconds -> Bool -> Bool -> Bool -> Bool -> Bool -> MetaId -> TCEnv -> CheckpointId -> ProblemId -> InteractionId -> Maybe QName -> Costs -> IORef MimerStats -> Rewrite -> Maybe QName -> SearchOptions [searchBaseComponents] :: SearchOptions -> BaseComponents [searchHintMode] :: SearchOptions -> HintMode [searchTimeout] :: SearchOptions -> MilliSeconds [searchGenProjectionsLocal] :: SearchOptions -> Bool [searchGenProjectionsLet] :: SearchOptions -> Bool [searchGenProjectionsExternal] :: SearchOptions -> Bool [searchGenProjectionsRec] :: SearchOptions -> Bool [searchSpeculateProjections] :: SearchOptions -> Bool [searchTopMeta] :: SearchOptions -> MetaId [searchTopEnv] :: SearchOptions -> TCEnv [searchTopCheckpoint] :: SearchOptions -> CheckpointId -- | Constraints postponed during search are tagged with this problem. A -- branch is only a solution once all of them are solved. [searchProblem] :: SearchOptions -> ProblemId [searchInteractionId] :: SearchOptions -> InteractionId [searchFnName] :: SearchOptions -> Maybe QName [searchCosts] :: SearchOptions -> Costs [searchStats] :: SearchOptions -> IORef MimerStats [searchRewrite] :: SearchOptions -> Rewrite [searchBuiltinFlat] :: SearchOptions -> Maybe QName type Cost = Int data Costs Costs :: Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> Cost -> (Nat -> Cost) -> Costs [costLocal] :: Costs -> Cost [costFn] :: Costs -> Cost [costDataCon] :: Costs -> Cost [costRecordCon] :: Costs -> Cost [costSpeculateProj] :: Costs -> Cost [costProj] :: Costs -> Cost [costAxiom] :: Costs -> Cost [costLet] :: Costs -> Cost [costLevel] :: Costs -> Cost [costSet] :: Costs -> Cost [costRecCall] :: Costs -> Cost -- | Cost of a new meta-variable appearing in a non-implicit position [costNewMeta] :: Costs -> Cost -- | Cost of a new meta-variable appearing in an implicit position [costNewHiddenMeta] :: Costs -> Cost -- | Cost of reusing a component n times. Only counted when -- n>1. [costCompReuse] :: Costs -> Nat -> Cost noCost :: Cost defaultCosts :: Costs data MimerStats MimerStats :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> MimerStats -- | Could make use of an already generated component [statCompHit] :: MimerStats -> Int -- | Could use a generator for a component [statCompGen] :: MimerStats -> Int -- | Had to regenerate the cache (new context) [statCompRegen] :: MimerStats -> Int -- | Did not have to regenerate the cache [statCompNoRegen] :: MimerStats -> Int -- | Total number of meta-variables created explicitly (not through -- unification) [statMetasCreated] :: MimerStats -> Int -- | Number of times type equality is tested (with unification) [statTypeEqChecks] :: MimerStats -> Int -- | Number of times a refinement has been successful [statRefineSuccess] :: MimerStats -> Int -- | Number of times a refinement has failed [statRefineFail] :: MimerStats -> Int emptyMimerStats :: MimerStats incCompHit :: MimerStats -> MimerStats incCompGen :: MimerStats -> MimerStats incCompRegen :: MimerStats -> MimerStats incCompNoRegen :: MimerStats -> MimerStats incMetasCreated :: MimerStats -> MimerStats incTypeEqChecks :: MimerStats -> MimerStats incRefineSuccess :: MimerStats -> MimerStats incRefineFail :: MimerStats -> MimerStats haskellRecord :: Doc -> [(Doc, Doc)] -> Doc keyValueList :: [(Doc, Doc)] -> Doc instance GHC.Internal.Classes.Eq Agda.Mimer.Types.Component instance GHC.Internal.Classes.Eq Agda.Mimer.Types.Goal instance GHC.Internal.Classes.Eq Agda.Mimer.Types.MimerStats instance GHC.Internal.Classes.Eq Agda.Mimer.Types.RecCall instance GHC.Internal.Classes.Eq Agda.Mimer.Types.SearchBranch instance GHC.Internal.Generics.Generic Agda.Mimer.Types.BaseComponents instance GHC.Internal.Generics.Generic Agda.Mimer.Types.Component instance GHC.Internal.Generics.Generic Agda.Mimer.Types.Goal instance GHC.Internal.Generics.Generic Agda.Mimer.Types.MimerResult instance GHC.Internal.Generics.Generic Agda.Mimer.Types.MimerStats instance GHC.Internal.Generics.Generic Agda.Mimer.Types.RecCall instance GHC.Internal.Generics.Generic Agda.Mimer.Types.SearchBranch instance GHC.Internal.Generics.Generic Agda.Mimer.Types.SearchStepResult instance Control.DeepSeq.NFData Agda.Mimer.Types.BaseComponents instance Control.DeepSeq.NFData Agda.Mimer.Types.Component instance Control.DeepSeq.NFData Agda.Mimer.Types.Goal instance Control.DeepSeq.NFData Agda.Mimer.Types.MimerResult instance Control.DeepSeq.NFData Agda.Mimer.Types.MimerStats instance Control.DeepSeq.NFData Agda.Mimer.Types.RecCall instance Control.DeepSeq.NFData Agda.Mimer.Types.SearchBranch instance Control.DeepSeq.NFData Agda.Mimer.Types.SearchStepResult instance GHC.Internal.Classes.Ord Agda.Mimer.Types.Component instance GHC.Internal.Classes.Ord Agda.Mimer.Types.SearchBranch instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Types.BaseComponents instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Types.Component instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Types.Costs instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Types.Goal instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Types.SearchBranch instance Agda.Syntax.Common.Pretty.Pretty Agda.Mimer.Types.SearchOptions instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Mimer.Types.BaseComponents instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Mimer.Types.Component instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Mimer.Types.MimerResult instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Mimer.Types.SearchOptions instance GHC.Internal.Show.Show Agda.Mimer.Types.MimerStats instance GHC.Internal.Show.Show Agda.Mimer.Types.RecCall module Agda.Mimer.Monad type SM a = ReaderT SearchOptions TCM a getRecordFields :: HasConstInfo tcm => QName -> tcm [QName] getRecordInfo :: (MonadTCM tcm, HasConstInfo tcm) => Type -> tcm (Maybe (QName, Args, [QName], Bool)) allOpenMetas :: (AllMetas t, ReadTCState tcm) => t -> tcm [MetaId] assignMeta :: MetaId -> Term -> Type -> SM () getLocalVarTerms :: Int -> TCM [(Term, Dom Type)] getMetaInstantiation :: (MonadTCM tcm, PureTCM tcm, MonadInteractionPoints tcm, MonadFresh NameId tcm) => MetaId -> tcm (Maybe Expr) metaInstantiation :: (MonadDebug tcm, ReadTCState tcm) => MetaId -> tcm (Maybe Term) isTypeDatatype :: MonadTCM tcm => Type -> tcm Bool -- | Is an element of the given type computing a level? -- -- The returned checker is only sound but not complete because the type -- is taken as-is rather than being reduced. endsInLevelTester :: TCM (Type -> Bool) -- | From the scope of the given meta variable, extract all names in scope -- that we could use during synthesis. (This excludes macros, -- generalizable variables, pattern synonyms.) getEverythingInScope :: MetaVariable -> [QName] applyToMetas :: Nat -> Term -> Type -> TCM (Term, Type, [MetaId]) localVarCount :: SM Int getOpenComponent :: (MonadTCM tcm, MonadDebug tcm) => Open Component -> tcm Component newComponent :: MonadFresh CompId m => [MetaId] -> Cost -> Maybe Name -> Nat -> Term -> Type -> m Component newComponentQ :: MonadFresh CompId m => [MetaId] -> Cost -> QName -> Nat -> Term -> Type -> m Component getLocalVars :: Int -> Cost -> TCM [Component] -- | NOTE: Collects components from the *current* context, not the context -- of the InteractionId. collectComponents :: Options -> Costs -> InteractionId -> Maybe QName -> [QName] -> MetaId -> TCM BaseComponents qnameToComponent :: (HasConstInfo tcm, ReadTCState tcm, MonadFresh CompId tcm) => Cost -> QName -> tcm Component -- | Turn the let bindings of the current TCEnv into components. getLetVars :: (MonadFresh CompId tcm, MonadTCM tcm) => Cost -> tcm [Open Component] -- | Returns the variables as terms together with whether they where found -- under some constructor, and if so which argument of the function they -- appeared in. This information is used when building recursive calls, -- where it's important that we don't try to construct non-terminating -- solutions. collectLHSVars :: (ReadTCState tcm, MonadError TCErr tcm, MonadTCM tcm, HasConstInfo tcm) => InteractionId -> tcm (Open [(Term, Maybe Int)]) declarationQnames :: Declaration -> [QName] applyProj :: Args -> Component -> QName -> SM Component applyToMetasG :: Maybe Nat -> Component -> SM Component createMeta :: Type -> SM (MetaId, Term) startSearchBranch :: [MetaId] -> TCM SearchBranch withBranchState :: SearchBranch -> SM a -> SM a withBranchAndGoal :: SearchBranch -> Goal -> SM a -> SM a inGoalEnv :: Goal -> SM a -> SM a updateBranch' :: Maybe Component -> [MetaId] -> SearchBranch -> SM SearchBranch updateBranch :: [MetaId] -> SearchBranch -> SM SearchBranch updateBranchCost :: Component -> [MetaId] -> SearchBranch -> SM SearchBranch checkSolved :: SearchBranch -> SM SearchStepResult normaliseSolution :: Term -> SM Term partitionStepResult :: [SearchStepResult] -> SM ([SearchBranch], [MimerResult]) makeSearchOptions :: Rewrite -> Options -> InteractionId -> TCM SearchOptions -- | Unify the type of a candidate with the goal type. -- -- Constraints that cannot be solved yet, e.g. f ?n = f n -- blocked on meta ?n which is a subgoal of the candidate, are -- postponed under the search problem (see searchProblem). They -- are woken up when their blocking metas are solved, and -- checkSolved only accepts a branch once they are gone. dumbUnifier :: Type -> Type -> SM () -- | Solve constraints woken up by meta assignments. Throws an error if one -- of them turns out to be unsolvable. solveSearchConstraints :: SM () -- | Are all constraints solved that were postponed during search? searchConstraintsSolved :: SM Bool reportSMDoc :: VerboseKey -> VerboseLevel -> SM Doc -> SM () mimerTrace :: Int -> VerboseLevel -> SM Doc -> SM () topInstantiationDoc :: SM Doc prettyGoalInst :: Goal -> SM Doc branchInstantiationDocCost :: SearchBranch -> SM Doc -- | For debug branchInstantiationDoc :: SearchBranch -> SM Doc prettyBranch :: SearchBranch -> SM String customCosts :: TCM Costs updateStat :: (MimerStats -> MimerStats) -> SM () bench :: [Phase] -> SM a -> SM a writeTime :: (ReadTCState m, MonadError TCErr m, MonadTCM m, MonadDebug m) => InteractionId -> CPUTime -> m () -- | This module contains the implementation of Mimer, the current -- implementation of the auto interactive command (C-c C-a) and the -- successor of Agsy. -- -- The overall idea is that Mimer gathers a collection of "components" -- that it could use for building a solution and tries to refine the goal -- iteratively using these components. Components include global -- definitions, local variables, let-bound variables, and recursive calls -- to the function being defined. -- -- Mimer manages multiple branches of the search at the same time and -- assigns a cost to each branch, which is the sum of the costs of all -- its components. The cost of a component in turn is determined by its -- type and the number of new metas it introduces. -- -- A branch can be refined by picking one of its unsolved metavariables -- and refining it with all available components, resulting in a number -- of new branches (each one with a higher cost than the original). -- -- Mimer iteratively refines the branch with the lowest cost until it -- finds a solution or runs out of time. module Agda.Mimer.Mimer data MimerResult -- | Returns String rather than Expr because the give action -- expects a string. MimerExpr :: String -> MimerResult MimerList :: [(Int, String)] -> MimerResult MimerNoResult :: MimerResult -- | Entry point. Run Mimer on the given interaction point, returning the -- desired solution(s). Also debug prints timing statistics. mimer :: MonadTCM tcm => Rewrite -> InteractionId -> Range -> String -> tcm MimerResult module Agda.Interaction.SearchAbout findMentions :: Rewrite -> Range -> String -> ScopeM [(Name, Type)] -- | This module deals with finding imported modules and loading their -- interface files. module Agda.Interaction.Imports -- | Is the aim to type-check the top-level module, or only to scope-check -- it? data Mode pattern ScopeCheck :: () => Mode pattern TypeCheck :: () => Mode -- | The result and associated parameters of a type-checked file, when -- invoked directly via interaction or a backend. Note that the -- constructor is not exported. data CheckResult -- | Flattened unidirectional pattern for CheckResult for -- destructuring inside the ModuleInfo field. pattern CheckResult :: Interface -> Set TCWarning -> ModuleCheckMode -> Source -> CheckResult crModuleInfo :: CheckResult -> ModuleInfo crInterface :: CheckResult -> Interface crWarnings :: CheckResult -> Set TCWarning crMode :: CheckResult -> ModuleCheckMode crSource :: CheckResult -> Source -- | The decorated source code. data Source Source :: Text -> FileType -> SourceFile -> Module -> TopLevelModuleName -> [AgdaLibFile] -> Attributes -> Source -- | Source code. [srcText] :: Source -> Text -- | Source file type [srcFileType] :: Source -> FileType -- | Source location at the time of its parsing [srcOrigin] :: Source -> SourceFile -- | The parsed module. [srcModule] :: Source -> Module -- | The top-level module name. [srcModuleName] :: Source -> TopLevelModuleName -- | The .agda-lib file(s) of the project this file belongs to. [srcProjectLibs] :: Source -> [AgdaLibFile] -- | Every encountered attribute. [srcAttributes] :: Source -> Attributes -- | Scope checks the given module, generating an interface or retrieving -- an existing one. Returns the module name and exported scope from the -- interface. scopeCheckFileImport :: TopLevelModuleName -> TCM (ModuleName, Map ModuleName Scope) -- | Parses a source file and prepares the Source record. parseSource :: SourceFile -> TCM Source -- | Type checks the main file of the interaction. This could be the file -- loaded in the interacting editor (emacs), or the file passed on the -- command line. -- -- First, the primitive modules are imported. Then, getInterface -- is called to do the main work. -- -- If the Mode is ScopeCheck, then type-checking is not -- performed, only scope-checking. (This may include type-checking of -- imported modules.) In this case the generated, partial interface is -- not stored in the state (stDecodedModules). Note, however, that -- if the file has already been type-checked, then a complete interface -- is returned. typeCheckMain :: Mode -> Source -> TCM CheckResult -- | Tries to return the interface associated to the given (imported) -- module. The time stamp of the relevant interface file is also -- returned. Calls itself recursively for the imports of the given -- module. May type check the module. An error is raised if a warning is -- encountered. -- -- Do not use this for the main file, use typeCheckMain instead. getNonMainInterface :: TopLevelModuleName -> Maybe Source -> TCM Interface getNonMainModuleInfo :: TopLevelModuleName -> Maybe Source -> TCM ModuleInfo -- | If the module has already been visited (without warnings), then its -- interface is returned directly. -- -- Otherwise the interface is loaded via getStoredInterface. -- -- If that fails it is created via createInterface or, for -- non-main modules, createInterfaceIsolated. A such created -- interface is stored for potential later use. getInterface :: TopLevelModuleName -> MainInterface -> Maybe Source -> TCM ModuleInfo -- | Import the primitive modules (unless --no-load-primitives). importPrimitiveModules :: TCM () -- | If checking produced non-benign warnings, error out. raiseNonFatalErrors :: (HasOptions m, MonadTCError m) => CheckResult -> m () -- | Are we loading the interface for the user-loaded file or for an -- import? data MainInterface -- | For the main file. -- -- In this case state changes inflicted by createInterface are -- preserved. MainInterface :: Mode -> MainInterface -- | For an imported file. -- -- In this case state changes inflicted by createInterface are not -- preserved. NotMainInterface :: MainInterface -- | Structure necessary for synchronising parallel type-checking workers. data TCWorkers -- | If the user has asked for it, prepare the type checker for loading in -- parallel, and return a TCWorkers instance that can be used to -- coordinate a number of type-checking tasks. -- -- The given module name, when encountered, will be treated as the -- MainInterface. wantsParallelChecking :: TCM (Maybe TCWorkers) -- | Type-check the given module, using a TCWorkers instance to -- check its imports in parallel. -- -- Returns an action which *waits* for completion of type-checking of the -- given module. Note that the given action updates the -- DecodedModules in the TC state where it is called to the -- current results of parallel type-checking. The state after running -- this action is guaranteed to contain a DecodedModule for the -- given TopLevelModuleName. -- -- If the given MainInterface indicates that we are checking the -- main module, its checking will happen in the calling thread, and in -- the calling TC state. Otherwise, a thread (with isolated TC state) is -- created to check it. -- -- Regardless of whether we spawned a new thread or not, checking of the -- given module will block until all of its imports have been checked. chaseModule :: TCWorkers -> TopLevelModuleName -> MainInterface -> Maybe Source -> TCM (TCM ModuleInfo) -- | Set options from a Source pragma, using the source ranges of -- the pragmas for error reporting. Flag to check consistency. setOptionsFromSourcePragmas :: Bool -> Source -> TCM () -- | Read interface file corresponding to a module. readInterface :: InterfaceFile -> TCM (Maybe Interface) instance GHC.Internal.Classes.Eq Agda.Interaction.Imports.MainInterface instance GHC.Internal.Classes.Eq Agda.Interaction.Imports.Mode instance GHC.Internal.Show.Show Agda.Interaction.Imports.MainInterface instance GHC.Internal.Show.Show Agda.Interaction.Imports.Mode module Agda.Interaction.CommandLine runInteractionLoop :: Maybe AbsolutePath -> TCM () -> (AbsolutePath -> TCM CheckResult) -> TCM () instance GHC.Internal.Base.Applicative Agda.Interaction.CommandLine.ReplM instance GHC.Internal.Base.Functor Agda.Interaction.CommandLine.ReplM instance Agda.Interaction.Options.HasOptions.HasOptions Agda.Interaction.CommandLine.ReplM instance Control.Monad.Error.Class.MonadError Agda.TypeChecking.Monad.Base.TCErr Agda.Interaction.CommandLine.ReplM instance Agda.Utils.FileId.MonadFileId Agda.Interaction.CommandLine.ReplM instance GHC.Internal.Control.Monad.IO.Class.MonadIO Agda.Interaction.CommandLine.ReplM instance Control.Monad.Reader.Class.MonadReader Agda.Interaction.CommandLine.ReplEnv Agda.Interaction.CommandLine.ReplM instance GHC.Internal.Base.Monad Agda.Interaction.CommandLine.ReplM instance Control.Monad.State.Class.MonadState Agda.Interaction.CommandLine.ReplState Agda.Interaction.CommandLine.ReplM instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.Interaction.CommandLine.ReplM instance Agda.TypeChecking.Monad.Base.MonadTCM Agda.Interaction.CommandLine.ReplM instance Agda.TypeChecking.Monad.Base.MonadTCState Agda.Interaction.CommandLine.ReplM instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.Interaction.CommandLine.ReplM -- | Type-check all files of a library (option --build-library). module Agda.Interaction.BuildLibrary -- | Find .agda-lib file from current directory and build all -- modules located in the include paths and their subdirectories -- of the library. buildLibrary :: TCM () printAccumulatedWarnings :: TCM () module Agda.Compiler.Common compileDir :: HasOptions m => m FilePath curDefs :: ReadTCState m => m Definitions curIF :: ReadTCState m => m Interface curMName :: ReadTCState m => m TopLevelModuleName doCompile :: Monoid r => (IsMain -> Interface -> TCM r) -> IsMain -> Interface -> TCM r doCompile' :: Monoid r => (IsMain -> Interface -> TCM r) -> IsMain -> Interface -> StateT (Set ModuleName) TCM r -- | Sets up the compilation environment. inCompilerEnv :: CheckResult -> TCM a -> TCM a repl :: [String] -> String -> String setInterface :: Interface -> TCM () sortDefs :: Definitions -> [(QName, Definition)] topLevelModuleName :: ReadTCState m => ModuleName -> m TopLevelModuleName data IsMain IsMain :: IsMain NotMain :: IsMain module Agda.Compiler.MAlonzo.Misc data HsModuleEnv HsModuleEnv :: TopLevelModuleName -> Bool -> HsModuleEnv -- | The name of the Agda module [mazModuleName] :: HsModuleEnv -> TopLevelModuleName -- | Whether this is the compilation root and therefore should have the -- main function. This corresponds to the IsMain flag -- provided to the backend, not necessarily whether the GHC module has a -- main function defined. [mazIsMainModule] :: HsModuleEnv -> Bool -- | The options derived from GHCFlags and other shared options. data GHCOptions GHCOptions :: Bool -> FilePath -> [String] -> FilePath -> Bool -> Bool -> Bool -> GHCOptions [optGhcCallGhc] :: GHCOptions -> Bool -- | Use the compiler at PATH instead of "ghc" [optGhcBin] :: GHCOptions -> FilePath [optGhcFlags] :: GHCOptions -> [String] [optGhcCompileDir] :: GHCOptions -> FilePath -- | Make inductive constructors strict? [optGhcStrictData] :: GHCOptions -> Bool -- | Make functions strict? [optGhcStrict] :: GHCOptions -> Bool -- | Print function name upon entry using trace? [optGhcTrace] :: GHCOptions -> Bool -- | A static part of the GHC backend's environment that does not change -- from module to module. data GHCEnv GHCEnv :: GHCOptions -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> Maybe QName -> (QName -> Bool) -> Maybe Int -> Maybe Int -> GHCEnv [ghcEnvOpts] :: GHCEnv -> GHCOptions [ghcEnvBool] :: GHCEnv -> Maybe QName [ghcEnvTrue] :: GHCEnv -> Maybe QName [ghcEnvFalse] :: GHCEnv -> Maybe QName [ghcEnvMaybe] :: GHCEnv -> Maybe QName [ghcEnvNothing] :: GHCEnv -> Maybe QName [ghcEnvJust] :: GHCEnv -> Maybe QName [ghcEnvList] :: GHCEnv -> Maybe QName [ghcEnvNil] :: GHCEnv -> Maybe QName [ghcEnvCons] :: GHCEnv -> Maybe QName [ghcEnvNat] :: GHCEnv -> Maybe QName [ghcEnvInteger] :: GHCEnv -> Maybe QName [ghcEnvWord64] :: GHCEnv -> Maybe QName [ghcEnvInf] :: GHCEnv -> Maybe QName [ghcEnvSharp] :: GHCEnv -> Maybe QName [ghcEnvFlat] :: GHCEnv -> Maybe QName [ghcEnvInterval] :: GHCEnv -> Maybe QName [ghcEnvIZero] :: GHCEnv -> Maybe QName [ghcEnvIOne] :: GHCEnv -> Maybe QName [ghcEnvIsOne] :: GHCEnv -> Maybe QName [ghcEnvItIsOne] :: GHCEnv -> Maybe QName [ghcEnvIsOne1] :: GHCEnv -> Maybe QName [ghcEnvIsOne2] :: GHCEnv -> Maybe QName [ghcEnvIsOneEmpty] :: GHCEnv -> Maybe QName [ghcEnvPathP] :: GHCEnv -> Maybe QName [ghcEnvSub] :: GHCEnv -> Maybe QName [ghcEnvSubIn] :: GHCEnv -> Maybe QName [ghcEnvIsTCBuiltin] :: GHCEnv -> QName -> Bool [ghcEnvListArity] :: GHCEnv -> Maybe Int [ghcEnvMaybeArity] :: GHCEnv -> Maybe Int -- | Module compilation environment, bundling the overall backend session -- options along with the module's basic readable properties. data GHCModuleEnv GHCModuleEnv :: GHCEnv -> HsModuleEnv -> GHCModuleEnv [ghcModEnv] :: GHCModuleEnv -> GHCEnv [ghcModHsModuleEnv] :: GHCModuleEnv -> HsModuleEnv -- | Monads that can produce a GHCModuleEnv. class Monad m => ReadGHCModuleEnv (m :: Type -> Type) askGHCModuleEnv :: ReadGHCModuleEnv m => m GHCModuleEnv ($dmaskGHCModuleEnv) :: forall (t :: (Type -> Type) -> Type -> Type) (n :: Type -> Type). (ReadGHCModuleEnv m, MonadTrans t, m ~ t n, ReadGHCModuleEnv n) => m GHCModuleEnv askHsModuleEnv :: ReadGHCModuleEnv m => m HsModuleEnv askGHCEnv :: ReadGHCModuleEnv m => m GHCEnv newtype HsCompileState HsCompileState :: Set TopLevelModuleName -> HsCompileState [mazAccumlatedImports] :: HsCompileState -> Set TopLevelModuleName -- | Transformer adding read-only module info and a writable set of -- imported modules type HsCompileT (m :: Type -> Type) = ReaderT GHCModuleEnv StateT HsCompileState m -- | The default compilation monad is the entire TCM (☹️) enriched with our -- state and module info type HsCompileM = HsCompileT TCM runHsCompileT' :: HsCompileT m a -> GHCModuleEnv -> HsCompileState -> m (a, HsCompileState) runHsCompileT :: HsCompileT m a -> GHCModuleEnv -> m (a, HsCompileState) ghcBackendError :: (HasCallStack, MonadTCError m) => GHCBackendError -> m a -- | Whether the current module is expected to have the main -- function. This corresponds to the IsMain flag provided to the -- backend, not necessarily whether the GHC module actually has a -- main function defined. curIsMainModule :: ReadGHCModuleEnv m => m Bool -- | This is the same value as curMName, but does not rely on the -- TCM's state. (curMName and co. should be removed, but the -- current Backend interface is not sufficient yet to allow -- that) curAgdaMod :: ReadGHCModuleEnv m => m TopLevelModuleName -- | Get the Haskell module name of the currently-focused Agda module curHsMod :: ReadGHCModuleEnv m => m ModuleName -- | There are two kinds of functions: those definitely without unused -- arguments, and those that might have unused arguments. data FunctionKind NoUnused :: FunctionKind PossiblyUnused :: FunctionKind -- | Different kinds of variables: those starting with a, those -- starting with v, and those starting with x. data VariableKind A :: VariableKind V :: VariableKind X :: VariableKind -- | Different kinds of names. data NameKind -- | Types. TypeK :: NameKind -- | Constructors. ConK :: NameKind -- | Variables. VarK :: VariableKind -> NameKind -- | Used for coverage checking. CoverK :: NameKind -- | Used for constructor type checking. CheckK :: NameKind -- | Other functions. FunK :: FunctionKind -> NameKind -- | Turns strings into valid Haskell identifiers. -- -- In order to avoid clashes with names of regular Haskell definitions -- (those not generated from Agda definitions), make sure that the -- Haskell names are always used qualified, with the exception of names -- from the prelude. encodeString :: NameKind -> String -> String ihname :: VariableKind -> Nat -> Name unqhname :: NameKind -> QName -> Name tlmodOf :: ReadTCState m => ModuleName -> m ModuleName xqual :: QName -> Name -> HsCompileM QName xhqn :: NameKind -> QName -> HsCompileM QName hsName :: String -> QName conhqn :: QName -> HsCompileM QName bltQual :: BuiltinId -> String -> HsCompileM QName dname :: QName -> Name -- | Name for definition stripped of unused arguments duname :: QName -> Name hsPrimOp :: String -> QOp hsPrimOpApp :: String -> Exp -> Exp -> Exp hsInt :: Integer -> Exp hsTypedInt :: Integral a => a -> Exp hsTypedDouble :: Real a => a -> Exp hsLet :: Strictness -> Name -> Exp -> Exp -> Exp hsVarUQ :: Name -> Exp hsAppView :: Exp -> [Exp] hsOpToExp :: QOp -> Exp hsLambda :: [Pat] -> Exp -> Exp hsMapAlt :: (Exp -> Exp) -> Alt -> Alt hsMapRHS :: (Exp -> Exp) -> Rhs -> Rhs mazstr :: String mazName :: Name mazMod' :: String -> ModuleName mazMod :: TopLevelModuleName -> ModuleName mazCoerceName :: String mazErasedName :: String mazAnyTypeName :: String mazCoerce :: Exp mazUnreachableError :: Exp rtmUnreachableError :: Exp mazHole :: Exp rtmHole :: String -> Exp mazAnyType :: Type mazRTE :: ModuleName mazRTEFloat :: ModuleName rtmQual :: String -> QName rtmVar :: String -> Exp rtmError :: Text -> Exp unsafeCoerceMod :: ModuleName fakeD :: Name -> String -> Decl fakeDS :: String -> String -> Decl fakeDQ :: QName -> String -> Decl fakeType :: String -> Type fakeExp :: String -> Exp fakeDecl :: String -> Decl emptyBinds :: Maybe Binds -- | Can the character be used in a Haskell module name part -- (conid)? This function is more restrictive than what the -- Haskell report allows. isModChar :: Char -> Bool instance GHC.Internal.Classes.Eq Agda.Compiler.MAlonzo.Misc.HsCompileState instance GHC.Internal.Base.Monoid Agda.Compiler.MAlonzo.Misc.HsCompileState instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Except.ExceptT e m) instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Identity.IdentityT m) instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Maybe.MaybeT m) instance GHC.Internal.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCModuleEnv m) instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.State.Lazy.StateT s m) instance GHC.Internal.Base.Semigroup Agda.Compiler.MAlonzo.Misc.HsCompileState module Agda.Compiler.MAlonzo.Primitives newtype MainFunctionDef MainFunctionDef :: Definition -> MainFunctionDef data CheckedMainFunctionDef CheckedMainFunctionDef :: MainFunctionDef -> Decl -> CheckedMainFunctionDef [checkedMainDef] :: CheckedMainFunctionDef -> MainFunctionDef [checkedMainDecl] :: CheckedMainFunctionDef -> Decl asMainFunctionDef :: Definition -> Maybe MainFunctionDef mainFunctionDefs :: Interface -> [MainFunctionDef] -- | Check that the main function has type IO a, for some a. checkTypeOfMain :: Definition -> HsCompileM (Maybe CheckedMainFunctionDef) checkTypeOfMain' :: MainFunctionDef -> TCM CheckedMainFunctionDef -- | These builtins need a qualified import of Data.Char. charBuiltins :: [SomeBuiltin] -- | These builtins need a qualified import of MAlonzo.RTE.Float. floatBuiltins :: [SomeBuiltin] -- | Which builtins are actually used in the definitions? usedBuiltins :: BuiltinThings -> [Definition] -> Set SomeBuiltin treelessPrimName :: TPrim -> String -- | Definition bodies for primitive functions primBody :: MonadTCError m => PrimitiveId -> m Exp noCheckCover :: (HasBuiltins m, MonadReduce m) => QName -> m Bool module Agda.Compiler.MAlonzo.Pragmas -- | Raw Haskell pragma (something enclosed in {-# ... #-}). type GHCPragma = String -- | Raw Haskell import (something starting with import ). type GHCImport = String type HaskellCode = String type HaskellType = String -- | GHC backend translation pragmas. data HaskellPragma HsDefn :: Range -> HaskellCode -> HaskellPragma HsType :: Range -> HaskellType -> HaskellPragma -- | @COMPILE GHC X = data D (c₁ | ... | cₙ) HsData :: Range -> HaskellType -> [HaskellCode] -> HaskellPragma -- |
--   COMPILE GHC x as f
--   
HsExport :: Range -> HaskellCode -> HaskellPragma -- | Retrieve and parse a COMPILE GHC pragma stored for a name. getHaskellPragma :: QName -> TCM (Maybe HaskellPragma) parsePragma :: CompilerPragma -> Maybe HaskellPragma parseHaskellPragma :: CompilerPragma -> TCM (Maybe HaskellPragma) -- | Check whether the parsed COMPILE GHC pragma matches the kind -- of identifier it attaches to. sanityCheckPragma :: QName -> HaskellPragma -> TCM (Maybe HaskellPragma) getHaskellConstructor :: QName -> HsCompileM (Maybe HaskellCode) -- | Get content of FOREIGN GHC pragmas, sorted by -- KindOfForeignCode: file header pragmas, import statements, -- rest. foreignHaskell :: Interface -> (Set GHCPragma, Set GHCImport, [HaskellCode]) -- | Classify FOREIGN Haskell code. data KindOfForeignCode -- | A pragma that must appear before the module header. ForeignFileHeaderPragma :: KindOfForeignCode -- | An import statement. Must appear right after the module header. ForeignImport :: KindOfForeignCode -- | The rest. To appear after the import statements. ForeignOther :: KindOfForeignCode -- | Classify a FOREIGN GHC declaration. classifyForeign :: String -> KindOfForeignCode -- | Classify a Haskell pragma into whether it is a file header pragma or -- not. classifyPragma :: String -> KindOfForeignCode -- | Partition a list by KindOfForeignCode attribute. partitionByKindOfForeignCode :: (a -> KindOfForeignCode) -> [a] -> ([a], [a], [a]) instance GHC.Internal.Classes.Eq Agda.Compiler.MAlonzo.Pragmas.HaskellPragma instance Agda.Syntax.Position.HasRange Agda.Compiler.MAlonzo.Pragmas.HaskellPragma instance Agda.Syntax.Common.Pretty.Pretty Agda.Compiler.MAlonzo.Pragmas.HaskellPragma instance GHC.Internal.Show.Show Agda.Compiler.MAlonzo.Pragmas.HaskellPragma module Agda.Compiler.MAlonzo.Encode -- | Haskell module names have to satisfy the Haskell (including the -- hierarchical module namespace extension) lexical syntax: -- --
--   modid -> [modid.] large {small | large | digit | ' }
--   
-- -- encodeModuleName is an injective function into the set of -- module names defined by modid. The function preserves -- .s, and it also preserves module names whose first name part -- is not mazstr. -- -- Precondition: The input must not start or end with ., and no -- two .s may be adjacent. encodeModuleName :: ModuleName -> ModuleName module Agda.Compiler.MAlonzo.Pretty prettyPrint :: Pretty a => a -> String prettyWhere :: Maybe Binds -> Doc -> Doc prettyRhs :: String -> Rhs -> Doc prettyGuardedRhs :: String -> GuardedRhs -> Doc isOperator :: QName -> Bool prettyQName :: QName -> Doc instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Alt instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Binds instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.ConDecl instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.DataOrNew instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Decl instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Exp instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.ImportDecl instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.ImportSpec instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Literal instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Match instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Module instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.ModuleName instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.ModulePragma instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Name instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Pat instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.QName instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.QOp instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Stmt instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Strictness instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.TyVarBind instance Agda.Syntax.Common.Pretty.Pretty Agda.Utils.Haskell.Syntax.Type -- | Translating Agda types to Haskell types. Used to ensure that imported -- Haskell functions have the right type. module Agda.Compiler.MAlonzo.HaskellTypes haskellType :: QName -> HsCompileM Type hsTelApproximation :: Type -> HsCompileM ([Type], Type) hsTelApproximation' :: PolyApprox -> Type -> HsCompileM ([Type], Type) instance GHC.Internal.Classes.Eq Agda.Compiler.MAlonzo.HaskellTypes.PolyApprox -- | Interface for compiler backend writers. module Agda.Compiler.Backend data Recompile menv mod Recompile :: menv -> Recompile menv mod Skip :: mod -> Recompile menv mod data IsMain IsMain :: IsMain NotMain :: IsMain -- | f :: Flag opts is an action on the option record that results -- from parsing an option. f opts produces either an error -- message or an updated options record type Flag opts = opts -> OptM opts -- | Convert to treeless using default pipeline toTreeless :: EvaluationStrategy -> QName -> TCM (Maybe TTerm) crInterface :: CheckResult -> Interface crMode :: CheckResult -> ModuleCheckMode crWarnings :: CheckResult -> Set TCWarning -- | The result and associated parameters of a type-checked file, when -- invoked directly via interaction or a backend. Note that the -- constructor is not exported. data CheckResult -- | Flattened unidirectional pattern for CheckResult for -- destructuring inside the ModuleInfo field. pattern CheckResult :: Interface -> Set TCWarning -> ModuleCheckMode -> Source -> CheckResult backendInteraction :: AbsolutePath -> [Backend] -> TCM () -> (AbsolutePath -> TCM CheckResult) -> TCM () parseBackendOptions :: [Backend] -> [String] -> CommandLineOptions -> OptM ([Backend], CommandLineOptions) -- | Call the compilerMain function of the given backend. callBackend :: BackendName -> IsMain -> CheckResult -> TCM () -- | Call the backendInteractTop function of the given backend. callBackendInteractTop :: BackendName -> String -> CommandM () -- | Call the backendInteractHole function of the given backend. callBackendInteractHole :: BackendName -> String -> InteractionId -> Range -> String -> CommandM () module Agda.Interaction.InteractionTop atTopLevel :: CommandM a -> CommandM a -- | Displays the current goal, the given document, and the current -- context. -- -- Should not modify the state. cmd_goal_type_context_and :: GoalTypeAux -> Rewrite -> InteractionId -> Range -> String -> CommandM () -- | cmd_load' file argv unsolvedOk cmd loads the module in file -- file, using argv as the command-line options. -- -- If type checking completes without any exceptions having been -- encountered then the command cmd r is executed, where -- r is the result of typeCheckMain. cmd_load' :: FilePath -> [String] -> Bool -> Mode -> (CheckResult -> CommandM a) -> CommandM a -- | Opposite of liftIO for CommandM. -- -- This function should only be applied to computations that are -- guaranteed not to raise any errors (except for IOExceptions). commandMToIO :: (forall x. () => (CommandM a -> IO x) -> IO x) -> CommandM a decorate :: Doc -> String -- | Displays or updates status information. -- -- Does not change the state. displayStatus :: CommandM () -- | display_info does what displayInfo False -- does, but additionally displays some status information (see -- status and displayStatus). display_info :: DisplayInfo -> CommandM () extlam_dropName :: UnicodeOrAscii -> CaseContext -> String -> String getBackendName :: CompilerBackend -> BackendName getOldInteractionScope :: InteractionId -> CommandM ScopeInfo -- | A "give"-like action (give, refine, etc). -- -- give_gen force ii rng s give_ref mk_newtxt acts on -- interaction point ii occupying range rng, placing -- the new content given by string s, and replacing ii -- by the newly created interaction points in the state if safety checks -- pass (unless force is applied). give_gen :: UseForce -> InteractionId -> Range -> String -> GiveRefine -> CommandM () handleCommand :: (forall a. () => CommandM a -> CommandM a) -> CommandM () -> CommandM () -> CommandM () -- | Do setup and error handling for a command. handleCommand_ :: CommandM () -> CommandM () highlightExpr :: Expr -> TCM () -- | Can the command run even if the relevant file has not been loaded into -- the state? independent :: Interaction -> Bool -- | Creates a command queue, and forks a thread that writes commands to -- the queue. The queue is returned. initialiseCommandQueue :: IO Command -> IO CommandQueue insertOldInteractionScope :: InteractionId -> ScopeInfo -> CommandM () -- | Interpret an interaction. -- -- For each goal command specific to an InteractionPoint that -- comes with a Range for this interaction point we first -- synchronize this Range with the Range Agda has stored -- for the interaction meta. In general, we consider the Range -- sent with the command as more up-to-date than the the Range -- Agda has stored. This is because the editor keeps track of changes -- (that usually modify the position of interaction points), but Agda -- does not. -- -- Some goal commands carry a Range for reasons of uniformity but -- do not use it. For those, we do not synchronize the range. interpret :: Interaction -> CommandM () -- | Lift a TCM action transformer to a CommandM action transformer. liftCommandMT :: (forall x. () => TCM x -> TCM x) -> CommandM a -> CommandM a -- | Ditto, but restore state. liftCommandMTLocalState :: (forall x. () => TCM x -> TCM x) -> CommandM a -> CommandM a makeCaseVariant :: CaseContext -> MakeCaseVariant -- | If the next command from the command queue is anything but an actual -- command, then the command is returned. -- -- If the command is an IOTCM command, then the following happens: -- The given computation is applied to the command and executed. If an -- abort command is encountered (and acted upon), then the computation is -- interrupted, the persistent state and all options are restored, and -- some commands are sent to the frontend. If the computation was not -- interrupted, then its result is returned. maybeAbort :: (IOTCM -> CommandM a) -> CommandM (Command' (Maybe a)) maybeTimed :: CommandM a -> CommandM (Maybe CPUTime, a) -- | A Lens for oldInteractionScopes. modifyOldInteractionScopes :: (OldInteractionScopes -> OldInteractionScopes) -> CommandM () -- | A Lens for theInteractionPoints. modifyTheInteractionPoints :: ([InteractionId] -> [InteractionId]) -> CommandM () -- | Parses and scope checks an expression (using the "inside scope" as the -- scope), performs the given command with the expression as input, and -- returns the result and the time it takes. parseAndDoAtToplevel :: (Expr -> TCM a) -> String -> CommandM (Maybe CPUTime, a) -- | Try to parse an expression generated by Auto and feed it to the -- continuation if successful. If unsuccessful, just report the solution -- via Info_Auto. parseExprFromAuto :: InteractionId -> Range -> String -> (Expr -> CommandM a) -> CommandM (Either String a) -- | Put a response by the callback function given by -- stInteractionOutputCallback. putResponse :: Response -> CommandM () removeOldInteractionScope :: InteractionId -> CommandM () -- | Run an IOTCM value, catch the exceptions, emit output -- -- If an error happens the state of CommandM does not change, but -- stPersistent may change (which contains successfully loaded interfaces -- for example). runInteraction :: IOTCM -> CommandM () -- | Shows all the top-level names in scope which mention all the given -- identifiers in their type. searchAbout :: Rewrite -> Range -> String -> CommandM () -- | Sets the command line options and updates the status information. setCommandLineOpts :: CommandLineOptions -> CommandM () -- | Shows all the top-level names in the given module, along with their -- types. showModuleContents :: Rewrite -> Range -> String -> CommandM () -- | Solved goals already instantiated internally The second argument -- potentially limits it to one specific goal. solveInstantiatedGoals :: Rewrite -> Maybe InteractionId -> CommandM () -- | Sorts interaction points based on their ranges. sortInteractionPoints :: (MonadInteractionPoints m, MonadError TCErr m, MonadDebug m) => [InteractionId] -> m [InteractionId] -- | Computes some status information. -- -- Does not change the state. status :: CommandM Status -- | If given range is empty, get the range of the interaction point. -- Otherwise, set the range of the interaction point to the given range. -- -- The idea is that the interaction frontend may have a more recent range -- for an interaction point (for example, if the user has edited the file -- since the last command was sent). -- -- There may be frontends that do not send ranges (like the interaction -- test suite), so in that case get the range from the interaction point. syncInteractionRange :: (MonadInteractionPoints m, MonadDebug m, MonadError TCErr m) => InteractionId -> Range -> m Range -- | Tells the Emacs mode to go to the first error position (if any). tellEmacsToJumpToError :: Range -> [Response] -- | Tell to highlight the code using the given highlighting info (unless -- it is Nothing). tellToUpdateHighlighting :: Maybe (HighlightingInfo, HighlightingMethod, ModuleToSource) -> IO [Response] -- | Should Resp_InteractionPoints be issued after the command has -- run? updateInteractionPointsAfter :: Interaction -> Bool -- | Explain why something is in scope. whyInScope :: String -> CommandM () -- | Set envCurrentPath to theCurrentFile, if any. withCurrentFile :: CommandM a -> CommandM a data GiveRefine Give :: GiveRefine Refine :: GiveRefine Intro :: GiveRefine ElaborateGive :: Rewrite -> GiveRefine instance GHC.Internal.Classes.Eq Agda.Interaction.InteractionTop.GiveRefine instance GHC.Internal.Show.Show Agda.Interaction.InteractionTop.GiveRefine module Agda.Interaction.AgdaTop -- | repl is a fake ghci interpreter for both the Emacs the JSON -- frontend repl :: InteractionOutputCallback -> String -> TCM () -> TCM () module Agda.Interaction.EmacsTop -- | mimicGHCi is a fake ghci interpreter for the Emacs frontend and -- for interaction tests. -- -- mimicGHCi reads the Emacs frontend commands from stdin, -- interprets them and print the result into stdout. mimicGHCi :: TCM () -> TCM () namedMetaOf :: OutputConstraint Expr a -> a -- | Serializing Info_Error. showInfoError :: Info_Error -> TCM String -- | Print open metas nicely. prettyGoals :: Goals -> TCM Doc -- | Turn an Info_Error into a Doc. prettyInfoError :: Info_Error -> TCM Doc explainWhyInScope :: MonadPretty m => WhyInScopeData -> m Doc -- | Pretty-prints the context of the given meta-variable. prettyResponseContext :: InteractionId -> Bool -> [ResponseContextEntry] -> TCM Doc -- | Pretty-prints the type of the meta-variable. prettyTypeOfMeta :: Rewrite -> InteractionId -> TCM Doc -- | Pretty-print the result of a compute command in the command state -- captured when the command completed. Shared with the JSON frontend -- (Agda.Interaction.JSONTop) so that both frontends render the -- expression identically. prettyNormalForm :: CommandState -> ComputeMode -> Expr -> TCM Doc -- | Pretty-print an inferred type in the command state captured when the -- inference command completed. Shared with the JSON frontend. prettyInferredType :: CommandState -> Expr -> TCM Doc module Agda.Interaction.JSONTop -- | jsonREPL is a interpreter like mimicGHCi, but outputs -- JSON-encoded strings. -- -- jsonREPL reads Haskell values (that starts from IOTCM -- ...) from stdin, interprets them, and outputs JSON-encoded strings. -- into stdout. jsonREPL :: TCM () -> TCM () instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Internal.Blockers.Blocker instance Agda.Interaction.JSON.EncodeTCM Agda.Utils.Time.CPUTime instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.CommandState instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.ComputeMode instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.CurrentFile instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.DisplayInfo instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Abstract.Expr instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Concrete.Expr instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Base.GiveResult instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Base.GoalTypeAux instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Info_Error instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.InteractionId instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Base.MakeCaseVariant instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.MetaId instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Concrete.Name.NameInScope instance Agda.Interaction.JSON.EncodeTCM Agda.TypeChecking.Monad.Base.Types.NamedMeta instance (Agda.Interaction.JSON.EncodeTCM a, Agda.Interaction.JSON.EncodeTCM b) => Agda.Interaction.JSON.EncodeTCM (Agda.Interaction.Output.OutputConstraint b a) instance Agda.Interaction.JSON.EncodeTCM (Agda.Interaction.Output.OutputForm Agda.Syntax.Concrete.Expr Agda.Syntax.Concrete.Expr) instance Agda.Interaction.JSON.EncodeTCM (Agda.Syntax.Position.Position' ()) instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.ProblemId instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Position.Range instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Base.ResponseContextEntry instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Response instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.Rewrite instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Base.Status instance Agda.Interaction.JSON.EncodeTCM Agda.TypeChecking.Monad.Base.TCErr instance Agda.Interaction.JSON.EncodeTCM Agda.TypeChecking.Monad.Base.TCWarning instance Data.Aeson.Types.ToJSON.ToJSON Agda.Utils.Time.CPUTime instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.CommandState instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.ComputeMode instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.CurrentFile instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Concrete.Expr instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Response.Base.GiveResult instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.InteractionId instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Response.Base.MakeCaseVariant instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.MetaId instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.TopLevelModuleName.Boot.ModuleNameHash instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Concrete.Name.NameInScope instance Data.Aeson.Types.ToJSON.ToJSON (Agda.Syntax.Position.Position' ()) instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.ProblemId instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Position.Range instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.Rewrite instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Response.Base.Status module Agda.Interaction.Highlighting.Dot.Backend dotBackend :: Backend instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.Dot.Backend.DotFlags instance GHC.Internal.Generics.Generic Agda.Interaction.Highlighting.Dot.Backend.DotFlags instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.Dot.Backend.DotFlags module Agda.Interaction.Highlighting.Dot dotBackend :: Backend -- | Function for generating highlighted and aligned LaTeX from literate -- Agda source. module Agda.Interaction.Highlighting.LaTeX.Base data LaTeXOptions LaTeXOptions :: FilePath -> Maybe RangeFile -> Bool -> LaTeXOptions [latexOptOutDir] :: LaTeXOptions -> FilePath -- | The parser uses a Position which includes a source filename -- for error reporting and such. We don't actually get the source -- filename with an Interface, and it isn't necessary to look it -- up. This is a "nice-to-have" parameter. [latexOptSourceFileName] :: LaTeXOptions -> Maybe RangeFile -- | Count extended grapheme clusters rather than code points when -- generating LaTeX. [latexOptCountClusters] :: LaTeXOptions -> Bool -- | Generates a LaTeX file for the given interface. generateLaTeXIO :: (MonadLogLaTeX m, MonadIO m) => LaTeXOptions -> Interface -> m () -- | Create the common base output directory and check for/install the -- style file. prepareCommonAssets :: (MonadLogLaTeX m, MonadIO m) => FilePath -> m () -- | Log LaTeX messages using a provided action. -- -- This could be accomplished by putting logs into the RWST output and -- splitting it into a WriterT, but that becomes slightly more -- complicated to reason about in the presence of IO exceptions. -- -- We want the logging to be reasonably polymorphic, avoid space leaks -- that can occur with WriterT, and also be usable during outer phases -- such as directory preparation. class Monad m => MonadLogLaTeX (m :: Type -> Type) logLaTeX :: MonadLogLaTeX m => LogMessage -> m () data LogMessage LogMessage :: Debug -> Text -> [Text] -> LogMessage logMsgToText :: LogMessage -> Text instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.LaTeX.Base.Debug instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.LaTeX.Base.Kind instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.LaTeX.Base.AlignmentColumn instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.LaTeX.Base.Debug instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.LaTeX.Base.Kind instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.LaTeX.Base.LogMessage instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.LaTeX.Base.Output instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.LaTeX.Base.Token module Agda.Interaction.Highlighting.LaTeX.Backend latexBackend :: Backend latexBackendName :: BackendName instance GHC.Internal.Base.Applicative m => GHC.Internal.Base.Applicative (Agda.Interaction.Highlighting.LaTeX.Backend.LogLaTeXDebugT m) instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.LaTeX.Backend.LaTeXFlags instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Agda.Interaction.Highlighting.LaTeX.Backend.LogLaTeXDebugT m) instance GHC.Internal.Generics.Generic Agda.Interaction.Highlighting.LaTeX.Backend.LaTeXFlags instance GHC.Internal.Control.Monad.IO.Class.MonadIO m => GHC.Internal.Control.Monad.IO.Class.MonadIO (Agda.Interaction.Highlighting.LaTeX.Backend.LogLaTeXDebugT m) instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Agda.Interaction.Highlighting.LaTeX.Backend.LogLaTeXDebugT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.Interaction.Highlighting.LaTeX.Base.MonadLogLaTeX (Agda.Interaction.Highlighting.LaTeX.Backend.LogLaTeXDebugT m) instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.LaTeX.Backend.LaTeXFlags -- | Generating highlighted and aligned LaTeX from literate Agda source. module Agda.Interaction.Highlighting.LaTeX -- | Function for generating highlighted, hyperlinked HTML from Agda -- sources. module Agda.Interaction.Highlighting.HTML.Base -- | Options for HTML generation data HtmlOptions HtmlOptions :: FilePath -> HtmlHighlight -> Bool -> Maybe FilePath -> HtmlOptions [htmlOptDir] :: HtmlOptions -> FilePath [htmlOptHighlight] :: HtmlOptions -> HtmlHighlight [htmlOptHighlightOccurrences] :: HtmlOptions -> Bool [htmlOptCssFile] :: HtmlOptions -> Maybe FilePath -- | Determine how to highlight the file data HtmlHighlight HighlightAll :: HtmlHighlight HighlightCode :: HtmlHighlight HighlightAuto :: HtmlHighlight prepareCommonDestinationAssets :: MonadIO m => HtmlOptions -> m () -- | Bundle up the highlighting info for a source file srcFileOfInterface :: TopLevelModuleName -> Interface -> HtmlInputSourceFile defaultPageGen :: (MonadIO m, MonadLogHtml m) => HtmlOptions -> HtmlInputSourceFile -> m () class MonadLogHtml (m :: Type -> Type) logHtml :: MonadLogHtml m => HtmlLogAction m type LogHtmlT (m :: Type -> Type) = ReaderT HtmlLogAction m m runLogHtmlWith :: HtmlLogAction m -> LogHtmlT m a -> m a instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.HTML.Base.HtmlHighlight instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.HTML.Base.HtmlOptions instance GHC.Internal.Generics.Generic Agda.Interaction.Highlighting.HTML.Base.HtmlHighlight instance GHC.Internal.Base.Monad m => Agda.Interaction.Highlighting.HTML.Base.MonadLogHtml (Agda.Interaction.Highlighting.HTML.Base.LogHtmlT m) instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.HTML.Base.HtmlHighlight instance GHC.Internal.Show.Show Agda.Interaction.Highlighting.HTML.Base.HtmlHighlight -- | Backend for generating highlighted, hyperlinked HTML from Agda -- sources. module Agda.Interaction.Highlighting.HTML.Backend htmlBackend :: Backend instance GHC.Internal.Classes.Eq Agda.Interaction.Highlighting.HTML.Backend.HtmlFlags instance GHC.Internal.Generics.Generic Agda.Interaction.Highlighting.HTML.Backend.HtmlFlags instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.HTML.Backend.HtmlFlags -- | Backend for generating highlighted, hyperlinked HTML from Agda -- sources. module Agda.Interaction.Highlighting.HTML htmlBackend :: Backend module Agda.Compiler.MAlonzo.Compiler ghcBackend :: Backend -- | Option strings to activate the GHC backend. ghcInvocationStrings :: [String] instance GHC.Internal.Classes.Eq Agda.Compiler.MAlonzo.Compiler.UsesFloat instance GHC.Internal.Generics.Generic Agda.Compiler.MAlonzo.Compiler.GHCFlags instance GHC.Internal.Base.Monoid Agda.Compiler.MAlonzo.Compiler.UsesFloat instance Control.DeepSeq.NFData Agda.Compiler.MAlonzo.Compiler.GHCFlags instance GHC.Internal.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModule m) instance GHC.Internal.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCOptions m) instance GHC.Internal.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCEnv m) instance GHC.Internal.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCModuleEnv m) instance GHC.Internal.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModule m) instance GHC.Internal.Base.Semigroup Agda.Compiler.MAlonzo.Compiler.UsesFloat instance GHC.Internal.Show.Show Agda.Compiler.MAlonzo.Compiler.UsesFloat -- | Main module for JS backend. module Agda.Compiler.JS.Compiler jsBackend :: Backend jsBackend' :: Backend' JSOptions JSOptions JSModuleEnv Module (Maybe Export) data JSOptions JSOptions :: Bool -> Bool -> Bool -> Bool -> JSModuleStyle -> JSOptions [optJSCompile] :: JSOptions -> Bool [optJSOptimize] :: JSOptions -> Bool -- | Remove spaces etc. See -- https://en.wikipedia.org/wiki/Minification_(programming). [optJSMinify] :: JSOptions -> Bool -- | Run generated code through interpreter. [optJSVerify] :: JSOptions -> Bool [optJSModuleStyle] :: JSOptions -> JSModuleStyle defaultJSOptions :: JSOptions jsCommandLineFlags :: [OptDescr (Flag JSOptions)] jsPreCompile :: JSOptions -> TCM JSOptions -- | After all modules have been compiled, copy RTE modules and verify -- compiled modules. jsPostCompile :: JSOptions -> IsMain -> Map TopLevelModuleName Module -> TCM () data JSModuleEnv JSModuleEnv :: Maybe CoinductionKit -> Bool -> JSModuleEnv [jsCoinductionKit] :: JSModuleEnv -> Maybe CoinductionKit -- | Should this module be compiled? [jsCompile] :: JSModuleEnv -> Bool jsPreModule :: JSOptions -> IsMain -> TopLevelModuleName -> Maybe FilePath -> TCM (Recompile JSModuleEnv Module) jsPostModule :: JSOptions -> JSModuleEnv -> IsMain -> TopLevelModuleName -> [Maybe Export] -> TCM Module jsCompileDef :: JSOptions -> JSModuleEnv -> IsMain -> Definition -> TCM (Maybe Export) prefix :: [Char] jsMod :: TopLevelModuleName -> GlobalId jsFileName :: JSModuleStyle -> GlobalId -> String jsMember :: Name -> MemberId global' :: QName -> TCM (Exp, JSQName) global :: QName -> TCM (Exp, JSQName) reorder :: [Export] -> [Export] reorder' :: Set JSQName -> [Export] -> [Export] isTopLevelValue :: Export -> Bool isEmptyObject :: Export -> Bool insertAfter :: Set JSQName -> Export -> [Export] -> [Export] type EnvWithOpts = (JSOptions, JSModuleEnv) definition :: EnvWithOpts -> (QName, Definition) -> TCM (Maybe Export) -- | Ensure that there is at most one pragma for a name. checkCompilerPragmas :: QName -> TCM () defJSDef :: Definition -> Maybe String definition' :: EnvWithOpts -> QName -> Definition -> Type -> JSQName -> TCM (Maybe Export) compileTerm :: EnvWithOpts -> TTerm -> TCM Exp compileCaseNoPragma :: EnvWithOpts -> Int -> TTerm -> [TAlt] -> TCM Exp compileCaseWithPragma :: String -> EnvWithOpts -> Int -> [TAlt] -> TCM Exp compileAlt :: EnvWithOpts -> Int -> TAlt -> Exp -> TCM Exp compilePrim :: TPrim -> Exp visitorName :: QName -> TCM MemberId flatName :: MemberId local :: Nat -> Exp qname :: QName -> TCM Exp literal :: Literal -> Exp litqname :: QName -> Exp litmeta :: MetaId -> Exp writeModule :: Bool -> JSModuleStyle -> Module -> TCM () outFile :: JSModuleStyle -> GlobalId -> TCM FilePath -- | Primitives implemented in the JS Agda RTS. primitives :: Set PrimitiveId -- | Primitives that are intentionally compiled to Undefined by -- the JS backend (e.g. because they are erased, they are type-level -- only, or they are implemented in Agda). Any primitive not in -- primitives, undefinedPrimitives, or handled via -- defJSDef will trigger an UnknownJSPrimitive warning. undefinedPrimitives :: Set PrimitiveId instance GHC.Internal.Generics.Generic Agda.Compiler.JS.Compiler.JSOptions instance Control.DeepSeq.NFData Agda.Compiler.JS.Pretty.JSModuleStyle instance Control.DeepSeq.NFData Agda.Compiler.JS.Compiler.JSOptions -- | Built-in backends. module Agda.Compiler.Builtin builtinBackends :: [Backend] -- | Agda main module. module Agda.Main -- | The main function runAgda :: [Backend] -> IO () -- | The main function without importing built-in backends runAgda' :: [Backend] -> IO () runAgdaArgs :: [Backend] -> [String] -> IO () type Interactor a = TCM () -> AbsolutePath -> TCM CheckResult -> TCM a -- | Major mode of operation, not including the standard mode (checking the -- given main module). data FrontendType -- | --interaction or --interaction-json. FrontEndInteraction :: InteractionFormat -> FrontendType -- | --interactive. FrontEndRepl :: FrontendType -- | --build-library. FrontEndBuildLibrary :: FrontendType data InteractionFormat -- | --interaction. InteractionEmacs :: InteractionFormat -- | --interaction-json. InteractionJson :: InteractionFormat pattern FrontEndEmacs :: FrontendType pattern FrontEndJson :: FrontendType buildLibraryInteractor :: Interactor () -- | Emacs/JSON mode. Note that it ignores the "check" action because it -- calls typeCheck directly. interactionInteractor :: InteractionFormat -> Interactor () -- | The (deprecated) repl mode. replInteractor :: Maybe AbsolutePath -> Interactor () -- | The interactor to use when there are no frontends or backends -- specified. defaultInteractor :: AbsolutePath -> Interactor () getInteractor :: MonadError String m => [Backend] -> Maybe AbsolutePath -> CommandLineOptions -> m (Maybe (Interactor ())) -- | Run Agda with parsed command line options runAgdaWithOptions :: Interactor a -> String -> CommandLineOptions -> TCM a -- | Print usage information. printUsage :: [Backend] -> Help -> IO () -- | Print version information. printVersion :: [Backend] -> PrintAgdaVersion -> IO () printAgdaDataDir :: IO () printAgdaAppDir :: IO () printOptions :: IO () -- | What to do for bad options. optionError :: String -> IO () -- | Run a TCM action in IO; catch and pretty print errors. runTCMPrettyErrors :: TCM () -> IO () -- | If the error is an IO error, and the error message suggests that the -- problem is related to locales or code pages, print out some extra -- information. helpForLocaleError :: TCErr -> IO ()