-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A dependently typed functional programming language and proof assistant -- -- 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 Coq, Idris, -- Lean and NuPRL. -- -- This package includes both a command-line program (agda) and an Emacs -- mode. If you want to use the Emacs mode you can set it up by running -- agda-mode setup (see the README). -- -- Note that the Agda package does not follow the package versioning -- policy, because it is not intended to be used by third-party packages. @package Agda @version 2.6.2.2.20230105 module Agda.Interaction.ExitCode data AgdaError -- | 1 UnknownError :: AgdaError -- | 42 TCMError :: AgdaError -- | 71 OptionError :: AgdaError -- | 113 CommandError :: AgdaError -- | 154 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.Enum.Bounded Agda.Interaction.ExitCode.AgdaError instance GHC.Enum.Enum Agda.Interaction.ExitCode.AgdaError instance GHC.Classes.Eq Agda.Interaction.ExitCode.AgdaError instance GHC.Show.Show Agda.Interaction.ExitCode.AgdaError -- | 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.Classes.Ord Agda.Termination.CutOff.CutOff instance GHC.Classes.Eq Agda.Termination.CutOff.CutOff instance GHC.Show.Show Agda.Termination.CutOff.CutOff instance Control.DeepSeq.NFData Agda.Termination.CutOff.CutOff -- | 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.Num.Integer.Integer instance Agda.Termination.Semiring.HasZero GHC.Types.Int -- | 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.Base.Functor (Agda.Utils.AffineHole.AffineHole r) instance GHC.Base.Applicative (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) -- | 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. -- --
-- ($) :: (a -> b) -> a -> b -- (<$>) :: Functor f => (a -> b) -> f a -> f b ---- -- Whereas $ is function application, <$> is function -- application lifted over a Functor. -- --
-- >>> 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 <$. -- --
-- >>> 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 $> -- | Infix version of for. (<&>) :: Functor m => m a -> (a -> b) -> m b infixl 1 <&> instance Agda.Utils.Functor.Decoration Data.Functor.Identity.Identity 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 ((,) a) -- | Hash tables. module Agda.Utils.HashTable -- | Hash tables. data HashTable k v -- | An empty hash table. empty :: IO (HashTable k v) -- | Inserts the key and the corresponding value into the hash table. insert :: (Eq k, Hashable k) => HashTable k v -> k -> v -> IO () -- | Tries to find a value corresponding to the key in the hash table. lookup :: (Eq k, Hashable k) => HashTable k v -> k -> IO (Maybe v) -- | Converts the hash table to a list. -- -- The order of the elements in the list is unspecified. toList :: (Eq k, Hashable k) => HashTable k v -> IO [(k, v)] -- | 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 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.Classes.Eq Agda.Utils.Haskell.Syntax.DataOrNew instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Strictness instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Literal instance GHC.Classes.Ord Agda.Utils.Haskell.Syntax.ModuleName instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.ModuleName instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Name instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.QName instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.QOp instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.TyVarBind instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Type instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Pat instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.ConDecl instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Stmt instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.GuardedRhs instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Binds instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Alt instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Exp instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Rhs instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Match instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Decl -- | Strictification of Haskell code module Agda.Compiler.MAlonzo.Strict -- | The function makeStrict makes every function argument, case and -- generator pattern, and LocalBind binding 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. class MakeStrict a makeStrict :: MakeStrict a => a -> a instance Agda.Compiler.MAlonzo.Strict.MakeStrict a => Agda.Compiler.MAlonzo.Strict.MakeStrict [a] instance Agda.Compiler.MAlonzo.Strict.MakeStrict a => Agda.Compiler.MAlonzo.Strict.MakeStrict (GHC.Maybe.Maybe a) instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Module instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Decl instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Match instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Pat instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Binds instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Rhs instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.GuardedRhs instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Stmt instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Exp instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Alt -- | Auxiliary functions for the IO monad. module Agda.Utils.IO -- | Catch IOExceptions. class CatchIO m catchIO :: CatchIO m => m a -> (IOException -> m a) -> m a instance Agda.Utils.IO.CatchIO GHC.Types.IO instance Agda.Utils.IO.CatchIO m => Agda.Utils.IO.CatchIO (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.Utils.IO.CatchIO m => Agda.Utils.IO.CatchIO (Control.Monad.Trans.State.Lazy.StateT s m) -- | 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 () -- | 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.Show.Show Agda.Utils.IO.UTF8.ReadException instance GHC.Exception.Type.Exception 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 -- | 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 -- | 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 -- | Throw an Impossible error reporting the *caller's* call site. __IMPOSSIBLE__ :: HasCallStack => a impossible :: HasCallStack => Impossible -- | 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.Types.IO instance GHC.Classes.Eq Agda.Utils.Impossible.Impossible instance GHC.Classes.Ord Agda.Utils.Impossible.Impossible instance Control.DeepSeq.NFData Agda.Utils.Impossible.Impossible instance GHC.Show.Show Agda.Utils.Impossible.Impossible instance GHC.Exception.Type.Exception 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 Control.DeepSeq.NFData Agda.Utils.Empty.Empty instance GHC.Classes.Eq Agda.Utils.Empty.Empty instance GHC.Classes.Ord Agda.Utils.Empty.Empty instance GHC.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 qualified Agda.Utils.BoolSet as BoolSet import -- Agda.Utils.BoolSet (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.Enum.Bounded Agda.Utils.BoolSet.BoolSet instance GHC.Enum.Enum Agda.Utils.BoolSet.BoolSet instance GHC.Show.Show Agda.Utils.BoolSet.BoolSet instance GHC.Classes.Ord Agda.Utils.BoolSet.BoolSet instance GHC.Classes.Eq Agda.Utils.BoolSet.BoolSet -- | 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 [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 [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 -> [[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] 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.Classes.Ord a => GHC.Classes.Ord (Agda.Utils.Bag.Bag a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.Bag.Bag a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.Bag.Bag a) instance GHC.Classes.Ord a => GHC.Base.Semigroup (Agda.Utils.Bag.Bag a) instance GHC.Classes.Ord a => GHC.Base.Monoid (Agda.Utils.Bag.Bag a) instance Data.Foldable.Foldable Agda.Utils.Bag.Bag module Agda.Auto.NarrowingSearch newtype Prio Prio :: Int -> Prio [getPrio] :: Prio -> Int class Trav a where { type Block a; } trav :: (Trav a, Monad m) => (forall b. TravWith b (Block a) => MM b (Block b) -> m ()) -> a -> m () -- | Trav instance a with block type blk type TravWith a blk = (Trav a, Block a ~ blk) data Term blk Term :: a -> Term blk -- | Result of type-checking. data Prop blk -- | Success. OK :: Prop blk -- | Definite failure. Error :: String -> Prop blk -- | Experimental. AddExtraRef :: String -> Metavar a blk -> Move' blk a -> Prop blk -- | Parallel conjunction of constraints. And :: Maybe [Term blk] -> MetaEnv (PB blk) -> MetaEnv (PB blk) -> Prop blk -- | Experimental, related to mcompoint. First arg is sidecondition. Sidecondition :: MetaEnv (PB blk) -> MetaEnv (PB blk) -> Prop blk -- | Forking proof on something that is not part of the term language. E.g. -- whether a term will reduce or not. Or :: Prio -> MetaEnv (PB blk) -> MetaEnv (PB blk) -> Prop blk -- | Obsolete. ConnectHandle :: OKHandle blk -> MetaEnv (PB blk) -> Prop blk data OKVal OKVal :: OKVal type OKHandle blk = MM OKVal blk type OKMeta blk = Metavar OKVal blk -- | Agsy's meta variables. -- -- a the type of the metavariable (what it can be instantiated -- with). blk the search control information (e.g. the scope of -- the meta). data Metavar a blk Metavar :: IORef (Maybe a) -> IORef Bool -> IORef [(QPB a blk, Maybe (CTree blk))] -> IORef [SubConstraints blk] -> IORef [Move' blk a] -> Metavar a blk -- | Maybe an instantiation (refinement). It is usually shallow, i.e., just -- one construct(or) with arguments again being metas. [mbind] :: Metavar a blk -> IORef (Maybe a) -- | Does this meta block a principal constraint (i.e., a type-checking -- constraint). [mprincipalpresent] :: Metavar a blk -> IORef Bool -- | List of observers, i.e., constraints blocked by this meta. [mobs] :: Metavar a blk -> IORef [(QPB a blk, Maybe (CTree blk))] -- | Used for experiments with independence of subproofs. [mcompoint] :: Metavar a blk -> IORef [SubConstraints blk] -- | Experimental. [mextrarefs] :: Metavar a blk -> IORef [Move' blk a] hequalMetavar :: Metavar a1 blk1 -> Metavar a2 bkl2 -> Bool newMeta :: IORef [SubConstraints blk] -> IO (Metavar a blk) initMeta :: IO (Metavar a blk) data CTree blk CTree :: IORef (PrioMeta blk) -> IORef (Maybe (SubConstraints blk)) -> IORef (Maybe (CTree blk)) -> IORef [OKMeta blk] -> CTree blk [ctpriometa] :: CTree blk -> IORef (PrioMeta blk) [ctsub] :: CTree blk -> IORef (Maybe (SubConstraints blk)) [ctparent] :: CTree blk -> IORef (Maybe (CTree blk)) [cthandles] :: CTree blk -> IORef [OKMeta blk] data SubConstraints blk SubConstraints :: IORef Bool -> IORef Int -> CTree blk -> CTree blk -> SubConstraints blk [scflip] :: SubConstraints blk -> IORef Bool [sccomcount] :: SubConstraints blk -> IORef Int [scsub1] :: SubConstraints blk -> CTree blk [scsub2] :: SubConstraints blk -> CTree blk newCTree :: Maybe (CTree blk) -> IO (CTree blk) newSubConstraints :: CTree blk -> IO (SubConstraints blk) data PrioMeta blk PrioMeta :: Prio -> Metavar a blk -> PrioMeta blk NoPrio :: Bool -> PrioMeta blk data Restore Restore :: IORef a -> a -> Restore type Undo = StateT [Restore] IO ureadIORef :: IORef a -> Undo a uwriteIORef :: IORef a -> a -> Undo () umodifyIORef :: IORef a -> (a -> a) -> Undo () ureadmodifyIORef :: IORef a -> (a -> a) -> Undo a runUndo :: Undo a -> IO a newtype RefCreateEnv blk a RefCreateEnv :: StateT (IORef [SubConstraints blk], Int) IO a -> RefCreateEnv blk a [runRefCreateEnv] :: RefCreateEnv blk a -> StateT (IORef [SubConstraints blk], Int) IO a newtype Cost Cost :: Int -> Cost [getCost] :: Cost -> Int data Move' blk a Move :: Cost -> RefCreateEnv blk a -> Move' blk a [moveCost] :: Move' blk a -> Cost [moveNext] :: Move' blk a -> RefCreateEnv blk a class Refinable a blk refinements :: Refinable a blk => blk -> [blk] -> Metavar a blk -> IO [Move' blk a] newPlaceholder :: RefCreateEnv blk (MM a blk) newOKHandle :: RefCreateEnv blk (OKHandle blk) dryInstantiate :: RefCreateEnv blk a -> IO a type BlkInfo blk = (Bool, Prio, Maybe blk) data MM a blk NotM :: a -> MM a blk Meta :: Metavar a blk -> MM a blk rm :: Empty -> MM a b -> a type MetaEnv = IO data MB a blk NotB :: a -> MB a blk Blocked :: Metavar b blk -> MetaEnv (MB a blk) -> MB a blk Failed :: String -> MB a blk data PB blk NotPB :: Prop blk -> PB blk PBlocked :: Metavar b blk -> BlkInfo blk -> MetaEnv (PB blk) -> PB blk PDoubleBlocked :: Metavar b1 blk -> Metavar b2 blk -> MetaEnv (PB blk) -> PB blk data QPB b blk QPBlocked :: BlkInfo blk -> MetaEnv (PB blk) -> QPB b blk QPDoubleBlocked :: IORef Bool -> MetaEnv (PB blk) -> QPB b blk mmcase :: Refinable a blk => MM a blk -> (a -> MetaEnv (MB b blk)) -> MetaEnv (MB b blk) mmmcase :: MM a blk -> MetaEnv (MB b blk) -> (a -> MetaEnv (MB b blk)) -> MetaEnv (MB b blk) mmpcase :: Refinable a blk => BlkInfo blk -> MM a blk -> (a -> MetaEnv (PB blk)) -> MetaEnv (PB blk) doubleblock :: (Refinable a blk, Refinable b blk) => MM a blk -> MM b blk -> MetaEnv (PB blk) -> MetaEnv (PB blk) mbcase :: MetaEnv (MB a blk) -> (a -> MetaEnv (MB b blk)) -> MetaEnv (MB b blk) mbpcase :: Prio -> Maybe blk -> MetaEnv (MB a blk) -> (a -> MetaEnv (PB blk)) -> MetaEnv (PB blk) mmbpcase :: MetaEnv (MB a blk) -> (forall b. Refinable b blk => MM b blk -> MetaEnv (PB blk)) -> (a -> MetaEnv (PB blk)) -> MetaEnv (PB blk) waitok :: OKHandle blk -> MetaEnv (MB b blk) -> MetaEnv (MB b blk) mbret :: a -> MetaEnv (MB a blk) mbfailed :: String -> MetaEnv (MB a blk) mpret :: Prop blk -> MetaEnv (PB blk) expandbind :: MM a blk -> MetaEnv (MM a blk) type HandleSol = IO () type SRes = Either Bool Int topSearch :: forall blk. IORef Int -> IORef Int -> HandleSol -> blk -> MetaEnv (PB blk) -> Cost -> Cost -> IO Bool extractblkinfos :: Metavar a blk -> IO [blk] recalcs :: [(QPB a blk, Maybe (CTree blk))] -> Undo Bool seqc :: Undo Bool -> Undo Bool -> Undo Bool recalc :: (QPB a blk, Maybe (CTree blk)) -> Undo Bool reccalc :: MetaEnv (PB blk) -> Maybe (CTree blk) -> Undo Bool calc :: forall blk. MetaEnv (PB blk) -> Maybe (CTree blk) -> Undo (Maybe [OKMeta blk]) choosePrioMeta :: Bool -> PrioMeta blk -> PrioMeta blk -> PrioMeta blk propagatePrio :: CTree blk -> Undo [OKMeta blk] data Choice LeftDisjunct :: Choice RightDisjunct :: Choice choose :: MM Choice blk -> Prio -> MetaEnv (PB blk) -> MetaEnv (PB blk) -> MetaEnv (PB blk) instance GHC.Num.Num Agda.Auto.NarrowingSearch.Prio instance GHC.Classes.Ord Agda.Auto.NarrowingSearch.Prio instance GHC.Classes.Eq Agda.Auto.NarrowingSearch.Prio instance GHC.Classes.Ord Agda.Auto.NarrowingSearch.Cost instance GHC.Classes.Eq Agda.Auto.NarrowingSearch.Cost instance GHC.Num.Num Agda.Auto.NarrowingSearch.Cost instance Agda.Auto.NarrowingSearch.Refinable Agda.Auto.NarrowingSearch.Choice blk instance Agda.Auto.NarrowingSearch.TravWith a blk => Agda.Auto.NarrowingSearch.Trav (Agda.Auto.NarrowingSearch.MM a blk) instance GHC.Classes.Eq (Agda.Auto.NarrowingSearch.Metavar a blk) instance GHC.Classes.Eq (Agda.Auto.NarrowingSearch.PrioMeta blk) instance GHC.Base.Functor (Agda.Auto.NarrowingSearch.RefCreateEnv blk) instance GHC.Base.Applicative (Agda.Auto.NarrowingSearch.RefCreateEnv blk) instance GHC.Base.Monad (Agda.Auto.NarrowingSearch.RefCreateEnv blk) instance Agda.Auto.NarrowingSearch.Refinable Agda.Auto.NarrowingSearch.OKVal blk -- | 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.Show.Show Agda.Utils.IntSet.Infinite.IntSet instance GHC.Classes.Eq Agda.Utils.IntSet.Infinite.IntSet instance GHC.Base.Semigroup Agda.Utils.IntSet.Infinite.IntSet instance GHC.Base.Monoid Agda.Utils.IntSet.Infinite.IntSet -- | A cut-down implementation of lenses, with names taken from Edward -- Kmett's lens package. module Agda.Utils.Lens -- | Van Laarhoven style homogeneous lenses. Mnemoic: "Lens inner outer". type Lens' i o = forall f. Functor f => (i -> f i) -> o -> f o type LensGet i o = o -> i type LensSet i o = i -> o -> o type LensMap i o = (i -> i) -> o -> o key :: Ord k => k -> Lens' (Maybe v) (Map k v) -- | Write a part of the state. (.=) :: MonadState o m => Lens' i o -> i -> m () infix 4 .= -- | Modify inner part i of structure o using a function -- i -> i. over :: Lens' i o -> LensMap i o -- | Set inner part i of structure o as designated by -- Lens' i o. set :: Lens' i o -> LensSet i o lFst :: Lens' a (a, b) lSnd :: Lens' b (a, b) -- | Get inner part i of structure o as designated by -- Lens' i o. (^.) :: o -> Lens' i o -> i infixl 8 ^. -- | Focus on a part of the state for a stateful computation. focus :: Monad m => Lens' i o -> StateT i m a -> StateT o m a -- | Read a part of the state. use :: MonadState o m => Lens' i o -> m i -- | Modify a part of the state. (%=) :: MonadState o m => Lens' i o -> (i -> i) -> m () infix 4 %= -- | Modify a part of the state monadically. (%==) :: MonadState o m => Lens' i o -> (i -> m i) -> m () infix 4 %== -- | Modify a part of the state monadically, and return some result. (%%=) :: MonadState o m => Lens' i o -> (i -> m (i, r)) -> m r infix 4 %%= -- | Modify a part of the state locally. locallyState :: MonadState o m => Lens' i o -> (i -> i) -> m r -> m r -- | Ask for part of read-only state. view :: MonadReader o m => Lens' i o -> m i -- | Modify a part of the state in a subcomputation. locally :: MonadReader o m => Lens' i o -> (i -> i) -> m a -> m a locally' :: ((o -> o) -> m a -> m a) -> Lens' i o -> (i -> i) -> m a -> m a -- | Infix version of for. (<&>) :: Functor m => m a -> (a -> b) -> m b infixl 1 <&> module Agda.Utils.IndexedList -- | Existential wrapper for indexed types. data Some :: (k -> Type) -> Type [Some] :: f i -> Some f -- | Unpacking a wrapped value. withSome :: Some b -> (forall i. 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 :: (x -> Type) -> [x] -> Type [Nil] :: All p '[] [Cons] :: p x -> All p xs -> All p (x ': xs) -- | Constructing an indexed list from a plain list. makeAll :: (a -> Some b) -> [a] -> Some (All b) -- | Turning an indexed list back into a plain list. forgetAll :: (forall x. b x -> a) -> All b xs -> [a] -- | An index into a type-level list. data Index :: [x] -> x -> Type [Zero] :: Index (x ': xs) x [Suc] :: Index xs x -> Index (y ': xs) x -- | Indices are just natural numbers. forgetIndex :: Index xs x -> Int -- | Mapping over an indexed list. mapWithIndex :: (forall x. Index xs x -> p x -> q x) -> All p xs -> All q xs -- | If you have an index you can get a lens for the given element. lIndex :: Index xs x -> Lens' (p x) (All p xs) -- | Looking up an element in an indexed list. lookupIndex :: All p xs -> Index xs x -> p x -- | All indices into an indexed list. allIndices :: All p xs -> All (Index xs) xs module Agda.Auto.Options data Mode MNormal :: Bool -> Bool -> Mode MCaseSplit :: Mode MRefine :: Bool -> Mode data AutoHintMode AHMNone :: AutoHintMode AHMModule :: AutoHintMode type Hints = [String] newtype TimeOut TimeOut :: Int -> TimeOut [getTimeOut] :: TimeOut -> Int -- | Options for Auto, default value and lenses data AutoOptions AutoOptions :: Hints -> TimeOut -> Int -> Mode -> AutoHintMode -> AutoOptions [autoHints] :: AutoOptions -> Hints [autoTimeOut] :: AutoOptions -> TimeOut [autoPick] :: AutoOptions -> Int [autoMode] :: AutoOptions -> Mode [autoHintMode] :: AutoOptions -> AutoHintMode initAutoOptions :: AutoOptions aoHints :: Lens' Hints AutoOptions aoTimeOut :: Lens' TimeOut AutoOptions aoPick :: Lens' Int AutoOptions aoMode :: Lens' Mode AutoOptions aoHintMode :: Lens' AutoHintMode AutoOptions -- | Tokenising the input (makes parseArgs cleaner) data AutoToken M :: AutoToken C :: AutoToken R :: AutoToken D :: AutoToken L :: AutoToken T :: String -> AutoToken S :: Int -> AutoToken H :: String -> AutoToken autoTokens :: [String] -> [AutoToken] parseTime :: String -> Int parseArgs :: String -> AutoOptions instance GHC.Show.Show Agda.Auto.Options.TimeOut -- | 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 :: Lens' a (Record a b) lensField2 :: Lens' b (Record a b) module Agda.Utils.Map -- | 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 based on the keys. filterKeys :: (k -> Bool) -> Map k a -> Map k a -- | 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 -- | Retain object when tag is True. boolToMaybe :: Bool -> a -> Maybe a -- | 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 -- | caseMaybe without the Just case. whenNothing :: Monoid m => Maybe a -> m -> m -- | Monadic version of fromMaybe. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a -- | Version of mapMaybe with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] -- | Filtering a singleton list. -- --
-- filterMaybe p a = listToMaybe (filter p [a]) --filterMaybe :: (a -> Bool) -> a -> Maybe a -- | 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]) -- | caseMaybeM without the Just case. whenNothingM :: Monad m => m (Maybe a) -> m () -> m () -- | 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 () -- | 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) -- | 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 -- | caseMaybe with flipped branches. ifJust :: Maybe a -> (a -> b) -> b -> b -- | Monadic version of maybe. maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b -- | caseMaybeM with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b -- | caseMaybeM without the Nothing case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () -- | Lift a maybe to an Alternative. liftMaybe :: Alternative f => Maybe a -> f a module Agda.Utils.Memo -- | Simple, non-reentrant memoisation. memo :: MonadState s m => Lens' (Maybe a) s -> m a -> m a -- | Recursive memoisation, second argument is the value you get on -- recursive calls. memoRec :: MonadState s m => Lens' (Maybe a) s -> a -> m a -> m a memoUnsafe :: Ord a => (a -> b) -> a -> b memoUnsafeH :: (Eq a, Hashable a) => (a -> b) -> a -> b -- | More monoids. module Agda.Utils.Monoid -- | Maximum of on-negative (small) natural numbers. newtype MaxNat MaxNat :: Int -> MaxNat [getMaxNat] :: MaxNat -> Int instance GHC.Enum.Enum Agda.Utils.Monoid.MaxNat instance GHC.Show.Show Agda.Utils.Monoid.MaxNat instance GHC.Classes.Ord Agda.Utils.Monoid.MaxNat instance GHC.Classes.Eq Agda.Utils.Monoid.MaxNat instance GHC.Num.Num Agda.Utils.Monoid.MaxNat instance GHC.Base.Semigroup Agda.Utils.Monoid.MaxNat instance GHC.Base.Monoid Agda.Utils.Monoid.MaxNat -- | 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 -- | Satisfying null empty == True. null :: (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 () instance Agda.Utils.Null.Null () 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 Data.ByteString.Internal.ByteString instance Agda.Utils.Null.Null Data.ByteString.Lazy.Internal.ByteString instance Agda.Utils.Null.Null Data.Text.Internal.Text instance Agda.Utils.Null.Null [a] instance Agda.Utils.Null.Null (Agda.Utils.Bag.Bag 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 (Data.Map.Internal.Map k 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 (Data.Sequence.Internal.Seq a) instance Agda.Utils.Null.Null (Data.Set.Internal.Set a) instance Agda.Utils.Null.Null (GHC.Maybe.Maybe a) instance Agda.Utils.Null.Null Text.PrettyPrint.HughesPJ.Doc instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (Data.Functor.Identity.Identity a) instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (GHC.Types.IO a) instance (Agda.Utils.Null.Null (m a), GHC.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.Except.ExceptT e m a) instance (Agda.Utils.Null.Null (m a), GHC.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.Reader.ReaderT r m a) instance (Agda.Utils.Null.Null (m a), GHC.Base.Monad m) => Agda.Utils.Null.Null (Control.Monad.Trans.State.Lazy.StateT s m a) instance (Agda.Utils.Null.Null (m a), GHC.Base.Monad m, GHC.Base.Monoid w) => Agda.Utils.Null.Null (Control.Monad.Trans.Writer.Lazy.WriterT w m a) -- | A strict version of the Maybe type. -- -- Import qualified, as in import qualified Agda.Utils.Maybe.Strict -- as Strict -- -- Copyright : (c) 2006-2007 Roman Leshchinskiy (c) 2013 Simon Meier -- License : BSD-style (see the file LICENSE) -- -- Copyright : (c) 2014 Andreas Abel module Agda.Utils.Maybe.Strict -- | 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 -- | Monadic version of fromMaybe. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a -- | Version of mapMaybe with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] -- | Filtering a singleton list. -- --
-- filterMaybe p a = listToMaybe (filter p [a]) --filterMaybe :: (a -> Bool) -> a -> Maybe a -- | 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 () -- | 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) -- | 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 maybe. maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b -- | caseMaybeM with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b -- | caseMaybeM without the Nothing case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () instance GHC.Base.Applicative Data.Strict.Maybe.Maybe instance Agda.Utils.Null.Null (Data.Strict.Maybe.Maybe a) 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.Enum.Bounded Agda.Utils.PartialOrd.PartialOrdering instance GHC.Enum.Enum Agda.Utils.PartialOrd.PartialOrdering instance GHC.Show.Show Agda.Utils.PartialOrd.PartialOrdering instance GHC.Classes.Eq Agda.Utils.PartialOrd.PartialOrdering instance GHC.Base.Functor Agda.Utils.PartialOrd.Pointwise instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.PartialOrd.Pointwise a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.PartialOrd.Pointwise a) instance GHC.Base.Functor Agda.Utils.PartialOrd.Inclusion instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.PartialOrd.Inclusion a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Utils.PartialOrd.Inclusion a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.PartialOrd.Inclusion a) instance GHC.Classes.Ord a => Agda.Utils.PartialOrd.PartialOrd (Agda.Utils.PartialOrd.Inclusion [a]) instance GHC.Classes.Ord a => Agda.Utils.PartialOrd.PartialOrd (Agda.Utils.PartialOrd.Inclusion (Data.Set.Internal.Set a)) instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Utils.PartialOrd.PartialOrd (Agda.Utils.PartialOrd.Pointwise [a]) instance Agda.Utils.PartialOrd.PartialOrd GHC.Types.Int instance Agda.Utils.PartialOrd.PartialOrd GHC.Num.Integer.Integer instance Agda.Utils.PartialOrd.PartialOrd () instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Utils.PartialOrd.PartialOrd (GHC.Maybe.Maybe a) instance (Agda.Utils.PartialOrd.PartialOrd a, Agda.Utils.PartialOrd.PartialOrd b) => Agda.Utils.PartialOrd.PartialOrd (Data.Either.Either a b) instance (Agda.Utils.PartialOrd.PartialOrd a, Agda.Utils.PartialOrd.PartialOrd b) => Agda.Utils.PartialOrd.PartialOrd (a, b) instance Agda.Utils.PartialOrd.PartialOrd Agda.Utils.PartialOrd.PartialOrdering instance GHC.Base.Semigroup Agda.Utils.PartialOrd.PartialOrdering instance GHC.Base.Monoid Agda.Utils.PartialOrd.PartialOrdering -- | 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.Pointer data Ptr a newPtr :: a -> Ptr a derefPtr :: Ptr a -> a setPtr :: a -> Ptr a -> Ptr a updatePtr :: (a -> a) -> Ptr a -> Ptr a -- | If f a contains many copies of a they will all be -- the same pointer in the result. If the function is well-behaved (i.e. -- preserves the implicit equivalence, this shouldn't matter). updatePtrM :: Functor f => (a -> f a) -> Ptr a -> f (Ptr a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.Pointer.Ptr a) instance GHC.Base.Functor Agda.Utils.Pointer.Ptr instance Data.Foldable.Foldable Agda.Utils.Pointer.Ptr instance Data.Traversable.Traversable Agda.Utils.Pointer.Ptr instance GHC.Classes.Eq (Agda.Utils.Pointer.Ptr a) instance GHC.Classes.Ord (Agda.Utils.Pointer.Ptr a) instance Data.Hashable.Class.Hashable (Agda.Utils.Pointer.Ptr a) instance Control.DeepSeq.NFData (Agda.Utils.Pointer.Ptr a) module Agda.Utils.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 -- | 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.Generics.Generic Agda.Utils.ProfileOptions.ProfileOption instance GHC.Enum.Bounded Agda.Utils.ProfileOptions.ProfileOption instance GHC.Enum.Enum Agda.Utils.ProfileOptions.ProfileOption instance GHC.Classes.Ord Agda.Utils.ProfileOptions.ProfileOption instance GHC.Classes.Eq Agda.Utils.ProfileOptions.ProfileOption instance GHC.Show.Show Agda.Utils.ProfileOptions.ProfileOption instance Control.DeepSeq.NFData Agda.Utils.ProfileOptions.ProfileOptions instance GHC.Classes.Eq Agda.Utils.ProfileOptions.ProfileOptions instance GHC.Show.Show Agda.Utils.ProfileOptions.ProfileOptions instance Control.DeepSeq.NFData Agda.Utils.ProfileOptions.ProfileOption 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.StarSemiRing () instance Agda.Utils.SemiRing.StarSemiRing a => Agda.Utils.SemiRing.StarSemiRing (GHC.Maybe.Maybe a) instance Agda.Utils.SemiRing.SemiRing () instance Agda.Utils.SemiRing.SemiRing a => Agda.Utils.SemiRing.SemiRing (GHC.Maybe.Maybe a) -- | Some semigroup instances used in several places module Agda.Utils.Semigroup -- | The class of semigroups (types with an associative binary operation). -- -- Instances should satisfy the following: -- -- class () => Semigroup a -- | An associative operation. -- --
-- >>> [1,2,3] <> [4,5,6] -- [1,2,3,4,5,6] --(<>) :: Semigroup a => a -> a -> a infixr 6 <> instance (GHC.Base.Applicative m, GHC.Base.Semigroup doc) => GHC.Base.Semigroup (Control.Monad.Trans.Reader.ReaderT s m doc) instance (GHC.Base.Monad m, GHC.Base.Semigroup doc) => GHC.Base.Semigroup (Control.Monad.Trans.State.Lazy.StateT s m doc) -- | 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 -- | Overloaded singleton constructor for collections. class Singleton el coll | coll -> el singleton :: Singleton el coll => el -> coll instance Agda.Utils.Singleton.Collection a [a] instance Agda.Utils.Singleton.Collection a ([a] -> [a]) instance Agda.Utils.Singleton.Collection a (Data.Semigroup.Internal.Endo [a]) instance Agda.Utils.Singleton.Collection a (Data.DList.Internal.DList a) instance Agda.Utils.Singleton.Collection a (Data.Sequence.Internal.Seq a) instance Agda.Utils.Singleton.Collection GHC.Types.Int Data.IntSet.Internal.IntSet instance Agda.Utils.Singleton.Collection (GHC.Types.Int, a) (Data.IntMap.Internal.IntMap a) instance GHC.Classes.Ord a => Agda.Utils.Singleton.Collection a (Data.Set.Internal.Set a) instance GHC.Classes.Ord k => Agda.Utils.Singleton.Collection (k, a) (Data.Map.Internal.Map k a) instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Agda.Utils.Singleton.Collection a (Data.HashSet.Internal.HashSet a) instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Agda.Utils.Singleton.Collection (k, a) (Data.HashMap.Internal.HashMap k a) instance Agda.Utils.Singleton.Singleton a (GHC.Maybe.Maybe a) instance Agda.Utils.Singleton.Singleton a [a] instance Agda.Utils.Singleton.Singleton a ([a] -> [a]) instance Agda.Utils.Singleton.Singleton a (Data.Semigroup.Internal.Endo [a]) instance Agda.Utils.Singleton.Singleton a (Data.DList.Internal.DList a) instance Agda.Utils.Singleton.Singleton a (GHC.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.Singleton.Singleton GHC.Types.Int Data.IntSet.Internal.IntSet instance Agda.Utils.Singleton.Singleton (k, a) (Data.Map.Internal.Map k a) instance Agda.Utils.Singleton.Singleton (GHC.Types.Int, a) (Data.IntMap.Internal.IntMap a) instance Data.Hashable.Class.Hashable a => Agda.Utils.Singleton.Singleton a (Data.HashSet.Internal.HashSet a) instance Data.Hashable.Class.Hashable k => Agda.Utils.Singleton.Singleton (k, a) (Data.HashMap.Internal.HashMap k a) -- | 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] -- | Small sets represented as immutable bit arrays for fast membership -- checking. -- -- Membership checking is O(1), but all other operations are O(n) where n -- is the size of the element type. The element type needs to implement -- Bounded and Ix. -- -- Mimics the interface of Set. -- -- Import as: import qualified Agda.Utils.SmallSet as SmallSet -- import Agda.Utils.SmallSet (SmallSet) module Agda.Utils.SmallSet data SmallSet 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: -- --
-- 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 -- | Adjust value at key, leave subtree intact. adjust :: Ord k => [k] -> (Maybe v -> Maybe v) -> Trie k v -> Trie k v -- | Delete value at key, but leave subtree intact. 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' (Maybe v) (Trie k v) instance Data.Foldable.Foldable (Agda.Utils.Trie.Trie k) instance GHC.Base.Functor (Agda.Utils.Trie.Trie k) instance (GHC.Classes.Eq v, GHC.Classes.Eq k) => GHC.Classes.Eq (Agda.Utils.Trie.Trie k v) instance (GHC.Show.Show v, GHC.Show.Show k) => GHC.Show.Show (Agda.Utils.Trie.Trie k v) 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) module Agda.Utils.Tuple -- | Bifunctoriality for pairs. (-*-) :: (a -> c) -> (b -> d) -> (a, b) -> (c, d) infix 2 -*- -- |
-- mapFst f = f -*- id --mapFst :: (a -> c) -> (a, b) -> (c, b) -- |
-- mapSnd g = id -*- g --mapSnd :: (b -> d) -> (a, b) -> (a, d) -- | Lifted pairing. (/\) :: (a -> b) -> (a -> c) -> a -> (b, c) infix 3 /\ 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 mapFst. mapFstM :: Applicative m => (a -> m c) -> (a, b) -> m (c, b) -- | Monadic mapSnd. mapSndM :: Applicative m => (b -> m d) -> (a, b) -> m (a, d) data Pair a Pair :: a -> a -> Pair a instance Data.Traversable.Traversable Agda.Utils.Tuple.Pair instance Data.Foldable.Foldable Agda.Utils.Tuple.Pair instance GHC.Base.Functor Agda.Utils.Tuple.Pair instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.Tuple.Pair a) instance GHC.Base.Applicative Agda.Utils.Tuple.Pair -- | Utility functions for lists. module Agda.Utils.List -- | Append a single element at the end. Time: O(length); use only on small -- lists. snoc :: [a] -> a -> [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 -- | Case distinction for lists, with list last. O(1). listCase :: b -> (a -> [a] -> b) -> [a] -> b -- | 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 -- | 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] -- | 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 -- | 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) -- | Opposite of cons (:), safe. O(1). uncons :: [a] -> Maybe (a, [a]) -- | Maybe cons. O(1). mcons ma as = maybeToList ma ++ as mcons :: Maybe a -> [a] -> [a] -- | init and last in one go, safe. O(n). 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) -- | init of non-empty list, safe. O(n). init1 a as = init -- (a:as) init1 :: a -> [a] -> [a] -- | init, safe. O(n). initMaybe :: [a] -> Maybe [a] -- | init, safe. O(n). initWithDefault :: [a] -> [a] -> [a] -- | Lookup function (safe). O(min n index). (!!!) :: [a] -> Int -> Maybe a -- | 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 with default value for index out of range. O(min n -- index). -- -- The name is chosen akin to genericIndex. indexWithDefault :: a -> [a] -> Int -> a -- | 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) -- | A generalised variant of elemIndex. O(n). genericElemIndex :: (Eq a, Integral i) => a -> [a] -> Maybe i -- | downFrom n = [n-1,..1,0]. O(n). downFrom :: Integral 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] -- | Update nth element of a list, if it exists. O(min index n). -- -- Precondition: the index is >= 0. updateAt :: Int -> (a -> a) -> [a] -> [a] type Prefix a = -- | The list before the split point. [a] type Suffix a = -- | The list after the split point. [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) -- | Drop from the end of a list. O(length). -- --
-- dropEnd n = reverse . drop n . reverse ---- -- Forces the whole list even for n==0. dropEnd :: forall a. Int -> [a] -> Prefix a -- | 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 :: forall a. (a -> Bool) -> [a] -> (Prefix a, Suffix 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]) -- | 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]) -- | 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 -- | A generalized version of span. O(length . fst . spanJust -- f). spanJust :: (a -> Maybe b) -> [a] -> (Prefix b, Suffix a) -- | 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]) -- | 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) -- | 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) -- | Sublist relation. isSublistOf :: Eq a => [a] -> [a] -> Bool -- | All ways of removing one element from a list. O(n²). holes :: [a] -> [(a, [a])] -- | Compute the common prefix of two lists. O(min n m). commonPrefix :: Eq a => [a] -> [a] -> Prefix a -- | Drops from both lists simultaneously until one list is empty. O(min n -- m). dropCommon :: [a] -> [b] -> (Suffix a, Suffix b) -- | 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) -- | Compute the common suffix of two lists. O(n + m). commonSuffix :: Eq a => [a] -> [a] -> Suffix a -- | stripSuffix suf xs = Just pre iff xs = pre ++ suf. -- O(n). stripSuffix :: Eq a => Suffix a -> [a] -> Maybe (Prefix a) type ReversedSuffix a = [a] -- | stripReversedSuffix rsuf xs = Just pre iff xs = pre ++ -- reverse suf. O(n). stripReversedSuffix :: forall a. Eq a => ReversedSuffix a -> [a] -> Maybe (Prefix 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 -- | 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] -- | 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 :: forall a. Eq a => [a] -> [a] -> (Int, Int) -- | groupOn f = groupBy ((==) `on` f) . -- sortBy (compare `on` f). O(n log n). groupOn :: Ord b => (a -> b) -> [a] -> [[a]] -- | A variant of groupBy which applies the predicate to consecutive -- pairs. O(n). DEPRECATED in favor of groupBy'. groupBy' :: (a -> a -> Bool) -> [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 :: forall a. (a -> Bool) -> [a] -> [[a]] -- | Check membership for the same list often. Use partially applied to -- create membership predicate hasElem xs :: a -> Bool. -- --
-- nubAndDuplicatesOn f xs = (ys, xs List.\\ ys) -- where ys = nubOn f xs --nubAndDuplicatesOn :: Ord b => (a -> b) -> [a] -> ([a], [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] -- | 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, Eq c, Hashable c) => (a -> b) -> (a -> c) -> [a] -> [a] -- | 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] -- | 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 -- | Non-efficient, monadic nub. O(n²). nubM :: Monad m => (a -> a -> m Bool) -> [a] -> m [a] -- | Requires both lists to have the same length. O(n). -- -- Otherwise, Nothing is returned. zipWith' :: (a -> b -> c) -> [a] -> [b] -> Maybe [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] unzipWith :: (a -> (b, c)) -> [a] -> ([b], [c]) -- | Implemented using tree recursion, don't run me at home! O(3^(min n -- m)). editDistanceSpec :: Eq a => [a] -> [a] -> Int -- | Implemented using dynamic programming and Data.Array. O(n*m). editDistance :: forall a. Eq a => [a] -> [a] -> Int mergeStrictlyOrderedBy :: (a -> a -> Bool) -> [a] -> [a] -> Maybe [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 -- | 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 (Data.String.IsString (m a), GHC.Base.Monad m) => Data.String.IsString (Control.Monad.Trans.Reader.ReaderT r m a) instance (Data.String.IsString (m a), GHC.Base.Monad m) => Data.String.IsString (Control.Monad.Trans.State.Lazy.StateT s m a) -- | Non-empty lists. -- -- Better name List1 for non-empty lists, plus missing -- functionality. -- -- Import: @ -- -- {-# LANGUAGE PatternSynonyms #-} -- -- import Agda.Utils.List1 (List1, pattern (:|)) import qualified -- Agda.Utils.List1 as List1 -- -- @ module Agda.Utils.List1 type List1 = NonEmpty type String1 = List1 Char -- | List foldr but with a base case for the singleton list. foldr :: (a -> b -> b) -> (a -> b) -> List1 a -> b -- | Concatenate one or more non-empty lists. concat :: [List1 a] -> [a] -- | Like catMaybes. catMaybes :: List1 (Maybe a) -> [a] -- | Like filter. mapMaybe :: (a -> Maybe b) -> List1 a -> [b] -- | Like lefts. lefts :: List1 (Either a b) -> [a] -- | Like rights. rights :: List1 (Either a b) -> [b] -- | Like partitionEithers. partitionEithers :: List1 (Either a b) -> ([a], [b]) -- | Like union. Duplicates in the first list are not removed. -- O(nm). union :: Eq a => List1 a -> List1 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 () -- | Build a list with one element. -- -- More precise type for snoc. snoc :: [a] -> a -> List1 a ifNull :: [a] -> b -> (List1 a -> b) -> b -- | Return the last element and the rest. initLast :: List1 a -> ([a], a) ifNotNull :: [a] -> (List1 a -> b) -> b -> b unlessNull :: Null m => [a] -> (List1 a -> m) -> m -- | 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]) -- | More precise type for groupBy'. -- -- A variant of groupBy which applies the predicate to consecutive -- pairs. O(n). groupBy' :: forall a. (a -> a -> Bool) -> [a] -> [List1 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 => List1 a -> Bool -- | Non-efficient, monadic nub. O(n²). nubM :: Monad m => (a -> a -> m Bool) -> List1 a -> m (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] -- | Safe version of fromList. fromListSafe :: List1 a -> [a] -> List1 a -- | Non-empty (and non-strict) list type. data () => NonEmpty a (:|) :: a -> [a] -> NonEmpty a infixr 5 :| -- | 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 -- | sortBy for NonEmpty, behaves the same as sortBy sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a -- | Number of elements in NonEmpty list. length :: NonEmpty a -> Int -- | filter p xs removes any elements from xs that -- do not satisfy p. filter :: (a -> Bool) -> NonEmpty a -> [a] -- | The unfoldr function is analogous to Data.List's -- unfoldr operation. unfoldr :: (a -> (b, Maybe a)) -> a -> NonEmpty b -- | 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) -- | cycle xs returns the infinite repetition of -- xs: -- --
-- cycle (1 :| [2,3]) = 1 :| [2,3,1,2,3,...] --cycle :: NonEmpty a -> NonEmpty a -- | The zip function takes two streams and returns a stream of -- corresponding pairs. zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) -- | Map a function over a NonEmpty stream. map :: (a -> b) -> NonEmpty a -> NonEmpty b -- | groupWith operates like group, but uses the provided -- projection when comparing for equality groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a] -- | Extract the first element of the stream. head :: NonEmpty a -> 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)) -- | Extract the possibly-empty tail of the stream. tail :: NonEmpty a -> [a] -- | Extract the last element of the stream. last :: NonEmpty a -> a -- | Extract everything except the last element of the stream. init :: NonEmpty a -> [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 -- | 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 -- | repeat x returns a constant stream, where all elements -- are equal to x. repeat :: a -> NonEmpty a -- | takeWhile p xs returns the longest prefix of the -- stream xs for which the predicate p holds. takeWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs. dropWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | take n xs returns the first n elements of -- xs. take :: Int -> NonEmpty a -> [a] -- | drop n xs drops the first n elements off the -- front of the sequence xs. drop :: Int -> NonEmpty 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]) -- | 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]) -- | The break p function is equivalent to span -- (not . p). break :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | reverse a finite NonEmpty stream. reverse :: NonEmpty a -> NonEmpty a -- | 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 !! -- | The unzip function is the inverse of the zip function. unzip :: Functor f => f (a, b) -> (f a, f b) -- | Compute n-ary logic exclusive OR operation on NonEmpty list. xor :: NonEmpty Bool -> Bool -- | The isPrefixOf function returns True if the first -- argument is a prefix of the second. isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool -- | 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 -- | '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 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]) -- | 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 -- | 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. For example, in list notation: -- --
-- 'group' $ 'cycle' "Mississippi" -- = "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ... --group :: (Foldable f, Eq a) => f a -> [NonEmpty a] -- | groupBy operates like group, but uses the provided -- equality predicate instead of ==. groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a] -- | The inits function takes a stream xs and returns all -- the finite prefixes of xs. inits :: Foldable f => f a -> NonEmpty [a] -- | The tails function takes a stream xs and returns all -- the suffixes of xs. tails :: Foldable f => f a -> NonEmpty [a] -- | Sort a stream. sort :: Ord a => NonEmpty a -> NonEmpty a -- | Construct a NonEmpty list from a single element. singleton :: a -> 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. unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b -- | nonEmpty efficiently turns a normal list into a NonEmpty -- stream, producing Nothing if the input is empty. nonEmpty :: [a] -> Maybe (NonEmpty a) -- | Prepend an element to the stream. (<|) :: a -> NonEmpty a -> NonEmpty a infixr 5 <| -- | Synonym for <|. cons :: a -> NonEmpty a -> NonEmpty a -- | some1 x sequences x one or more times. some1 :: Alternative f => f a -> f (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] -- | 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) -- | groupBy1 is to group1 as groupBy is to -- group. groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | groupWith1 is to group1 as groupWith is to -- group groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | groupAllWith1 is to groupWith1 as groupAllWith is -- to groupWith groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | sortWith for NonEmpty, behaves the same as: -- --
-- sortBy . comparing --sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a -- | 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 -- | 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 -- | 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 family 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 -- | Collection size. -- -- For TermSize see Agda.Syntax.Internal. module Agda.Utils.Size -- | The size of a collection (i.e., its length). class Sized a size :: Sized a => a -> Int size :: (Sized a, Foldable t, t b ~ a) => a -> Int -- | 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 instance Agda.Utils.Size.Sized (Agda.Utils.Size.SizedThing a) instance Agda.Utils.Null.Null a => Agda.Utils.Null.Null (Agda.Utils.Size.SizedThing a) instance Agda.Utils.Size.Sized [a] instance Agda.Utils.Size.Sized (Data.Set.Internal.Set 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 (Agda.Utils.List1.List1 a) instance Agda.Utils.Size.Sized (Data.Map.Internal.Map k a) instance Agda.Utils.Size.Sized (Data.Sequence.Internal.Seq a) instance Agda.Utils.Size.Sized Data.IntSet.Internal.IntSet 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 -- | 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 -- | 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 GHC.Generics.Generic Agda.Utils.Permutation.Permutation instance GHC.Classes.Eq Agda.Utils.Permutation.Permutation instance Data.Traversable.Traversable Agda.Utils.Permutation.Drop instance Data.Foldable.Foldable Agda.Utils.Permutation.Drop instance GHC.Base.Functor Agda.Utils.Permutation.Drop instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.Permutation.Drop a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Utils.Permutation.Drop a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.Permutation.Drop a) instance Agda.Utils.Permutation.DoDrop [a] instance Agda.Utils.Permutation.DoDrop Agda.Utils.Permutation.Permutation instance Agda.Utils.Permutation.InversePermute [GHC.Maybe.Maybe a] [(GHC.Types.Int, a)] instance Agda.Utils.Permutation.InversePermute [GHC.Maybe.Maybe a] (Data.IntMap.Internal.IntMap a) instance Agda.Utils.Permutation.InversePermute [GHC.Maybe.Maybe a] [GHC.Maybe.Maybe a] instance Agda.Utils.Permutation.InversePermute (GHC.Types.Int -> a) [GHC.Maybe.Maybe a] instance GHC.Show.Show Agda.Utils.Permutation.Permutation instance Agda.Utils.Size.Sized Agda.Utils.Permutation.Permutation instance Agda.Utils.Null.Null Agda.Utils.Permutation.Permutation instance Control.DeepSeq.NFData Agda.Utils.Permutation.Permutation -- | Lists of length at least 2. -- -- Import as: import Agda.Utils.List2 (List2(List2)) import -- qualified Agda.Utils.List2 as List2 module Agda.Utils.List2 -- | Lists of length ≥2. data List2 a List2 :: a -> a -> [a] -> List2 a -- | Safe. O(1). head :: List2 a -> a -- | Safe. O(1). tail :: List2 a -> List1 a -- | Safe. O(n). init :: List2 a -> List1 a break :: (a -> Bool) -> List2 a -> ([a], [a]) -- | O(1). cons :: a -> List1 a -> List2 a -- | O(length first list). append :: List1 a -> List1 a -> List2 a -- | O(length first list). appendList :: List2 a -> [a] -> List2 a -- | Unsafe! O(1). fromList1 :: List1 a -> List2 a -- | Safe. O(1). toList1 :: List2 a -> List1 a -- | Safe. O(1). fromListMaybe :: [a] -> Maybe (List2 a) -- | Safe. O(1). fromList1Maybe :: List1 a -> Maybe (List2 a) -- | Any List1 is either a singleton or a List2. O(1). fromList1Either :: List1 a -> Either a (List2 a) -- | Inverse of fromList1Either. O(1). toList1Either :: Either a (List2 a) -> List1 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 Data.Traversable.Traversable Agda.Utils.List2.List2 instance Data.Foldable.Foldable Agda.Utils.List2.List2 instance GHC.Base.Functor Agda.Utils.List2.List2 instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.List2.List2 a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Utils.List2.List2 a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.List2.List2 a) instance GHC.IsList.IsList (Agda.Utils.List2.List2 a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.List2.List2 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 -- | Pretty printing functions. module Agda.Utils.Pretty -- | 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 -- |
-- a ? b = hang a 2 b --(>) :: Doc -> Doc -> Doc infixl 6 > hcat :: Foldable t => t Doc -> Doc hsep :: Foldable t => t Doc -> Doc vcat :: Foldable t => t Doc -> Doc punctuate :: Foldable t => Doc -> t Doc -> [Doc] sep :: Foldable t => t Doc -> Doc fsep :: Foldable t => t Doc -> Doc -- | Use instead of show when printing to world. prettyShow :: Pretty a => a -> String -- | Comma separated list, without the brackets. prettyList_ :: Pretty a => [a] -> Doc -- | Apply parens to Doc if boolean is true. mparens :: Bool -> Doc -> Doc -- |
-- pshow = text . show --pshow :: Show a => a -> Doc -- | Pretty print a set. prettySet :: Pretty a => [a] -> Doc -- | Pretty print an association list. prettyMap :: (Pretty k, Pretty v) => [(k, v)] -> Doc pwords :: String -> [Doc] fwords :: String -> Doc -- | Separate, but only if both separees are not null. hsepWith :: Doc -> Doc -> Doc -> Doc -- | Pretty print a single association. prettyAssign :: (Pretty k, Pretty v) => (k, v) -> Doc -- | Only wrap in parens if not empty parensNonEmpty :: Doc -> Doc -- | 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 -- | Handles strings with newlines properly (preserving indentation) multiLineText :: String -> Doc singPlural :: Sized a => a -> c -> c -> c -- | Used for with-like telescopes prefixedThings :: Doc -> [Doc] -> Doc -- | 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 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 -- | The abstract type of documents. A Doc represents a set of -- layouts. A Doc with no occurrences of Union or NoDoc represents just -- one layout. data () => Doc -- | A single Char fragment pattern Chr :: () => {-# UNPACK #-} !Char -> TextDetails -- | Used to represent a Fast String fragment but now deprecated and -- identical to the Str constructor. pattern PStr :: () => String -> TextDetails -- | 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 document of height and width 1, containing a literal character. char :: Char -> Doc parens :: Doc -> Doc -- | Beside, separated by space, unless one of the arguments is -- empty. <+> is associative, with identity -- empty. (<+>) :: Doc -> Doc -> Doc infixl 6 <+> -- | Returns True if the document is empty isEmpty :: Doc -> Bool space :: Doc integer :: Integer -> Doc float :: Float -> Doc braces :: Doc -> Doc brackets :: Doc -> Doc semi :: Doc comma :: Doc colon :: Doc -- | Same as text. Used to be used for Bytestrings. ptext :: String -> Doc -- | Some text with any width. (text s = sizedText (length s) s) sizedText :: Int -> String -> Doc -- | Some text, but without any width. Use for non-printing text such as a -- HTML or Latex tags zeroWidthText :: String -> Doc equals :: Doc lparen :: Doc rparen :: Doc lbrack :: Doc rbrack :: Doc lbrace :: Doc rbrace :: Doc int :: Int -> Doc double :: Double -> Doc rational :: Rational -> Doc quotes :: Doc -> Doc doubleQuotes :: Doc -> Doc -- | Nest (or indent) a document by a given number of positions (which may -- also be negative). nest satisfies the laws: -- --
nest 0 x = x
nest k (nest k' x) = nest (k+k') -- x
nest k (x <> y) = nest k x -- <> nest k y
nest k (x $$ y) = nest k x $$ -- nest k y
nest k empty = empty
-- hang d1 n d2 = sep [d1, nest n d2] --hang :: Doc -> Int -> Doc -> 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 -> Doc -> Doc infixl 5 $$ -- | Above, with no overlapping. $+$ is associative, with identity -- empty. ($+$) :: Doc -> Doc -> Doc infixl 5 $+$ -- | Either hcat or vcat. cat :: [Doc] -> Doc -- | "Paragraph fill" version of cat. fcat :: [Doc] -> Doc -- | The default style (mode=PageMode, lineLength=100, -- ribbonsPerLine=1.5). style :: Style -- | Render the Doc to a String using the default Style -- (see style). render :: Doc -> String -- | Render the Doc to a String using the given Style. renderStyle :: Style -> Doc -> String -- | 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 -> a -- | An associative operation. -- --
-- >>> [1,2,3] <> [4,5,6] -- [1,2,3,4,5,6] --(<>) :: Semigroup a => a -> a -> a infixr 6 <> instance Agda.Utils.Pretty.Pretty GHC.Types.Bool instance Agda.Utils.Pretty.Pretty GHC.Types.Int instance Agda.Utils.Pretty.Pretty GHC.Int.Int32 instance Agda.Utils.Pretty.Pretty GHC.Num.Integer.Integer instance Agda.Utils.Pretty.Pretty GHC.Word.Word64 instance Agda.Utils.Pretty.Pretty GHC.Types.Double instance Agda.Utils.Pretty.Pretty Data.Text.Internal.Text instance Agda.Utils.Pretty.Pretty GHC.Types.Char instance Agda.Utils.Pretty.Pretty Text.PrettyPrint.HughesPJ.Doc instance Agda.Utils.Pretty.Pretty () instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (GHC.Maybe.Maybe a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty [a] instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Utils.List1.List1 a) instance Agda.Utils.Pretty.Pretty Data.IntSet.Internal.IntSet instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Data.Set.Internal.Set a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Data.IntMap.Internal.IntMap a) instance (Agda.Utils.Pretty.Pretty k, Agda.Utils.Pretty.Pretty v) => Agda.Utils.Pretty.Pretty (Data.Map.Internal.Map k v) -- | 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 Control.DeepSeq.NFData Agda.Utils.Time.CPUTime instance GHC.Real.Integral Agda.Utils.Time.CPUTime instance GHC.Enum.Enum Agda.Utils.Time.CPUTime instance GHC.Real.Real Agda.Utils.Time.CPUTime instance GHC.Num.Num Agda.Utils.Time.CPUTime instance GHC.Classes.Ord Agda.Utils.Time.CPUTime instance GHC.Show.Show Agda.Utils.Time.CPUTime instance GHC.Classes.Eq Agda.Utils.Time.CPUTime instance Agda.Utils.Pretty.Pretty 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 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, Eq k, Hashable k, Show k) => 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, Eq k, Hashable k, Show k) => 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: -- --
-- 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: -- --
-- >>> 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. -- --
-- >>> 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 :: forall a b. [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 -- | Finally for the Error class. Errors in the finally part take -- precedence over prior errors. finally :: MonadError e m => m a -> m () -> m a -- | Bracket without failure. Typically used to preserve state. bracket_ :: Monad m => m a -> (a -> m ()) -> m b -> m b andM :: (Foldable f, Monad m) => f (m Bool) -> m Bool -- | Lazy monadic disjunction. or2M :: Monad m => m Bool -> m Bool -> m Bool -- | The for version of mapMaybeMM. forMaybeMM :: Monad m => m [a] -> (a -> m (Maybe b)) -> m [b] -- |
-- ifNotM mc = ifM (not $ mc) --ifNotM :: Monad m => m Bool -> m a -> m a -> m a -- | Monadic if-then-else. ifM :: Monad m => m Bool -> m a -> m a -> m a unlessM :: Monad m => m Bool -> m () -> m () -- | Like guard, but raise given error when condition fails. guardWithError :: MonadError e m => e -> Bool -> m () -- | Try a computation, return Nothing if an Error occurs. tryMaybe :: (MonadError e m, Functor m) => m a -> m (Maybe a) -- | Lazy monadic conjunction. and2M :: Monad m => m Bool -> m Bool -> m Bool -- | Output a single value. tell1 :: (Monoid ws, Singleton w ws, MonadWriter ws m) => w -> m () -- | A monadic version of mapMaybe :: (a -> Maybe b) -> -- [a] -> [b]. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] -- | A monadic version of dropWhile :: (a -> Bool) -> [a] -- -> [a]. dropWhileM :: Monad m => (a -> m Bool) -> [a] -> m [a] -- | Binary bind. (==<<) :: Monad m => (a -> b -> m c) -> (m a, m b) -> m c whenM :: Monad m => m Bool -> m () -> m () -- | Monadic guard. guardM :: (Monad m, MonadPlus m) => m Bool -> m () allM :: (Foldable f, Monad m) => f a -> (a -> m Bool) -> m Bool orM :: (Foldable f, Monad m) => f (m Bool) -> m Bool anyM :: (Foldable f, Monad m) => f a -> (a -> m Bool) -> 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 disjunction with accumulation of errors in a monoid. -- Errors are discarded if we succeed. orEitherM :: (Monoid e, Monad m, Functor m) => [m (Either e b)] -> m (Either e b) -- | 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 -- | Generalized version of for_ :: Applicative m => [a] -> (a -- -> m ()) -> m () forM' :: (Foldable t, Applicative m, Monoid b) => t a -> (a -> m b) -> m b mapMM :: (Traversable t, Monad m) => (a -> m b) -> m (t a) -> m (t b) forMM :: (Traversable t, Monad m) => m (t a) -> (a -> m b) -> m (t b) mapMM_ :: (Foldable t, Monad m) => (a -> m ()) -> m (t a) -> m () forMM_ :: (Foldable t, Monad m) => m (t a) -> (a -> m ()) -> m () -- | A version of mapMaybeM with a computation for the -- input list. mapMaybeMM :: Monad m => (a -> m (Maybe b)) -> m [a] -> m [b] -- | The for version of mapMaybeM. forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> 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 @partition :: (a -> Bool) -- -> [a] -> ([a],[a]) partitionM :: (Functor m, Applicative m) => (a -> m Bool) -> [a] -> m ([a], [a]) -- | Translates Maybe to MonadPlus. fromMaybeMP :: MonadPlus m => Maybe a -> m a -- | Generalises the catMaybes function from lists to an arbitrary -- MonadPlus. catMaybesMP :: MonadPlus m => m (Maybe a) -> m a -- | Branch over elements of a monadic Foldable data structure. scatterMP :: (MonadPlus m, Foldable t) => m (t a) -> m a -- | Run a command, catch the exception and return it. tryCatch :: (MonadError e m, Functor m) => m () -> m (Maybe e) -- | Restore state after computation. localState :: MonadState s m => m a -> m a embedWriter :: (Monoid w, Monad m) => Writer w a -> WriterT w m a -- | Conditional execution of Applicative expressions. For example, -- --
-- when debug (putStrLn "Debugging") ---- -- will output the string Debugging if the Boolean value -- debug is True, and otherwise do nothing. when :: Applicative f => Bool -> f () -> f () -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | 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 -- | 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. -- --
-- >>> 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. -- --
-- >>> 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. (<$) :: 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 a ListT :: m (Maybe (a, ListT m a)) -> ListT m a [runListT] :: ListT m 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 :: Monad m => ListT m a -- | Consing a value to a lazy list. consListT :: Monad m => a -> ListT m a -> ListT m a -- | Singleton lazy list. sgListT :: 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 :: 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 a. m a -> m' a) -> ListT m a -> ListT m' a instance GHC.Base.Functor m => GHC.Base.Functor (Agda.Utils.ListT.ListT m) instance GHC.Base.Monad m => GHC.Base.Semigroup (Agda.Utils.ListT.ListT m a) instance GHC.Base.Monad m => GHC.Base.Monoid (Agda.Utils.ListT.ListT m a) instance (GHC.Base.Functor m, GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Alternative (Agda.Utils.ListT.ListT m) instance (GHC.Base.Functor m, GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.MonadPlus (Agda.Utils.ListT.ListT m) instance (GHC.Base.Functor m, GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Applicative (Agda.Utils.ListT.ListT m) instance (GHC.Base.Functor m, GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Monad (Agda.Utils.ListT.ListT m) instance Control.Monad.Trans.Class.MonadTrans Agda.Utils.ListT.ListT instance (GHC.Base.Applicative m, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Agda.Utils.ListT.ListT m) instance (GHC.Base.Applicative m, Control.Monad.Reader.Class.MonadReader r m) => Control.Monad.Reader.Class.MonadReader r (Agda.Utils.ListT.ListT m) instance (GHC.Base.Applicative m, Control.Monad.State.Class.MonadState s m) => Control.Monad.State.Class.MonadState s (Agda.Utils.ListT.ListT m) instance GHC.Base.Monad m => Control.Monad.Fail.MonadFail (Agda.Utils.ListT.ListT m) -- | 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 instance Control.DeepSeq.NFData Agda.Utils.FileName.AbsolutePath instance Data.Hashable.Class.Hashable Agda.Utils.FileName.AbsolutePath instance GHC.Classes.Ord Agda.Utils.FileName.AbsolutePath instance GHC.Classes.Eq Agda.Utils.FileName.AbsolutePath instance GHC.Show.Show Agda.Utils.FileName.AbsolutePath instance Agda.Utils.Pretty.Pretty 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 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 -- | 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 where { type BenchPhase m; } 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.Generics.Generic (Agda.Utils.Benchmark.BenchmarkOn a) instance GHC.Generics.Generic (Agda.Utils.Benchmark.Benchmark a) instance Agda.Utils.Benchmark.MonadBench m => Agda.Utils.Benchmark.MonadBench (Control.Monad.Trans.Reader.ReaderT r m) instance (Agda.Utils.Benchmark.MonadBench m, GHC.Base.Monoid w) => Agda.Utils.Benchmark.MonadBench (Control.Monad.Trans.Writer.Lazy.WriterT w 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 => 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.Null.Null (Agda.Utils.Benchmark.Benchmark a) instance (GHC.Classes.Ord a, Agda.Utils.Pretty.Pretty a) => Agda.Utils.Pretty.Pretty (Agda.Utils.Benchmark.Benchmark a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.Benchmark.Benchmark a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.Benchmark.BenchmarkOn a) -- | 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 v, 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 :: forall k v m. (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 :: forall k v. (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 v, 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 v, 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 v, 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 :: forall k v. (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 v, 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 v, 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.Generics.Generic (Agda.Utils.BiMap.BiMap k v) instance Agda.Utils.Null.Null (Agda.Utils.BiMap.BiMap k v) instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Agda.Utils.BiMap.BiMap k v) instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Agda.Utils.BiMap.BiMap k v) instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Agda.Utils.BiMap.BiMap k v) -- | 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 -> !Int32 -> !Int32 -> !Int32 -> Position' a -- | File. [srcFile] :: Position' a -> !a -- | Position, counting from 1. [posPos] :: Position' a -> !Int32 -- | Line number, counting from 1. [posLine] :: Position' a -> !Int32 -- | Column number, counting from 1. [posCol] :: Position' a -> !Int32 type SrcFile = Maybe RangeFile -- | File information used in the Position, Interval' and -- Range' types. data RangeFile RangeFile :: !AbsolutePath -> !Maybe TopLevelModuleName -> RangeFile -- | The file's path. [rangeFilePath] :: RangeFile -> !AbsolutePath -- | The file's top-level module name. -- -- 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 should not contain a range. [rangeFileName] :: RangeFile -> !Maybe TopLevelModuleName -- | A smart constructor for RangeFile. mkRangeFile :: AbsolutePath -> Maybe TopLevelModuleName -> RangeFile positionInvariant :: Position' a -> Bool -- | The first position in a file: position 1, line 1, column 1. startPos :: Maybe RangeFile -> Position -- | 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 -- | The first position in a file: position 1, line 1, column 1. startPos' :: a -> Position' a type Interval = Interval' SrcFile type IntervalWithoutFile = Interval' () -- | An interval. The iEnd position is not included in the -- interval. -- -- Note the invariant which intervals have to satisfy: -- intervalInvariant. data Interval' a Interval :: !Position' a -> Interval' a [iStart, iEnd] :: Interval' a -> !Position' a intervalInvariant :: Ord a => Interval' a -> Bool -- | Converts a file name and two positions to an interval. posToInterval :: a -> PositionWithoutFile -> PositionWithoutFile -> Interval' a -- | Gets the srcFile component of the interval. Because of the -- invariant, they are both the same. getIntervalFile :: Interval' a -> a -- | The length of an interval. iLength :: Interval' a -> Int32 -- | Finds the least interval which covers the arguments. -- -- Precondition: The intervals must point to the same file. fuseIntervals :: Ord a => Interval' a -> Interval' a -> Interval' a -- | Sets the srcFile components of the interval. setIntervalFile :: a -> Interval' b -> Interval' a type Range = Range' SrcFile -- | 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 :: Ord a => 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 -- | 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) -- | The range's top-level module name, if any. rangeModule :: Range -> Maybe TopLevelModuleName -- | 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' a -> 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 :: Ord a => 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 getRange :: (HasRange a, Foldable t, HasRange b, t b ~ a) => a -> Range -- | 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 setRange :: (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 killRange :: (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) killRange1 :: KillRange a => (a -> b) -> a -> b killRange2 :: (KillRange a, KillRange b) => (a -> b -> c) -> a -> b -> c killRange3 :: (KillRange a, KillRange b, KillRange c) => (a -> b -> c -> d) -> a -> b -> c -> d killRange4 :: (KillRange a, KillRange b, KillRange c, KillRange d) => (a -> b -> c -> d -> e) -> a -> b -> c -> d -> e killRange5 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e) => (a -> b -> c -> d -> e -> f) -> a -> b -> c -> d -> e -> f killRange6 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f) => (a -> b -> c -> d -> e -> f -> g) -> a -> b -> c -> d -> e -> f -> g killRange7 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g) => (a -> b -> c -> d -> e -> f -> g -> h) -> a -> b -> c -> d -> e -> f -> g -> h killRange8 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> a -> b -> c -> d -> e -> f -> g -> h -> i killRange9 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j killRange10 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k killRange11 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l killRange12 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m killRange13 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n killRange14 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m, KillRange n) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o killRange15 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m, KillRange n, KillRange o) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p killRange16 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m, KillRange n, KillRange o, KillRange p) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q killRange17 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m, KillRange n, KillRange o, KillRange p, KillRange q) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r killRange18 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m, KillRange n, KillRange o, KillRange p, KillRange q, KillRange r) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s killRange19 :: (KillRange a, KillRange b, KillRange c, KillRange d, KillRange e, KillRange f, KillRange g, KillRange h, KillRange i, KillRange j, KillRange k, KillRange l, KillRange m, KillRange n, KillRange o, KillRange p, KillRange q, KillRange r, KillRange s) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> 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 :: Ord a => 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 -- | beginningOfFile r is an empty range (a single, empty -- interval) at the beginning of r's starting position's file. -- If there is no such position, then an empty range is returned. beginningOfFile :: Range -> 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 :: HasRange a => [a] -> [a] -> ([a], [(a, a)]) instance GHC.Generics.Generic (Agda.Syntax.Position.Position' a) instance Data.Traversable.Traversable Agda.Syntax.Position.Position' instance Data.Foldable.Foldable Agda.Syntax.Position.Position' instance GHC.Base.Functor Agda.Syntax.Position.Position' instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Position' a) instance GHC.Generics.Generic Agda.Syntax.Position.RangeFile instance GHC.Show.Show Agda.Syntax.Position.RangeFile instance GHC.Generics.Generic (Agda.Syntax.Position.Interval' a) instance Data.Traversable.Traversable Agda.Syntax.Position.Interval' instance Data.Foldable.Foldable Agda.Syntax.Position.Interval' instance GHC.Base.Functor Agda.Syntax.Position.Interval' instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Position.Interval' a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Position.Interval' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Interval' a) instance GHC.Generics.Generic (Agda.Syntax.Position.Range' a) instance Data.Traversable.Traversable Agda.Syntax.Position.Range' instance Data.Foldable.Foldable Agda.Syntax.Position.Range' instance GHC.Base.Functor Agda.Syntax.Position.Range' instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Position.Range' a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Position.Range' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Range' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Position.PrintRange a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Position.PrintRange a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Position.PrintRange a) instance (Agda.Utils.Pretty.Pretty a, Agda.Syntax.Position.HasRange a) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.PrintRange a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Position.Range instance Agda.Syntax.Position.KillRange Data.Void.Void instance Agda.Syntax.Position.KillRange () instance Agda.Syntax.Position.KillRange GHC.Types.Bool instance Agda.Syntax.Position.KillRange GHC.Types.Int instance Agda.Syntax.Position.KillRange GHC.Num.Integer.Integer instance Agda.Syntax.Position.KillRange Agda.Utils.Permutation.Permutation instance Agda.Syntax.Position.KillRange GHC.Base.String instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange [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 (Agda.Utils.Permutation.Drop a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.List1.List1 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 (GHC.Maybe.Maybe a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Data.Strict.Maybe.Maybe a) instance (GHC.Classes.Ord a, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Data.Set.Internal.Set a) 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 a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Data.Either.Either a b) instance Agda.Syntax.Position.SetRange Agda.Syntax.Position.Range instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange [a] instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (GHC.Maybe.Maybe a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Position.Interval instance Agda.Syntax.Position.HasRange Agda.Syntax.Position.Range instance Agda.Syntax.Position.HasRange () instance Agda.Syntax.Position.HasRange GHC.Types.Bool instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange [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.Utils.List2.List2 a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (GHC.Maybe.Maybe a) 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 a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (Data.Either.Either a b) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Position.Range' a) instance Agda.Utils.Null.Null (Agda.Syntax.Position.Range' a) instance GHC.Classes.Eq a => GHC.Base.Semigroup (Agda.Syntax.Position.Range' a) instance GHC.Classes.Eq a => GHC.Base.Monoid (Agda.Syntax.Position.Range' a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.Range' (Data.Strict.Maybe.Maybe a)) instance Control.DeepSeq.NFData Agda.Syntax.Position.IntervalWithoutFile instance Agda.Utils.Pretty.Pretty Agda.Syntax.Position.IntervalWithoutFile instance Control.DeepSeq.NFData Agda.Syntax.Position.Interval instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.Interval' (Data.Strict.Maybe.Maybe a)) instance Control.DeepSeq.NFData Agda.Syntax.Position.PositionWithoutFile instance Agda.Utils.Pretty.Pretty Agda.Syntax.Position.PositionWithoutFile instance Control.DeepSeq.NFData Agda.Syntax.Position.Position instance GHC.Classes.Eq Agda.Syntax.Position.RangeFile instance GHC.Classes.Ord Agda.Syntax.Position.RangeFile instance Control.DeepSeq.NFData Agda.Syntax.Position.RangeFile instance Agda.Utils.Pretty.Pretty Agda.Syntax.Position.RangeFile instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Position.Position' a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Position.Position' a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.Position' (Data.Strict.Maybe.Maybe a)) -- | Some common syntactic entities are defined in this module. module Agda.Syntax.Common type Nat = Int type Arity = Nat -- | Used to specify whether something should be delayed. data Delayed Delayed :: Delayed NotDelayed :: Delayed data FileType AgdaFileType :: FileType MdFileType :: FileType RstFileType :: FileType TexFileType :: FileType OrgFileType :: FileType -- | Variants of Cubical Agda. data Cubical CErased :: Cubical CFull :: Cubical -- | Agda variants. -- -- Only some variants are tracked. data Language WithoutK :: Language WithK :: Language Cubical :: Cubical -> Language data RecordDirectives' a RecordDirectives :: Maybe (Ranged Induction) -> Maybe HasEta0 -> Maybe Range -> Maybe a -> RecordDirectives' a [recInductive] :: RecordDirectives' a -> Maybe (Ranged Induction) [recHasEta] :: RecordDirectives' a -> Maybe HasEta0 [recPattern] :: RecordDirectives' a -> Maybe Range [recConstructor] :: RecordDirectives' a -> Maybe a emptyRecordDirectives :: RecordDirectives' a -- | Does a record come with eta-equality? data HasEta' a YesEta :: HasEta' a NoEta :: a -> HasEta' a -- | 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 type HasEta0 = HasEta' () -- | 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 -- | Can we pattern match on the record constructor? class PatternMatchingAllowed a patternMatchingAllowed :: PatternMatchingAllowed a => a -> Bool -- | Can we construct a record by copattern matching? class CopatternMatchingAllowed a copatternMatchingAllowed :: CopatternMatchingAllowed a => a -> Bool -- |
-- Inductive < Coinductive --data Induction Inductive :: Induction CoInductive :: Induction data Overlappable YesOverlap :: Overlappable NoOverlap :: Overlappable data Hiding Hidden :: Hiding Instance :: Overlappable -> Hiding NotHidden :: Hiding -- | Decorating something with Hiding information. data WithHiding a WithHiding :: !Hiding -> a -> WithHiding a [whHiding] :: WithHiding a -> !Hiding [whThing] :: WithHiding 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 setHiding :: LensHiding a => Hiding -> a -> a mapHiding :: LensHiding a => (Hiding -> Hiding) -> a -> a getHiding :: (LensHiding a, LensArgInfo a) => a -> Hiding mapHiding :: (LensHiding a, LensArgInfo a) => (Hiding -> Hiding) -> a -> a -- | Monoidal composition of Hiding information in some data. mergeHiding :: LensHiding a => WithHiding a -> a -- | NotHidden arguments are visible. visible :: LensHiding a => a -> Bool -- | Instance and Hidden arguments are notVisible. notVisible :: LensHiding a => a -> Bool -- | Hidden arguments are hidden. hidden :: LensHiding a => a -> Bool hide :: LensHiding a => a -> a hideOrKeepInstance :: LensHiding a => a -> a makeInstance :: LensHiding a => a -> a makeInstance' :: LensHiding a => Overlappable -> a -> a isOverlappable :: LensHiding a => a -> Bool isInstance :: LensHiding a => a -> Bool -- | Ignores Overlappable. sameHiding :: (LensHiding a, LensHiding b) => a -> b -> Bool -- | 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 -- | We have a tuple of modalities, which might not be fully orthogonal. -- For instance, irrelevant stuff is also run-time irrelevant. data Modality Modality :: Relevance -> Quantity -> Cohesion -> Modality -- | Legacy irrelevance. See Pfenning, LiCS 2001; -- AbelVezzosiWinterhalter, 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 -- | m moreUsableModality m' means that an m can -- be used where ever an m' is required. moreUsableModality :: Modality -> Modality -> Bool usableModality :: LensModality a => a -> Bool -- | Multiplicative monoid (standard monoid). composeModality :: Modality -> Modality -> Modality -- | 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 -- | 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 -- | 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 -- | Modality forms a pointwise additive monoid. addModality :: Modality -> Modality -> Modality -- | Identity under addition zeroModality :: Modality -- | Identity under composition unitModality :: Modality -- | Absorptive element under addition. topModality :: Modality -- | The default Modality Beware that this is neither the additive unit nor -- the unit under composition, because the default quantity is ω. defaultModality :: Modality -- | Equality ignoring origin. sameModality :: (LensModality a, LensModality b) => a -> b -> Bool lModRelevance :: Lens' Relevance Modality lModQuantity :: Lens' Quantity Modality lModCohesion :: Lens' Cohesion Modality class LensModality a getModality :: LensModality a => a -> Modality setModality :: LensModality a => Modality -> a -> a mapModality :: LensModality a => (Modality -> Modality) -> a -> a getModality :: (LensModality a, LensArgInfo a) => a -> Modality mapModality :: (LensModality a, LensArgInfo a) => (Modality -> Modality) -> a -> a getRelevanceMod :: LensModality a => LensGet Relevance a setRelevanceMod :: LensModality a => LensSet Relevance a mapRelevanceMod :: LensModality a => LensMap Relevance a getQuantityMod :: LensModality a => LensGet Quantity a setQuantityMod :: LensModality a => LensSet Quantity a mapQuantityMod :: LensModality a => LensMap Quantity a getCohesionMod :: LensModality a => LensGet Cohesion a setCohesionMod :: LensModality a => LensSet Cohesion a mapCohesionMod :: LensModality a => LensMap Cohesion a -- | 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 -- | 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 -- | 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 -- | Equality ignoring origin. sameQuantity :: Quantity -> Quantity -> Bool -- | Quantity forms an additive monoid with zero Quantity0. addQuantity :: Quantity -> Quantity -> Quantity -- | Identity element under addition zeroQuantity :: Quantity -- | Absorptive element! This differs from Relevance and Cohesion whose -- default is the multiplicative unit. defaultQuantity :: Quantity -- | Identity element under composition unitQuantity :: Quantity -- | Absorptive element is ω. topQuantity :: Quantity -- | m moreUsableQuantity m' means that an m can -- be used where ever an m' is required. moreQuantity :: Quantity -> Quantity -> Bool -- | Composition of quantities (multiplication). -- -- Quantity0 is dominant. Quantity1 is neutral. -- -- Right-biased for origin. composeQuantity :: Quantity -> Quantity -> Quantity -- | 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 -- | 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 -- | Left division by a Quantity. Used e.g. to modify context when -- going into a q argument. inverseApplyQuantity :: LensQuantity a => Quantity -> a -> a -- | Check for Quantity0. hasQuantity0 :: LensQuantity a => a -> Bool -- | Check for Quantity1. hasQuantity1 :: LensQuantity a => a -> Bool -- | Check for Quantityω. hasQuantityω :: LensQuantity a => a -> Bool -- | Did the user supply a quantity annotation? noUserQuantity :: LensQuantity a => a -> Bool -- | A thing of quantity 0 is unusable, all others are usable. usableQuantity :: LensQuantity a => a -> Bool class LensQuantity a getQuantity :: LensQuantity a => a -> Quantity setQuantity :: LensQuantity a => Quantity -> a -> a mapQuantity :: LensQuantity a => (Quantity -> Quantity) -> a -> a getQuantity :: (LensQuantity a, LensModality a) => a -> Quantity mapQuantity :: (LensQuantity a, LensModality a) => (Quantity -> Quantity) -> a -> a -- | A special case of Quantity: erased or not. data Erased Erased :: Q0Origin -> Erased NotErased :: QωOrigin -> Erased -- | The default value of type Erased: not erased. defaultErased :: Erased -- | Erased can be embedded into Quantity. asQuantity :: Erased -> Quantity -- | Quantity can be projected onto Erased. erasedFromQuantity :: Quantity -> Maybe Erased -- | Equality ignoring origin. sameErased :: Erased -> Erased -> Bool -- | Is the value "erased"? isErased :: Erased -> Bool -- | Composition of values of type Erased. -- -- Erased is dominant. NotErased is neutral. -- -- Right-biased for the origin. composeErased :: Erased -> Erased -> Erased -- | A function argument can be relevant or irrelevant. See -- Agda.TypeChecking.Irrelevance. data Relevance -- | The argument is (possibly) relevant at compile-time. Relevant :: Relevance -- | The argument may never flow into evaluation position. Therefore, it is -- irrelevant at run-time. It is treated relevantly during equality -- checking. NonStrict :: Relevance -- | The argument is irrelevant at compile- and runtime. Irrelevant :: Relevance allRelevances :: [Relevance] -- | 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 setRelevance :: LensRelevance a => Relevance -> a -> a mapRelevance :: LensRelevance a => (Relevance -> Relevance) -> a -> a getRelevance :: (LensRelevance a, LensModality a) => a -> Relevance mapRelevance :: (LensRelevance a, LensModality a) => (Relevance -> Relevance) -> a -> a isRelevant :: LensRelevance a => a -> Bool isIrrelevant :: LensRelevance a => a -> Bool isNonStrict :: LensRelevance a => a -> Bool -- | Information ordering. Relevant `moreRelevant` NonStrict -- `moreRelevant` Irrelevant moreRelevant :: Relevance -> Relevance -> Bool -- | Equality ignoring origin. sameRelevance :: Relevance -> Relevance -> Bool -- | usableRelevance rel == False iff we cannot use a variable of -- rel. usableRelevance :: LensRelevance a => a -> Bool -- | Relevance composition. Irrelevant is dominant, -- Relevant is neutral. Composition coincides with max. composeRelevance :: Relevance -> Relevance -> Relevance -- | 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 -- | 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 -- | Left division by a Relevance. Used e.g. to modify context when -- going into a rel argument. inverseApplyRelevance :: LensRelevance a => Relevance -> a -> a -- | Combine inferred Relevance. The unit is Irrelevant. addRelevance :: Relevance -> Relevance -> Relevance -- | Relevance forms a monoid under addition, and even a semiring. zeroRelevance :: Relevance -- | Identity element under composition unitRelevance :: Relevance -- | Absorptive element under addition. topRelevance :: Relevance -- | Default Relevance is the identity element under composition defaultRelevance :: Relevance -- | Irrelevant function arguments may appear non-strictly in the codomain -- type. irrToNonStrict :: Relevance -> Relevance -- | Applied when working on types (unless --experimental-irrelevance). nonStrictToRel :: Relevance -> Relevance nonStrictToIrr :: Relevance -> Relevance -- | We have a tuple of annotations, which might not be fully orthogonal. data Annotation Annotation :: Lock -> Annotation -- | Fitch-style dependent right adjoints. See Modal Dependent Type Theory -- and Dependent Right Adjoints, arXiv:1804.05236. [annLock] :: Annotation -> Lock defaultAnnotation :: Annotation class LensAnnotation a getAnnotation :: LensAnnotation a => a -> Annotation setAnnotation :: LensAnnotation a => Annotation -> a -> a mapAnnotation :: LensAnnotation a => (Annotation -> Annotation) -> a -> a getAnnotation :: (LensAnnotation a, LensArgInfo a) => a -> Annotation setAnnotation :: (LensAnnotation a, LensArgInfo a) => Annotation -> a -> a data Lock IsNotLock :: Lock -- | In the future there might be different kinds of them. For now we -- assume lock weakening. IsLock :: Lock defaultLock :: Lock class LensLock a getLock :: LensLock a => a -> Lock setLock :: LensLock a => Lock -> a -> a mapLock :: LensLock a => (Lock -> Lock) -> a -> a -- | 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. | Sharp -- ^ same points, codiscrete topology, -- idempotent monad, diamond-like. Continuous :: Cohesion -- | single point space, artificially added for Flat left-composition. Squash :: Cohesion allCohesions :: [Cohesion] -- | 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 setCohesion :: LensCohesion a => Cohesion -> a -> a mapCohesion :: LensCohesion a => (Cohesion -> Cohesion) -> a -> a getCohesion :: (LensCohesion a, LensModality a) => a -> Cohesion mapCohesion :: (LensCohesion a, LensModality a) => (Cohesion -> Cohesion) -> a -> a -- | Information ordering. Flat `moreCohesion` Continuous -- `moreCohesion` Sharp `moreCohesion` Squash moreCohesion :: Cohesion -> Cohesion -> Bool -- | Equality ignoring origin. sameCohesion :: Cohesion -> Cohesion -> Bool -- | usableCohesion rel == False iff we cannot use a variable of -- rel. usableCohesion :: LensCohesion a => a -> Bool -- | Cohesion composition. Squash is dominant, -- Continuous is neutral. composeCohesion :: Cohesion -> Cohesion -> Cohesion -- | 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 -- | 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 -- | Left division by a Cohesion. Used e.g. to modify context when -- going into a rel argument. inverseApplyCohesion :: LensCohesion a => Cohesion -> a -> a -- | Combine inferred Cohesion. The unit is Squash. addCohesion :: Cohesion -> Cohesion -> Cohesion -- | Cohesion forms a monoid under addition, and even a semiring. zeroCohesion :: Cohesion -- | Identity under composition unitCohesion :: Cohesion -- | Absorptive element under addition. topCohesion :: Cohesion -- | Default Cohesion is the identity element under composition defaultCohesion :: Cohesion -- | 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 -- | Decorating something with Origin information. data WithOrigin a WithOrigin :: !Origin -> a -> WithOrigin a [woOrigin] :: WithOrigin a -> !Origin [woThing] :: WithOrigin a -> 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 setOrigin :: LensOrigin a => Origin -> a -> a mapOrigin :: LensOrigin a => (Origin -> Origin) -> a -> a getOrigin :: (LensOrigin a, LensArgInfo a) => a -> Origin mapOrigin :: (LensOrigin a, LensArgInfo a) => (Origin -> Origin) -> a -> a data FreeVariables UnknownFVs :: FreeVariables KnownFVs :: IntSet -> FreeVariables unknownFreeVariables :: FreeVariables noFreeVariables :: FreeVariables oneFreeVariable :: Int -> FreeVariables freeVariablesFromList :: [Int] -> FreeVariables -- | 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 setFreeVariables :: LensFreeVariables a => FreeVariables -> a -> a mapFreeVariables :: LensFreeVariables a => (FreeVariables -> FreeVariables) -> a -> a getFreeVariables :: (LensFreeVariables a, LensArgInfo a) => a -> FreeVariables mapFreeVariables :: (LensFreeVariables a, LensArgInfo a) => (FreeVariables -> FreeVariables) -> a -> a hasNoFreeVariables :: LensFreeVariables a => a -> Bool -- | 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 class LensArgInfo a getArgInfo :: LensArgInfo a => a -> ArgInfo setArgInfo :: LensArgInfo a => ArgInfo -> a -> a mapArgInfo :: LensArgInfo a => (ArgInfo -> ArgInfo) -> a -> a defaultArgInfo :: ArgInfo getHidingArgInfo :: LensArgInfo a => LensGet Hiding a setHidingArgInfo :: LensArgInfo a => LensSet Hiding a mapHidingArgInfo :: LensArgInfo a => LensMap Hiding a getModalityArgInfo :: LensArgInfo a => LensGet Modality a setModalityArgInfo :: LensArgInfo a => LensSet Modality a mapModalityArgInfo :: LensArgInfo a => LensMap Modality a getOriginArgInfo :: LensArgInfo a => LensGet Origin a setOriginArgInfo :: LensArgInfo a => LensSet Origin a mapOriginArgInfo :: LensArgInfo a => LensMap Origin a getFreeVariablesArgInfo :: LensArgInfo a => LensGet FreeVariables a setFreeVariablesArgInfo :: LensArgInfo a => LensSet FreeVariables a mapFreeVariablesArgInfo :: LensArgInfo a => LensMap FreeVariables a isInsertedHidden :: (LensHiding a, LensOrigin a) => a -> Bool data Arg e Arg :: ArgInfo -> e -> Arg e [argInfo] :: Arg e -> ArgInfo [unArg] :: Arg e -> e defaultArg :: a -> Arg a -- | 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] class Eq a => Underscore a underscore :: Underscore a => a isUnderscore :: Underscore a => a -> Bool -- | 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 -- | Standard naming. type Named_ = Named NamedName -- | Standard argument names. type NamedName = WithOrigin (Ranged ArgName) -- | Equality of argument names of things modulo Range' and -- Origin. sameName :: NamedName -> NamedName -> Bool unnamed :: a -> Named name a isUnnamed :: Named name a -> Maybe a named :: name -> a -> Named name a userNamed :: Ranged ArgName -> a -> Named_ a -- | Accessor/editor for the nameOf component. class LensNamed a where { -- | The type of the name type NameOf a; } lensNamed :: LensNamed a => Lens' (Maybe (NameOf a)) a lensNamed :: (LensNamed a, Decoration f, LensNamed b, NameOf b ~ NameOf a, f b ~ a) => Lens' (Maybe (NameOf a)) a getNameOf :: LensNamed a => a -> Maybe (NameOf a) setNameOf :: LensNamed a => Maybe (NameOf a) -> a -> a mapNameOf :: LensNamed a => (Maybe (NameOf a) -> Maybe (NameOf a)) -> a -> a bareNameOf :: (LensNamed a, NameOf a ~ NamedName) => a -> Maybe ArgName bareNameWithDefault :: (LensNamed a, NameOf a ~ NamedName) => ArgName -> a -> ArgName -- | Equality of argument names of things modulo Range' and -- Origin. namedSame :: (LensNamed a, LensNamed b, NameOf a ~ NamedName, NameOf b ~ NamedName) => a -> b -> Bool -- | 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 -- | Only Hidden arguments can have names. type NamedArg a = Arg (Named_ a) -- | Get the content of a NamedArg. namedArg :: NamedArg a -> a defaultNamedArg :: a -> NamedArg a unnamedArg :: ArgInfo -> a -> NamedArg 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) -- |
-- setNamedArg a b = updateNamedArg (const b) a --setNamedArg :: NamedArg a -> b -> NamedArg b -- | Names in binders and arguments. type ArgName = String argNameToString :: ArgName -> String stringToArgName :: String -> ArgName appendArgNames :: ArgName -> ArgName -> ArgName -- | Thing with range info. data Ranged a Ranged :: Range -> a -> Ranged a [rangeOf] :: Ranged a -> Range [rangedThing] :: Ranged a -> a -- | Thing with no range info. unranged :: a -> Ranged a -- | A RawName is some sort of string. type RawName = String rawNameToString :: RawName -> String stringToRawName :: String -> RawName -- | String with range info. type RString = Ranged RawName -- | 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 -- | Prefer user-written over system-inserted. bestConInfo :: ConOrigin -> ConOrigin -> ConOrigin -- | 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 -- | Functions can be defined in both infix and prefix style. See -- LHS. data IsInfix InfixDef :: IsInfix PrefixDef :: IsInfix -- | 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. PrivateAccess :: Origin -> Access PublicAccess :: Access -- | Abstract or concrete. data IsAbstract AbstractDef :: IsAbstract ConcreteDef :: IsAbstract class LensIsAbstract a lensIsAbstract :: LensIsAbstract a => Lens' IsAbstract a -- | Is any element of a collection an AbstractDef. class AnyIsAbstract a anyIsAbstract :: AnyIsAbstract a => a -> IsAbstract anyIsAbstract :: (AnyIsAbstract a, Foldable t, AnyIsAbstract b, t b ~ a) => a -> IsAbstract -- | Is this definition eligible for instance search? data IsInstance -- | Range of the instance keyword. InstanceDef :: Range -> IsInstance NotInstanceDef :: IsInstance -- | Is this a macro definition? data IsMacro MacroDef :: IsMacro NotMacroDef :: IsMacro newtype ModuleNameHash ModuleNameHash :: Word64 -> ModuleNameHash [moduleNameHash] :: ModuleNameHash -> Word64 noModuleNameHash :: ModuleNameHash -- | The unique identifier of a name. Second argument is the top-level -- module identifier. data NameId NameId :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !ModuleNameHash -> NameId -- | Meta-variable identifiers use the same structure as NameIds. data MetaId MetaId :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !ModuleNameHash -> MetaId [metaId] :: MetaId -> {-# UNPACK #-} !Word64 [metaModule] :: MetaId -> {-# UNPACK #-} !ModuleNameHash newtype Constr a Constr :: a -> Constr a -- | A "problem" consists of a set of constraints and the same constraint -- can be part of multiple problems. newtype ProblemId ProblemId :: Nat -> ProblemId -- | 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 -- | 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 -- | An abbreviation: noPlaceholder = NoPlaceholder -- Nothing. noPlaceholder :: e -> MaybePlaceholder e newtype InteractionId InteractionId :: Nat -> InteractionId [interactionId] :: InteractionId -> Nat -- | Precedence levels for operators. type PrecedenceLevel = Double data FixityLevel -- | No fixity declared. Unrelated :: FixityLevel -- | Fixity level declared as the number. Related :: !PrecedenceLevel -> FixityLevel -- | Associativity. data Associativity NonAssoc :: Associativity LeftAssoc :: Associativity RightAssoc :: Associativity -- | 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 noFixity :: Fixity defaultFixity :: Fixity -- | 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 noFixity' :: Fixity' _fixityAssoc :: Lens' Associativity Fixity _fixityLevel :: Lens' FixityLevel Fixity class LensFixity a lensFixity :: LensFixity a => Lens' Fixity a class LensFixity' a lensFixity' :: LensFixity' a => Lens' Fixity' a -- | 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 Range -> 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. [publicOpen] :: ImportDirective' n m -> Maybe Range type HidingDirective' n m = [ImportedName' n m] type RenamingDirective' n m = [Renaming' n m] -- | Default is directive is private (use everything, but do not -- export). defaultImportDir :: ImportDirective' n m -- | isDefaultImportDir implies null, but not the other -- way round. isDefaultImportDir :: ImportDirective' n m -> Bool -- | 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 mapUsing :: ([ImportedName' n1 m1] -> [ImportedName' n2 m2]) -> Using' n1 m1 -> Using' n2 m2 -- | 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 fromImportedName :: ImportedName' a a -> a setImportedName :: ImportedName' a a -> a -> ImportedName' a a -- | Like partitionEithers. partitionImportedNames :: [ImportedName' n m] -> ([n], [m]) 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 -- | 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 -- | Positivity check? (Default = True). data PositivityCheck YesPositivityCheck :: PositivityCheck NoPositivityCheck :: PositivityCheck -- | Universe check? (Default is yes). data UniverseCheck YesUniverseCheck :: UniverseCheck NoUniverseCheck :: UniverseCheck -- | Coverage check? (Default is yes). data CoverageCheck YesCoverageCheck :: CoverageCheck NoCoverageCheck :: CoverageCheck -- | 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 data ExpandedEllipsis ExpandedEllipsis :: Range -> Int -> ExpandedEllipsis [ellipsisRange] :: ExpandedEllipsis -> Range [ellipsisWithArgs] :: ExpandedEllipsis -> Int NoEllipsis :: ExpandedEllipsis -- | Notation as provided by the syntax declaration. type Notation = [NotationPart] noNotation :: Notation -- | 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 -- | 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 instance GHC.Generics.Generic Agda.Syntax.Common.Delayed instance GHC.Classes.Ord Agda.Syntax.Common.Delayed instance GHC.Classes.Eq Agda.Syntax.Common.Delayed instance GHC.Show.Show Agda.Syntax.Common.Delayed instance GHC.Generics.Generic Agda.Syntax.Common.FileType instance GHC.Show.Show Agda.Syntax.Common.FileType instance GHC.Classes.Ord Agda.Syntax.Common.FileType instance GHC.Classes.Eq Agda.Syntax.Common.FileType instance GHC.Generics.Generic Agda.Syntax.Common.Cubical instance GHC.Show.Show Agda.Syntax.Common.Cubical instance GHC.Classes.Eq Agda.Syntax.Common.Cubical instance GHC.Generics.Generic Agda.Syntax.Common.Language instance GHC.Show.Show Agda.Syntax.Common.Language instance GHC.Classes.Eq Agda.Syntax.Common.Language instance Data.Traversable.Traversable Agda.Syntax.Common.HasEta' instance Data.Foldable.Foldable Agda.Syntax.Common.HasEta' instance GHC.Base.Functor Agda.Syntax.Common.HasEta' instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Common.HasEta' a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.HasEta' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.HasEta' a) instance GHC.Enum.Bounded Agda.Syntax.Common.PatternOrCopattern instance GHC.Enum.Enum Agda.Syntax.Common.PatternOrCopattern instance GHC.Classes.Ord Agda.Syntax.Common.PatternOrCopattern instance GHC.Classes.Eq Agda.Syntax.Common.PatternOrCopattern instance GHC.Show.Show Agda.Syntax.Common.PatternOrCopattern instance GHC.Show.Show Agda.Syntax.Common.Induction instance GHC.Classes.Ord Agda.Syntax.Common.Induction instance GHC.Classes.Eq Agda.Syntax.Common.Induction instance GHC.Classes.Ord Agda.Syntax.Common.Overlappable instance GHC.Classes.Eq Agda.Syntax.Common.Overlappable instance GHC.Show.Show Agda.Syntax.Common.Overlappable instance GHC.Classes.Ord Agda.Syntax.Common.Hiding instance GHC.Classes.Eq Agda.Syntax.Common.Hiding instance GHC.Show.Show Agda.Syntax.Common.Hiding instance Data.Traversable.Traversable Agda.Syntax.Common.WithHiding instance Data.Foldable.Foldable Agda.Syntax.Common.WithHiding instance GHC.Base.Functor Agda.Syntax.Common.WithHiding instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.WithHiding a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Common.WithHiding a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.WithHiding a) instance Agda.Utils.PartialOrd.PartialOrd t => Agda.Utils.PartialOrd.PartialOrd (Agda.Syntax.Common.UnderAddition t) instance GHC.Classes.Ord t => GHC.Classes.Ord (Agda.Syntax.Common.UnderAddition t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Agda.Syntax.Common.UnderAddition t) instance GHC.Base.Functor Agda.Syntax.Common.UnderAddition instance GHC.Show.Show t => GHC.Show.Show (Agda.Syntax.Common.UnderAddition t) instance Agda.Utils.PartialOrd.PartialOrd t => Agda.Utils.PartialOrd.PartialOrd (Agda.Syntax.Common.UnderComposition t) instance GHC.Classes.Ord t => GHC.Classes.Ord (Agda.Syntax.Common.UnderComposition t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Agda.Syntax.Common.UnderComposition t) instance GHC.Base.Functor Agda.Syntax.Common.UnderComposition instance GHC.Show.Show t => GHC.Show.Show (Agda.Syntax.Common.UnderComposition t) instance GHC.Classes.Ord Agda.Syntax.Common.Q0Origin instance GHC.Classes.Eq Agda.Syntax.Common.Q0Origin instance GHC.Generics.Generic Agda.Syntax.Common.Q0Origin instance GHC.Show.Show Agda.Syntax.Common.Q0Origin instance GHC.Classes.Ord Agda.Syntax.Common.Q1Origin instance GHC.Classes.Eq Agda.Syntax.Common.Q1Origin instance GHC.Generics.Generic Agda.Syntax.Common.Q1Origin instance GHC.Show.Show Agda.Syntax.Common.Q1Origin instance GHC.Classes.Ord Agda.Syntax.Common.QωOrigin instance GHC.Classes.Eq Agda.Syntax.Common.QωOrigin instance GHC.Generics.Generic Agda.Syntax.Common.QωOrigin instance GHC.Show.Show Agda.Syntax.Common.QωOrigin instance GHC.Classes.Ord Agda.Syntax.Common.Quantity instance GHC.Classes.Eq Agda.Syntax.Common.Quantity instance GHC.Generics.Generic Agda.Syntax.Common.Quantity instance GHC.Show.Show Agda.Syntax.Common.Quantity instance GHC.Generics.Generic Agda.Syntax.Common.Erased instance GHC.Classes.Eq Agda.Syntax.Common.Erased instance GHC.Show.Show Agda.Syntax.Common.Erased instance GHC.Generics.Generic Agda.Syntax.Common.Relevance instance GHC.Enum.Bounded Agda.Syntax.Common.Relevance instance GHC.Enum.Enum Agda.Syntax.Common.Relevance instance GHC.Classes.Eq Agda.Syntax.Common.Relevance instance GHC.Show.Show Agda.Syntax.Common.Relevance instance GHC.Classes.Ord Agda.Syntax.Common.Lock instance GHC.Enum.Bounded Agda.Syntax.Common.Lock instance GHC.Enum.Enum Agda.Syntax.Common.Lock instance GHC.Classes.Eq Agda.Syntax.Common.Lock instance GHC.Generics.Generic Agda.Syntax.Common.Lock instance GHC.Show.Show Agda.Syntax.Common.Lock instance GHC.Generics.Generic Agda.Syntax.Common.Annotation instance GHC.Show.Show Agda.Syntax.Common.Annotation instance GHC.Classes.Ord Agda.Syntax.Common.Annotation instance GHC.Classes.Eq Agda.Syntax.Common.Annotation instance GHC.Generics.Generic Agda.Syntax.Common.Cohesion instance GHC.Enum.Bounded Agda.Syntax.Common.Cohesion instance GHC.Enum.Enum Agda.Syntax.Common.Cohesion instance GHC.Classes.Eq Agda.Syntax.Common.Cohesion instance GHC.Show.Show Agda.Syntax.Common.Cohesion instance GHC.Generics.Generic Agda.Syntax.Common.Modality instance GHC.Show.Show Agda.Syntax.Common.Modality instance GHC.Classes.Ord Agda.Syntax.Common.Modality instance GHC.Classes.Eq Agda.Syntax.Common.Modality instance GHC.Classes.Ord Agda.Syntax.Common.Origin instance GHC.Classes.Eq Agda.Syntax.Common.Origin instance GHC.Show.Show Agda.Syntax.Common.Origin instance Data.Traversable.Traversable Agda.Syntax.Common.WithOrigin instance Data.Foldable.Foldable Agda.Syntax.Common.WithOrigin instance GHC.Base.Functor Agda.Syntax.Common.WithOrigin instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.WithOrigin a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Common.WithOrigin a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.WithOrigin a) instance GHC.Show.Show Agda.Syntax.Common.FreeVariables instance GHC.Classes.Ord Agda.Syntax.Common.FreeVariables instance GHC.Classes.Eq Agda.Syntax.Common.FreeVariables instance GHC.Show.Show Agda.Syntax.Common.ArgInfo instance GHC.Classes.Ord Agda.Syntax.Common.ArgInfo instance GHC.Classes.Eq Agda.Syntax.Common.ArgInfo instance Data.Traversable.Traversable Agda.Syntax.Common.Arg instance Data.Foldable.Foldable Agda.Syntax.Common.Arg instance GHC.Base.Functor Agda.Syntax.Common.Arg instance GHC.Show.Show e => GHC.Show.Show (Agda.Syntax.Common.Arg e) instance GHC.Classes.Ord e => GHC.Classes.Ord (Agda.Syntax.Common.Arg e) instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Common.Arg e) instance Data.Traversable.Traversable (Agda.Syntax.Common.Named name) instance Data.Foldable.Foldable (Agda.Syntax.Common.Named name) instance GHC.Base.Functor (Agda.Syntax.Common.Named name) instance (GHC.Show.Show name, GHC.Show.Show a) => GHC.Show.Show (Agda.Syntax.Common.Named name a) instance (GHC.Classes.Ord name, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Common.Named name a) instance (GHC.Classes.Eq name, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Common.Named name a) instance Data.Traversable.Traversable Agda.Syntax.Common.Ranged instance Data.Foldable.Foldable Agda.Syntax.Common.Ranged instance GHC.Base.Functor Agda.Syntax.Common.Ranged instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.Ranged a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.RecordDirectives' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.RecordDirectives' a) instance GHC.Base.Functor Agda.Syntax.Common.RecordDirectives' instance GHC.Generics.Generic Agda.Syntax.Common.ConOrigin instance GHC.Enum.Bounded Agda.Syntax.Common.ConOrigin instance GHC.Enum.Enum Agda.Syntax.Common.ConOrigin instance GHC.Classes.Ord Agda.Syntax.Common.ConOrigin instance GHC.Classes.Eq Agda.Syntax.Common.ConOrigin instance GHC.Show.Show Agda.Syntax.Common.ConOrigin instance GHC.Generics.Generic Agda.Syntax.Common.ProjOrigin instance GHC.Enum.Bounded Agda.Syntax.Common.ProjOrigin instance GHC.Enum.Enum Agda.Syntax.Common.ProjOrigin instance GHC.Classes.Ord Agda.Syntax.Common.ProjOrigin instance GHC.Classes.Eq Agda.Syntax.Common.ProjOrigin instance GHC.Show.Show Agda.Syntax.Common.ProjOrigin instance GHC.Classes.Ord Agda.Syntax.Common.IsInfix instance GHC.Classes.Eq Agda.Syntax.Common.IsInfix instance GHC.Show.Show Agda.Syntax.Common.IsInfix instance GHC.Classes.Ord Agda.Syntax.Common.Access instance GHC.Classes.Eq Agda.Syntax.Common.Access instance GHC.Show.Show Agda.Syntax.Common.Access instance GHC.Generics.Generic Agda.Syntax.Common.IsAbstract instance GHC.Classes.Ord Agda.Syntax.Common.IsAbstract instance GHC.Classes.Eq Agda.Syntax.Common.IsAbstract instance GHC.Show.Show Agda.Syntax.Common.IsAbstract instance GHC.Classes.Ord Agda.Syntax.Common.IsInstance instance GHC.Classes.Eq Agda.Syntax.Common.IsInstance instance GHC.Show.Show Agda.Syntax.Common.IsInstance instance GHC.Generics.Generic Agda.Syntax.Common.IsMacro instance GHC.Classes.Ord Agda.Syntax.Common.IsMacro instance GHC.Classes.Eq Agda.Syntax.Common.IsMacro instance GHC.Show.Show Agda.Syntax.Common.IsMacro instance Data.Hashable.Class.Hashable Agda.Syntax.Common.ModuleNameHash instance GHC.Classes.Ord Agda.Syntax.Common.ModuleNameHash instance GHC.Classes.Eq Agda.Syntax.Common.ModuleNameHash instance GHC.Show.Show Agda.Syntax.Common.NameId instance GHC.Generics.Generic Agda.Syntax.Common.NameId instance GHC.Classes.Ord Agda.Syntax.Common.NameId instance GHC.Classes.Eq Agda.Syntax.Common.NameId instance GHC.Generics.Generic Agda.Syntax.Common.MetaId instance GHC.Classes.Ord Agda.Syntax.Common.MetaId instance GHC.Classes.Eq Agda.Syntax.Common.MetaId instance Control.DeepSeq.NFData Agda.Syntax.Common.ProblemId instance GHC.Num.Num Agda.Syntax.Common.ProblemId instance GHC.Real.Integral Agda.Syntax.Common.ProblemId instance GHC.Real.Real Agda.Syntax.Common.ProblemId instance GHC.Enum.Enum Agda.Syntax.Common.ProblemId instance GHC.Classes.Ord Agda.Syntax.Common.ProblemId instance GHC.Classes.Eq Agda.Syntax.Common.ProblemId instance GHC.Classes.Ord Agda.Syntax.Common.PositionInName instance GHC.Classes.Eq Agda.Syntax.Common.PositionInName instance GHC.Show.Show Agda.Syntax.Common.PositionInName instance GHC.Show.Show e => GHC.Show.Show (Agda.Syntax.Common.MaybePlaceholder e) instance Data.Traversable.Traversable Agda.Syntax.Common.MaybePlaceholder instance Data.Foldable.Foldable Agda.Syntax.Common.MaybePlaceholder instance GHC.Base.Functor Agda.Syntax.Common.MaybePlaceholder instance GHC.Classes.Ord e => GHC.Classes.Ord (Agda.Syntax.Common.MaybePlaceholder e) instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Common.MaybePlaceholder e) instance Control.DeepSeq.NFData Agda.Syntax.Common.InteractionId instance GHC.Enum.Enum Agda.Syntax.Common.InteractionId instance GHC.Real.Real Agda.Syntax.Common.InteractionId instance GHC.Real.Integral Agda.Syntax.Common.InteractionId instance GHC.Num.Num Agda.Syntax.Common.InteractionId instance GHC.Show.Show Agda.Syntax.Common.InteractionId instance GHC.Classes.Ord Agda.Syntax.Common.InteractionId instance GHC.Classes.Eq Agda.Syntax.Common.InteractionId instance GHC.Show.Show Agda.Syntax.Common.FixityLevel instance GHC.Classes.Ord Agda.Syntax.Common.FixityLevel instance GHC.Classes.Eq Agda.Syntax.Common.FixityLevel instance GHC.Show.Show Agda.Syntax.Common.Associativity instance GHC.Classes.Ord Agda.Syntax.Common.Associativity instance GHC.Classes.Eq Agda.Syntax.Common.Associativity instance GHC.Show.Show Agda.Syntax.Common.Fixity instance (GHC.Show.Show m, GHC.Show.Show n) => GHC.Show.Show (Agda.Syntax.Common.ImportedName' n m) instance (GHC.Classes.Ord m, GHC.Classes.Ord n) => GHC.Classes.Ord (Agda.Syntax.Common.ImportedName' n m) instance (GHC.Classes.Eq m, GHC.Classes.Eq n) => GHC.Classes.Eq (Agda.Syntax.Common.ImportedName' n m) instance (GHC.Classes.Eq m, GHC.Classes.Eq n) => GHC.Classes.Eq (Agda.Syntax.Common.Using' n m) instance (GHC.Classes.Eq m, GHC.Classes.Eq n) => GHC.Classes.Eq (Agda.Syntax.Common.Renaming' n m) instance (GHC.Classes.Eq m, GHC.Classes.Eq n) => GHC.Classes.Eq (Agda.Syntax.Common.ImportDirective' n m) instance GHC.Base.Functor Agda.Syntax.Common.TerminationCheck instance GHC.Classes.Eq m => GHC.Classes.Eq (Agda.Syntax.Common.TerminationCheck m) instance GHC.Show.Show m => GHC.Show.Show (Agda.Syntax.Common.TerminationCheck m) instance GHC.Generics.Generic Agda.Syntax.Common.PositivityCheck instance GHC.Enum.Enum Agda.Syntax.Common.PositivityCheck instance GHC.Enum.Bounded Agda.Syntax.Common.PositivityCheck instance GHC.Show.Show Agda.Syntax.Common.PositivityCheck instance GHC.Classes.Ord Agda.Syntax.Common.PositivityCheck instance GHC.Classes.Eq Agda.Syntax.Common.PositivityCheck instance GHC.Generics.Generic Agda.Syntax.Common.UniverseCheck instance GHC.Enum.Enum Agda.Syntax.Common.UniverseCheck instance GHC.Enum.Bounded Agda.Syntax.Common.UniverseCheck instance GHC.Show.Show Agda.Syntax.Common.UniverseCheck instance GHC.Classes.Ord Agda.Syntax.Common.UniverseCheck instance GHC.Classes.Eq Agda.Syntax.Common.UniverseCheck instance GHC.Generics.Generic Agda.Syntax.Common.CoverageCheck instance GHC.Enum.Enum Agda.Syntax.Common.CoverageCheck instance GHC.Enum.Bounded Agda.Syntax.Common.CoverageCheck instance GHC.Show.Show Agda.Syntax.Common.CoverageCheck instance GHC.Classes.Ord Agda.Syntax.Common.CoverageCheck instance GHC.Classes.Eq Agda.Syntax.Common.CoverageCheck instance Data.Traversable.Traversable (Agda.Syntax.Common.RewriteEqn' qn nm p) instance Data.Foldable.Foldable (Agda.Syntax.Common.RewriteEqn' qn nm p) instance GHC.Base.Functor (Agda.Syntax.Common.RewriteEqn' qn nm p) instance (GHC.Show.Show e, GHC.Show.Show qn, GHC.Show.Show nm, GHC.Show.Show p) => GHC.Show.Show (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance (GHC.Classes.Eq e, GHC.Classes.Eq qn, GHC.Classes.Eq nm, GHC.Classes.Eq p) => GHC.Classes.Eq (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance GHC.Classes.Eq Agda.Syntax.Common.ExpandedEllipsis instance GHC.Show.Show Agda.Syntax.Common.ExpandedEllipsis instance GHC.Show.Show Agda.Syntax.Common.BoundVariablePosition instance GHC.Classes.Ord Agda.Syntax.Common.BoundVariablePosition instance GHC.Classes.Eq Agda.Syntax.Common.BoundVariablePosition instance GHC.Show.Show Agda.Syntax.Common.NotationPart instance GHC.Show.Show Agda.Syntax.Common.Fixity' instance Agda.Syntax.Common.LensFixity' Agda.Syntax.Common.Fixity' instance GHC.Classes.Eq Agda.Syntax.Common.Fixity' instance Agda.Utils.Null.Null Agda.Syntax.Common.Fixity' instance Control.DeepSeq.NFData Agda.Syntax.Common.Fixity' instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Fixity' instance Agda.Syntax.Common.LensFixity Agda.Syntax.Common.Fixity' instance GHC.Classes.Eq Agda.Syntax.Common.NotationPart instance GHC.Classes.Ord Agda.Syntax.Common.NotationPart instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.NotationPart instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.NotationPart instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.NotationPart instance Control.DeepSeq.NFData Agda.Syntax.Common.NotationPart instance Control.DeepSeq.NFData Agda.Syntax.Common.BoundVariablePosition instance Agda.Utils.Null.Null Agda.Syntax.Common.ExpandedEllipsis instance GHC.Base.Semigroup Agda.Syntax.Common.ExpandedEllipsis instance GHC.Base.Monoid Agda.Syntax.Common.ExpandedEllipsis instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ExpandedEllipsis instance Control.DeepSeq.NFData Agda.Syntax.Common.ExpandedEllipsis 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 (Agda.Utils.Pretty.Pretty nm, Agda.Utils.Pretty.Pretty p, Agda.Utils.Pretty.Pretty e) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.RewriteEqn' qn nm p e) instance (Agda.Syntax.Position.HasRange qn, Agda.Syntax.Position.HasRange nm, 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.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 Agda.Syntax.Common.CoverageCheck instance GHC.Base.Semigroup Agda.Syntax.Common.CoverageCheck instance GHC.Base.Monoid Agda.Syntax.Common.CoverageCheck instance Control.DeepSeq.NFData Agda.Syntax.Common.CoverageCheck instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.UniverseCheck instance Control.DeepSeq.NFData Agda.Syntax.Common.UniverseCheck instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.PositivityCheck instance GHC.Base.Semigroup Agda.Syntax.Common.PositivityCheck instance GHC.Base.Monoid Agda.Syntax.Common.PositivityCheck instance Control.DeepSeq.NFData Agda.Syntax.Common.PositivityCheck instance Agda.Syntax.Position.KillRange m => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.TerminationCheck m) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.TerminationCheck a) instance Agda.Utils.Null.Null (Agda.Syntax.Common.ImportDirective' n m) instance (Agda.Syntax.Position.HasRange n, Agda.Syntax.Position.HasRange m) => GHC.Base.Semigroup (Agda.Syntax.Common.ImportDirective' n m) instance (Agda.Syntax.Position.HasRange n, Agda.Syntax.Position.HasRange m) => GHC.Base.Monoid (Agda.Syntax.Common.ImportDirective' n m) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.ImportDirective' a b) instance (Agda.Syntax.Position.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.ImportDirective' a b) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.ImportDirective' a b) 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.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Renaming' a b) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.Renaming' a b) instance GHC.Base.Semigroup (Agda.Syntax.Common.Using' n m) instance GHC.Base.Monoid (Agda.Syntax.Common.Using' n m) instance Agda.Utils.Null.Null (Agda.Syntax.Common.Using' n m) 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.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Using' a b) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.Using' 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.KillRange a, Agda.Syntax.Position.KillRange b) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.ImportedName' a b) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Agda.Syntax.Common.ImportedName' a b) instance Agda.Syntax.Common.LensFixity Agda.Syntax.Common.Fixity instance GHC.Classes.Eq Agda.Syntax.Common.Fixity instance GHC.Classes.Ord Agda.Syntax.Common.Fixity instance Agda.Utils.Null.Null Agda.Syntax.Common.Fixity instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Fixity instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Fixity instance Control.DeepSeq.NFData Agda.Syntax.Common.Fixity instance Agda.Utils.Null.Null Agda.Syntax.Common.FixityLevel instance Control.DeepSeq.NFData Agda.Syntax.Common.FixityLevel instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.InteractionId instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.InteractionId instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.MaybePlaceholder a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.MaybePlaceholder a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.MaybePlaceholder a) instance GHC.Show.Show Agda.Syntax.Common.ProblemId instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.ProblemId instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.MetaId instance GHC.Enum.Enum Agda.Syntax.Common.MetaId instance GHC.Show.Show Agda.Syntax.Common.MetaId instance Control.DeepSeq.NFData Agda.Syntax.Common.MetaId instance Data.Hashable.Class.Hashable Agda.Syntax.Common.MetaId instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.NameId instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.NameId instance GHC.Enum.Enum Agda.Syntax.Common.NameId instance Control.DeepSeq.NFData Agda.Syntax.Common.NameId instance Data.Hashable.Class.Hashable Agda.Syntax.Common.NameId instance Agda.Utils.BiMap.HasTag Agda.Syntax.Common.ModuleNameHash instance GHC.Show.Show Agda.Syntax.Common.ModuleNameHash instance Control.DeepSeq.NFData Agda.Syntax.Common.ModuleNameHash instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsMacro instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.IsMacro instance Control.DeepSeq.NFData Agda.Syntax.Common.IsMacro instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsInstance instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.IsInstance instance Control.DeepSeq.NFData Agda.Syntax.Common.IsInstance 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.Maybe.Maybe a) instance Agda.Syntax.Common.LensIsAbstract Agda.Syntax.Common.IsAbstract instance GHC.Base.Semigroup Agda.Syntax.Common.IsAbstract instance GHC.Base.Monoid Agda.Syntax.Common.IsAbstract instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.IsAbstract instance Control.DeepSeq.NFData Agda.Syntax.Common.IsAbstract instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Access instance Control.DeepSeq.NFData Agda.Syntax.Common.Access instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Access instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Access instance Control.DeepSeq.NFData Agda.Syntax.Common.ProjOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ProjOrigin instance Control.DeepSeq.NFData Agda.Syntax.Common.ConOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ConOrigin instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.RecordDirectives' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.RecordDirectives' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.RecordDirectives' a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.Ranged a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.Ranged a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Ranged a) instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.Ranged instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.Ranged a) instance Agda.Syntax.Common.LensNamed a => Agda.Syntax.Common.LensNamed (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Common.LensNamed (GHC.Maybe.Maybe a) instance Agda.Syntax.Common.LensNamed (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Common.LensHiding a => Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.Named nm a) instance Agda.Utils.Functor.Decoration (Agda.Syntax.Common.Named name) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.Named name a) instance (Agda.Syntax.Position.KillRange name, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Named name a) instance (Control.DeepSeq.NFData name, Control.DeepSeq.NFData a) => Control.DeepSeq.NFData (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Common.Underscore GHC.Base.String instance Agda.Syntax.Common.Underscore Data.ByteString.Internal.ByteString instance Agda.Syntax.Common.Underscore Text.PrettyPrint.HughesPJ.Doc instance Agda.Syntax.Common.LensAnnotation (Agda.Syntax.Common.Arg t) instance Agda.Syntax.Common.LensLock (Agda.Syntax.Common.Arg t) instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.Arg instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Arg a) instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensArgInfo (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensModality (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensFreeVariables (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensRelevance (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensQuantity (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensCohesion (Agda.Syntax.Common.Arg e) instance Agda.Syntax.Common.LensHiding Agda.Syntax.Common.Hiding instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Common.LensHiding 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.LensQuantity 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.LensRelevance Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensCohesion Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensCohesion Agda.Syntax.Common.Cohesion instance Agda.Syntax.Common.LensCohesion Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensModality Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensModality Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensAnnotation Agda.Syntax.Common.Annotation instance Agda.Syntax.Common.LensAnnotation 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.LensOrigin Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensFreeVariables Agda.Syntax.Common.FreeVariables instance Agda.Syntax.Common.LensFreeVariables Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensArgInfo Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensLock Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ArgInfo instance Control.DeepSeq.NFData Agda.Syntax.Common.ArgInfo instance GHC.Base.Semigroup Agda.Syntax.Common.FreeVariables instance GHC.Base.Monoid Agda.Syntax.Common.FreeVariables instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.FreeVariables instance Control.DeepSeq.NFData Agda.Syntax.Common.FreeVariables instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.WithOrigin instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.WithOrigin a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.WithOrigin a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.WithOrigin a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.WithOrigin a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.WithOrigin a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.Origin instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Modality instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Modality) instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Modality) instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Modality instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Modality instance Control.DeepSeq.NFData Agda.Syntax.Common.Modality instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Cohesion instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Cohesion instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Cohesion instance Control.DeepSeq.NFData Agda.Syntax.Common.Cohesion instance GHC.Classes.Ord Agda.Syntax.Common.Cohesion instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Cohesion instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Cohesion) instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Cohesion) instance Agda.Syntax.Common.LensLock Agda.Syntax.Common.Lock instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Annotation instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Annotation instance Control.DeepSeq.NFData Agda.Syntax.Common.Annotation instance Control.DeepSeq.NFData Agda.Syntax.Common.Lock instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Relevance instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Relevance instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Relevance instance Control.DeepSeq.NFData Agda.Syntax.Common.Relevance instance GHC.Classes.Ord Agda.Syntax.Common.Relevance instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Relevance instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Relevance) instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Relevance) instance Control.DeepSeq.NFData Agda.Syntax.Common.Erased instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Erased instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Erased instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Erased) instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.LeftClosedPOMonoid (Agda.Syntax.Common.UnderComposition Agda.Syntax.Common.Quantity) instance GHC.Base.Semigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance GHC.Base.Monoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POSemigroup (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance Agda.Utils.POMonoid.POMonoid (Agda.Syntax.Common.UnderAddition Agda.Syntax.Common.Quantity) instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Quantity instance Control.DeepSeq.NFData Agda.Syntax.Common.Quantity instance GHC.Base.Semigroup Agda.Syntax.Common.QωOrigin instance GHC.Base.Monoid Agda.Syntax.Common.QωOrigin instance Agda.Utils.Null.Null Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.QωOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.QωOrigin instance Control.DeepSeq.NFData Agda.Syntax.Common.QωOrigin instance GHC.Base.Semigroup Agda.Syntax.Common.Q1Origin instance GHC.Base.Monoid Agda.Syntax.Common.Q1Origin instance Agda.Utils.Null.Null Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Q1Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Q1Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.Q1Origin instance GHC.Base.Semigroup Agda.Syntax.Common.Q0Origin instance GHC.Base.Monoid Agda.Syntax.Common.Q0Origin instance Agda.Utils.Null.Null Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Position.SetRange Agda.Syntax.Common.Q0Origin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Q0Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.Q0Origin instance GHC.Base.Applicative Agda.Syntax.Common.UnderComposition instance GHC.Base.Applicative Agda.Syntax.Common.UnderAddition instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.WithHiding instance GHC.Base.Applicative Agda.Syntax.Common.WithHiding instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Position.SetRange a => Agda.Syntax.Position.SetRange (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.WithHiding a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.WithHiding a) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Hiding instance GHC.Base.Semigroup Agda.Syntax.Common.Hiding instance GHC.Base.Monoid Agda.Syntax.Common.Hiding instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Hiding instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Hiding instance Control.DeepSeq.NFData Agda.Syntax.Common.Hiding instance GHC.Base.Semigroup Agda.Syntax.Common.Overlappable instance GHC.Base.Monoid Agda.Syntax.Common.Overlappable instance Control.DeepSeq.NFData Agda.Syntax.Common.Overlappable instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Induction instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.Induction instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Induction instance Control.DeepSeq.NFData Agda.Syntax.Common.Induction instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.Induction instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Common.CopatternMatchingAllowed Agda.Syntax.Common.HasEta instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Common.PatternMatchingAllowed Agda.Syntax.Common.HasEta instance Control.DeepSeq.NFData Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Position.HasRange Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.PatternOrCopattern instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.HasEta' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.HasEta' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Common.HasEta' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Language instance Control.DeepSeq.NFData Agda.Syntax.Common.Language instance Control.DeepSeq.NFData Agda.Syntax.Common.Cubical instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.FileType instance Control.DeepSeq.NFData Agda.Syntax.Common.FileType instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Delayed instance Control.DeepSeq.NFData Agda.Syntax.Common.Delayed -- | 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.Show.Show x => GHC.Show.Show (Agda.Syntax.Fixity.ThingWithFixity x) instance Data.Traversable.Traversable Agda.Syntax.Fixity.ThingWithFixity instance Data.Foldable.Foldable Agda.Syntax.Fixity.ThingWithFixity instance GHC.Base.Functor Agda.Syntax.Fixity.ThingWithFixity instance GHC.Generics.Generic Agda.Syntax.Fixity.ParenPreference instance GHC.Show.Show Agda.Syntax.Fixity.ParenPreference instance GHC.Classes.Ord Agda.Syntax.Fixity.ParenPreference instance GHC.Classes.Eq Agda.Syntax.Fixity.ParenPreference instance GHC.Generics.Generic Agda.Syntax.Fixity.Precedence instance GHC.Classes.Eq Agda.Syntax.Fixity.Precedence instance GHC.Show.Show Agda.Syntax.Fixity.Precedence instance Control.DeepSeq.NFData Agda.Syntax.Fixity.Precedence instance Agda.Utils.Pretty.Pretty Agda.Syntax.Fixity.Precedence instance Control.DeepSeq.NFData Agda.Syntax.Fixity.ParenPreference instance Agda.Syntax.Common.LensFixity' (Agda.Syntax.Fixity.ThingWithFixity a) instance Agda.Syntax.Common.LensFixity (Agda.Syntax.Fixity.ThingWithFixity a) instance Agda.Syntax.Position.KillRange x => Agda.Syntax.Position.KillRange (Agda.Syntax.Fixity.ThingWithFixity x) -- | 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 type PrecedenceKey = Either PrecedenceLevel PrecedenceLevel -- | The parser monad. type Parser tok a = Parser MemoKey tok (MaybePlaceholder tok) a -- | Runs the parser. parse :: forall tok a. 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 instance GHC.Generics.Generic Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance GHC.Show.Show Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance GHC.Classes.Eq Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey instance Data.Hashable.Class.Hashable Agda.Syntax.Concrete.Operators.Parser.Monad.MemoKey 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 :: [(Comment, Exp)] -> Exp Apply :: Exp -> [Exp] -> Exp Lookup :: Exp -> MemberId -> Exp If :: Exp -> Exp -> Exp -> Exp BinOp :: Exp -> String -> Exp -> Exp PreOp :: String -> Exp -> Exp Const :: String -> Exp -- | Arbitrary JS code. PlainJS :: String -> Exp newtype LocalId LocalId :: Nat -> LocalId newtype GlobalId GlobalId :: [String] -> GlobalId data MemberId MemberId :: String -> MemberId MemberIndex :: Int -> Comment -> MemberId newtype Comment Comment :: String -> Comment 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 uses :: (Uses a, a ~ t b, Foldable t, Uses b) => a -> Set JSQName class Globals a globals :: Globals a => a -> Set GlobalId globals :: (Globals a, a ~ t b, Foldable t, Globals b) => a -> Set GlobalId instance GHC.Show.Show Agda.Compiler.JS.Syntax.LocalId instance GHC.Classes.Ord Agda.Compiler.JS.Syntax.LocalId instance GHC.Classes.Eq Agda.Compiler.JS.Syntax.LocalId instance GHC.Show.Show Agda.Compiler.JS.Syntax.GlobalId instance GHC.Classes.Ord Agda.Compiler.JS.Syntax.GlobalId instance GHC.Classes.Eq Agda.Compiler.JS.Syntax.GlobalId instance GHC.Base.Monoid Agda.Compiler.JS.Syntax.Comment instance GHC.Base.Semigroup Agda.Compiler.JS.Syntax.Comment instance GHC.Show.Show Agda.Compiler.JS.Syntax.Comment instance GHC.Show.Show Agda.Compiler.JS.Syntax.MemberId instance GHC.Classes.Ord Agda.Compiler.JS.Syntax.MemberId instance GHC.Classes.Eq Agda.Compiler.JS.Syntax.MemberId instance GHC.Classes.Eq Agda.Compiler.JS.Syntax.Exp instance GHC.Show.Show Agda.Compiler.JS.Syntax.Exp instance GHC.Show.Show Agda.Compiler.JS.Syntax.Export instance GHC.Show.Show Agda.Compiler.JS.Syntax.Module 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 (GHC.Maybe.Maybe 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 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 Agda.Compiler.JS.Syntax.Globals Agda.Compiler.JS.Syntax.Comment 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 Agda.Compiler.JS.Syntax.Module 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) instance Agda.Compiler.JS.Syntax.Uses Agda.Compiler.JS.Syntax.Comment instance Agda.Compiler.JS.Syntax.Uses Agda.Compiler.JS.Syntax.Exp instance Agda.Compiler.JS.Syntax.Uses Agda.Compiler.JS.Syntax.Export instance GHC.Classes.Eq Agda.Compiler.JS.Syntax.Comment instance GHC.Classes.Ord Agda.Compiler.JS.Syntax.Comment module Agda.Auto.Syntax -- | Unique identifiers for variable occurrences in unification. type UId o = Metavar (Exp o) (RefInfo o) data HintMode HMNormal :: HintMode HMRecCall :: HintMode data EqReasoningConsts o EqReasoningConsts :: ConstRef o -> EqReasoningConsts o [eqrcId, eqrcBegin, eqrcStep, eqrcEnd, eqrcSym, eqrcCong] :: EqReasoningConsts o -> ConstRef o data EqReasoningState EqRSNone :: EqReasoningState EqRSChain :: EqReasoningState EqRSPrf1 :: EqReasoningState EqRSPrf2 :: EqReasoningState EqRSPrf3 :: EqReasoningState -- | The concrete instance of the blk parameter in Metavar. -- I.e., the information passed to the search control. data RefInfo o RIEnv :: [(ConstRef o, HintMode)] -> Nat -> Maybe (EqReasoningConsts o) -> RefInfo o [rieHints] :: RefInfo o -> [(ConstRef o, HintMode)] -- | Nat - deffreevars (to make cost of using module parameters correspond -- to that of hints). [rieDefFreeVars] :: RefInfo o -> Nat [rieEqReasoningConsts] :: RefInfo o -> Maybe (EqReasoningConsts o) RIMainInfo :: Nat -> HNExp o -> Bool -> RefInfo o -- | Size of typing context in which meta was created. [riMainCxtLength] :: RefInfo o -> Nat -- | Head normal form of type of meta. [riMainType] :: RefInfo o -> HNExp o -- | True if iota steps performed when normalising target type (used to put -- cost when traversing a definition by construction instantiation). [riMainIota] :: RefInfo o -> Bool RIUnifInfo :: [CAction o] -> HNExp o -> RefInfo o RICopyInfo :: ICExp o -> RefInfo o RIIotaStep :: Bool -> RefInfo o RIInferredTypeUnknown :: RefInfo o RINotConstructor :: RefInfo o RIUsedVars :: [UId o] -> [Elr o] -> RefInfo o RIPickSubsvar :: RefInfo o RIEqRState :: EqReasoningState -> RefInfo o RICheckElim :: Bool -> RefInfo o RICheckProjIndex :: [ConstRef o] -> RefInfo o type MyPB o = PB (RefInfo o) type MyMB a o = MB a (RefInfo o) type Nat = Int data MId Id :: String -> MId NoId :: MId -- | Abstraction with maybe a name. -- -- Different from Agda, where there is also info whether function is -- constant. data Abs a Abs :: MId -> a -> Abs a -- | Constant signatures. data ConstDef o ConstDef :: String -> o -> MExp o -> DeclCont o -> Nat -> ConstDef o -- | For debug printing. [cdname] :: ConstDef o -> String -- | Reference to the Agda constant. [cdorigin] :: ConstDef o -> o -- | Type of constant. [cdtype] :: ConstDef o -> MExp o -- | Constant definition. [cdcont] :: ConstDef o -> DeclCont o -- | Free vars of the module where the constant is defined.. [cddeffreevars] :: ConstDef o -> Nat -- | Constant definitions. data DeclCont o Def :: Nat -> [Clause o] -> Maybe Nat -> Maybe Nat -> DeclCont o Datatype :: [ConstRef o] -> [ConstRef o] -> DeclCont o Constructor :: Nat -> DeclCont o Postulate :: DeclCont o type Clause o = ([Pat o], MExp o) data Pat o PatConApp :: ConstRef o -> [Pat o] -> Pat o PatVar :: String -> Pat o -- | Dot pattern. PatExp :: Pat o -- | Projection pattern. PatProj :: ConstRef o -> Pat o type ConstRef o = IORef (ConstDef o) -- | Head of application (elimination). data Elr o Var :: Nat -> Elr o Const :: ConstRef o -> Elr o getVar :: Elr o -> Maybe Nat getConst :: Elr o -> Maybe (ConstRef o) data Sort Set :: Nat -> Sort UnknownSort :: Sort Type :: Sort -- | Agsy's internal syntax. data Exp o App :: Maybe (UId o) -> OKHandle (RefInfo o) -> Elr o -> MArgList o -> Exp o -- | Unique identifier of the head. [appUId] :: Exp o -> Maybe (UId o) -- | This application has been type-checked. [appOK] :: Exp o -> OKHandle (RefInfo o) -- | Head. [appHead] :: Exp o -> Elr o -- | Arguments. [appElims] :: Exp o -> MArgList o -- | Lambda with hiding information. Lam :: Hiding -> Abs (MExp o) -> Exp o -- | True if possibly dependent (var not known to not occur). -- False if non-dependent. Pi :: Maybe (UId o) -> Hiding -> Bool -> MExp o -> Abs (MExp o) -> Exp o Sort :: Sort -> Exp o -- | Absurd lambda with hiding information. AbsurdLambda :: Hiding -> Exp o dontCare :: Exp o -- | "Maybe expression": Expression or reference to meta variable. type MExp o = MM (Exp o) (RefInfo o) data ArgList o -- | No more eliminations. ALNil :: ArgList o -- | Application and tail. ALCons :: Hiding -> MExp o -> MArgList o -> ArgList o -- | proj pre args, projfcn idx, tail ALProj :: MArgList o -> MM (ConstRef o) (RefInfo o) -> Hiding -> MArgList o -> ArgList o -- | Constructor parameter (missing in Agda). Agsy has monomorphic -- constructors. Inserted to cover glitch of polymorphic constructor -- applications coming from Agda ALConPar :: MArgList o -> ArgList o type MArgList o = MM (ArgList o) (RefInfo o) data WithSeenUIds a o WithSeenUIds :: [Maybe (UId o)] -> a -> WithSeenUIds a o [seenUIds] :: WithSeenUIds a o -> [Maybe (UId o)] [rawValue] :: WithSeenUIds a o -> a type HNExp o = WithSeenUIds (HNExp' o) o data HNExp' o HNApp :: Elr o -> ICArgList o -> HNExp' o HNLam :: Hiding -> Abs (ICExp o) -> HNExp' o HNPi :: Hiding -> Bool -> ICExp o -> Abs (ICExp o) -> HNExp' o HNSort :: Sort -> HNExp' o -- | Head-normal form of ICArgList. First entry is exposed. -- -- Q: Why are there no projection eliminations? data HNArgList o HNALNil :: HNArgList o HNALCons :: Hiding -> ICExp o -> ICArgList o -> HNArgList o HNALConPar :: ICArgList o -> HNArgList o -- | Lazy concatenation of argument lists under explicit substitutions. data ICArgList o CALNil :: ICArgList o CALConcat :: Clos (MArgList o) o -> ICArgList o -> ICArgList o -- | An expression a in an explicit substitution [CAction -- a]. type ICExp o = Clos (MExp o) o data Clos a o Clos :: [CAction o] -> a -> Clos a o type CExp o = TrBr (ICExp o) o data TrBr a o TrBr :: [MExp o] -> a -> TrBr a o -- | Entry of an explicit substitution. -- -- An explicit substitution is a list of CActions. This is -- isomorphic to the usual presentation where Skip and -- Weak would be constructors of exp. substs. data CAction o -- | Instantation of variable. Sub :: ICExp o -> CAction o -- | For going under a binder, often called Lift. Skip :: CAction o -- | Shifting substitution (going to a larger context). Weak :: Nat -> CAction o type Ctx o = [(MId, CExp o)] type EE = IO detecteliminand :: [Clause o] -> Maybe Nat detectsemiflex :: ConstRef o -> [Clause o] -> IO Bool categorizedecl :: ConstRef o -> IO () class MetaliseOKH t metaliseOKH :: MetaliseOKH t => t -> IO t metaliseokh :: MExp o -> IO (MExp o) class ExpandMetas t expandMetas :: ExpandMetas t => t -> IO t addtrailingargs :: Clos (MArgList o) o -> ICArgList o -> ICArgList o closify :: MExp o -> CExp o sub :: MExp o -> CExp o -> CExp o subi :: MExp o -> ICExp o -> ICExp o weak :: Weakening t => Nat -> t -> t class Weakening t weak' :: Weakening t => Nat -> t -> t -- | Substituting for a variable. doclos :: [CAction o] -> Nat -> Either Nat (ICExp o) -- | FreeVars class and instances freeVars :: FreeVars t => t -> Set Nat class FreeVars t freeVarsOffset :: FreeVars t => Nat -> t -> Set Nat -- | Renaming Typeclass and instances rename :: Renaming t => (Nat -> Nat) -> t -> t class Renaming t renameOffset :: Renaming t => Nat -> (Nat -> Nat) -> t -> t instance GHC.Show.Show Agda.Auto.Syntax.EqReasoningState instance GHC.Classes.Eq Agda.Auto.Syntax.EqReasoningState instance GHC.Classes.Eq (Agda.Auto.Syntax.Elr o) instance (Agda.Auto.Syntax.Renaming a, Agda.Auto.Syntax.Renaming b) => Agda.Auto.Syntax.Renaming (a, b) instance Agda.Auto.Syntax.Renaming t => Agda.Auto.Syntax.Renaming (Agda.Auto.NarrowingSearch.MM t a) instance Agda.Auto.Syntax.Renaming t => Agda.Auto.Syntax.Renaming (Agda.Auto.Syntax.Abs t) instance Agda.Auto.Syntax.Renaming (Agda.Auto.Syntax.Elr o) instance Agda.Auto.Syntax.Renaming (Agda.Auto.Syntax.Exp o) instance Agda.Auto.Syntax.Renaming (Agda.Auto.Syntax.ArgList o) instance (Agda.Auto.Syntax.FreeVars a, Agda.Auto.Syntax.FreeVars b) => Agda.Auto.Syntax.FreeVars (a, b) instance Agda.Auto.Syntax.FreeVars t => Agda.Auto.Syntax.FreeVars (Agda.Auto.NarrowingSearch.MM t a) instance Agda.Auto.Syntax.FreeVars t => Agda.Auto.Syntax.FreeVars (Agda.Auto.Syntax.Abs t) instance Agda.Auto.Syntax.FreeVars (Agda.Auto.Syntax.Elr o) instance Agda.Auto.Syntax.FreeVars (Agda.Auto.Syntax.Exp o) instance Agda.Auto.Syntax.FreeVars (Agda.Auto.Syntax.ArgList o) instance Agda.Auto.Syntax.Weakening a => Agda.Auto.Syntax.Weakening (Agda.Auto.Syntax.TrBr a o) instance Agda.Auto.Syntax.Weakening (Agda.Auto.Syntax.Clos a o) instance Agda.Auto.Syntax.Weakening (Agda.Auto.Syntax.ICArgList o) instance Agda.Auto.Syntax.Weakening (Agda.Auto.Syntax.Elr o) instance Agda.Auto.Syntax.ExpandMetas t => Agda.Auto.Syntax.ExpandMetas (Agda.Auto.NarrowingSearch.MM t a) instance Agda.Auto.Syntax.ExpandMetas t => Agda.Auto.Syntax.ExpandMetas (Agda.Auto.Syntax.Abs t) instance Agda.Auto.Syntax.ExpandMetas (Agda.Auto.Syntax.Exp o) instance Agda.Auto.Syntax.ExpandMetas (Agda.Auto.Syntax.ArgList o) instance Agda.Auto.Syntax.MetaliseOKH t => Agda.Auto.Syntax.MetaliseOKH (Agda.Auto.NarrowingSearch.MM t a) instance Agda.Auto.Syntax.MetaliseOKH t => Agda.Auto.Syntax.MetaliseOKH (Agda.Auto.Syntax.Abs t) instance Agda.Auto.Syntax.MetaliseOKH (Agda.Auto.Syntax.Exp o) instance Agda.Auto.Syntax.MetaliseOKH (Agda.Auto.Syntax.ArgList o) module Agda.Auto.SearchControl data ExpRefInfo o ExpRefInfo :: Maybe (RefInfo o) -> [RefInfo o] -> Bool -> Bool -> Maybe ([UId o], [Elr o]) -> Maybe Bool -> Bool -> Maybe EqReasoningState -> ExpRefInfo o [eriMain] :: ExpRefInfo o -> Maybe (RefInfo o) [eriUnifs] :: ExpRefInfo o -> [RefInfo o] [eriInfTypeUnknown] :: ExpRefInfo o -> Bool [eriIsEliminand] :: ExpRefInfo o -> Bool [eriUsedVars] :: ExpRefInfo o -> Maybe ([UId o], [Elr o]) [eriIotaStep] :: ExpRefInfo o -> Maybe Bool [eriPickSubsVar] :: ExpRefInfo o -> Bool [eriEqRState] :: ExpRefInfo o -> Maybe EqReasoningState initExpRefInfo :: ExpRefInfo o getinfo :: [RefInfo o] -> ExpRefInfo o -- | univar sub v figures out what the name of v -- "outside" of the substitution sub ought to be, if anything. univar :: [CAction o] -> Nat -> Maybe Nat -- | List of the variables instantiated by the substitution subsvars :: [CAction o] -> [Nat] -- | Moves A move is composed of a Cost together with an action -- computing the refined problem. type Move o = Move' (RefInfo o) (Exp o) -- | New constructors Taking a step towards a solution consists in picking -- a constructor and filling in the missing parts with placeholders to be -- discharged later on. newAbs :: MId -> RefCreateEnv blk (Abs (MM a blk)) newLam :: Hiding -> MId -> RefCreateEnv (RefInfo o) (Exp o) newPi :: UId o -> Bool -> Hiding -> RefCreateEnv (RefInfo o) (Exp o) foldArgs :: [(Hiding, MExp o)] -> MArgList o -- | New spine of arguments potentially using placeholders newArgs' :: [Hiding] -> [MExp o] -> RefCreateEnv (RefInfo o) (MArgList o) newArgs :: [Hiding] -> RefCreateEnv (RefInfo o) (MArgList o) -- | New Application node using a new spine of arguments -- respecting the Hiding annotation newApp' :: UId o -> ConstRef o -> [Hiding] -> [MExp o] -> RefCreateEnv (RefInfo o) (Exp o) newApp :: UId o -> ConstRef o -> [Hiding] -> RefCreateEnv (RefInfo o) (Exp o) -- | Equality reasoning steps The begin token is accompanied by two steps -- because it does not make sense to have a derivation any shorter than -- that. eqStep :: UId o -> EqReasoningConsts o -> Move o eqEnd :: UId o -> EqReasoningConsts o -> Move o eqCong :: UId o -> EqReasoningConsts o -> Move o eqSym :: UId o -> EqReasoningConsts o -> Move o eqBeginStep2 :: UId o -> EqReasoningConsts o -> Move o -- | Pick the first unused UId amongst the ones you have seen (GA: ??) -- Defaults to the head of the seen ones. pickUid :: forall o. [UId o] -> [Maybe (UId o)] -> (Maybe (UId o), Bool) extraref :: UId o -> [Maybe (UId o)] -> ConstRef o -> Move o costIncrease :: Cost costUnificationOccurs :: Cost costUnification :: Cost costAppVar :: Cost costAppVarUsed :: Cost costAppHint :: Cost costAppHintUsed :: Cost costAppRecCall :: Cost costAppRecCallUsed :: Cost costAppConstructor :: Cost costAppConstructorSingle :: Cost costAppExtraRef :: Cost costLam :: Cost costLamUnfold :: Cost costPi :: Cost costSort :: Cost costIotaStep :: Cost costInferredTypeUnkown :: Cost costAbsurdLam :: Cost costUnificationIf :: Bool -> Cost costEqStep :: Cost costEqEnd :: Cost costEqSym :: Cost costEqCong :: Cost prioNo :: Prio prioTypeUnknown :: Prio prioTypecheckArgList :: Prio prioInferredTypeUnknown :: Prio prioCompBeta :: Prio prioCompBetaStructured :: Prio prioCompareArgList :: Prio prioCompIota :: Prio prioCompChoice :: Prio prioCompUnif :: Prio prioCompCopy :: Prio prioNoIota :: Prio prioAbsurdLambda :: Prio prioProjIndex :: Prio prioTypecheck :: Bool -> Prio instance Agda.Auto.NarrowingSearch.Refinable (Agda.Auto.Syntax.Exp o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Refinable (Agda.Auto.Syntax.ArgList o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Refinable (Agda.Auto.Syntax.ICExp o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Refinable (Agda.Auto.Syntax.ConstRef o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Trav a => Agda.Auto.NarrowingSearch.Trav [a] instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.MId, Agda.Auto.Syntax.CExp o) instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.TrBr a o) instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.Exp o) instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.ArgList o) -- | 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. literateProcessors :: [(String, (Processor, FileType))] -- | Short list of extensions for literate Agda files. For display -- purposes. literateExtsShortList :: [String] literateSrcFile :: [Layer] -> SrcFile -- | Preprocessor for literate TeX. literateTeX :: Position -> String -> [Layer] -- | Preprocessor for reStructuredText. literateRsT :: Position -> String -> [Layer] -- | Preprocessor for Markdown. literateMd :: Position -> String -> [Layer] -- | Preprocessor for Org mode documents. literateOrg :: Position -> String -> [Layer] -- | 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 ---- --
-- f pos s /= [] ---- --
-- f pos s >>= layerContent == s --type Processor = Position -> 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 -> Interval -> String -> Layer [layerRole] :: Layer -> LayerRole [interval] :: Layer -> Interval [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.Classes.Eq Agda.Syntax.Parser.Literate.LayerRole instance GHC.Show.Show Agda.Syntax.Parser.Literate.LayerRole instance GHC.Show.Show Agda.Syntax.Parser.Literate.Layer instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Literate.Layer -- | 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 UnicodeOk :: UnicodeOrAscii 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 -- | 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 -> SpecialCharacters [_dbraces] :: SpecialCharacters -> Doc -> Doc [_lambda] :: SpecialCharacters -> Doc [_arrow] :: SpecialCharacters -> Doc [_forallQ] :: SpecialCharacters -> Doc [_leftIdiomBrkt] :: SpecialCharacters -> Doc [_rightIdiomBrkt] :: SpecialCharacters -> Doc [_emptyIdiomBrkt] :: SpecialCharacters -> Doc instance GHC.Generics.Generic Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Enum.Bounded Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Enum.Enum Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Classes.Eq Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance GHC.Show.Show Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Glyph.UnicodeOrAscii -- | 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 isOpenMixfix :: 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 -- | Don't use on 'NoName{}'. lensNameParts :: Lens' NameParts Name 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' NameInScope a 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' RawName NameParts -- | 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' (Maybe Suffix) Name -- | 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' Name QName -- |
-- 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 isNoName :: (IsNoName a, Foldable t, IsNoName b, t b ~ a) => a -> Bool instance GHC.Generics.Generic Agda.Syntax.Concrete.Name.NamePart instance GHC.Show.Show Agda.Syntax.Concrete.Name.NameInScope instance GHC.Classes.Eq Agda.Syntax.Concrete.Name.NameInScope instance GHC.Classes.Ord Agda.Syntax.Concrete.Name.QName instance GHC.Classes.Eq Agda.Syntax.Concrete.Name.QName instance GHC.Show.Show Agda.Syntax.Concrete.Name.Name instance GHC.Show.Show Agda.Syntax.Concrete.Name.NamePart instance GHC.Show.Show Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Name.IsNoName GHC.Base.String instance Agda.Syntax.Concrete.Name.IsNoName Data.ByteString.Internal.ByteString 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.Concrete.Name.LensInScope Agda.Syntax.Concrete.Name.NameInScope instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Name.LensInScope Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Common.Underscore Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.QName instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Name.QName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Common.Underscore Agda.Syntax.Concrete.Name.Name instance GHC.Classes.Eq Agda.Syntax.Concrete.Name.Name instance GHC.Classes.Ord Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.Name instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Name.Name instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.Name instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.NameInScope instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.NameParts instance GHC.Classes.Eq Agda.Syntax.Concrete.Name.NamePart instance GHC.Classes.Ord Agda.Syntax.Concrete.Name.NamePart instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Name.NamePart instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.NamePart -- | This module defines the names of all BUILTINs. module Agda.Syntax.Builtin builtinNat :: String builtinSuc :: String builtinZero :: String builtinNatPlus :: String builtinNatMinus :: String builtinNatTimes :: String builtinNatDivSucAux :: String builtinNatModSucAux :: String builtinNatEquals :: String builtinNatLess :: String builtinInteger :: String builtinIntegerPos :: String builtinIntegerNegSuc :: String builtinWord64 :: String builtinFloat :: String builtinChar :: String builtinString :: String builtinUnit :: String builtinUnitUnit :: String builtinSigma :: String builtinBool :: String builtinTrue :: String builtinFalse :: String builtinList :: String builtinNil :: String builtinCons :: String builtinIO :: String builtinMaybe :: String builtinNothing :: String builtinJust :: String builtinPath :: String builtinPathP :: String builtinInterval :: String builtinIZero :: String builtinIOne :: String builtinPartial :: String builtinPartialP :: String builtinIMin :: String builtinIMax :: String builtinINeg :: String builtinIsOne :: String builtinItIsOne :: String builtinIsOne1 :: String builtinIsOne2 :: String builtinIsOneEmpty :: String builtinComp :: String builtinPOr :: String builtinTrans :: String builtinHComp :: String builtinSub :: String builtinSubIn :: String builtinSubOut :: String builtinEquiv :: String builtinEquivFun :: String builtinEquivProof :: String builtinTranspProof :: String builtinGlue :: String builtin_glue :: String builtin_unglue :: String builtin_glueU :: String builtin_unglueU :: String builtinFaceForall :: String builtinId :: String builtinReflId :: String builtinConId :: String builtinIdElim :: String builtinSizeUniv :: String builtinSize :: String builtinSizeLt :: String builtinSizeSuc :: String builtinSizeInf :: String builtinSizeMax :: String builtinInf :: String builtinSharp :: String builtinFlat :: String builtinEquality :: String builtinRefl :: String builtinRewrite :: String builtinLevelMax :: String builtinLevel :: String builtinLevelZero :: String builtinLevelSuc :: String builtinSet :: String builtinProp :: String builtinSetOmega :: String builtinStrictSet :: String builtinSSetOmega :: String builtinLockUniv :: String builtinIntervalUniv :: String builtinFromNat :: String builtinFromNeg :: String builtinFromString :: String builtinQName :: String builtinAgdaSort :: String builtinAgdaSortSet :: String builtinAgdaSortLit :: String builtinAgdaSortProp :: String builtinAgdaSortPropLit :: String builtinAgdaSortInf :: String builtinAgdaSortUnsupported :: String builtinHiding :: String builtinHidden :: String builtinInstance :: String builtinVisible :: String builtinRelevance :: String builtinRelevant :: String builtinIrrelevant :: String builtinQuantity :: String builtinQuantity0 :: String builtinQuantityω :: String builtinModality :: String builtinModalityConstructor :: String builtinAssoc :: String builtinAssocLeft :: String builtinAssocRight :: String builtinAssocNon :: String builtinPrecedence :: String builtinPrecRelated :: String builtinPrecUnrelated :: String builtinFixity :: String builtinFixityFixity :: String builtinArgInfo :: String builtinArgArgInfo :: String builtinArg :: String builtinArgArg :: String builtinAbs :: String builtinAbsAbs :: String builtinAgdaTerm :: String builtinAgdaTermVar :: String builtinAgdaTermLam :: String builtinAgdaTermExtLam :: String builtinAgdaTermDef :: String builtinAgdaTermCon :: String builtinAgdaTermPi :: String builtinAgdaTermSort :: String builtinAgdaTermLit :: String builtinAgdaTermUnsupported :: String builtinAgdaTermMeta :: String builtinAgdaErrorPart :: String builtinAgdaErrorPartString :: String builtinAgdaErrorPartTerm :: String builtinAgdaErrorPartPatt :: String builtinAgdaErrorPartName :: String builtinAgdaLiteral :: String builtinAgdaLitNat :: String builtinAgdaLitWord64 :: String builtinAgdaLitFloat :: String builtinAgdaLitChar :: String builtinAgdaLitString :: String builtinAgdaLitQName :: String builtinAgdaLitMeta :: String builtinAgdaClause :: String builtinAgdaClauseClause :: String builtinAgdaClauseAbsurd :: String builtinAgdaPattern :: String builtinAgdaPatVar :: String builtinAgdaPatCon :: String builtinAgdaPatDot :: String builtinAgdaPatLit :: String builtinAgdaPatProj :: String builtinAgdaPatAbsurd :: String builtinAgdaDefinitionFunDef :: String builtinAgdaDefinitionDataDef :: String builtinAgdaDefinitionRecordDef :: String builtinAgdaDefinitionDataConstructor :: String builtinAgdaDefinitionPostulate :: String builtinAgdaDefinitionPrimitive :: String builtinAgdaDefinition :: String builtinAgdaMeta :: String builtinAgdaTCM :: String builtinAgdaTCMReturn :: String builtinAgdaTCMBind :: String builtinAgdaTCMUnify :: String builtinAgdaTCMTypeError :: String builtinAgdaTCMInferType :: String builtinAgdaTCMCheckType :: String builtinAgdaTCMNormalise :: String builtinAgdaTCMReduce :: String builtinAgdaTCMCatchError :: String builtinAgdaTCMGetContext :: String builtinAgdaTCMExtendContext :: String builtinAgdaTCMInContext :: String builtinAgdaTCMFreshName :: String builtinAgdaTCMDeclareDef :: String builtinAgdaTCMDeclarePostulate :: String builtinAgdaTCMDeclareData :: String builtinAgdaTCMDefineData :: String builtinAgdaTCMDefineFun :: String builtinAgdaTCMGetType :: String builtinAgdaTCMGetDefinition :: String builtinAgdaTCMQuoteTerm :: String builtinAgdaTCMUnquoteTerm :: String builtinAgdaTCMQuoteOmegaTerm :: String builtinAgdaTCMBlockOnMeta :: String builtinAgdaTCMCommit :: String builtinAgdaTCMIsMacro :: String builtinAgdaTCMFormatErrorParts :: String builtinAgdaTCMDebugPrint :: String builtinAgdaTCMWithNormalisation :: String builtinAgdaTCMWithReconsParams :: String builtinAgdaTCMOnlyReduceDefs :: String builtinAgdaTCMDontReduceDefs :: String builtinAgdaTCMNoConstraints :: String builtinAgdaTCMRunSpeculative :: String builtinAgdaTCMExec :: String builtinAgdaTCMGetInstances :: String -- | 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 :: String -> Bool builtinsNoDef :: [String] sizeBuiltins :: [String] -- | Abstract names carry unique identifiers and stuff. module Agda.Syntax.Abstract.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 [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 -- | 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 -- | Check whether we are a projection pattern. class IsProjP a isProjP :: IsProjP a => a -> Maybe (ProjOrigin, AmbiguousQName) -- | A name suffix data Suffix NoSuffix :: Suffix Suffix :: !Integer -> Suffix -- | Something preceeded by a qualified name. data QNamed a QNamed :: QName -> a -> QNamed a [qname] :: QNamed a -> QName [qnamed] :: QNamed a -> a -- | 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] -- | Ambiguous qualified names. Used for overloaded constructors. -- -- Invariant: All the names in the list must have the same concrete, -- unqualified name. (This implies that they all have the same -- Range'). newtype AmbiguousQName AmbQ :: List1 QName -> AmbiguousQName [unAmbQ] :: AmbiguousQName -> List1 QName -- | 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 -- | Get the next version of the concrete name. For instance, nextName -- "x" = "x₁". The name must not be a NoName. nextName :: FreshNameMode -> Name -> Name qualify :: ModuleName -> Name -> QName -- | A singleton "ambiguous" name. unambiguous :: QName -> AmbiguousQName -- | Is the name an operator? isOperator :: QName -> Bool sameRoot :: Name -> Name -> Bool lensQNameName :: Lens' Name QName -- | Useful for debugging scoping problems uglyShowName :: Name -> String -- | Get the first of the ambiguous names. headAmbQ :: AmbiguousQName -> QName -- | Is a name ambiguous. isAmbiguous :: AmbiguousQName -> Bool -- | Get the name if unambiguous. getUnambiguous :: AmbiguousQName -> Maybe QName -- | A module is anonymous if the qualification path ends in an underscore. isAnonymousModuleName :: ModuleName -> Bool -- | 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: -- --
-- 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] -- | Introduces a new binding mkLet :: TTerm -> TTerm -> TTerm isPrimEq :: TPrim -> Bool -- | Strip leading coercions and indicate whether there were some. coerceView :: TTerm -> (Bool, TTerm) mkTApp :: TTerm -> Args -> TTerm tAppView :: 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]) tLetView :: TTerm -> ([TTerm], TTerm) tLamView :: TTerm -> (Int, TTerm) mkTLam :: Int -> TTerm -> TTerm tInt :: Integer -> TTerm intView :: TTerm -> Maybe Integer word64View :: TTerm -> Maybe Word64 tPlusK :: Integer -> TTerm -> TTerm tOp :: TPrim -> TTerm -> TTerm -> TTerm tNegPlusK :: Integer -> TTerm -> TTerm plusKView :: TTerm -> Maybe (Integer, TTerm) negPlusKView :: TTerm -> Maybe (Integer, TTerm) tUnreachable :: TTerm tIfThenElse :: TTerm -> TTerm -> TTerm -> TTerm instance GHC.Generics.Generic Agda.Syntax.Treeless.ArgUsage instance GHC.Classes.Ord Agda.Syntax.Treeless.ArgUsage instance GHC.Classes.Eq Agda.Syntax.Treeless.ArgUsage instance GHC.Show.Show Agda.Syntax.Treeless.ArgUsage instance GHC.Show.Show Agda.Syntax.Treeless.EvaluationStrategy instance GHC.Classes.Eq Agda.Syntax.Treeless.EvaluationStrategy instance GHC.Generics.Generic Agda.Syntax.Treeless.TPrim instance GHC.Classes.Ord Agda.Syntax.Treeless.TPrim instance GHC.Classes.Eq Agda.Syntax.Treeless.TPrim instance GHC.Show.Show Agda.Syntax.Treeless.TPrim instance GHC.Generics.Generic Agda.Syntax.Treeless.CaseType instance GHC.Classes.Ord Agda.Syntax.Treeless.CaseType instance GHC.Classes.Eq Agda.Syntax.Treeless.CaseType instance GHC.Show.Show Agda.Syntax.Treeless.CaseType instance GHC.Generics.Generic Agda.Syntax.Treeless.CaseInfo instance GHC.Classes.Ord Agda.Syntax.Treeless.CaseInfo instance GHC.Classes.Eq Agda.Syntax.Treeless.CaseInfo instance GHC.Show.Show Agda.Syntax.Treeless.CaseInfo instance GHC.Generics.Generic Agda.Syntax.Treeless.TError instance GHC.Classes.Ord Agda.Syntax.Treeless.TError instance GHC.Classes.Eq Agda.Syntax.Treeless.TError instance GHC.Show.Show Agda.Syntax.Treeless.TError instance GHC.Generics.Generic Agda.Syntax.Treeless.TAlt instance GHC.Classes.Ord Agda.Syntax.Treeless.TAlt instance GHC.Classes.Eq Agda.Syntax.Treeless.TAlt instance GHC.Show.Show Agda.Syntax.Treeless.TAlt instance GHC.Generics.Generic Agda.Syntax.Treeless.TTerm instance GHC.Classes.Ord Agda.Syntax.Treeless.TTerm instance GHC.Classes.Eq Agda.Syntax.Treeless.TTerm instance GHC.Show.Show Agda.Syntax.Treeless.TTerm instance GHC.Generics.Generic Agda.Syntax.Treeless.Compiled instance GHC.Classes.Ord Agda.Syntax.Treeless.Compiled instance GHC.Classes.Eq Agda.Syntax.Treeless.Compiled instance GHC.Show.Show Agda.Syntax.Treeless.Compiled instance Agda.Syntax.Treeless.Unreachable Agda.Syntax.Treeless.TAlt instance Agda.Syntax.Treeless.Unreachable Agda.Syntax.Treeless.TTerm instance Agda.Syntax.Position.KillRange Agda.Syntax.Treeless.Compiled instance Control.DeepSeq.NFData Agda.Syntax.Treeless.Compiled instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TTerm instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TAlt instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TError instance Control.DeepSeq.NFData Agda.Syntax.Treeless.CaseInfo instance Control.DeepSeq.NFData Agda.Syntax.Treeless.CaseType instance Control.DeepSeq.NFData Agda.Syntax.Treeless.TPrim instance Control.DeepSeq.NFData Agda.Syntax.Treeless.ArgUsage -- | 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.Show.Show Agda.Compiler.Treeless.AsPatterns.AsPat module Agda.Syntax.Parser.Tokens data Token TokKeyword :: Keyword -> Interval -> Token TokId :: (Interval, String) -> Token TokQId :: [(Interval, String)] -> 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 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 KwOPTIONS :: Keyword KwBUILTIN :: Keyword KwLINE :: Keyword KwFOREIGN :: Keyword KwCOMPILE :: Keyword KwIMPOSSIBLE :: Keyword KwSTATIC :: Keyword KwINJECTIVE :: Keyword KwINLINE :: Keyword KwNOINLINE :: Keyword KwETA :: 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 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 SymVirtualSemi :: Symbol SymBar :: Symbol SymColon :: Symbol SymArrow :: Symbol SymEqual :: Symbol SymLambda :: Symbol SymUnderscore :: Symbol SymQuestionMark :: Symbol SymAs :: Symbol SymOpenParen :: Symbol SymCloseParen :: Symbol SymOpenIdiomBracket :: Symbol SymCloseIdiomBracket :: Symbol SymEmptyIdiomBracket :: Symbol SymDoubleOpenBrace :: Symbol SymDoubleCloseBrace :: Symbol SymOpenBrace :: Symbol SymCloseBrace :: Symbol SymOpenVirtualBrace :: Symbol SymCloseVirtualBrace :: Symbol SymOpenPragma :: Symbol SymClosePragma :: Symbol SymEllipsis :: Symbol SymDotDot :: Symbol -- | A misplaced end-comment "-}". SymEndComment :: Symbol instance GHC.Show.Show Agda.Syntax.Parser.Tokens.Keyword instance GHC.Classes.Eq Agda.Syntax.Parser.Tokens.Keyword instance GHC.Show.Show Agda.Syntax.Parser.Tokens.Symbol instance GHC.Classes.Eq Agda.Syntax.Parser.Tokens.Symbol instance GHC.Show.Show Agda.Syntax.Parser.Tokens.Token instance GHC.Classes.Eq Agda.Syntax.Parser.Tokens.Token instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Tokens.Token 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 [_warningSet] :: WarningMode -> Set WarningName [_warn2Error] :: WarningMode -> Bool warningSet :: Lens' (Set WarningName) WarningMode warn2Error :: Lens' Bool WarningMode -- | 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 incompleteMatchWarnings :: Set WarningName errorWarnings :: Set WarningName defaultWarningMode :: WarningMode -- | Some warnings are errors and cannot be turned off. data WarningModeError Unknown :: String -> WarningModeError NoNoError :: String -> WarningModeError prettyWarningModeError :: WarningModeError -> String -- | 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 OverlappingTokensWarning_ :: WarningName UnsupportedAttribute_ :: WarningName MultipleAttributes_ :: WarningName LibUnknownField_ :: 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 HiddenGeneralize_ :: WarningName InvalidCatchallPragma_ :: WarningName InvalidConstructor_ :: WarningName InvalidConstructorBlock_ :: WarningName InvalidCoverageCheckPragma_ :: WarningName InvalidNoPositivityCheckPragma_ :: WarningName InvalidNoUniverseCheckPragma_ :: WarningName InvalidRecordDirective_ :: WarningName InvalidTerminationCheckPragma_ :: WarningName MissingDeclarations_ :: WarningName MissingDefinitions_ :: WarningName NotAllowedInMutual_ :: WarningName OpenPublicAbstract_ :: WarningName OpenPublicPrivate_ :: WarningName PolarityPragmasButNotPostulates_ :: WarningName PragmaCompiled_ :: WarningName PragmaNoTerminationCheck_ :: WarningName ShadowingInTelescope_ :: WarningName UnknownFixityInMixfixDecl_ :: WarningName UnknownNamesInFixityDecl_ :: WarningName UnknownNamesInPolarityPragmas_ :: WarningName UselessAbstract_ :: WarningName UselessInstance_ :: WarningName UselessPrivate_ :: WarningName AbsurdPatternRequiresNoRHS_ :: WarningName AsPatternShadowsConstructorOrPatternSynonym_ :: WarningName CantGeneralizeOverSorts_ :: WarningName ClashesViaRenaming_ :: WarningName CoverageIssue_ :: WarningName CoverageNoExactSplit_ :: WarningName DeprecationWarning_ :: WarningName DuplicateUsing_ :: WarningName FixityInRenamingModule_ :: WarningName GenericNonFatalError_ :: WarningName GenericUseless_ :: WarningName GenericWarning_ :: WarningName IllformedAsClause_ :: WarningName InstanceArgWithExplicitArg_ :: WarningName InstanceWithExplicitArg_ :: WarningName InstanceNoOutputTypeName_ :: WarningName InversionDepthReached_ :: WarningName ModuleDoesntExport_ :: WarningName NoGuardednessFlag_ :: WarningName NotInScope_ :: WarningName NotStrictlyPositive_ :: WarningName UnsupportedIndexedMatch_ :: WarningName OldBuiltin_ :: WarningName PragmaCompileErased_ :: WarningName RewriteMaybeNonConfluent_ :: WarningName RewriteNonConfluent_ :: WarningName RewriteAmbiguousRules_ :: WarningName RewriteMissingRule_ :: WarningName SafeFlagEta_ :: WarningName SafeFlagInjective_ :: WarningName SafeFlagNoCoverageCheck_ :: WarningName SafeFlagNonTerminating_ :: WarningName SafeFlagNoPositivityCheck_ :: WarningName SafeFlagNoUniverseCheck_ :: WarningName SafeFlagPolarity_ :: WarningName SafeFlagPostulate_ :: WarningName SafeFlagPragma_ :: WarningName SafeFlagTerminating_ :: WarningName SafeFlagWithoutKFlagPrimEraseEquality_ :: WarningName TerminationIssue_ :: WarningName UnreachableClauses_ :: WarningName UnsolvedConstraints_ :: WarningName UnsolvedInteractionMetas_ :: WarningName UnsolvedMetaVariables_ :: WarningName UselessHiding_ :: WarningName UselessInline_ :: WarningName UselessPatternDeclarationForRecord_ :: WarningName UselessPublic_ :: WarningName UserWarning_ :: WarningName WithoutKFlagPrimEraseEquality_ :: WarningName WrongInstanceDeclaration_ :: WarningName CoInfectiveImport_ :: WarningName InfectiveImport_ :: WarningName DuplicateFieldsWarning_ :: WarningName TooManyFieldsWarning_ :: WarningName warningName2String :: 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.Generics.Generic Agda.Interaction.Options.Warnings.WarningName instance GHC.Enum.Bounded Agda.Interaction.Options.Warnings.WarningName instance GHC.Enum.Enum Agda.Interaction.Options.Warnings.WarningName instance GHC.Read.Read Agda.Interaction.Options.Warnings.WarningName instance GHC.Show.Show Agda.Interaction.Options.Warnings.WarningName instance GHC.Classes.Ord Agda.Interaction.Options.Warnings.WarningName instance GHC.Classes.Eq Agda.Interaction.Options.Warnings.WarningName instance GHC.Generics.Generic Agda.Interaction.Options.Warnings.WarningMode instance GHC.Show.Show Agda.Interaction.Options.Warnings.WarningMode instance GHC.Classes.Eq Agda.Interaction.Options.Warnings.WarningMode instance Control.DeepSeq.NFData Agda.Interaction.Options.Warnings.WarningMode instance Control.DeepSeq.NFData Agda.Interaction.Options.Warnings.WarningName 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.Generics.Generic Agda.Interaction.Options.Help.HelpTopic instance GHC.Show.Show Agda.Interaction.Options.Help.HelpTopic instance GHC.Classes.Eq Agda.Interaction.Options.Help.HelpTopic instance GHC.Generics.Generic Agda.Interaction.Options.Help.Help instance GHC.Show.Show Agda.Interaction.Options.Help.Help instance GHC.Classes.Eq Agda.Interaction.Options.Help.Help instance Control.DeepSeq.NFData Agda.Interaction.Options.Help.Help instance Control.DeepSeq.NFData Agda.Interaction.Options.Help.HelpTopic -- | Basic data types for library management. module Agda.Interaction.Library.Base -- | A symbolic library name. type LibName = String 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 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 one or more .agda-lib files, or be part of the default -- project. data ProjectConfig ProjectConfig :: FilePath -> [FilePath] -> ProjectConfig [configRoot] :: ProjectConfig -> FilePath [configAgdaLibFiles] :: ProjectConfig -> [FilePath] DefaultProjectConfig :: ProjectConfig -- | Content of a .agda-lib file. data AgdaLibFile AgdaLibFile :: LibName -> FilePath -> [FilePath] -> [LibName] -> [String] -> AgdaLibFile -- | The symbolic name of the library. [_libName] :: AgdaLibFile -> LibName -- | Path to this .agda-lib file (not content of the file). [_libFile] :: AgdaLibFile -> FilePath -- | 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 -> [String] emptyLibFile :: AgdaLibFile -- | Lenses for AgdaLibFile libName :: Lens' LibName AgdaLibFile libFile :: Lens' FilePath AgdaLibFile libIncludes :: Lens' [FilePath] AgdaLibFile libDepends :: Lens' [LibName] AgdaLibFile libPragmas :: Lens' [String] AgdaLibFile 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 -> [AgdaLibFile] -> 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 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 Doc exceptions, still collects LibWarnings. type LibM = ExceptT Doc (WriterT [LibWarning] (StateT LibState IO)) -- | Cache locations of project configurations and parsed -- .agda-lib files. type LibState = (Map FilePath ProjectConfig, Map FilePath AgdaLibFile) 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 -- | 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 -- --
-- 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.Show.Show Agda.Interaction.Library.Parse.GenericLine -- | Ranges. module Agda.Interaction.Highlighting.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 -> Range [from, 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] -- | Converts a Range' to a Ranges. rToR :: Range -> Ranges -- | Converts a Range', seen as a continuous range, to a -- Range. rangeToRange :: Range -> Range -- | 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.Show.Show Agda.Interaction.Highlighting.Range.Range instance GHC.Classes.Ord Agda.Interaction.Highlighting.Range.Range instance GHC.Classes.Eq Agda.Interaction.Highlighting.Range.Range instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.Range.Ranges instance GHC.Show.Show Agda.Interaction.Highlighting.Range.Ranges instance GHC.Classes.Eq Agda.Interaction.Highlighting.Range.Ranges instance Agda.Utils.Null.Null Agda.Interaction.Highlighting.Range.Range instance Control.DeepSeq.NFData Agda.Interaction.Highlighting.Range.Range -- | 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 -- | A strict pair type where the first argument must be an Int. -- -- This type is included because there is no NFData instance for -- Pair in the package strict before version 4. newtype PairInt a PairInt :: Pair Int a -> PairInt a -- | 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 instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.RangeMap.PairInt a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.RangeMap.RangeMap a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.RangeMap.RangeMap a) instance Agda.Utils.Null.Null (Agda.Utils.RangeMap.RangeMap a) instance Agda.Utils.RangeMap.IsBasicRangeMap a (Agda.Utils.RangeMap.RangeMap a) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Agda.Utils.RangeMap.RangeMap a) instance GHC.Base.Semigroup a => GHC.Base.Monoid (Agda.Utils.RangeMap.RangeMap a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Utils.RangeMap.PairInt a) 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 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 curriedLambda :: Nat -> Exp -> Exp emp :: Exp union :: Exp -> Exp -> Exp vine :: [MemberId] -> Exp -> Exp object :: [([MemberId], Exp)] -> Exp module Agda.Compiler.JS.Pretty 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) -> a -> Doc prettyShow :: Pretty a => Bool -> a -> String class Pretties a pretties :: Pretties a => (Nat, Bool) -> a -> [Doc] block :: (Nat, Bool) -> Exp -> Doc modname :: GlobalId -> Doc exports :: (Nat, Bool) -> 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 Agda.Compiler.JS.Pretty.Pretty a => Agda.Compiler.JS.Pretty.Pretties [a] instance Agda.Compiler.JS.Pretty.Pretty a => Agda.Compiler.JS.Pretty.Pretties (Agda.Utils.List1.List1 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 Agda.Compiler.JS.Syntax.Exp instance Agda.Compiler.JS.Pretty.Pretty [(Agda.Compiler.JS.Syntax.GlobalId, Agda.Compiler.JS.Syntax.Export)] instance Agda.Compiler.JS.Pretty.Pretty a => Agda.Compiler.JS.Pretty.Pretty (GHC.Maybe.Maybe a) instance (Agda.Compiler.JS.Pretty.Pretty a, Agda.Compiler.JS.Pretty.Pretty b) => Agda.Compiler.JS.Pretty.Pretty (a, b) instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.LocalId instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.GlobalId instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.MemberId instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.Comment instance Agda.Compiler.JS.Pretty.Pretty Agda.Compiler.JS.Syntax.Module instance Data.String.IsString Agda.Compiler.JS.Pretty.Doc instance GHC.Base.Semigroup Agda.Compiler.JS.Pretty.Doc instance GHC.Base.Monoid Agda.Compiler.JS.Pretty.Doc module Agda.Auto.Typecheck -- | Typechecker drives the solution of metas. tcExp :: Bool -> Ctx o -> CExp o -> MExp o -> EE (MyPB o) getDatatype :: ICExp o -> EE (MyMB (Maybe (ICArgList o, [ConstRef o])) o) constructorImpossible :: ICArgList o -> ConstRef o -> EE (MyPB o) unequals :: ICArgList o -> ICArgList o -> ([(Nat, HNExp o)] -> EE (MyPB o)) -> [(Nat, HNExp o)] -> EE (MyPB o) unequal :: ICExp o -> ICExp o -> ([(Nat, HNExp o)] -> EE (MyPB o)) -> [(Nat, HNExp o)] -> EE (MyPB o) traversePi :: Int -> ICExp o -> EE (MyMB (HNExp o) o) tcargs :: Nat -> Bool -> Ctx o -> CExp o -> MArgList o -> MExp o -> Bool -> (CExp o -> MExp o -> EE (MyPB o)) -> EE (MyPB o) addend :: Hiding -> MExp o -> MM (Exp o) blk -> MM (Exp o) blk copyarg :: MExp o -> Bool type HNNBlks o = [HNExp o] noblks :: HNNBlks o addblk :: HNExp o -> HNNBlks o -> HNNBlks o hnn :: ICExp o -> EE (MyMB (HNExp o) o) hnn_blks :: ICExp o -> EE (MyMB (HNExp o, HNNBlks o) o) hnn_checkstep :: ICExp o -> EE (MyMB (HNExp o, Bool) o) hnn' :: ICExp o -> ICArgList o -> EE (MyMB (HNExp o, HNNBlks o) o) hnb :: ICExp o -> ICArgList o -> EE (MyMB (HNExp o) o) data HNRes o HNDone :: Maybe (Metavar (Exp o) (RefInfo o)) -> HNExp o -> HNRes o HNMeta :: ICExp o -> ICArgList o -> [Maybe (UId o)] -> HNRes o hnc :: Bool -> ICExp o -> ICArgList o -> [Maybe (UId o)] -> EE (MyMB (HNRes o) o) hnarglist :: ICArgList o -> EE (MyMB (HNArgList o) o) getNArgs :: Nat -> ICArgList o -> EE (MyMB (Maybe ([ICExp o], ICArgList o)) o) getAllArgs :: ICArgList o -> EE (MyMB [ICExp o] o) data PEval o PENo :: ICExp o -> PEval o PEConApp :: ICExp o -> ConstRef o -> [PEval o] -> PEval o iotastep :: Bool -> HNExp o -> EE (MyMB (Either (ICExp o, ICArgList o) (HNNBlks o)) o) noiotastep :: HNExp o -> EE (MyPB o) noiotastep_term :: ConstRef o -> MArgList o -> EE (MyPB o) data CMode o CMRigid :: Maybe (Metavar (Exp o) (RefInfo o)) -> HNExp o -> CMode o CMFlex :: MM b (RefInfo o) -> CMFlex o -> CMode o data CMFlex o CMFFlex :: ICExp o -> ICArgList o -> [Maybe (UId o)] -> CMFlex o CMFSemi :: Maybe (Metavar (Exp o) (RefInfo o)) -> HNExp o -> CMFlex o CMFBlocked :: Maybe (Metavar (Exp o) (RefInfo o)) -> HNExp o -> CMFlex o comp' :: forall o. Bool -> CExp o -> CExp o -> EE (MyPB o) checkeliminand :: MExp o -> EE (MyPB o) maybeor :: Bool -> Prio -> IO (PB (RefInfo o)) -> IO (PB (RefInfo o)) -> IO (PB (RefInfo o)) iotapossmeta :: ICExp o -> ICArgList o -> EE Bool meta_not_constructor :: ICExp o -> EE (MB Bool (RefInfo o)) calcEqRState :: EqReasoningConsts o -> MExp o -> EE (MyPB o) pickid :: MId -> MId -> MId tcSearch :: Bool -> Ctx o -> CExp o -> MExp o -> EE (MyPB o) module Agda.Auto.CaseSplit abspatvarname :: String costCaseSplitVeryHigh :: Cost costCaseSplitHigh :: Cost costCaseSplitLow :: Cost costAddVarDepth :: Cost data HI a HI :: Hiding -> a -> HI a drophid :: [HI a] -> [a] type CSPat o = HI (CSPatI o) type CSCtx o = [HI (MId, MExp o)] data CSPatI o CSPatConApp :: ConstRef o -> [CSPat o] -> CSPatI o CSPatProj :: ConstRef o -> CSPatI o CSPatVar :: Nat -> CSPatI o CSPatExp :: MExp o -> CSPatI o CSWith :: MExp o -> CSPatI o CSAbsurd :: CSPatI o CSOmittedArg :: CSPatI o type Sol o = [(CSCtx o, [CSPat o], Maybe (MExp o))] caseSplitSearch :: forall o. IORef Int -> Int -> [ConstRef o] -> Maybe (EqReasoningConsts o) -> Int -> Cost -> ConstRef o -> CSCtx o -> MExp o -> [CSPat o] -> IO [Sol o] caseSplitSearch' :: forall o. (Cost -> CSCtx o -> MExp o -> ([Nat], Nat, [Nat]) -> IO (Maybe (MExp o))) -> Int -> Cost -> ConstRef o -> CSCtx o -> MExp o -> [CSPat o] -> IO [Sol o] infertypevar :: CSCtx o -> Nat -> MExp o class Replace t u where { type ReplaceWith t u; } replace' :: Replace t u => Nat -> MExp (ReplaceWith t u) -> t -> Reader (Nat, Nat) u replace :: Replace t u => Nat -> Nat -> MExp (ReplaceWith t u) -> t -> u betareduce :: MExp o -> MArgList o -> MExp o concatargs :: MArgList o -> MArgList o -> MArgList o replacep :: forall o. Nat -> Nat -> CSPatI o -> MExp o -> CSPat o -> CSPat o type Assignments o = [(Nat, Exp o)] class Unify t where { type UnifiesTo t; } unify' :: Unify t => t -> t -> StateT (Assignments (UnifiesTo t)) Maybe () notequal' :: Unify t => t -> t -> ReaderT (Nat, Nat) (StateT (Assignments (UnifiesTo t)) IO) Bool unify :: Unify t => t -> t -> Maybe (Assignments (UnifiesTo t)) notequal :: Unify t => Nat -> Nat -> t -> t -> IO Bool unifyVar :: Nat -> Exp o -> StateT (Assignments o) Maybe () unifyexp :: MExp o -> MExp o -> Maybe [(Nat, MExp o)] class Lift t lift' :: Lift t => Nat -> Nat -> t -> t lift :: Lift t => Nat -> t -> t removevar :: CSCtx o -> MExp o -> [CSPat o] -> [(Nat, MExp o)] -> (CSCtx o, MExp o, [CSPat o]) findperm :: [MExp o] -> Maybe [Nat] freevars :: FreeVars t => t -> [Nat] applyperm :: [Nat] -> CSCtx o -> MExp o -> [CSPat o] -> (CSCtx o, MExp o, [CSPat o]) ren :: [Nat] -> Nat -> Int seqctx :: CSCtx o -> CSCtx o depthofvar :: Nat -> [CSPat o] -> Nat -- | Speculation: Type class computing the size (?) of a pattern and -- collecting the vars it introduces class LocalTerminationEnv a sizeAndBoundVars :: LocalTerminationEnv a => a -> (Sum Nat, [Nat]) -- | Take a list of patterns and returns (is, size, vars) where -- (speculation): localTerminationEnv :: [CSPat o] -> ([Nat], Nat, [Nat]) localTerminationSidecond :: ([Nat], Nat, [Nat]) -> ConstRef o -> MExp o -> EE (MyPB o) getblks :: MExp o -> IO [Nat] instance Agda.Auto.CaseSplit.LocalTerminationEnv a => Agda.Auto.CaseSplit.LocalTerminationEnv (Agda.Auto.CaseSplit.HI a) instance Agda.Auto.CaseSplit.LocalTerminationEnv (Agda.Auto.CaseSplit.CSPatI o) instance Agda.Auto.CaseSplit.LocalTerminationEnv a => Agda.Auto.CaseSplit.LocalTerminationEnv [a] instance Agda.Auto.CaseSplit.LocalTerminationEnv (Agda.Auto.Syntax.MExp o) instance (Agda.Auto.CaseSplit.LocalTerminationEnv a, Agda.Auto.CaseSplit.LocalTerminationEnv b) => Agda.Auto.CaseSplit.LocalTerminationEnv (a, b) instance Agda.Auto.CaseSplit.LocalTerminationEnv (Agda.Auto.Syntax.MArgList o) instance Agda.Auto.CaseSplit.Lift t => Agda.Auto.CaseSplit.Lift (Agda.Auto.Syntax.Abs t) instance Agda.Auto.CaseSplit.Lift t => Agda.Auto.CaseSplit.Lift (Agda.Auto.NarrowingSearch.MM t r) instance Agda.Auto.CaseSplit.Lift (Agda.Auto.Syntax.Exp o) instance Agda.Auto.CaseSplit.Lift (Agda.Auto.Syntax.ArgList o) instance (Agda.Auto.CaseSplit.Unify t, o GHC.Types.~ Agda.Auto.CaseSplit.UnifiesTo t) => Agda.Auto.CaseSplit.Unify (Agda.Auto.NarrowingSearch.MM t (Agda.Auto.Syntax.RefInfo o)) instance Agda.Auto.CaseSplit.Unify t => Agda.Auto.CaseSplit.Unify (Agda.Auto.Syntax.Abs t) instance Agda.Auto.CaseSplit.Unify (Agda.Auto.Syntax.Exp o) instance Agda.Auto.CaseSplit.Unify (Agda.Auto.Syntax.ArgList o) instance Agda.Auto.CaseSplit.Replace t u => Agda.Auto.CaseSplit.Replace (Agda.Auto.Syntax.Abs t) (Agda.Auto.Syntax.Abs u) instance Agda.Auto.CaseSplit.Replace (Agda.Auto.Syntax.Exp o) (Agda.Auto.Syntax.MExp o) instance Agda.Auto.CaseSplit.Replace t u => Agda.Auto.CaseSplit.Replace (Agda.Auto.NarrowingSearch.MM t (Agda.Auto.Syntax.RefInfo o)) u instance Agda.Auto.CaseSplit.Replace (Agda.Auto.Syntax.ArgList o) (Agda.Auto.Syntax.ArgList o) instance Agda.Auto.Syntax.Renaming (Agda.Auto.CaseSplit.CSPatI o) instance Agda.Auto.Syntax.Renaming t => Agda.Auto.Syntax.Renaming (Agda.Auto.CaseSplit.HI t) -- | 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 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 :: Ord n => 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' -- | 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 :: Ord n => (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 :: forall n e. (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 :: (Ord n1, Ord n2) => (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 :: forall n e. 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 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 :: 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 -> [[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' :: forall n e. 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 :: forall n e. 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: -- --
-- 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.Classes.Eq n, GHC.Classes.Eq e) => GHC.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) instance (GHC.Show.Show n, GHC.Show.Show e) => GHC.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance GHC.Base.Functor (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n) instance (GHC.Classes.Ord n, GHC.Classes.Ord e) => GHC.Classes.Ord (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance (GHC.Classes.Eq n, GHC.Classes.Eq e) => GHC.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance GHC.Base.Functor Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt instance GHC.Show.Show n => GHC.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance GHC.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance GHC.Classes.Ord (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance Agda.Utils.Pretty.Pretty n => Agda.Utils.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n) instance (Agda.Utils.Pretty.Pretty n, Agda.Utils.Pretty.Pretty e) => Agda.Utils.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Edge n e) instance GHC.Base.Functor (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n) instance (GHC.Classes.Ord n, Agda.Utils.Pretty.Pretty n, Agda.Utils.Pretty.Pretty e) => Agda.Utils.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) instance (GHC.Classes.Ord n, GHC.Show.Show n, GHC.Show.Show e) => GHC.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) 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] -- | Occurrences. module Agda.TypeChecking.Positivity.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 Unused :: Occurrence -- | 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 :: 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 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 IsIndex :: 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. productOfEdgesInBoundedWalk :: (SemiRing e, Ord n) => (e -> Occurrence) -> Graph n e -> n -> n -> Occurrence -> Maybe e instance GHC.Generics.Generic Agda.TypeChecking.Positivity.Occurrence.Where instance GHC.Classes.Ord Agda.TypeChecking.Positivity.Occurrence.Where instance GHC.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.Where instance GHC.Show.Show Agda.TypeChecking.Positivity.Occurrence.Where instance GHC.Generics.Generic Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance GHC.Classes.Ord Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance GHC.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance GHC.Show.Show Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance GHC.Enum.Bounded Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Enum.Enum Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Classes.Ord Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Classes.Eq Agda.TypeChecking.Positivity.Occurrence.Occurrence instance GHC.Show.Show Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Utils.SemiRing.SemiRing Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Utils.SemiRing.StarSemiRing Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.Utils.Null.Null Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance Agda.Utils.Size.Sized Agda.TypeChecking.Positivity.Occurrence.OccursWhere instance Control.DeepSeq.NFData Agda.TypeChecking.Positivity.Occurrence.Where instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.Where -- | 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 -> Set Name -> OpAppArgs -> Expr -- | ex: e | e1 | .. | en WithApp :: Range -> Expr -> [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 -- } Rec :: Range -> RecordAssignments -> Expr -- | ex: record e {x = a; y = b} RecUpdate :: 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 -> [Expr] -> Expr -- | ex: do x <- m1; m2 DoBlock :: Range -> 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 :: Range -> Expr -> Expr -- | ex: ..A, used for parsing ..A -> B DoubleDot :: Range -> 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 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 = [NamedArg (MaybePlaceholder (OpApp e))] -- | The Expr is not an application. data AppView AppView :: Expr -> [NamedArg Expr] -> AppView appView :: Expr -> AppView unAppView :: AppView -> 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 -- | 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 -> a -> Binder' a [binderPattern] :: Binder' a -> Maybe Pattern [binderName] :: Binder' a -> a type Binder = Binder' BoundName mkBinder_ :: Name -> Binder mkBinder :: a -> Binder' a -- | A lambda binding is either domain free or typed. 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 -- | Drop type annotations and lets from bindings. dropTypeAndModality :: LamBinding -> [LamBinding] -- | 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 :: Lens' Name (FieldAssignment' a) exprFieldA :: Lens' a (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' [bnameTactic] :: BoundName -> TacticAttribute [bnameIsFinite] :: BoundName -> Bool mkBoundName_ :: Name -> BoundName mkBoundName :: Name -> Fixity' -> BoundName type TacticAttribute = Maybe Expr type Telescope = [TypedBinding] -- | A telescope is a sequence of typed bindings. Bound variables are in -- scope in later types. type Telescope1 = List1 TypedBinding -- | We can try to get a Telescope from a [LamBinding]. -- If we have a type annotation already, we're happy. Otherwise we -- manufacture a binder with an underscore for the type. lamBindingsToTelescope :: Range -> [LamBinding] -> 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) -- | 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 -- | Extract a record directive isRecordDirective :: Declaration -> Maybe RecordDirective type RecordDirectives = RecordDirectives' (Name, IsInstance) -- | 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) TypeSig :: ArgInfo -> TacticAttribute -> Name -> Expr -> Declaration FieldSig :: IsInstance -> TacticAttribute -> Name -> Arg Expr -> Declaration -- | Variables to be generalized, can be hidden and/or irrelevant. Generalize :: Range -> [TypeSignature] -> Declaration Field :: Range -> [FieldSignature] -> Declaration FunClause :: LHS -> RHS -> WhereClause -> Bool -> Declaration -- | lone data signature in mutual block DataSig :: Range -> Name -> [LamBinding] -> Expr -> Declaration Data :: Range -> Name -> [LamBinding] -> Expr -> [TypeSignatureOrInstanceBlock] -> Declaration DataDef :: Range -> Name -> [LamBinding] -> [TypeSignatureOrInstanceBlock] -> Declaration -- | lone record signature in mutual block RecordSig :: Range -> Name -> [LamBinding] -> Expr -> Declaration RecordDef :: Range -> Name -> RecordDirectives -> [LamBinding] -> [Declaration] -> Declaration Record :: Range -> Name -> RecordDirectives -> [LamBinding] -> Expr -> [Declaration] -> Declaration -- | Should not survive beyond the parser RecordDirective :: RecordDirective -> Declaration Infix :: Fixity -> List1 Name -> Declaration -- | notation declaration for a name Syntax :: Name -> Notation -> Declaration PatternSyn :: Range -> Name -> [Arg Name] -> Pattern -> Declaration Mutual :: Range -> [Declaration] -> Declaration InterleavedMutual :: Range -> [Declaration] -> Declaration Abstract :: Range -> [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 :: Range -> Origin -> [Declaration] -> Declaration -- | The Range' here (exceptionally) only refers to the range of the -- instance keyword. The range of the whole block InstanceB -- r ds is fuseRange r ds. InstanceB :: Range -> [Declaration] -> Declaration LoneConstructor :: Range -> [Declaration] -> Declaration Macro :: Range -> [Declaration] -> Declaration Postulate :: Range -> [TypeSignatureOrInstanceBlock] -> Declaration Primitive :: Range -> [TypeSignature] -> Declaration Open :: Range -> QName -> ImportDirective -> Declaration Import :: Range -> QName -> Maybe AsName -> !OpenShortHand -> ImportDirective -> Declaration ModuleMacro :: Range -> Name -> ModuleApplication -> !OpenShortHand -> ImportDirective -> Declaration Module :: Range -> 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 data ModuleApplication -- |
-- tel. M args --SectionApp :: Range -> Telescope -> 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' (Either Expr Name) data OpenShortHand DoOpen :: 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 IdentP :: 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 -> Set Name -> [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 unused AsP :: Range -> Name -> Pattern -> Pattern -- |
-- .e --DotP :: Range -> Expr -> Pattern -- | 0, 1, etc. LitP :: Range -> Literal -> Pattern -- |
-- record {x = p; y = q} --RecP :: Range -> [FieldAssignment' Pattern] -> Pattern -- | i = i1 i.e. cubical face lattice generator EqualP :: Range -> [(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 -> [Pattern] -> [NamedArg Pattern] -> LHSCore [lhsHead] :: LHSCore -> LHSCore -- | Non-empty; at least one (| p). [lhsWithPatterns] :: LHSCore -> [Pattern] -- |
-- ps --[lhsPats] :: LHSCore -> [NamedArg Pattern] LHSEllipsis :: Range -> LHSCore -> LHSCore [lhsEllipsisRange] :: LHSCore -> Range -- | Pattern that was expanded from an ellipsis .... [lhsEllipsisPat] :: LHSCore -> LHSCore -- | 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 data LamClause LamClause :: [Pattern] -> RHS -> Bool -> LamClause -- | Possibly empty sequence. [lamLHS] :: LamClause -> [Pattern] [lamRHS] :: LamClause -> RHS [lamCatchAll] :: LamClause -> Bool 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] 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 -> Name -> Access -> decls -> WhereClause' decls -- | 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 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 -- | first string is backend name ForeignPragma :: Range -> RString -> String -> Pragma -- | first string is backend name CompilePragma :: Range -> RString -> 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 -- | For coinductive records, use pragma instead of regular -- eta-equality definition (as it is might make Agda loop). 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 -- | 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 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 -> [Occurrence] -> Pragma -- | Applies to the following data/record type. NoUniverseCheckPragma :: Range -> Pragma -- | Applies to the stated function NotProjectionLikePragma :: Range -> QName -> Pragma -- | Modules: Top-level pragmas plus other top-level declarations. data Module Mod :: [Pragma] -> [Declaration] -> Module [modPragmas] :: Module -> [Pragma] [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]) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Concrete.FieldAssignment' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Concrete.FieldAssignment' a) instance Data.Traversable.Traversable Agda.Syntax.Concrete.FieldAssignment' instance Data.Foldable.Foldable Agda.Syntax.Concrete.FieldAssignment' instance GHC.Base.Functor Agda.Syntax.Concrete.FieldAssignment' instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Concrete.RHS' e) instance Data.Traversable.Traversable Agda.Syntax.Concrete.RHS' instance Data.Foldable.Foldable Agda.Syntax.Concrete.RHS' instance GHC.Base.Functor Agda.Syntax.Concrete.RHS' instance Data.Traversable.Traversable Agda.Syntax.Concrete.WhereClause' instance Data.Foldable.Foldable Agda.Syntax.Concrete.WhereClause' instance GHC.Base.Functor Agda.Syntax.Concrete.WhereClause' instance GHC.Classes.Eq decls => GHC.Classes.Eq (Agda.Syntax.Concrete.WhereClause' decls) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Concrete.AsName' a) instance Data.Traversable.Traversable Agda.Syntax.Concrete.AsName' instance Data.Foldable.Foldable Agda.Syntax.Concrete.AsName' instance GHC.Base.Functor Agda.Syntax.Concrete.AsName' instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Concrete.AsName' a) instance GHC.Show.Show Agda.Syntax.Concrete.RecordDirective instance GHC.Classes.Eq Agda.Syntax.Concrete.RecordDirective instance GHC.Generics.Generic Agda.Syntax.Concrete.OpenShortHand instance GHC.Show.Show Agda.Syntax.Concrete.OpenShortHand instance GHC.Classes.Eq Agda.Syntax.Concrete.OpenShortHand instance GHC.Classes.Eq Agda.Syntax.Concrete.ModuleAssignment instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Concrete.OpApp e) instance Data.Traversable.Traversable Agda.Syntax.Concrete.OpApp instance Data.Foldable.Foldable Agda.Syntax.Concrete.OpApp instance GHC.Base.Functor Agda.Syntax.Concrete.OpApp instance GHC.Classes.Eq Agda.Syntax.Concrete.DoStmt instance GHC.Classes.Eq Agda.Syntax.Concrete.LamClause instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Concrete.LamBinding' a) instance Data.Traversable.Traversable Agda.Syntax.Concrete.LamBinding' instance Data.Foldable.Foldable Agda.Syntax.Concrete.LamBinding' instance GHC.Base.Functor Agda.Syntax.Concrete.LamBinding' instance GHC.Classes.Eq Agda.Syntax.Concrete.LHS instance Data.Traversable.Traversable Agda.Syntax.Concrete.Binder' instance Data.Foldable.Foldable Agda.Syntax.Concrete.Binder' instance GHC.Base.Functor Agda.Syntax.Concrete.Binder' instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Concrete.Binder' a) instance GHC.Classes.Eq Agda.Syntax.Concrete.BoundName instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Concrete.TypedBinding' e) instance Data.Traversable.Traversable Agda.Syntax.Concrete.TypedBinding' instance Data.Foldable.Foldable Agda.Syntax.Concrete.TypedBinding' instance GHC.Base.Functor Agda.Syntax.Concrete.TypedBinding' instance GHC.Classes.Eq Agda.Syntax.Concrete.ModuleApplication instance GHC.Classes.Eq Agda.Syntax.Concrete.Declaration instance GHC.Classes.Eq Agda.Syntax.Concrete.Expr instance GHC.Classes.Eq Agda.Syntax.Concrete.Pattern instance GHC.Classes.Eq Agda.Syntax.Concrete.Pragma instance GHC.Classes.Eq Agda.Syntax.Concrete.LHSCore instance Data.Traversable.Traversable (Agda.Syntax.Concrete.HoleContent' qn nm p) instance Data.Foldable.Foldable (Agda.Syntax.Concrete.HoleContent' qn nm p) instance GHC.Base.Functor (Agda.Syntax.Concrete.HoleContent' qn nm p) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LHSCore 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 Agda.Syntax.Position.HasRange e => Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.OpApp e) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Expr instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Binder instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.BoundName instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.WhereClause instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.RHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.DoStmt instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Pragma instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.AsName instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.ModuleAssignment 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.Expr instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.LHS instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.DoStmt instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Position.KillRange e => Agda.Syntax.Position.KillRange (Agda.Syntax.Concrete.OpApp e) 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.TypedBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.WhereClause instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Expr instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Pattern instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Declaration instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Pragma instance Control.DeepSeq.NFData Agda.Syntax.Concrete.AsName instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.TypedBinding' a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.ModuleApplication instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.OpApp a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.LHS instance Control.DeepSeq.NFData Agda.Syntax.Concrete.ModuleAssignment instance Control.DeepSeq.NFData Agda.Syntax.Concrete.LamClause instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.LamBinding' a) instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Binder instance Control.DeepSeq.NFData Agda.Syntax.Concrete.BoundName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.DoStmt instance Control.DeepSeq.NFData Agda.Syntax.Concrete.OpenShortHand instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.RecordDirective instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.RecordDirective instance Control.DeepSeq.NFData Agda.Syntax.Concrete.RecordDirective instance Agda.Utils.Null.Null (Agda.Syntax.Concrete.WhereClause' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.WhereClause' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.RHS' a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Concrete.FieldAssignment' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.FieldAssignment' a) module Agda.Syntax.TopLevelModuleName -- | A top-level module name has one or more name parts. type TopLevelModuleNameParts = List1 Text -- | Raw top-level module names (with linear-time comparisons). data RawTopLevelModuleName RawTopLevelModuleName :: Range -> TopLevelModuleNameParts -> RawTopLevelModuleName [rawModuleNameRange] :: RawTopLevelModuleName -> Range [rawModuleNameParts] :: RawTopLevelModuleName -> TopLevelModuleNameParts -- | Turns a raw top-level module name into a string. rawTopLevelModuleNameToString :: RawTopLevelModuleName -> String -- | Hashes a raw top-level module name. hashRawTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash -- | Turns a qualified name into a RawTopLevelModuleName. The -- qualified name is assumed to represent a top-level module name. rawTopLevelModuleNameForQName :: QName -> 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 -- | Computes the top-level module name. -- -- Precondition: The Declaration has to be well-formed. This means -- that there are only allowed declarations before the first module -- declaration, typically import declarations. See -- spanAllowedBeforeModule. rawTopLevelModuleNameForModule :: Module -> RawTopLevelModuleName -- | Top-level module names (with constant-time comparisons). data TopLevelModuleName TopLevelModuleName :: Range -> {-# UNPACK #-} !ModuleNameHash -> TopLevelModuleNameParts -> TopLevelModuleName [moduleNameRange] :: TopLevelModuleName -> Range [moduleNameId] :: TopLevelModuleName -> {-# UNPACK #-} !ModuleNameHash [moduleNameParts] :: TopLevelModuleName -> TopLevelModuleNameParts -- | A lens focusing on the moduleNameParts. lensTopLevelModuleNameParts :: Lens' TopLevelModuleNameParts TopLevelModuleName -- | Converts a top-level module name to a raw top-level module name. rawTopLevelModuleName :: TopLevelModuleName -> RawTopLevelModuleName -- | 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 -- | A corresponding QName. The range of each Name part is -- the whole range of the TopLevelModuleName. topLevelModuleNameToQName :: TopLevelModuleName -> QName -- | 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 instance GHC.Generics.Generic Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance GHC.Show.Show Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance GHC.Generics.Generic Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance GHC.Show.Show Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Utils.BiMap.HasTag Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance GHC.Classes.Eq Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance GHC.Classes.Ord Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Data.Hashable.Class.Hashable Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Utils.Size.Sized Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Utils.Pretty.Pretty Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Syntax.Position.HasRange Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Syntax.Position.SetRange Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.Syntax.Position.KillRange Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Control.DeepSeq.NFData Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance GHC.Classes.Eq Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance GHC.Classes.Ord Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Utils.Size.Sized Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Utils.Pretty.Pretty Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Position.HasRange Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Position.SetRange Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Position.KillRange Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Agda.Syntax.Concrete.Name.IsNoName Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName instance Control.DeepSeq.NFData Agda.Syntax.TopLevelModuleName.RawTopLevelModuleName -- | Pretty printer for the concrete syntax. module Agda.Syntax.Concrete.Pretty newtype Tel Tel :: Telescope -> Tel data NamedBinding NamedBinding :: Bool -> NamedArg Binder -> NamedBinding [withHiding] :: NamedBinding -> Bool [namedBinding] :: NamedBinding -> NamedArg Binder -- | 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 prettyRelevance :: LensRelevance a => a -> Doc -> Doc bracesAndSemicolons :: Foldable t => t Doc -> Doc prettyQuantity :: LensQuantity a => a -> Doc -> Doc prettyErased :: Erased -> Doc -> Doc prettyCohesion :: LensCohesion a => a -> Doc -> Doc prettyTactic :: BoundName -> Doc -> Doc prettyTactic' :: TacticAttribute -> Doc -> Doc prettyFiniteness :: BoundName -> Doc -> Doc -- | 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 :: Modality -> Doc prettyOpApp :: forall a. Pretty a => QName -> [NamedArg (MaybePlaceholder a)] -> [Doc] smashTel :: Telescope -> Telescope isLabeled :: NamedArg Binder -> Maybe ArgName pRecord :: Name -> RecordDirectives -> [LamBinding] -> Maybe Expr -> [Declaration] -> Doc pRecordDirective :: RecordDirective -> Doc pHasEta0 :: HasEta0 -> Doc instance GHC.Show.Show Agda.Syntax.Concrete.Expr instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Concrete.OpApp a) instance GHC.Show.Show Agda.Syntax.Concrete.Declaration instance GHC.Show.Show Agda.Syntax.Concrete.Pattern instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Concrete.Binder' a) instance GHC.Show.Show Agda.Syntax.Concrete.TypedBinding instance GHC.Show.Show Agda.Syntax.Concrete.LamBinding instance GHC.Show.Show Agda.Syntax.Concrete.BoundName instance GHC.Show.Show Agda.Syntax.Concrete.ModuleAssignment instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Syntax.Common.ImportDirective' a b) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Syntax.Common.Using' a b) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Syntax.Common.Renaming' a b) instance GHC.Show.Show Agda.Syntax.Concrete.Pragma instance GHC.Show.Show Agda.Syntax.Concrete.RHS instance GHC.Show.Show Agda.Syntax.Concrete.LHS instance GHC.Show.Show Agda.Syntax.Concrete.LHSCore instance GHC.Show.Show Agda.Syntax.Concrete.LamClause instance GHC.Show.Show Agda.Syntax.Concrete.WhereClause instance GHC.Show.Show Agda.Syntax.Concrete.ModuleApplication instance GHC.Show.Show Agda.Syntax.Concrete.DoStmt instance GHC.Show.Show Agda.Syntax.Concrete.Module instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Expr instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Pretty.Tel instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Pretty.NamedBinding instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.LamBinding instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.TypedBinding instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (a, b) instance Agda.Utils.Pretty.Pretty (Agda.Syntax.Fixity.ThingWithFixity Agda.Syntax.Concrete.Name.Name) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.WithHiding a) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Relevance instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Q0Origin instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Q1Origin instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.QωOrigin instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Quantity instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Cohesion instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Modality instance Agda.Utils.Pretty.Pretty (Agda.Syntax.Concrete.OpApp Agda.Syntax.Concrete.Expr) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.MaybePlaceholder a) instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Data.Either.Either a b) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.ModuleAssignment instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.LamClause instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.BoundName instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Concrete.Binder' a) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.RHS instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.WhereClause instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.LHS instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.LHSCore instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.ModuleApplication instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.DoStmt instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Declaration instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.OpenShortHand instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Pragma instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Associativity instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.FixityLevel instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Fixity instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.NotationPart instance Agda.Utils.Pretty.Pretty Agda.Syntax.Common.Fixity' instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.Arg a) instance Agda.Utils.Pretty.Pretty e => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.Named_ e) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Pattern instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.ImportDirective' a b) instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.Using' a b) instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.Renaming' a b) instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Common.ImportedName' a b) -- | 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.Generics.Generic Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Classes.Ord Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Classes.Eq Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Show.Show Agda.TypeChecking.Coverage.SplitTree.LazySplit instance GHC.Generics.Generic (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance GHC.Generics.Generic Agda.TypeChecking.Coverage.SplitTree.SplitTag instance GHC.Classes.Ord Agda.TypeChecking.Coverage.SplitTree.SplitTag instance GHC.Classes.Eq Agda.TypeChecking.Coverage.SplitTree.SplitTag instance GHC.Show.Show Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.Coverage.SplitTree.SplitTreeLabel a) instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.Syntax.Position.KillRange Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Control.DeepSeq.NFData Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.Coverage.SplitTree.SplitTree' a) instance Control.DeepSeq.NFData Agda.TypeChecking.Coverage.SplitTree.LazySplit -- | 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 -- | 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 -> Set Name -> Fixity -> Notation -> Bool -> NewNotation [notaName] :: NewNotation -> QName -- | The names the syntax and/or fixity belong to. -- -- Invariant: The set is non-empty. Every name in the list matches -- notaName. [notaNames] :: NewNotation -> Set 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: -- --
-- postulate --PostulateBlock :: KindOfBlock -- | primitive. Ensured by parser. PrimitiveBlock :: KindOfBlock -- | instance. Actually, here all kinds of sub-declarations are -- allowed a priori. InstanceBlock :: 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 -> DataRecOrFun [_kindPosCheck] :: DataRecOrFun -> PositivityCheck [_kindUniCheck] :: DataRecOrFun -> UniverseCheck -- | Name of a function. FunName :: TerminationCheck -> CoverageCheck -> DataRecOrFun isFunName :: DataRecOrFun -> Bool sameKind :: DataRecOrFun -> DataRecOrFun -> Bool terminationCheck :: DataRecOrFun -> TerminationCheck coverageCheck :: DataRecOrFun -> CoverageCheck positivityCheck :: DataRecOrFun -> PositivityCheck mutualChecks :: DataRecOrFun -> MutualChecks universeCheck :: DataRecOrFun -> UniverseCheck instance GHC.Generics.Generic Agda.Syntax.Concrete.Definitions.Types.Clause instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Types.Clause instance GHC.Generics.Generic Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance GHC.Classes.Ord Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance GHC.Classes.Eq Agda.Syntax.Concrete.Definitions.Types.KindOfBlock instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Types.InMutual instance GHC.Classes.Eq Agda.Syntax.Concrete.Definitions.Types.InMutual instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance GHC.Classes.Eq Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Types.DataRecOrFun instance GHC.Base.Semigroup Agda.Syntax.Concrete.Definitions.Types.MutualChecks instance GHC.Base.Monoid Agda.Syntax.Concrete.Definitions.Types.MutualChecks instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Types.NiceDeclaration instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Types.Clause 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' InvalidName :: Name -> DeclarationException' DuplicateDefinition :: Name -> DeclarationException' DuplicateAnonDeclaration :: Range -> DeclarationException' MissingWithClauses :: Name -> LHS -> DeclarationException' WrongDefinition :: Name -> DataRecOrFun -> DataRecOrFun -> DeclarationException' DeclarationPanic :: String -> 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 of -- mutual block. InvalidMeasureMutual :: Range -> DeclarationException' UnquoteDefRequiresSignature :: List1 Name -> DeclarationException' BadMacroDef :: NiceDeclaration -> DeclarationException' data DeclarationWarning DeclarationWarning :: CallStack -> DeclarationWarning' -> DeclarationWarning [dwLocation] :: DeclarationWarning -> CallStack [dwWarning] :: DeclarationWarning -> DeclarationWarning' -- | Non-fatal errors encountered in the Nicifier. data DeclarationWarning' -- | Empty abstract block. EmptyAbstract :: Range -> DeclarationWarning' -- | Empty constructor block. EmptyConstructor :: Range -> DeclarationWarning' -- | Empty field block. EmptyField :: Range -> DeclarationWarning' -- | Empty variable block. EmptyGeneralize :: Range -> DeclarationWarning' -- | Empty instance block EmptyInstance :: Range -> DeclarationWarning' -- | Empty macro block. EmptyMacro :: Range -> DeclarationWarning' -- | Empty mutual block. EmptyMutual :: Range -> DeclarationWarning' -- | Empty postulate block. EmptyPostulate :: Range -> DeclarationWarning' -- | Empty private block. EmptyPrivate :: Range -> DeclarationWarning' -- | Empty primitive block. EmptyPrimitive :: Range -> 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 definition in a constructor block InvalidConstructor :: 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' -- | 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 record directive outside of a record / below existing fields. InvalidRecordDirective :: Range -> DeclarationWarning' -- | A {-# TERMINATING #-} and {-# NON_TERMINATING #-} pragma that does not -- apply to any function. InvalidTerminationCheckPragma :: Range -> DeclarationWarning' -- | Definitions (e.g. constructors or functions) without a declaration. MissingDeclarations :: [(Name, Range)] -> DeclarationWarning' -- | Declarations (e.g. type signatures) without a definition. MissingDefinitions :: [(Name, Range)] -> DeclarationWarning' NotAllowedInMutual :: Range -> String -> DeclarationWarning' -- | private has no effect on open public. (But the user -- might think so.) OpenPublicPrivate :: Range -> DeclarationWarning' -- | abstract has no effect on open public. (But the user -- might think so.) OpenPublicAbstract :: Range -> DeclarationWarning' PolarityPragmasButNotPostulates :: [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' ShadowingInTelescope :: List1 (Name, List2 Range) -> DeclarationWarning' UnknownFixityInMixfixDecl :: [Name] -> DeclarationWarning' UnknownNamesInFixityDecl :: [Name] -> DeclarationWarning' UnknownNamesInPolarityPragmas :: [Name] -> DeclarationWarning' -- | abstract block with nothing that can (newly) be made -- abstract. UselessAbstract :: Range -> DeclarationWarning' -- | instance block with nothing that can (newly) become an -- instance. UselessInstance :: Range -> DeclarationWarning' -- | private block with nothing that can (newly) be made private. UselessPrivate :: Range -> DeclarationWarning' declarationWarningName :: DeclarationWarning -> WarningName declarationWarningName' :: DeclarationWarning' -> WarningName -- | Nicifier warnings turned into errors in --safe mode. unsafeDeclarationWarning :: DeclarationWarning -> Bool unsafeDeclarationWarning' :: DeclarationWarning' -> Bool instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance GHC.Generics.Generic Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance GHC.Generics.Generic Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance GHC.Show.Show Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Definitions.Errors.DeclarationWarning' instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationException instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Definitions.Errors.DeclarationException' module Agda.Syntax.Concrete.Definitions.Monad -- | Nicifier monad. Preserve the state when throwing an exception. newtype Nice a Nice :: ExceptT DeclarationException (State NiceEnv) a -> Nice a [unNice] :: Nice a -> ExceptT DeclarationException (State NiceEnv) a -- | Run a Nicifier computation, return result and warnings (in -- chronological order). runNice :: Nice a -> (Either DeclarationException a, NiceWarnings) -- | Nicifier state. data NiceEnv NiceEnv :: LoneSigs -> TerminationCheck -> PositivityCheck -> UniverseCheck -> Catchall -> CoverageCheck -> NiceWarnings -> NameId -> NiceEnv -- | Lone type signatures that wait for their definition. [_loneSigs] :: NiceEnv -> LoneSigs -- | Termination checking pragma waiting for a definition. [_termChk] :: NiceEnv -> TerminationCheck -- | Positivity checking pragma waiting for a definition. [_posChk] :: NiceEnv -> PositivityCheck -- | Universe checking pragma waiting for a data/rec signature or -- definition. [_uniChk] :: NiceEnv -> UniverseCheck -- | Catchall pragma waiting for a function clause. [_catchall] :: NiceEnv -> Catchall -- | Coverage pragma waiting for a definition. [_covChk] :: NiceEnv -> CoverageCheck -- | Stack of warnings. Head is last warning. [niceWarn] :: NiceEnv -> NiceWarnings -- | We distinguish different NoNames (anonymous definitions) by a -- unique NameId. [_nameId] :: NiceEnv -> 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 = -- | We retain the 'Name' also in the codomain since -- 'Name' as a key is up to @Eq Name@ which ignores the range. -- However, without range names are not unique in case the -- user gives a second definition of the same name. -- This causes then problems in 'replaceSigs' which might -- replace the wrong signature. -- -- Another reason is that we want to distinguish different -- occurrences of 'NoName' in a mutual block (issue #4157). -- The 'NoName' in the codomain will have a unique 'NameId'. Map Name LoneSig type NiceWarnings = -- | Stack of warnings. Head is last warning. [DeclarationWarning] -- | Initial nicifier state. initNiceEnv :: NiceEnv lensNameId :: Lens' NameId NiceEnv nextNameId :: Nice NameId -- | Lens for field _loneSigs. loneSigs :: Lens' LoneSigs NiceEnv -- | 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 -- | Ensure that all forward declarations have been given a definition. forgetLoneSigs :: Nice () checkLoneSigs :: LoneSigs -> Nice () -- | Get names of lone function signatures, plus their unique names. loneFuns :: LoneSigs -> [(Name, Name)] -- | Create a LoneSigs map from an association list. loneSigsFromLoneNames :: [(Range, Name, DataRecOrFun)] -> LoneSigs -- | Lens for field _termChk. terminationCheckPragma :: Lens' TerminationCheck NiceEnv withTerminationCheckPragma :: TerminationCheck -> Nice a -> Nice a coverageCheckPragma :: Lens' CoverageCheck NiceEnv withCoverageCheckPragma :: CoverageCheck -> Nice a -> Nice a -- | Lens for field _posChk. positivityCheckPragma :: Lens' PositivityCheck NiceEnv withPositivityCheckPragma :: PositivityCheck -> Nice a -> Nice a -- | Lens for field _uniChk. universeCheckPragma :: Lens' UniverseCheck NiceEnv withUniverseCheckPragma :: UniverseCheck -> Nice a -> Nice a -- | Get universe check pragma from a data/rec signature. Defaults to -- YesUniverseCheck. getUniverseCheckFromSig :: Name -> Nice UniverseCheck -- | Lens for field _catchall. catchallPragma :: Lens' Catchall NiceEnv -- | Get current catchall pragma, and reset it for the next clause. popCatchallPragma :: Nice Catchall 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 Control.Monad.Error.Class.MonadError Agda.Syntax.Concrete.Definitions.Errors.DeclarationException Agda.Syntax.Concrete.Definitions.Monad.Nice instance Control.Monad.State.Class.MonadState Agda.Syntax.Concrete.Definitions.Monad.NiceEnv Agda.Syntax.Concrete.Definitions.Monad.Nice instance GHC.Base.Monad Agda.Syntax.Concrete.Definitions.Monad.Nice instance GHC.Base.Applicative Agda.Syntax.Concrete.Definitions.Monad.Nice instance GHC.Base.Functor Agda.Syntax.Concrete.Definitions.Monad.Nice module Agda.Syntax.Concrete.Attribute -- | An attribute is a modifier for ArgInfo. data Attribute RelevanceAttribute :: Relevance -> Attribute QuantityAttribute :: Quantity -> Attribute TacticAttribute :: Expr -> Attribute CohesionAttribute :: Cohesion -> Attribute LockAttribute :: Lock -> Attribute -- | (Conjunctive constraint.) type LensAttribute a = (LensRelevance a, LensQuantity a, LensCohesion a, LensLock a) -- | Modifiers for Relevance. relevanceAttributeTable :: [(String, Relevance)] -- | Modifiers for Quantity. quantityAttributeTable :: [(String, Quantity)] cohesionAttributeTable :: [(String, Cohesion)] -- | Information about cohesion attributes (printed representations and -- positions). -- -- This information is returned by the parser. Code that calls the parser -- should, if appropriate, complain if support for cohesion attributes -- has not been enabled and the returned list is non-empty. This can be -- taken care of by checkCohesionAttributes, which should not be -- called until after pragma options have been set. type CohesionAttributes = [(String, Range)] -- | Modifiers for Quantity. lockAttributeTable :: [(String, Lock)] -- | 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 :: 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 Lock if unset. setPristineLock :: LensLock a => Lock -> 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 -> Maybe Expr relevanceAttributes :: [Attribute] -> [Attribute] quantityAttributes :: [Attribute] -> [Attribute] tacticAttributes :: [Attribute] -> [Attribute] instance GHC.Show.Show Agda.Syntax.Concrete.Attribute.Attribute instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Attribute.Attribute instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Attribute.Attribute instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Attribute.Attribute module Agda.Syntax.Parser.Monad -- | The parse 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] -> !CohesionAttributes -> 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] -- | Every encountered occurrence of a cohesion attribute. [parseCohesion] :: ParseState -> !CohesionAttributes -- | Parse errors: what you get if parsing fails. data ParseError -- | Errors that arise at a specific position in the file ParseError :: !SrcFile -> !PositionWithoutFile -> String -> String -> String -> ParseError -- | The file in which the error occurred. [errSrcFile] :: ParseError -> !SrcFile -- | Where the error occurred. [errPos] :: ParseError -> !PositionWithoutFile -- | 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' SrcFile -> ParseError -- | The range of the bigger overlapping token [errRange] :: ParseError -> !Range' SrcFile -- | 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 -- | Unsupported attribute. UnsupportedAttribute :: Range -> !Maybe String -> ParseWarning -- | Multiple attributes. MultipleAttributes :: Range -> !Maybe String -> 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 -- | 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 = Int32 -- | 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 () -- | 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.Show.Show Agda.Syntax.Parser.Monad.LayoutStatus instance GHC.Classes.Eq Agda.Syntax.Parser.Monad.LayoutStatus instance GHC.Show.Show Agda.Syntax.Parser.Monad.LayoutBlock instance GHC.Show.Show Agda.Syntax.Parser.Monad.ParseFlags instance GHC.Show.Show Agda.Syntax.Parser.Monad.ParseError instance GHC.Show.Show Agda.Syntax.Parser.Monad.ParseWarning instance GHC.Show.Show Agda.Syntax.Parser.Monad.ParseState instance Control.Monad.Error.Class.MonadError Agda.Syntax.Parser.Monad.ParseError Agda.Syntax.Parser.Monad.Parser instance Control.Monad.State.Class.MonadState Agda.Syntax.Parser.Monad.ParseState Agda.Syntax.Parser.Monad.Parser instance GHC.Base.Monad Agda.Syntax.Parser.Monad.Parser instance GHC.Base.Applicative Agda.Syntax.Parser.Monad.Parser instance GHC.Base.Functor Agda.Syntax.Parser.Monad.Parser instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Parser.Monad.ParseResult a) instance Control.DeepSeq.NFData Agda.Syntax.Parser.Monad.ParseWarning instance Agda.Utils.Pretty.Pretty Agda.Syntax.Parser.Monad.ParseWarning instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Monad.ParseWarning instance Agda.Utils.Pretty.Pretty Agda.Syntax.Parser.Monad.ParseError instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Monad.ParseError -- | 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 qualified Agda.Utils.Favorites -- 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 Agda.Utils.Singleton.Singleton a (Agda.Utils.Favorites.Favorites a) instance Agda.Utils.Null.Null (Agda.Utils.Favorites.Favorites a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.Favorites.Favorites a) instance Data.Foldable.Foldable Agda.Utils.Favorites.Favorites instance GHC.Classes.Ord a => GHC.Classes.Eq (Agda.Utils.Favorites.Favorites a) instance Agda.Utils.PartialOrd.PartialOrd a => GHC.Base.Semigroup (Agda.Utils.Favorites.Favorites a) instance Agda.Utils.PartialOrd.PartialOrd a => GHC.Base.Monoid (Agda.Utils.Favorites.Favorites a) -- | Additional functions for association lists. module Agda.Utils.AssocList -- | A finite map, represented as a set of pairs. -- -- Invariant: at most one value per key. type AssocList k v = [(k, v)] -- | Lookup keys in the same association list often. Use partially applied -- to create partial function apply m :: k -> Maybe v. -- --
-- >>> 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 -- | 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 = Map QName NameMapEntry type ModuleMap = Map 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 ... = --PatternBound :: BindingSource -- |
-- let ... in --LetBound :: BindingSource -- |
-- | ... in q --WithBound :: 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 :: [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' ModuleName ScopeInfo scopeModules :: Lens' (Map ModuleName Scope) ScopeInfo scopeVarsToBind :: Lens' LocalVars ScopeInfo scopeLocals :: Lens' LocalVars ScopeInfo scopePrecedence :: Lens' PrecedenceStack ScopeInfo scopeInverseName :: Lens' NameMap ScopeInfo scopeInverseModule :: Lens' ModuleMap ScopeInfo scopeInScope :: Lens' InScopeSet ScopeInfo scopeFixities :: Lens' Fixities ScopeInfo scopePolarities :: Lens' Polarities ScopeInfo scopeFixitiesAndPolarities :: Lens' (Fixities, Polarities) ScopeInfo -- | 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 -> ModulesInScope -> InScopeSet -> NameSpace -- | Maps concrete names to a list of abstract names. [nsNames] :: NameSpace -> NamesInScope -- | 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 [a] type NamesInScope = ThingsInScope AbstractName 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 :: forall a. InScope a => NameSpace -> ThingsInScope a -- | Non-dependent tag for name or module. data NameOrModule NameNotModule :: NameOrModule ModuleNotName :: NameOrModule -- | 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 isDefName :: KindOfName -> Bool 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 -- | 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 -- | 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 data NameMetadata NoMetadata :: NameMetadata GeneralizedVarsMetadata :: Map QName Name -> NameMetadata -- | 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 -- | Van Laarhoven lens on anameName. lensAnameName :: Lens' QName AbstractName -- | Van Laarhoven lens on amodName. lensAmodName :: Lens' ModuleName AbstractModule 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 :: Set 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 -- | The flat list of ambiguous names in AmbiguousNameReason. ambiguousNamesInReason :: AmbiguousNameReason -> List2 QName data WhyInScopeData WhyInScopeData :: QName -> FilePath -> Maybe LocalVar -> [AbstractName] -> [AbstractModule] -> 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) -> (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 -> 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) -> (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 -- | 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 -- | 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: -- --
-- 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)] -- | 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.Show.Show i => GHC.Show.Show (Agda.Termination.SparseMatrix.Size i) instance GHC.Classes.Ord i => GHC.Classes.Ord (Agda.Termination.SparseMatrix.Size i) instance GHC.Classes.Eq i => GHC.Classes.Eq (Agda.Termination.SparseMatrix.Size i) instance GHC.Ix.Ix i => GHC.Ix.Ix (Agda.Termination.SparseMatrix.MIx i) instance GHC.Show.Show i => GHC.Show.Show (Agda.Termination.SparseMatrix.MIx i) instance GHC.Classes.Ord i => GHC.Classes.Ord (Agda.Termination.SparseMatrix.MIx i) instance GHC.Classes.Eq i => GHC.Classes.Eq (Agda.Termination.SparseMatrix.MIx i) instance Data.Traversable.Traversable (Agda.Termination.SparseMatrix.Matrix i) instance Data.Foldable.Foldable (Agda.Termination.SparseMatrix.Matrix i) instance GHC.Base.Functor (Agda.Termination.SparseMatrix.Matrix i) instance (GHC.Classes.Ord i, GHC.Classes.Ord b) => GHC.Classes.Ord (Agda.Termination.SparseMatrix.Matrix i b) instance (GHC.Classes.Eq i, GHC.Classes.Eq b) => GHC.Classes.Eq (Agda.Termination.SparseMatrix.Matrix i b) instance Agda.Termination.SparseMatrix.Transpose (Agda.Termination.SparseMatrix.Size i) instance Agda.Termination.SparseMatrix.Transpose (Agda.Termination.SparseMatrix.MIx i) instance GHC.Classes.Ord i => Agda.Termination.SparseMatrix.Transpose (Agda.Termination.SparseMatrix.Matrix i b) instance (GHC.Real.Integral i, Agda.Termination.Semiring.HasZero b, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Agda.Termination.SparseMatrix.Matrix i b) instance (GHC.Real.Integral i, Agda.Termination.Semiring.HasZero b) => Agda.Termination.SparseMatrix.Diagonal (Agda.Termination.SparseMatrix.Matrix i b) b instance (GHC.Classes.Ord i, Agda.Utils.PartialOrd.PartialOrd a) => Agda.Utils.PartialOrd.PartialOrd (Agda.Termination.SparseMatrix.Matrix i a) instance (GHC.Real.Integral i, Agda.Termination.Semiring.HasZero b, GHC.Show.Show i, GHC.Show.Show b) => GHC.Show.Show (Agda.Termination.SparseMatrix.Matrix i b) -- | 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 -> {-# UNPACK #-} !Int -> Order -- | No relation, infinite increase, or increase beyond termination depth. Unknown :: Order -- | Matrix-shaped order, currently UNUSED. Mat :: {-# UNPACK #-} !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 -- | 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.Show.Show Agda.Termination.Order.Order instance GHC.Classes.Ord Agda.Termination.Order.Order instance GHC.Classes.Eq Agda.Termination.Order.Order instance Agda.Termination.Order.NotWorse Agda.Termination.Order.Order instance (GHC.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.Semiring.HasZero Agda.Termination.Order.Order instance Agda.Utils.PartialOrd.PartialOrd Agda.Termination.Order.Order instance Agda.Utils.Pretty.Pretty 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: -- --
-- 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) -- | 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 -- | Breaks up a string into substrings. Returns every maximal subsequence -- of zero or more characters distinct from .. -- --
-- splitOnDots "" == [""] -- splitOnDots "foo.bar" == ["foo", "bar"] -- splitOnDots ".foo.bar" == ["", "foo", "bar"] -- splitOnDots "foo.bar." == ["foo", "bar", ""] -- splitOnDots "foo..bar" == ["foo", "", "bar"] --splitOnDots :: String -> [String] instance GHC.Base.Functor Agda.Syntax.Parser.Parser.LamBinds' instance GHC.Show.Show Agda.Syntax.Parser.Parser.RHSOrTypeSigs instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Parser.Attr instance Agda.Syntax.Position.SetRange Agda.Syntax.Parser.Parser.Attr -- | 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 an identifier. Identifiers can be qualified (see Name). -- Example: Foo.Bar.f identifier :: 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. -- --
-- 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) -> Bool -> Maybe Bool -> Maybe Bool -> 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 -> Bool -- | Pattern matching of this clause is exact, no catch-all case. Computed -- by the coverage checker. Nothing means coverage checker has -- not run yet (clause may be inexact). Just False means clause -- is not exact. Just True means clause is exact. [clauseExact] :: Clause -> Maybe Bool -- | clauseBody contains recursive calls; computed by termination -- checker. Nothing means that termination checker has not run -- yet, or that clauseBody contains meta-variables; these could -- be filled with recursive calls later! Just False means -- definitely no recursive call. Just True means definitely a -- recursive call. [clauseRecursive] :: Clause -> Maybe Bool -- | 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 type Telescope = Tele (Dom Type) -- | 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. -- --
-- 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 :: PatternInfo -> 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 type NotBlocked = NotBlocked' Term type NamedArgs = [NamedArg Term] -- | 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 -> [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 -- | 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] class LensConName a getConName :: LensConName a => a -> QName setConName :: LensConName a => QName -> a -> a mapConName :: LensConName a => (QName -> QName) -> a -> a type ConInfo = ConOrigin -- | 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 -- | Sorts. data Sort' t -- | Set ℓ. Type :: Level' t -> Sort' t -- | Prop ℓ. Prop :: Level' t -> Sort' t -- | Setωᵢ. Inf :: IsFibrant -> !Integer -> Sort' t -- | SSet ℓ. SSet :: Level' t -> Sort' t -- | SizeUniv, a sort inhabited by type Size. SizeUniv :: Sort' t -- | LockUniv, a sort for locks. LockUniv :: Sort' t -- | IntervalUniv, a sort inhabited by the cubical interval. IntervalUniv :: Sort' t -- | Sort of the pi type. 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. UnivSort :: Sort' t -> Sort' t MetaS :: {-# UNPACK #-} !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 type Type' a = Type'' Term a -- | 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 data IsFibrant IsFibrant :: IsFibrant IsStrict :: IsFibrant -- | 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 data PlusLevel' t Plus :: !Integer -> t -> PlusLevel' t type PlusLevel = PlusLevel' Term type LevelAtom = Term -- | Newtypes for terms that produce a dummy, rather than crash, when -- applied to incompatible eliminations. newtype BraveTerm BraveTerm :: Term -> BraveTerm [unBrave] :: BraveTerm -> Term -- | 'Blocked a without the a. type Blocked_ = Blocked () -- | Named pattern arguments. type NAPs = [NamedArg DeBruijnPattern] type DeBruijnPattern = Pattern' DBPatVar -- | Pattern variables. type PatVarName = ArgName data PatternInfo PatternInfo :: PatOrigin -> [Name] -> PatternInfo [patOrigin] :: PatternInfo -> PatOrigin [patAsNames] :: PatternInfo -> [Name] -- | 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 -- | 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 -- | 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 -> 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 -- | Type used when numbering pattern variables. data DBPatVar DBPatVar :: PatVarName -> !Int -> DBPatVar [dbPatVarName] :: DBPatVar -> PatVarName [dbPatVarIndex] :: DBPatVar -> !Int -- | 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 PatternSubstitution = Substitution' DeBruijnPattern -- | View type as equality type. data EqualityView EqualityViewType :: EqualityTypeData -> EqualityView -- | reduced OtherType :: Type -> EqualityView -- | reduced IdiomType :: Type -> EqualityView data EqualityTypeData EqualityTypeData :: Sort -> QName -> Args -> Arg Term -> Arg Term -> Arg Term -> EqualityTypeData -- | 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 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 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 type DummyTermKind = String -- | Telescope as list. type ListTel' a = [Dom (a, Type)] type ListTel = ListTel' ArgName -- | Drop the types from a telescope. class TelToArgs a telToArgs :: TelToArgs a => a -> [Arg ArgName] -- | Constructing a singleton telescope. class SgTel a sgTel :: SgTel a => a -> Telescope -- | Suggest a name if available (i.e. name is not "_") class Suggest a suggestName :: Suggest a => a -> Maybe String data Suggestion Suggestion :: a -> Suggestion pattern EqualityType :: Sort -> QName -> Args -> Arg Term -> Arg Term -> Arg Term -> EqualityView -- | Constant level n pattern ClosedLevel :: Integer -> Level litP :: Literal -> Pattern' a varP :: a -> Pattern' a -- | Convert a telescope to its list form. telToList :: Tele (Dom t) -> [Dom (ArgName, t)] -- | Doesn't do any reduction. arity :: Type -> Nat -- | Add DontCare is it is not already a DontCare. dontCare :: Term -> Term -- | An unapplied variable. var :: Nat -> Term argFromDom :: Dom' t a -> Arg a namedArgFromDom :: Dom' t a -> NamedArg a domFromArg :: Arg a -> Dom a domFromNamedArg :: NamedArg a -> Dom a defaultDom :: a -> Dom a defaultArgDom :: ArgInfo -> a -> Dom a defaultNamedArgDom :: ArgInfo -> String -> a -> Dom a clausePats :: Clause -> [Arg DeBruijnPattern] patVarNameToString :: PatVarName -> String nameToPatVarName :: Name -> PatVarName defaultPatternInfo :: PatternInfo dotP :: Term -> Pattern' a namedVarP :: PatVarName -> Named_ Pattern namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern -- | Make an absurd pattern with the given de Bruijn index. absurdP :: Int -> DeBruijnPattern absurdPatternName :: PatVarName noConPatternInfo :: ConPatternInfo -- | Build partial ConPatternInfo from ConInfo toConPatternInfo :: ConInfo -> ConPatternInfo -- | Build ConInfo from ConPatternInfo. fromConPatternInfo :: ConPatternInfo -> ConInfo -- | Retrieve the PatternInfo from a pattern patternInfo :: Pattern' x -> Maybe PatternInfo -- | Retrieve the origin of a pattern patternOrigin :: Pattern' x -> Maybe PatOrigin -- | Does the pattern perform a match that could fail? properlyMatching :: Pattern' a -> Bool properlyMatching' :: Bool -> Bool -> Pattern' a -> Bool eqtSort :: EqualityView -> Sort eqtName :: EqualityView -> QName eqtParams :: EqualityView -> Args eqtType :: EqualityView -> Arg Term eqtLhs :: EqualityView -> Arg Term eqtRhs :: EqualityView -> Arg Term isEqualityType :: EqualityView -> Bool isPathType :: PathView -> Bool isIOne :: IntervalView -> Bool -- | Absurd lambdas are internally represented as identity with variable -- name "()". absurdBody :: Abs Term isAbsurdBody :: Abs Term -> Bool isAbsurdPatternName :: PatVarName -> Bool -- | Construct a string representing the call-site that created the dummy -- thing. dummyLocName :: CallStack -> String -- | Aux: A dummy term to constitute a dummy termlevelsort/type. dummyTermWith :: DummyTermKind -> CallStack -> Term -- | A dummy level to constitute a level/sort created at location. Note: -- use macro DUMMY_LEVEL ! dummyLevel :: CallStack -> Level atomicLevel :: t -> Level' t -- | A dummy term created at location. Note: use macro DUMMY_TERM ! dummyTerm :: CallStack -> Term __DUMMY_TERM__ :: HasCallStack => Term __DUMMY_LEVEL__ :: HasCallStack => Level -- | A dummy sort created at location. Note: use macro DUMMY_SORT ! dummySort :: CallStack -> Sort __DUMMY_SORT__ :: HasCallStack => Sort -- | A dummy type created at location. Note: use macro DUMMY_TYPE ! dummyType :: CallStack -> Type __DUMMY_TYPE__ :: HasCallStack => Type -- | Context entries without a type have this dummy type. Note: use macro -- DUMMY_DOM ! dummyDom :: CallStack -> Dom Type __DUMMY_DOM__ :: HasCallStack => Dom Type varSort :: Int -> Sort tmSort :: Term -> Sort tmSSort :: Term -> Sort -- | Given a constant m and level l, compute m + -- l levelPlus :: Integer -> Level -> Level levelSuc :: Level -> Level mkType :: Integer -> Sort mkProp :: Integer -> Sort mkSSet :: Integer -> Sort isSort :: Term -> Maybe Sort impossibleTerm :: CallStack -> Term -- | A traversal for the names in a telescope. mapAbsNamesM :: Applicative m => (ArgName -> m ArgName) -> Tele a -> m (Tele a) mapAbsNames :: (ArgName -> ArgName) -> Tele a -> Tele a replaceEmptyName :: ArgName -> Tele a -> Tele a telFromList' :: (a -> ArgName) -> ListTel' a -> Telescope -- | Convert a list telescope to a telescope. telFromList :: ListTel -> Telescope -- | Lens to edit a Telescope as a list. listTel :: Lens' ListTel Telescope -- | Removing a topmost DontCare constructor. stripDontCare :: Term -> Term suggests :: [Suggestion] -> String -- | 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 -> Bool) -> Term -> Term -- | A view distinguishing the neutrals Var, Def, and -- MetaV which can be projected. hasElims :: Term -> Maybe (Elims -> Term, Elims) pDom :: LensHiding a => a -> Doc -> Doc prettyPrecLevelSucs :: Int -> Integer -> (Int -> Doc) -> Doc -- | Meta-variable identifiers use the same structure as NameIds. data MetaId MetaId :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !ModuleNameHash -> MetaId [metaId] :: MetaId -> {-# UNPACK #-} !Word64 [metaModule] :: MetaId -> {-# UNPACK #-} !ModuleNameHash -- | A "problem" consists of a set of constraints and the same constraint -- can be part of multiple problems. newtype ProblemId ProblemId :: Nat -> ProblemId instance Data.Traversable.Traversable (Agda.Syntax.Internal.Dom' t) instance Data.Foldable.Foldable (Agda.Syntax.Internal.Dom' t) instance GHC.Base.Functor (Agda.Syntax.Internal.Dom' t) instance (GHC.Show.Show t, GHC.Show.Show e) => GHC.Show.Show (Agda.Syntax.Internal.Dom' t e) instance GHC.Generics.Generic Agda.Syntax.Internal.DataOrRecord instance GHC.Classes.Eq Agda.Syntax.Internal.DataOrRecord instance GHC.Show.Show Agda.Syntax.Internal.DataOrRecord instance GHC.Generics.Generic Agda.Syntax.Internal.ConHead instance GHC.Show.Show Agda.Syntax.Internal.ConHead instance GHC.Generics.Generic (Agda.Syntax.Internal.Abs a) instance Data.Traversable.Traversable Agda.Syntax.Internal.Abs instance Data.Foldable.Foldable Agda.Syntax.Internal.Abs instance GHC.Base.Functor Agda.Syntax.Internal.Abs instance GHC.Generics.Generic (Agda.Syntax.Internal.Tele a) instance Data.Traversable.Traversable Agda.Syntax.Internal.Tele instance Data.Foldable.Foldable Agda.Syntax.Internal.Tele instance GHC.Base.Functor Agda.Syntax.Internal.Tele instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Internal.Tele a) instance GHC.Generics.Generic Agda.Syntax.Internal.IsFibrant instance GHC.Classes.Ord Agda.Syntax.Internal.IsFibrant instance GHC.Classes.Eq Agda.Syntax.Internal.IsFibrant instance GHC.Show.Show Agda.Syntax.Internal.IsFibrant instance Data.Traversable.Traversable Agda.Syntax.Internal.PlusLevel' instance Data.Foldable.Foldable Agda.Syntax.Internal.PlusLevel' instance GHC.Base.Functor Agda.Syntax.Internal.PlusLevel' instance GHC.Show.Show t => GHC.Show.Show (Agda.Syntax.Internal.PlusLevel' t) instance Data.Traversable.Traversable Agda.Syntax.Internal.Level' instance Data.Foldable.Foldable Agda.Syntax.Internal.Level' instance GHC.Base.Functor Agda.Syntax.Internal.Level' instance GHC.Show.Show t => GHC.Show.Show (Agda.Syntax.Internal.Level' t) instance GHC.Show.Show t => GHC.Show.Show (Agda.Syntax.Internal.Sort' t) instance Data.Traversable.Traversable (Agda.Syntax.Internal.Type'' t) instance Data.Foldable.Foldable (Agda.Syntax.Internal.Type'' t) instance GHC.Base.Functor (Agda.Syntax.Internal.Type'' t) instance (GHC.Show.Show t, GHC.Show.Show a) => GHC.Show.Show (Agda.Syntax.Internal.Type'' t a) instance GHC.Show.Show Agda.Syntax.Internal.Term instance GHC.Show.Show Agda.Syntax.Internal.BraveTerm instance GHC.Generics.Generic Agda.Syntax.Internal.PatOrigin instance GHC.Classes.Eq Agda.Syntax.Internal.PatOrigin instance GHC.Show.Show Agda.Syntax.Internal.PatOrigin instance GHC.Generics.Generic Agda.Syntax.Internal.PatternInfo instance GHC.Classes.Eq Agda.Syntax.Internal.PatternInfo instance GHC.Show.Show Agda.Syntax.Internal.PatternInfo instance GHC.Generics.Generic Agda.Syntax.Internal.DBPatVar instance GHC.Classes.Eq Agda.Syntax.Internal.DBPatVar instance GHC.Show.Show Agda.Syntax.Internal.DBPatVar instance GHC.Generics.Generic Agda.Syntax.Internal.ConPatternInfo instance GHC.Show.Show Agda.Syntax.Internal.ConPatternInfo instance GHC.Generics.Generic (Agda.Syntax.Internal.Pattern' x) instance Data.Traversable.Traversable Agda.Syntax.Internal.Pattern' instance Data.Foldable.Foldable Agda.Syntax.Internal.Pattern' instance GHC.Base.Functor Agda.Syntax.Internal.Pattern' instance GHC.Show.Show x => GHC.Show.Show (Agda.Syntax.Internal.Pattern' x) instance GHC.Generics.Generic Agda.Syntax.Internal.Clause instance GHC.Show.Show Agda.Syntax.Internal.Clause instance GHC.Generics.Generic (Agda.Syntax.Internal.Substitution' a) instance Data.Traversable.Traversable Agda.Syntax.Internal.Substitution' instance Data.Foldable.Foldable Agda.Syntax.Internal.Substitution' instance GHC.Base.Functor Agda.Syntax.Internal.Substitution' instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Internal.Substitution' a) instance GHC.Show.Show Agda.Syntax.Internal.IntervalView instance (Data.Foldable.Foldable t, Agda.Syntax.Internal.TermSize a) => Agda.Syntax.Internal.TermSize (t a) instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.TermSize Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.TermSize a => Agda.Syntax.Internal.TermSize (Agda.Syntax.Internal.Substitution' a) instance Agda.Syntax.Internal.Suggest GHC.Base.String instance Agda.Syntax.Internal.Suggest (Agda.Syntax.Internal.Abs b) instance Agda.Syntax.Internal.Suggest Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Internal.Suggest Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Common.ArgName, Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) 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.TelToArgs Agda.Syntax.Internal.ListTel instance Agda.Syntax.Internal.TelToArgs Agda.Syntax.Internal.Telescope instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Substitution instance Agda.Utils.Null.Null (Agda.Syntax.Internal.Substitution' a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Substitution' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Substitution' a) 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.Position.HasRange Agda.Syntax.Internal.Clause instance Agda.Utils.Null.Null Agda.Syntax.Internal.Clause instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Clause instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Clause instance Control.DeepSeq.NFData Agda.Syntax.Internal.Clause instance Agda.Syntax.Abstract.Name.IsProjP (Agda.Syntax.Internal.Pattern' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Pattern' a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Pattern' a) instance Control.DeepSeq.NFData x => Control.DeepSeq.NFData (Agda.Syntax.Internal.Pattern' x) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.ConPatternInfo instance Control.DeepSeq.NFData Agda.Syntax.Internal.ConPatternInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.DBPatVar instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.DBPatVar instance Control.DeepSeq.NFData Agda.Syntax.Internal.DBPatVar instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PatternInfo instance Control.DeepSeq.NFData Agda.Syntax.Internal.PatternInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PatOrigin instance Control.DeepSeq.NFData Agda.Syntax.Internal.PatOrigin instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Blocked a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Blocked a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PlusLevel instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.PlusLevel instance Control.DeepSeq.NFData Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.LensSort Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.LensSort (Agda.Syntax.Internal.Type' a) instance Agda.Syntax.Internal.LensSort a => Agda.Syntax.Internal.LensSort (Agda.Syntax.Internal.Dom a) instance Agda.Syntax.Internal.LensSort a => Agda.Syntax.Internal.LensSort (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Term instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Level instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Type' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Sort instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Term instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Tele (Agda.Syntax.Internal.Dom a)) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Level instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Sort instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Type instance Control.DeepSeq.NFData Agda.Syntax.Internal.Term instance Control.DeepSeq.NFData Agda.Syntax.Internal.Type instance Control.DeepSeq.NFData Agda.Syntax.Internal.Sort instance Control.DeepSeq.NFData Agda.Syntax.Internal.Level instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Internal.Dom e) instance Agda.Utils.Functor.Decoration (Agda.Syntax.Internal.Type'' t) instance Control.DeepSeq.NFData Agda.Syntax.Internal.IsFibrant instance Agda.Utils.Null.Null (Agda.Syntax.Internal.Tele a) instance Agda.Utils.Size.Sized (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Tele a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Tele a) instance Agda.Utils.Functor.Decoration Agda.Syntax.Internal.Abs instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Internal.Abs a) instance Agda.Utils.Size.Sized a => Agda.Utils.Size.Sized (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Abs a) instance Agda.Utils.Pretty.Pretty t => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Abs t) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Position.SetRange Agda.Syntax.Internal.ConHead instance Agda.Syntax.Internal.LensConName Agda.Syntax.Internal.ConHead instance GHC.Classes.Eq Agda.Syntax.Internal.ConHead instance GHC.Classes.Ord Agda.Syntax.Internal.ConHead instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.ConHead instance Agda.Syntax.Position.HasRange Agda.Syntax.Internal.ConHead instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.ConHead instance Control.DeepSeq.NFData Agda.Syntax.Internal.ConHead instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.DataOrRecord instance Control.DeepSeq.NFData Agda.Syntax.Internal.DataOrRecord instance Agda.Utils.Functor.Decoration (Agda.Syntax.Internal.Dom' t) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Internal.Dom' t a) instance (Agda.Syntax.Position.KillRange t, Agda.Syntax.Position.KillRange a) => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Dom' t a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Internal.Dom' t a) instance Agda.Syntax.Common.LensNamed (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensArgInfo (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensModality (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensFreeVariables (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensAnnotation (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensRelevance (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensQuantity (Agda.Syntax.Internal.Dom' t e) instance Agda.Syntax.Common.LensCohesion (Agda.Syntax.Internal.Dom' t e) instance (Agda.Utils.Pretty.Pretty t, Agda.Utils.Pretty.Pretty e) => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Dom' t e) 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.Term instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.Level instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn a => Agda.TypeChecking.Substitute.DeBruijn.DeBruijn (Agda.Syntax.Common.Named_ a) -- | 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 -> IntSet precomputeFreeVars_ :: PrecomputeFreeVars a => a -> 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.Abs a) instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Term instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Level instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars Agda.Syntax.Internal.Type instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.Syntax.Internal.Elim.Elim' a) 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.Maybe.Maybe a) instance (Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a, Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars b) => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (a, b) -- | Computing the free variables of a term lazily. -- -- We implement a reduce (traversal into monoid) over internal syntax for -- a generic collection (monoid with singletons). This should allow a -- more efficient test for the presence of a particular variable. -- -- Worst-case complexity does not change (i.e. the case when a variable -- does not occur), but best case-complexity does matter. For instance, -- see mkAbs: each time we construct a dependent function type, we -- check whether it is actually dependent. -- -- 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)) -- --
-- Γ ⊢ ρ : Δ, Ψ -- ------------------- -- Γ ⊢ 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 (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 -- | underAbs k a b applies k to a and the -- content of abstraction b and puts the abstraction back. -- a is raised if abstraction was proper such that at point of -- application of k and the content of b are at the -- same context. Precondition: a and b are at the same -- context at call time. underAbs :: Subst a => (a -> b -> b) -> a -> Abs b -> Abs b -- | underLambdas n k a b drops n initial Lams -- from b, performs operation k on a and the -- body of b, and puts the Lams back. a is -- raised correctly according to the number of abstractions. underLambdas :: TermSubst a => Int -> (a -> Term -> Term) -> a -> Term -> Term instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Abstract.Name.QName 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.Show.Show a => GHC.Show.Show (Agda.Syntax.Reflected.Elim' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Reflected.Abs a) instance GHC.Show.Show Agda.Syntax.Reflected.Sort instance GHC.Show.Show Agda.Syntax.Reflected.Term instance GHC.Show.Show Agda.Syntax.Reflected.Pattern instance GHC.Show.Show Agda.Syntax.Reflected.Clause instance GHC.Show.Show Agda.Syntax.Reflected.Definition 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 -- | 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 labelPatVars :: (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, 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 mapNamedArgPattern :: (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 -- | Fold pattern. foldrPattern :: (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 -- | Traverse pattern. traversePatternM :: (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 countPatternVars :: (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.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 a => Agda.Syntax.Internal.Pattern.PatternVarModalities (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Pattern.PatternVarModalities (Agda.Syntax.Internal.Pattern' x) 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.Arg 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.PatternLike a (Agda.Syntax.Internal.Pattern' a) 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.Arg 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.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.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 (Agda.Syntax.Common.Named x a) (Agda.Syntax.Common.Named x b) instance Agda.Syntax.Internal.Pattern.LabelPatVars a b => Agda.Syntax.Internal.Pattern.LabelPatVars [a] [b] instance Agda.Syntax.Internal.Pattern.LabelPatVars Agda.Syntax.Internal.Pattern Agda.Syntax.Internal.DeBruijnPattern 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.FunArity [Agda.Syntax.Internal.Clause] -- | 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 -- | Generic traversal with post-traversal action. Ignores sorts. traverseTermM :: (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 -- | Generic fold, ignoring sorts. foldTerm :: (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 GHC.Types.Bool instance Agda.Syntax.Internal.Generic.TermLike GHC.Types.Int instance Agda.Syntax.Internal.Generic.TermLike GHC.Num.Integer.Integer instance Agda.Syntax.Internal.Generic.TermLike GHC.Types.Char instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Elim.Elim' 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.Dom a) 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.Maybe.Maybe a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Internal.Blocked 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.Internal.Tele a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.Syntax.Common.WithHiding a) 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 Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Type instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.EqualityView -- | 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 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 -- | 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 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. Done :: [Arg ArgName] -> 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 type CompiledClauses = CompiledClauses' Term 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 prettyMap_ :: (Pretty k, Pretty v) => Map k v -> [Doc] instance GHC.Generics.Generic (Agda.TypeChecking.CompiledClause.WithArity c) instance GHC.Show.Show c => GHC.Show.Show (Agda.TypeChecking.CompiledClause.WithArity c) instance Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.WithArity instance Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.WithArity instance GHC.Base.Functor Agda.TypeChecking.CompiledClause.WithArity instance GHC.Generics.Generic (Agda.TypeChecking.CompiledClause.Case c) instance GHC.Show.Show c => GHC.Show.Show (Agda.TypeChecking.CompiledClause.Case c) instance Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.Case instance Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.Case instance GHC.Base.Functor Agda.TypeChecking.CompiledClause.Case instance GHC.Generics.Generic (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance Data.Foldable.Foldable Agda.TypeChecking.CompiledClause.CompiledClauses' instance Data.Traversable.Traversable Agda.TypeChecking.CompiledClause.CompiledClauses' instance GHC.Base.Functor Agda.TypeChecking.CompiledClause.CompiledClauses' instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.Syntax.Position.KillRange Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.CompiledClauses' a) instance GHC.Base.Semigroup m => GHC.Base.Semigroup (Agda.TypeChecking.CompiledClause.Case m) instance (GHC.Base.Semigroup m, GHC.Base.Monoid m) => GHC.Base.Monoid (Agda.TypeChecking.CompiledClause.Case m) instance Agda.Utils.Null.Null (Agda.TypeChecking.CompiledClause.Case m) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.CompiledClause.Case a) instance Agda.Syntax.Position.KillRange c => Agda.Syntax.Position.KillRange (Agda.TypeChecking.CompiledClause.Case c) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.Case a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.Case a) instance GHC.Base.Semigroup c => GHC.Base.Semigroup (Agda.TypeChecking.CompiledClause.WithArity c) instance (GHC.Base.Semigroup c, GHC.Base.Monoid c) => GHC.Base.Monoid (Agda.TypeChecking.CompiledClause.WithArity c) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.CompiledClause.WithArity a) instance Agda.Syntax.Position.KillRange c => Agda.Syntax.Position.KillRange (Agda.TypeChecking.CompiledClause.WithArity c) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.Generic.TermLike (Agda.TypeChecking.CompiledClause.WithArity a) instance Control.DeepSeq.NFData c => Control.DeepSeq.NFData (Agda.TypeChecking.CompiledClause.WithArity c) 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 allMetas :: (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 Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.Type instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.Elim.Elim' a) instance Agda.Syntax.Internal.Generic.TermLike a => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Internal.Tele a) instance (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.MetaVars.AllMetas Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.MetaVars.AllMetas Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.MetaVars.AllMetas GHC.Base.String 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.MetaVars.AllMetas a => Agda.Syntax.Internal.MetaVars.AllMetas [a] instance Agda.Syntax.Internal.MetaVars.AllMetas a => Agda.Syntax.Internal.MetaVars.AllMetas (GHC.Maybe.Maybe a) instance Agda.Syntax.Internal.MetaVars.AllMetas a => Agda.Syntax.Internal.MetaVars.AllMetas (Agda.Syntax.Common.Arg a) -- | Extract used definitions from terms. module Agda.Syntax.Internal.Defs -- | 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 [QName] or Set -- QName. Note that emb can also choose to discard a used -- definition by mapping to the unit of the monoid. getDefs' :: (GetDefs a, Monoid b) => (MetaId -> Maybe Term) -> (QName -> b) -> a -> b -- | Inputs to and outputs of getDefs' are organized as a monad. type GetDefsM b = ReaderT (GetDefsEnv b) (Writer b) data GetDefsEnv b GetDefsEnv :: (MetaId -> Maybe Term) -> (QName -> b) -> GetDefsEnv b [lookupMeta] :: GetDefsEnv b -> MetaId -> Maybe Term [embDef] :: GetDefsEnv b -> QName -> b -- | What it takes to get the used definitions. class Monad m => MonadGetDefs m doDef :: MonadGetDefs m => QName -> m () doMeta :: MonadGetDefs m => MetaId -> m () -- | 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 :: (GetDefs a, MonadGetDefs m) => a -> m () getDefs :: (GetDefs a, MonadGetDefs m, Foldable f, GetDefs b, f b ~ a) => a -> m () instance GHC.Base.Monoid b => Agda.Syntax.Internal.Defs.MonadGetDefs (Agda.Syntax.Internal.Defs.GetDefsM b) instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Clause instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Common.MetaId instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Type instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.Defs.GetDefs Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (GHC.Maybe.Maybe a) instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs [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 a => Agda.Syntax.Internal.Defs.GetDefs (Agda.Syntax.Common.Arg a) 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.Abs a) 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.Telescope instance Agda.Syntax.Internal.Defs.GetDefs GHC.Base.String -- | 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 -- | Types are just expressions. Use this type synonym for hinting that an -- expression should be a type. type Type = Expr type Constructor = TypeSignature type Clause = Clause' LHS 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 :: RString -> QName -> String -> Pragma StaticPragma :: QName -> Pragma -- | For coinductive records, use pragma instead of regular -- eta-equality definition (as it is might make Agda loop). EtaPragma :: QName -> Pragma InjectivePragma :: QName -> Pragma InlinePragma :: Bool -> QName -> Pragma NotProjectionLikePragma :: QName -> Pragma DisplayPragma :: QName -> [NamedArg Pattern] -> Expr -> Pragma type Telescope = [TypedBinding] type Pattern = Pattern' Expr -- | Record field assignment f = e. type Assign = FieldAssignment' 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 -> [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 :: Set 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. Rec :: ExprInfo -> RecordAssigns -> Expr -- | Record update. RecUpdate :: ExprInfo -> Expr -> Assigns -> Expr -- | Scope annotation. ScopedExpr :: ScopeInfo -> Expr -> Expr -- | Quote an identifier QName. Quote :: ExprInfo -> Expr -- | Quote a term. QuoteTerm :: ExprInfo -> Expr -- | The splicing construct: unquote ... Unquote :: ExprInfo -> Expr -- | For printing DontCare from Syntax.Internal. DontCare :: Expr -> Expr -- | 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 data Binder' a Binder :: Maybe Pattern -> a -> Binder' a [binderPattern] :: Binder' a -> Maybe Pattern [binderName] :: Binder' a -> a type Binder = Binder' BindName -- | 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 :: TacticAttr -> NamedArg Binder -> LamBinding -- | . (xs:e) or {xs:e} or (let Ds) DomainFull :: TypedBinding -> LamBinding -- | 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: -- --
-- M {{...}} --RecordModuleInstance :: ModuleName -> ModuleApplication -- | Only Axioms. type TypeSignature = Declaration type ImportDirective = ImportDirective' QName ModuleName type ImportedName = ImportedName' QName ModuleName type Renaming = Renaming' QName ModuleName type RewriteEqn = RewriteEqn' QName BindName Pattern Expr type WithExpr = WithExpr' Expr type LHSCore = LHSCore' Expr 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 -> [WithExpr] -> [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 type HoleContent = HoleContent' () BindName Pattern Expr data ScopeCopyInfo ScopeCopyInfo :: Ren ModuleName -> Ren QName -> ScopeCopyInfo [renModules] :: ScopeCopyInfo -> Ren ModuleName [renNames] :: ScopeCopyInfo -> Ren QName type Args = [NamedArg Expr] -- | Renaming (generic). type Ren a = Map a (List1 a) type PatternSynDefn = ([Arg Name], Pattern' Void) type PatternSynDefns = Map QName PatternSynDefn -- | 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 -- | 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 :: TacticAttr -> Bool -> TypedBindingInfo -- | Does this binding have a tactic annotation? [tbTacticAttr] :: TypedBindingInfo -> TacticAttr -- | 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 type Field = TypeSignature -- | 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 :: PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e EqualP :: PatInfo -> [(e, e)] -> Pattern' e -- | | p, for with-patterns. WithP :: PatInfo -> Pattern' e -> Pattern' e -- | Pattern with type annotation AnnP :: PatInfo -> e -> Pattern' e -> Pattern' e type DefInfo = DefInfo' Expr type NAPs e = [NamedArg (Pattern' e)] -- | 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 -- | Bindings that are valid in a let. data LetBinding -- |
-- LetBind info rel name type defn --LetBind :: LetInfo -> ArgInfo -> BindName -> Type -> Expr -> LetBinding -- | Irrefutable pattern binding. LetPatBind :: LetInfo -> Pattern -> Expr -> LetBinding -- | LetApply mi newM (oldM args) renamings dir. The -- ImportDirective is for highlighting purposes. LetApply :: ModuleInfo -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> ImportDirective -> LetBinding -- | only for highlighting and abstractToConcrete LetOpen :: ModuleInfo -> ModuleName -> ImportDirective -> LetBinding -- | Only used for highlighting. Refers to the first occurrence of -- x in let x : A; x = e. LetDeclaredVariable :: BindName -> LetBinding type RecordAssigns = [RecordAssign] type Assigns = [Assign] type RecordAssign = Either Assign ModuleName 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 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] type TacticAttr = Maybe Expr -- | 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 -> Bool -> 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 -> 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 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] type WithExpr' e = Named BindName (Arg e) -- | 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 -> [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 -> [Arg (Pattern' e)] -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] type NAPs1 e = List1 (NamedArg (Pattern' e)) type Patterns = [NamedArg Pattern] -- | Are we in an abstract block? -- -- In that case some definition is abstract. class AnyAbstract a anyAbstract :: AnyAbstract a => a -> Bool -- | Turn a name into an expression. class NameToExpr a nameToExpr :: NameToExpr a => a -> Expr class SubstExpr a substExpr :: SubstExpr a => [(Name, Expr)] -> a -> a substExpr :: (SubstExpr a, Functor t, SubstExpr b, t b ~ a) => [(Name, Expr)] -> a -> a -- | 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 :: [DeclarationSpine] -> DeclarationSpine SectionS :: [DeclarationSpine] -> DeclarationSpine ApplyS :: DeclarationSpine ImportS :: DeclarationSpine PragmaS :: DeclarationSpine OpenS :: DeclarationSpine FunDefS :: [ClauseSpine] -> DeclarationSpine DataSigS :: DeclarationSpine DataDefS :: DeclarationSpine RecSigS :: DeclarationSpine RecDefS :: [DeclarationSpine] -> DeclarationSpine PatternSynDefS :: DeclarationSpine UnquoteDeclS :: DeclarationSpine UnquoteDefS :: DeclarationSpine UnquoteDataS :: DeclarationSpine ScopedDeclS :: [DeclarationSpine] -> DeclarationSpine -- | Clause spines. data ClauseSpine ClauseS :: RHSSpine -> WhereDeclarationsSpine -> ClauseSpine -- | Right-hand side spines. data RHSSpine RHSS :: RHSSpine AbsurdRHSS :: RHSSpine WithRHSS :: [ClauseSpine] -> RHSSpine RewriteRHSS :: RHSSpine -> WhereDeclarationsSpine -> RHSSpine -- | Spines corresponding to WhereDeclarations values. data WhereDeclarationsSpine WhereDeclsS :: Maybe DeclarationSpine -> WhereDeclarationsSpine -- | Pattern synonym for regular Def. pattern Def :: QName -> Expr app :: Expr -> [NamedArg Expr] -> Expr mkBinder_ :: Name -> Binder mkBinder :: a -> Binder' a mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding mkBindName :: Name -> BindName -- | Smart constructor for Generalized. generalized :: Set QName -> Type -> Type initCopyInfo :: ScopeCopyInfo extractPattern :: Binder' a -> Maybe (Pattern, a) mkDomainFree :: NamedArg Binder -> LamBinding defaultTbInfo :: TypedBindingInfo mkTBind :: Range -> List1 (NamedArg Binder) -> Type -> TypedBinding mkPi :: ExprInfo -> Telescope -> Type -> Type noDataDefParams :: DataDefParams noWhereDecls :: WhereDeclarations -- | The name defined by the given axiom. -- -- Precondition: The declaration has to be a (scoped) Axiom. axiomName :: Declaration -> QName patternToExpr :: Pattern -> Expr lambdaLiftExpr :: [Name] -> Expr -> Expr insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name]) -- | The declaration spine corresponding to a declaration. declarationSpine :: Declaration -> DeclarationSpine -- | The clause spine corresponding to a clause. clauseSpine :: Clause -> ClauseSpine -- | The right-hand side spine corresponding to a right-hand side. rhsSpine :: RHS -> RHSSpine -- | The spine corresponding to a WhereDeclarations value. whereDeclarationsSpine :: WhereDeclarations -> WhereDeclarationsSpine instance Control.DeepSeq.NFData Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.SetRange Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.BindName instance GHC.Show.Show Agda.Syntax.Abstract.BindName instance GHC.Generics.Generic Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Show.Show Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Classes.Eq Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Generics.Generic (Agda.Syntax.Abstract.Pattern' e) instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Abstract.Pattern' e) instance Data.Traversable.Traversable Agda.Syntax.Abstract.Pattern' instance Data.Foldable.Foldable Agda.Syntax.Abstract.Pattern' instance GHC.Base.Functor Agda.Syntax.Abstract.Pattern' instance GHC.Show.Show e => GHC.Show.Show (Agda.Syntax.Abstract.Pattern' e) instance GHC.Generics.Generic (Agda.Syntax.Abstract.LHSCore' e) instance GHC.Classes.Eq e => GHC.Classes.Eq (Agda.Syntax.Abstract.LHSCore' e) instance Data.Traversable.Traversable Agda.Syntax.Abstract.LHSCore' instance Data.Foldable.Foldable Agda.Syntax.Abstract.LHSCore' instance GHC.Base.Functor Agda.Syntax.Abstract.LHSCore' instance GHC.Show.Show e => GHC.Show.Show (Agda.Syntax.Abstract.LHSCore' e) instance GHC.Generics.Generic Agda.Syntax.Abstract.ProblemEq instance GHC.Show.Show Agda.Syntax.Abstract.ProblemEq instance GHC.Generics.Generic Agda.Syntax.Abstract.Pragma instance GHC.Classes.Eq Agda.Syntax.Abstract.Pragma instance GHC.Show.Show Agda.Syntax.Abstract.Pragma instance GHC.Generics.Generic Agda.Syntax.Abstract.GeneralizeTelescope instance GHC.Classes.Eq Agda.Syntax.Abstract.GeneralizeTelescope instance GHC.Show.Show Agda.Syntax.Abstract.GeneralizeTelescope instance GHC.Generics.Generic Agda.Syntax.Abstract.ModuleApplication instance GHC.Classes.Eq Agda.Syntax.Abstract.ModuleApplication instance GHC.Show.Show Agda.Syntax.Abstract.ModuleApplication instance GHC.Generics.Generic Agda.Syntax.Abstract.LetBinding instance GHC.Classes.Eq Agda.Syntax.Abstract.LetBinding instance GHC.Show.Show Agda.Syntax.Abstract.LetBinding instance GHC.Generics.Generic (Agda.Syntax.Abstract.Binder' a) instance Data.Traversable.Traversable Agda.Syntax.Abstract.Binder' instance Data.Foldable.Foldable Agda.Syntax.Abstract.Binder' instance GHC.Base.Functor Agda.Syntax.Abstract.Binder' instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Abstract.Binder' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Abstract.Binder' a) instance GHC.Generics.Generic Agda.Syntax.Abstract.TypedBindingInfo instance GHC.Classes.Eq Agda.Syntax.Abstract.TypedBindingInfo instance GHC.Show.Show Agda.Syntax.Abstract.TypedBindingInfo instance GHC.Generics.Generic Agda.Syntax.Abstract.TypedBinding instance GHC.Classes.Eq Agda.Syntax.Abstract.TypedBinding instance GHC.Show.Show Agda.Syntax.Abstract.TypedBinding instance GHC.Generics.Generic Agda.Syntax.Abstract.LamBinding instance GHC.Classes.Eq Agda.Syntax.Abstract.LamBinding instance GHC.Show.Show Agda.Syntax.Abstract.LamBinding instance GHC.Generics.Generic Agda.Syntax.Abstract.DataDefParams instance GHC.Classes.Eq Agda.Syntax.Abstract.DataDefParams instance GHC.Show.Show Agda.Syntax.Abstract.DataDefParams instance GHC.Generics.Generic Agda.Syntax.Abstract.Declaration instance GHC.Show.Show Agda.Syntax.Abstract.Declaration instance GHC.Generics.Generic Agda.Syntax.Abstract.WhereDeclarations instance GHC.Classes.Eq Agda.Syntax.Abstract.WhereDeclarations instance GHC.Show.Show Agda.Syntax.Abstract.WhereDeclarations instance GHC.Generics.Generic Agda.Syntax.Abstract.RHS instance GHC.Show.Show Agda.Syntax.Abstract.RHS instance GHC.Generics.Generic (Agda.Syntax.Abstract.Clause' lhs) instance GHC.Classes.Eq lhs => GHC.Classes.Eq (Agda.Syntax.Abstract.Clause' lhs) instance Data.Traversable.Traversable Agda.Syntax.Abstract.Clause' instance Data.Foldable.Foldable Agda.Syntax.Abstract.Clause' instance GHC.Base.Functor Agda.Syntax.Abstract.Clause' instance GHC.Show.Show lhs => GHC.Show.Show (Agda.Syntax.Abstract.Clause' lhs) instance GHC.Generics.Generic Agda.Syntax.Abstract.LHS instance GHC.Show.Show Agda.Syntax.Abstract.LHS instance GHC.Generics.Generic Agda.Syntax.Abstract.Expr instance GHC.Show.Show Agda.Syntax.Abstract.Expr instance GHC.Generics.Generic Agda.Syntax.Abstract.SpineLHS instance GHC.Classes.Eq Agda.Syntax.Abstract.SpineLHS instance GHC.Show.Show Agda.Syntax.Abstract.SpineLHS instance GHC.Show.Show Agda.Syntax.Abstract.RHSSpine instance GHC.Show.Show Agda.Syntax.Abstract.ClauseSpine instance GHC.Show.Show Agda.Syntax.Abstract.DeclarationSpine instance GHC.Show.Show Agda.Syntax.Abstract.WhereDeclarationsSpine instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr (GHC.Maybe.Maybe a) instance Agda.Syntax.Abstract.SubstExpr a => Agda.Syntax.Abstract.SubstExpr [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 (Agda.Syntax.Common.Arg a) 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.Syntax.Concrete.FieldAssignment' a) instance (Agda.Syntax.Abstract.SubstExpr a, Agda.Syntax.Abstract.SubstExpr b) => Agda.Syntax.Abstract.SubstExpr (a, b) instance (Agda.Syntax.Abstract.SubstExpr a, Agda.Syntax.Abstract.SubstExpr b) => Agda.Syntax.Abstract.SubstExpr (Data.Either.Either a b) instance Agda.Syntax.Abstract.SubstExpr Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Abstract.SubstExpr Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.SubstExpr Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.NameToExpr Agda.Syntax.Scope.Base.AbstractName instance Agda.Syntax.Abstract.NameToExpr Agda.Syntax.Scope.Base.ResolvedName instance Agda.Syntax.Abstract.AnyAbstract a => Agda.Syntax.Abstract.AnyAbstract [a] instance Agda.Syntax.Abstract.AnyAbstract Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.SpineLHS instance Control.DeepSeq.NFData Agda.Syntax.Abstract.SpineLHS instance GHC.Classes.Eq Agda.Syntax.Abstract.ProblemEq instance Agda.Utils.Null.Null Agda.Syntax.Abstract.WhereDeclarations instance GHC.Classes.Eq Agda.Syntax.Abstract.RHS instance GHC.Classes.Eq Agda.Syntax.Abstract.LHS instance Agda.Syntax.Abstract.Name.IsProjP Agda.Syntax.Abstract.Expr instance GHC.Classes.Eq Agda.Syntax.Abstract.Expr instance GHC.Classes.Eq Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Common.Underscore Agda.Syntax.Abstract.Expr instance Agda.Syntax.Common.LensHiding Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Common.LensHiding Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.Binder' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Expr instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.LHS instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.Clause' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.RHS instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.Binder' a) instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.GeneralizeTelescope instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.DataDefParams instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.TypedBindingInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Expr instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.LHS instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.Clause' a) 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.WhereDeclarations instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.LetBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Expr instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Declaration instance Control.DeepSeq.NFData Agda.Syntax.Abstract.ModuleApplication instance Control.DeepSeq.NFData Agda.Syntax.Abstract.Pragma instance Control.DeepSeq.NFData Agda.Syntax.Abstract.LetBinding instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Abstract.Binder' a) instance Control.DeepSeq.NFData Agda.Syntax.Abstract.LamBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.TypedBinding instance Control.DeepSeq.NFData Agda.Syntax.Abstract.TypedBindingInfo instance Control.DeepSeq.NFData Agda.Syntax.Abstract.GeneralizeTelescope instance Control.DeepSeq.NFData Agda.Syntax.Abstract.DataDefParams instance Control.DeepSeq.NFData Agda.Syntax.Abstract.ProblemEq instance Control.DeepSeq.NFData lhs => Control.DeepSeq.NFData (Agda.Syntax.Abstract.Clause' lhs) instance Control.DeepSeq.NFData Agda.Syntax.Abstract.WhereDeclarations instance Control.DeepSeq.NFData Agda.Syntax.Abstract.RHS instance Control.DeepSeq.NFData Agda.Syntax.Abstract.LHS instance Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.LHSCore' e) instance Agda.Syntax.Position.KillRange e => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.LHSCore' e) instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Abstract.LHSCore' e) instance Agda.Syntax.Abstract.Name.IsProjP (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Position.HasRange (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Position.SetRange (Agda.Syntax.Abstract.Pattern' a) instance Agda.Syntax.Position.KillRange e => Agda.Syntax.Position.KillRange (Agda.Syntax.Abstract.Pattern' e) instance Control.DeepSeq.NFData e => Control.DeepSeq.NFData (Agda.Syntax.Abstract.Pattern' e) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Abstract.ScopeCopyInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.ScopeCopyInfo instance Control.DeepSeq.NFData Agda.Syntax.Abstract.ScopeCopyInfo instance GHC.Classes.Eq Agda.Syntax.Abstract.BindName instance GHC.Classes.Ord Agda.Syntax.Abstract.BindName instance Agda.Syntax.Position.KillRange Agda.Syntax.Abstract.Name.Suffix module Agda.Syntax.Abstract.Views data AppView' arg Application :: Expr -> [NamedArg arg] -> AppView' arg type AppView = AppView' Expr -- | Gather applications to expose head and spine. -- -- Note: everything is an application, possibly of itself to 0 arguments appView :: Expr -> AppView appView' :: Expr -> AppView' (AppInfo, Expr) maybeProjTurnPostfix :: Expr -> Maybe 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 and AnnPatterns to expose -- underlying pattern. asView :: Pattern -> ([Name], [Expr], 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 deepUnscopeDecls :: [Declaration] -> [Declaration] deepUnscopeDecl :: Declaration -> [Declaration] type RecurseExprFn m a = Applicative m => (Expr -> m Expr -> m Expr) -> a -> m a type RecurseExprRecFn m = 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 a = (Applicative m, Monad m) => (Expr -> m Expr) -> a -> m a type TraverseExprRecFn m = 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 -- | The first expression is pre-traversal, the second one post-traversal. recurseExpr :: (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 declaredNames :: (DeclaredNames a, Foldable t, DeclaredNames b, t b ~ a) => Collection KName m => a -> m instance GHC.Base.Functor Agda.Syntax.Abstract.Views.AppView' 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 (Agda.Utils.List1.List1 a) instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (GHC.Maybe.Maybe a) instance Agda.Syntax.Abstract.Views.DeclaredNames a => Agda.Syntax.Abstract.Views.DeclaredNames (Agda.Syntax.Common.Arg 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.Syntax.Concrete.FieldAssignment' a) instance (Agda.Syntax.Abstract.Views.DeclaredNames a, Agda.Syntax.Abstract.Views.DeclaredNames b) => Agda.Syntax.Abstract.Views.DeclaredNames (Data.Either.Either a b) 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.Views.KName instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.RecordDirectives instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Pragma instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.Clause instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Abstract.Views.DeclaredNames Agda.Syntax.Abstract.RHS instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.LetBinding 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.RHS instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Pragma instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (GHC.Maybe.Maybe a) 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 [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 b) => Agda.Syntax.Abstract.Views.ExprLike (a, b) instance Agda.Syntax.Abstract.Views.ExprLike Data.Void.Void instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Concrete.FieldAssignment' a) instance (Agda.Syntax.Abstract.Views.ExprLike a, Agda.Syntax.Abstract.Views.ExprLike b) => Agda.Syntax.Abstract.Views.ExprLike (Data.Either.Either a b) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.BindName instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.GeneralizeTelescope instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.DataDefParams instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.TypedBindingInfo instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Abstract.Views.ExprLike a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Abstract.Pattern' a) instance (Agda.Syntax.Abstract.Views.ExprLike qn, Agda.Syntax.Abstract.Views.ExprLike nm, 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.WhereDeclarations 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 a => Agda.Syntax.Abstract.Views.ExprLike (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Abstract.Views.ExprLike Agda.Syntax.Abstract.SpineLHS -- | 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 [Arg Expr] -- | Match a pattern against a pattern synonym. matchPatternSynP :: PatternSynDefn -> Pattern' e -> Maybe [Arg (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 mapNamedArgPattern :: (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 -- | Fold pattern. foldrAPattern :: (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 -- | Traverse pattern. traverseAPatternM :: (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 -> ([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 -- | 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 :: NAPs 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 :: [Pattern' e] -> LHSPatternView e -- | Construct the LHSPatternView of the given list (if not empty). -- -- Return the view and the remaining patterns. lhsPatternView :: IsProjP e => 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 -> [Arg (Pattern' e)] -> LHSCore' e lhsCoreAddChunk :: IsProjP e => 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 GHC.Show.Show e => GHC.Show.Show (Agda.Syntax.Abstract.Pattern.LHSPatternView e) instance Agda.Syntax.Abstract.Pattern.LHSToSpine Agda.Syntax.Abstract.Clause Agda.Syntax.Abstract.SpineClause instance Agda.Syntax.Abstract.Pattern.LHSToSpine a b => Agda.Syntax.Abstract.Pattern.LHSToSpine [a] [b] instance Agda.Syntax.Abstract.Pattern.LHSToSpine Agda.Syntax.Abstract.LHS Agda.Syntax.Abstract.SpineLHS instance Agda.Syntax.Abstract.Pattern.APatternLike (Agda.Syntax.Abstract.Pattern' a) 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.Common.Named n 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.Maybe.Maybe 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 b, Agda.Syntax.Abstract.Pattern.ADotT a GHC.Types.~ Agda.Syntax.Abstract.Pattern.ADotT b) => Agda.Syntax.Abstract.Pattern.APatternLike (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 [a] 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 (GHC.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.Concrete.Pattern.IsWithP (Agda.Syntax.Abstract.Pattern' e) 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]) :: Constraint -- | On Booleans type family If (b :: Bool) (l :: k) (r :: k) :: k -- | 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 :: (Function k l -> Type) -> Function k (Function [l] [l] -> Type) -> Type data ConsMap1 :: (Function k l -> Type) -> k -> Function [l] [l] -> Type type family Constant (b :: l) (as :: [k]) :: [l] -- | Arrows [a1,..,an] r corresponds to a1 -> .. -> an -- -> r | Products [a1,..,an] corresponds to (a1, -- (..,( an, ())..)) type Arrows (as :: [Type]) (r :: Type) = Foldr (->) r as type Products (as :: [Type]) = Foldr (,) () as -- | IsBase t is 'True whenever t is *not* a -- function space. type family IsBase (t :: Type) :: Bool -- | 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] type family Domains' (t :: Type) :: [Type] type family CoDomain (t :: Type) :: Type type family CoDomain' (t :: Type) :: Type -- | 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 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 data Function :: Type -> Type -> Type data Constant0 :: Function a (Function b a -> Type) -> Type data Constant1 :: Type -> Function b a -> Type type family Apply (t :: Function k l -> Type) (u :: k) :: l instance Agda.Utils.TypeLevel.Currying '[] b instance Agda.Utils.TypeLevel.Currying as b => Agda.Utils.TypeLevel.Currying (a : as) 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 :: 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. KnownBool b => proxy b -> Bool instance Agda.Utils.TypeLits.KnownBool 'GHC.Types.True instance Agda.Utils.TypeLits.KnownBool 'GHC.Types.False module Agda.Utils.Update -- | The ChangeT monad transformer. data ChangeT m 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 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 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 :: Monad m => UpdaterT m a -> UpdaterT m a -- | Blindly run an updater. runUpdater :: Updater a -> a -> (a, Bool) -- | Mark a computation as dirty. dirty :: Monad m => UpdaterT m a ifDirty :: (Monad m, MonadChange m) => m a -> (a -> m b) -> (a -> m b) -> m b -- | Like Functor, but preserving sharing. class Traversable f => Updater1 f 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 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 Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Agda.Utils.Update.ChangeT m) instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (Agda.Utils.Update.ChangeT m) instance Control.Monad.Trans.Class.MonadTrans Agda.Utils.Update.ChangeT instance GHC.Base.Monad m => GHC.Base.Monad (Agda.Utils.Update.ChangeT m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Agda.Utils.Update.ChangeT m) instance GHC.Base.Functor m => GHC.Base.Functor (Agda.Utils.Update.ChangeT m) instance Agda.Utils.Update.Updater2 (,) instance Agda.Utils.Update.Updater2 Data.Either.Either instance Agda.Utils.Update.Updater1 GHC.Maybe.Maybe instance Agda.Utils.Update.Updater1 [] instance Control.Monad.Trans.Control.MonadTransControl Agda.Utils.Update.ChangeT instance GHC.Base.Monad m => Agda.Utils.Update.MonadChange (Agda.Utils.Update.ChangeT m) instance Agda.Utils.Update.MonadChange Data.Functor.Identity.Identity instance GHC.Base.Monad m => Agda.Utils.Update.MonadChange (Control.Monad.Trans.Identity.IdentityT m) -- | Preprocess Declarations, producing NiceDeclarations. -- --
-- -- 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 contents of .agda-lib files in the given project -- root. getAgdaLibFiles' :: FilePath -> LibErrorIO [AgdaLibFile] -- | Returns the absolute default lib dir. This directory is used to store -- the Primitive.agda file. getPrimitiveLibDir :: IO FilePath -- | A symbolic library name. type LibName = String -- | Content of a .agda-lib file. data AgdaLibFile AgdaLibFile :: LibName -> FilePath -> [FilePath] -> [LibName] -> [String] -> AgdaLibFile -- | The symbolic name of the library. [_libName] :: AgdaLibFile -> LibName -- | Path to this .agda-lib file (not content of the file). [_libFile] :: AgdaLibFile -> FilePath -- | 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 -> [String] -- | A symbolic executable name. type ExeName = Text -- | Throws Doc exceptions, still collects LibWarnings. type LibM = ExceptT Doc (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 one or more .agda-lib files, or be part of the default -- project. data ProjectConfig ProjectConfig :: FilePath -> [FilePath] -> ProjectConfig [configRoot] :: ProjectConfig -> FilePath [configAgdaLibFiles] :: ProjectConfig -> [FilePath] DefaultProjectConfig :: ProjectConfig -- | 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 VersionView VersionView :: LibName -> [Integer] -> VersionView -- | Actual library name. [vvBase] :: VersionView -> LibName -- | Major version, minor version, subminor version, etc., all -- non-negative. Note: a priori, there is no reason why the version -- numbers should be Ints. [vvNumbers] :: VersionView -> [Integer] -- | Split a library name into basename and a list of version numbers. -- --
-- versionView "foo-1.2.3" == VersionView "foo" [1, 2, 3] -- versionView "foo-01.002.3" == VersionView "foo" [1, 2, 3] ---- -- Note that because of leading zeros, versionView is not -- injective. (unVersionView . versionView would produce a -- normal form.) versionView :: LibName -> VersionView -- | Print a VersionView, inverse of versionView (modulo -- leading zeros). unVersionView :: VersionView -> LibName -- | 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] instance GHC.Show.Show Agda.Interaction.Library.VersionView instance GHC.Classes.Eq Agda.Interaction.Library.VersionView module Agda.Interaction.Options data CommandLineOptions Options :: String -> Maybe FilePath -> [FilePath] -> [AbsolutePath] -> [LibName] -> Maybe FilePath -> Bool -> Bool -> Map ExeName FilePath -> Bool -> Bool -> Maybe Help -> Bool -> Bool -> Bool -> !Bool -> Maybe FilePath -> Bool -> Bool -> Bool -> Bool -> PragmaOptions -> Bool -> Bool -> 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 ~.agdadefaults [optDefaultLibs] :: CommandLineOptions -> Bool -- | look for .agda-lib files [optUseLibs] :: CommandLineOptions -> Bool -- | Map names of trusted executables to absolute paths [optTrustedExecutables] :: CommandLineOptions -> Map ExeName FilePath [optPrintAgdaDir] :: CommandLineOptions -> Bool [optPrintVersion] :: CommandLineOptions -> Bool [optPrintHelp] :: CommandLineOptions -> Maybe Help -- | Agda REPL (-I). [optInteractive] :: CommandLineOptions -> Bool [optGHCiInteraction] :: CommandLineOptions -> Bool [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 [optLocalInterfaces] :: 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 -- | Options which can be set in a pragma. data PragmaOptions PragmaOptions :: Bool -> Bool -> UnicodeOrAscii -> !Verbosity -> ProfileOptions -> Bool -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> CutOff -> Bool -> Bool -> Bool -> WithDefault 'False -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> WithDefault 'False -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Cubical -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> Int -> Bool -> Bool -> !Maybe Int -> WarningMode -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe ConfluenceCheck -> Bool -> WithDefault 'False -> Bool -> Bool -> Bool -> WithDefault 'False -> Bool -> Bool -> PragmaOptions [optShowImplicit] :: PragmaOptions -> Bool [optShowIrrelevant] :: PragmaOptions -> Bool [optUseUnicode] :: PragmaOptions -> UnicodeOrAscii [optVerbose] :: PragmaOptions -> !Verbosity [optProfiling] :: PragmaOptions -> ProfileOptions [optProp] :: PragmaOptions -> Bool [optTwoLevel] :: PragmaOptions -> WithDefault 'False [optAllowUnsolved] :: PragmaOptions -> Bool [optAllowIncompleteMatch] :: PragmaOptions -> Bool [optDisablePositivity] :: PragmaOptions -> Bool [optTerminationCheck] :: PragmaOptions -> Bool -- | Cut off structural order comparison at some depth in termination -- checker? [optTerminationDepth] :: PragmaOptions -> CutOff [optUniverseCheck] :: PragmaOptions -> Bool [optOmegaInOmega] :: PragmaOptions -> Bool [optCumulativity] :: PragmaOptions -> Bool [optSizedTypes] :: PragmaOptions -> WithDefault 'False [optGuardedness] :: PragmaOptions -> WithDefault 'False [optInjectiveTypeConstructors] :: PragmaOptions -> Bool [optUniversePolymorphism] :: PragmaOptions -> Bool [optIrrelevantProjections] :: PragmaOptions -> Bool -- | irrelevant levels, irrelevant data matching [optExperimentalIrrelevance] :: PragmaOptions -> Bool [optWithoutK] :: PragmaOptions -> WithDefault 'False [optCubicalCompatible] :: PragmaOptions -> WithDefault 'False -- | Allow definitions by copattern matching? [optCopatterns] :: PragmaOptions -> Bool -- | Is pattern matching allowed in the current file? [optPatternMatching] :: PragmaOptions -> Bool [optExactSplit] :: PragmaOptions -> Bool [optEta] :: PragmaOptions -> Bool -- | Perform the forcing analysis on data constructors? [optForcing] :: PragmaOptions -> Bool -- | Perform the projection-likeness analysis on functions? [optProjectionLike] :: PragmaOptions -> Bool -- | Mark parameters of record modules as erased? [optEraseRecordParameters] :: PragmaOptions -> Bool -- | Can rewrite rules be added and used? [optRewriting] :: PragmaOptions -> Bool [optCubical] :: PragmaOptions -> Maybe Cubical [optGuarded] :: PragmaOptions -> Bool -- | Should we speculatively unify function applications as if they were -- injective? [optFirstOrder] :: PragmaOptions -> Bool -- | Should system generated projections ProjSystem be printed -- postfix (True) or prefix (False). [optPostfixProjections] :: PragmaOptions -> Bool -- | Should case splitting replace variables with dot patterns (False) or -- keep them as variables (True). [optKeepPatternVariables] :: PragmaOptions -> Bool [optInstanceSearchDepth] :: PragmaOptions -> Int [optOverlappingInstances] :: PragmaOptions -> Bool -- | Should instance search consider instances with qualified names? [optQualifiedInstances] :: PragmaOptions -> Bool [optInversionMaxDepth] :: PragmaOptions -> Int [optSafe] :: PragmaOptions -> Bool [optDoubleCheck] :: PragmaOptions -> Bool -- | 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 [optCompileNoMain] :: PragmaOptions -> Bool [optCaching] :: PragmaOptions -> Bool -- | Count extended grapheme clusters rather than code points when -- generating LaTeX. [optCountClusters] :: PragmaOptions -> Bool -- | Automatic compile-time inlining for simple definitions (unless marked -- NOINLINE). [optAutoInline] :: PragmaOptions -> Bool [optPrintPatternSynonyms] :: PragmaOptions -> Bool -- | Use the Agda abstract machine (fastReduce)? [optFastReduce] :: PragmaOptions -> Bool -- | Use call-by-name instead of call-by-need [optCallByName] :: PragmaOptions -> Bool -- | Check confluence of rewrite rules? [optConfluenceCheck] :: PragmaOptions -> Maybe ConfluenceCheck -- | Are the cohesion modalities available? [optCohesion] :: PragmaOptions -> Bool -- | Can we split on a (@flat x : A) argument? [optFlatSplit] :: PragmaOptions -> WithDefault 'False -- | Should every top-level module start with an implicit statement -- open import Agda.Primitive using (Set; Prop)? [optImportSorts] :: PragmaOptions -> Bool -- | Should we load the primitive modules at all? This is a stronger form -- of optImportSorts. [optLoadPrimitives] :: PragmaOptions -> Bool [optAllowExec] :: PragmaOptions -> Bool -- | Save meta-variables. [optSaveMetas] :: PragmaOptions -> WithDefault 'False -- | Show identity substitutions when pretty-printing terms (i.e. always -- show all arguments of a metavariable) [optShowIdentitySubstitutions] :: PragmaOptions -> Bool -- | Do not discard clauses constructed by the coverage checker (needed for -- some external backends) [optKeepCoveringClauses] :: PragmaOptions -> Bool -- | The options from an OPTIONS pragma. -- -- 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. type OptionsPragma = [String] -- | Warnings when parsing options. data OptionWarning OptionRenamed :: String -> String -> OptionWarning [oldOptionName] :: OptionWarning -> String [newOptionName] :: OptionWarning -> String optionWarningName :: OptionWarning -> WarningName -- | 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 -- | The options parse monad OptM collects warnings that are not -- discarded when a fatal error occurrs data OptM a runOptM :: OptM opts -> (Either OptionError opts, OptionWarnings) -- | Each OptDescr describes a single option. -- -- The arguments to Option are: -- --
-- t --[ipbValue] :: IPBoundary' t -> t -- |
-- ?n es --[ipbMetaApp] :: IPBoundary' t -> t -- | Is ?n overapplied in ?n es ? [ipbOverapplied] :: IPBoundary' t -> Overapplied -- | MonadTCEnv made into its own dedicated service class. This -- allows us to use MonadReader for ReaderT extensions of -- TCM. class Monad m => MonadTCEnv m askTC :: MonadTCEnv m => m TCEnv localTC :: MonadTCEnv m => (TCEnv -> TCEnv) -> m a -> m a askTC :: (MonadTCEnv m, MonadTrans t, MonadTCEnv n, t n ~ m) => m TCEnv localTC :: (MonadTCEnv m, MonadTransControl t, MonadTCEnv n, t n ~ m) => (TCEnv -> TCEnv) -> m a -> m a -- | Embedding a TCM computation. class (Applicative tcm, MonadIO tcm, MonadTCEnv tcm, MonadTCState tcm, HasOptions tcm) => MonadTCM tcm liftTCM :: MonadTCM tcm => TCM a -> tcm a liftTCM :: (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 getTC :: MonadTCState m => m TCState putTC :: MonadTCState m => TCState -> m () modifyTC :: MonadTCState m => (TCState -> TCState) -> m () getTC :: (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => m TCState putTC :: (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => TCState -> m () modifyTC :: (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => (TCState -> TCState) -> m () class Monad m => ReadTCState m getTCState :: ReadTCState m => m TCState locallyTCState :: ReadTCState m => Lens' a TCState -> (a -> a) -> m b -> m b withTCState :: ReadTCState m => (TCState -> TCState) -> m a -> m a getTCState :: (ReadTCState m, MonadTrans t, ReadTCState n, t n ~ m) => m TCState locallyTCState :: (ReadTCState m, MonadTransControl t, ReadTCState n, t n ~ m) => Lens' a TCState -> (a -> a) -> m b -> m b -- | The type checking monad transformer. Adds readonly TCEnv and -- mutable TCState. newtype TCMT m a TCM :: (IORef TCState -> TCEnv -> m a) -> TCMT m a [unTCM] :: TCMT m a -> IORef TCState -> TCEnv -> m a -- | Distinguish error message when parsing lhs or pattern synonym, resp. data LHSOrPatSyn IsLHS :: LHSOrPatSyn IsPatSyn :: LHSOrPatSyn -- | 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 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 :: Range -> [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 CheckConstructorFitsIn :: QName -> Type -> Sort -> Call -- | Highlight (interactively) if and only if the boolean is True. CheckFunDefCall :: Range -> QName -> [Clause] -> Bool -> Call CheckPragma :: Range -> Pragma -> Call CheckPrimitive :: Range -> QName -> Expr -> Call CheckIsEmpty :: Range -> Type -> Call CheckConfluence :: QName -> QName -> Call CheckWithFunctionType :: Type -> Call CheckSectionApplication :: Range -> 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 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 data Closure a Closure :: Signature -> TCEnv -> ScopeInfo -> Map ModuleName CheckpointId -> a -> Closure a [clSignature] :: Closure a -> Signature [clEnv] :: Closure a -> TCEnv [clScope] :: Closure a -> ScopeInfo [clModuleCheckpoints] :: Closure a -> Map ModuleName CheckpointId [clValue] :: Closure a -> a class (Applicative m, MonadTCEnv m, ReadTCState m, HasOptions m) => MonadReduce m liftReduce :: MonadReduce m => ReduceM a -> m a liftReduce :: (MonadReduce m, MonadTrans t, MonadReduce n, t n ~ m) => ReduceM a -> m a type Statistics = Map String Integer -- | The backends are responsible for parsing their own pragmas. data CompilerPragma CompilerPragma :: Range -> String -> CompilerPragma data TCEnv TCEnv :: Context -> LetBindings -> ModuleName -> Maybe AbsolutePath -> [(ModuleName, Nat)] -> [TopLevelModuleName] -> Maybe MutualId -> TerminationCheck () -> CoverageCheck -> Bool -> Bool -> Bool -> Bool -> Bool -> Set ProblemId -> AbstractMode -> Modality -> Bool -> Bool -> Range -> Range -> IPClause -> Maybe (Closure Call) -> HighlightingLevel -> HighlightingMethod -> ExpandHidden -> Maybe QName -> Simplification -> AllowedReductions -> ReduceDefs -> Bool -> Int -> Bool -> Bool -> Bool -> Bool -> UnquoteFlags -> !Int -> Bool -> [QName] -> Bool -> CheckpointId -> Map CheckpointId Substitution -> DoGeneralize -> Map QName GeneralizedValue -> Maybe BackendName -> Bool -> Bool -> !Maybe Int -> TCEnv [envContext] :: TCEnv -> Context [envLetBindings] :: TCEnv -> LetBindings [envCurrentModule] :: TCEnv -> ModuleName -- | 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] :: TCEnv -> Maybe AbsolutePath -- | anonymous modules and their number of free variables [envAnonymousModules] :: TCEnv -> [(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. [envImportPath] :: TCEnv -> [TopLevelModuleName] -- | the current (if any) mutual block [envMutualBlock] :: TCEnv -> Maybe MutualId -- | are we inside the scope of a termination pragma [envTerminationCheck] :: TCEnv -> TerminationCheck () -- | are we inside the scope of a coverage pragma [envCoverageCheck] :: TCEnv -> CoverageCheck -- | are we inside a make-case (if so, ignore forcing analysis in unifier) [envMakeCase] :: TCEnv -> Bool -- | Are we currently in the process of solving active constraints? [envSolvingConstraints] :: TCEnv -> Bool -- | Have we stepped into the where-declarations of a clause? Everything -- under a where will be checked with this flag on. [envCheckingWhere] :: TCEnv -> Bool -- | Are we working on types? Turned on by workOnTypes. [envWorkingOnTypes] :: TCEnv -> Bool -- | Are we allowed to assign metas? [envAssignMetas] :: TCEnv -> Bool [envActiveProblems] :: TCEnv -> Set 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] :: TCEnv -> AbstractMode -- | Relevance component: Are we checking an irrelevant argument? -- (=Irrelevant) Then top-level irrelevant declarations are -- enabled. Other value: Relevant, then only relevant decls. are -- available. -- -- Quantity component: Are we checking a runtime-irrelevant thing? -- (=Quantity0) Then runtime-irrelevant things are usable. Other -- value: Quantity1, runtime relevant. Quantityω is not -- allowed here, see Bob Atkey, LiCS 2018. [envModality] :: TCEnv -> Modality -- | 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] :: TCEnv -> Bool -- | Sometimes we want to disable display forms. [envDisplayFormsEnabled] :: TCEnv -> Bool [envRange] :: TCEnv -> Range -- | Interactive highlighting uses this range rather than envRange. [envHighlightingRange] :: TCEnv -> Range -- | What is the current clause we are type-checking? Will be recorded in -- interaction points in this clause. [envClause] :: TCEnv -> IPClause -- | what we're doing at the moment [envCall] :: TCEnv -> Maybe (Closure Call) -- | Set to None when imported modules are type-checked. [envHighlightingLevel] :: TCEnv -> HighlightingLevel [envHighlightingMethod] :: TCEnv -> 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] :: TCEnv -> ExpandHidden -- | We are reducing an application of this function. (For tracking of -- incomplete matches.) [envAppDef] :: TCEnv -> Maybe QName -- | Did we encounter a simplification (proper match) during the current -- reduction process? [envSimplification] :: TCEnv -> Simplification [envAllowedReductions] :: TCEnv -> AllowedReductions [envReduceDefs] :: TCEnv -> ReduceDefs [envReconstructed] :: TCEnv -> Bool -- | Injectivity can cause non-termination for unsolvable contraints (#431, -- #3067). Keep a limit on the nesting depth of injectivity uses. [envInjectivityDepth] :: TCEnv -> Int -- | 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] :: TCEnv -> Bool -- | When True, types will be omitted from printed pi types if -- they can be inferred. [envPrintDomainFreePi] :: TCEnv -> 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] :: TCEnv -> 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] :: TCEnv -> Bool [envUnquoteFlags] :: TCEnv -> UnquoteFlags -- | Until we get a termination checker for instance search (#1743) we -- limit the search depth to ensure termination. [envInstanceDepth] :: TCEnv -> !Int [envIsDebugPrinting] :: TCEnv -> Bool -- | #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] :: TCEnv -> [QName] -- | Use call-by-need evaluation for reductions. [envCallByNeed] :: TCEnv -> Bool -- | Checkpoints track the evolution of the context as we go under binders -- or refine it by pattern matching. [envCurrentCheckpoint] :: TCEnv -> CheckpointId -- | Keeps the substitution from each previous checkpoint to the current -- context. [envCheckpoints] :: TCEnv -> Map CheckpointId Substitution -- | Should new metas generalized over. [envGeneralizeMetas] :: TCEnv -> DoGeneralize -- | Values for used generalizable variables. [envGeneralizedVars] :: TCEnv -> Map QName GeneralizedValue -- | Is some backend active at the moment, and if yes, which? NB: we only -- store the BackendName here, otherwise instance Data -- TCEnv is not derivable. The actual backend can be obtained from -- the name via stBackends. [envActiveBackendName] :: TCEnv -> Maybe BackendName -- | Are we currently computing the overlap between two rewrite rules for -- the purpose of confluence checking? [envConflComputingOverlap] :: TCEnv -> Bool -- | Are we currently in the process of executing an elaborate-and-give -- interactive command? [envCurrentlyElaborating] :: TCEnv -> Bool -- | 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] :: TCEnv -> !Maybe Int data Definition Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> NumGeneralizableArgs -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe QName -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> !Language -> 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] -- | How many arguments should be generalised. [defArgGeneralizable] :: Definition -> NumGeneralizableArgs -- | 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 of class q [defInstance] :: Definition -> Maybe QName -- | Has this function been created by a module instantiation? [defCopy] :: Definition -> Bool -- | The set of symbols with rewrite rules that match against this symbol [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? [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 [theDef] :: Definition -> Defn data Interface Interface :: Hash -> Text -> FileType -> [(TopLevelModuleName, Hash)] -> ModuleName -> TopLevelModuleName -> Map ModuleName Scope -> ScopeInfo -> Signature -> RemoteMetaStore -> DisplayForms -> Map QName Text -> Maybe Text -> BuiltinThings (String, QName) -> Map BackendName [ForeignCode] -> HighlightingInfo -> [OptionsPragma] -> [OptionsPragma] -> PragmaOptions -> PatternSynDefns -> [TCWarning] -> Set QName -> 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 -> Map QName Text -- | Whether this module should raise a warning when imported [iImportWarning] :: Interface -> Maybe Text [iBuiltin] :: Interface -> BuiltinThings (String, QName) [iForeignCode] :: Interface -> Map BackendName [ForeignCode] [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 -> [TCWarning] [iPartialDefs] :: Interface -> Set QName -- | The constraints needed for typeError and similar. type MonadTCError m = (MonadTCEnv m, ReadTCState m, MonadError TCErr m) type BackendName = String data TCState TCSt :: !PreScopeState -> !PostScopeState -> !PersistentTCState -> TCState -- | The state which is frozen after scope checking. [stPreScopeState] :: TCState -> !PreScopeState -- | The state which is modified after scope checking. [stPostScopeState] :: TCState -> !PostScopeState -- | State which is forever, like a diamond. [stPersistentState] :: TCState -> !PersistentTCState type RewriteRules = [RewriteRule] data PrimFun PrimFun :: QName -> Arity -> ([Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term)) -> PrimFun [primFunName] :: PrimFun -> QName [primFunArity] :: PrimFun -> Arity [primFunImplementation] :: PrimFun -> [Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term) data RunMetaOccursCheck RunMetaOccursCheck :: RunMetaOccursCheck DontRunMetaOccursCheck :: RunMetaOccursCheck -- | 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 class Monad m => MonadBlock m -- | `patternViolation b` aborts the current computation patternViolation :: MonadBlock m => Blocker -> m a -- | `patternViolation b` aborts the current computation patternViolation :: (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 data Reduced no yes NoReduction :: no -> Reduced no yes YesReduction :: Simplification -> yes -> Reduced no yes data ProblemConstraint PConstr :: Set ProblemId -> Blocker -> Closure Constraint -> ProblemConstraint [constraintProblems] :: ProblemConstraint -> Set ProblemId [constraintUnblocker] :: ProblemConstraint -> Blocker [theConstraint] :: ProblemConstraint -> Closure Constraint newtype Fields Fields :: [(Name, Type)] -> Fields data ForeignCode ForeignCode :: Range -> String -> ForeignCode newtype Section Section :: Telescope -> Section [_secTelescope] :: Section -> Telescope data PreScopeState PreScopeState :: !HighlightingInfo -> !Signature -> !HashSet TopLevelModuleName -> !ModuleToSource -> !VisitedModules -> !ScopeInfo -> !PatternSynDefns -> !PatternSynDefns -> !Maybe (Set QName) -> !PragmaOptions -> !BuiltinThings PrimFun -> !DisplayForms -> !InstanceTable -> !Map BackendName [ForeignCode] -> !InteractionId -> !Map QName Text -> !Map QName Text -> !Maybe Text -> !Set QName -> !Map FilePath ProjectConfig -> !Map FilePath AgdaLibFile -> !RemoteMetaStore -> PreScopeState -- | 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 most not be serialized! [stPreImports] :: PreScopeState -> !Signature -- | The top-level modules imported by the current module. [stPreImportedModules] :: PreScopeState -> !HashSet TopLevelModuleName [stPreModuleToSource] :: PreScopeState -> !ModuleToSource [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 generalizable variables; used during scope checking of terms [stPreGeneralizedVars] :: PreScopeState -> !Maybe (Set QName) -- | Options applying to the current file. OPTIONS pragmas only -- affect this field. [stPrePragmaOptions] :: PreScopeState -> !PragmaOptions [stPreImportedBuiltins] :: PreScopeState -> !BuiltinThings PrimFun -- | Display forms added by someone else to imported identifiers [stPreImportedDisplayForms] :: PreScopeState -> !DisplayForms [stPreImportedInstanceDefs] :: PreScopeState -> !InstanceTable -- | {-# FOREIGN #-} code that should be included in the compiled -- output. Does not include code for imported modules. [stPreForeignCode] :: PreScopeState -> !Map BackendName [ForeignCode] [stPreFreshInteractionId] :: PreScopeState -> !InteractionId -- | Imported UserWarnings, not to be stored in the -- Interface [stPreImportedUserWarnings] :: PreScopeState -> !Map QName Text -- | Locally defined UserWarnings, to be stored in the -- Interface [stPreLocalUserWarnings] :: PreScopeState -> !Map QName Text -- | 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 -- | Map from directories to paths of closest enclosing .agda-lib files (or -- Nothing if there are none). [stPreProjectConfigs] :: PreScopeState -> !Map FilePath ProjectConfig -- | Contents of .agda-lib files that have already been parsed. [stPreAgdaLibFiles] :: PreScopeState -> !Map FilePath AgdaLibFile -- | Used for meta-variables from other modules. [stPreImportedMetaStore] :: PreScopeState -> !RemoteMetaStore data PostScopeState PostScopeState :: !HighlightingInfo -> !DisambiguatedNames -> !LocalMetaStore -> !LocalMetaStore -> !InteractionPoints -> !Constraints -> !Constraints -> !Bool -> !Set QName -> !Signature -> !Map ModuleName CheckpointId -> !DisplayForms -> !Maybe (ModuleName, TopLevelModuleName) -> !TempInstanceTable -> !ConcreteNames -> !Map RawName (DList RawName) -> !Map Name (DList RawName) -> !Statistics -> ![TCWarning] -> !Map MutualId MutualBlock -> !BuiltinThings PrimFun -> !MetaId -> !MutualId -> !ProblemId -> !CheckpointId -> !Int -> !NameId -> !Bool -> !Bool -> !Bool -> !Bool -> !Set QName -> PostScopeState -- | Highlighting info. [stPostSyntaxInfo] :: PostScopeState -> !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] :: PostScopeState -> !DisambiguatedNames -- | Used for open meta-variables. [stPostOpenMetaStore] :: PostScopeState -> !LocalMetaStore -- | Used for local, instantiated meta-variables. [stPostSolvedMetaStore] :: PostScopeState -> !LocalMetaStore [stPostInteractionPoints] :: PostScopeState -> !InteractionPoints [stPostAwakeConstraints] :: PostScopeState -> !Constraints [stPostSleepingConstraints] :: PostScopeState -> !Constraints -- | Dirty when a constraint is added, used to prevent pointer update. -- Currently unused. [stPostDirty] :: PostScopeState -> !Bool -- | 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] :: PostScopeState -> !Set QName -- | Declared identifiers of the current file. These will be serialized -- after successful type checking. [stPostSignature] :: PostScopeState -> !Signature -- | For each module remember the checkpoint corresponding to the orignal -- context of the module parameters. [stPostModuleCheckpoints] :: PostScopeState -> !Map ModuleName CheckpointId -- | Display forms we add for imported identifiers [stPostImportsDisplayForms] :: PostScopeState -> !DisplayForms -- | The current module is available after it has been type checked. [stPostCurrentModule] :: PostScopeState -> !Maybe (ModuleName, TopLevelModuleName) [stPostInstanceDefs] :: PostScopeState -> !TempInstanceTable -- | 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] :: PostScopeState -> !ConcreteNames -- | Map keeping track for each name root (= name w/o numeric suffixes) -- what names with the same root have been used during a TC computation. -- This information is used to build the ShadowingNames map. [stPostUsedNames] :: PostScopeState -> !Map RawName (DList RawName) -- | Map keeping track for each (abstract) name the list of all (raw) names -- that it could maybe be shadowed by. [stPostShadowingNames] :: PostScopeState -> !Map Name (DList RawName) -- | Counters to collect various statistics about meta variables etc. Only -- for current file. [stPostStatistics] :: PostScopeState -> !Statistics [stPostTCWarnings] :: PostScopeState -> ![TCWarning] [stPostMutualBlocks] :: PostScopeState -> !Map MutualId MutualBlock [stPostLocalBuiltins] :: PostScopeState -> !BuiltinThings PrimFun [stPostFreshMetaId] :: PostScopeState -> !MetaId [stPostFreshMutualId] :: PostScopeState -> !MutualId [stPostFreshProblemId] :: PostScopeState -> !ProblemId [stPostFreshCheckpointId] :: PostScopeState -> !CheckpointId [stPostFreshInt] :: PostScopeState -> !Int [stPostFreshNameId] :: PostScopeState -> !NameId [stPostAreWeCaching] :: PostScopeState -> !Bool [stPostPostponeInstanceSearch] :: PostScopeState -> !Bool [stPostConsideringInstance] :: 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. [stPostInstantiateBlocking] :: PostScopeState -> !Bool -- | Local partial definitions, to be stored in the Interface [stPostLocalPartialDefs] :: PostScopeState -> !Set QName -- | A part of the state which is not reverted when an error is thrown or -- the state is reset. data PersistentTCState PersistentTCSt :: !DecodedModules -> !BiMap RawTopLevelModuleName ModuleNameHash -> CommandLineOptions -> InteractionOutputCallback -> !Benchmark -> !Statistics -> !Maybe LoadedFileCache -> [Backend] -> PersistentTCState [stDecodedModules] :: PersistentTCState -> !DecodedModules -- | Module name hashes for top-level module names (and vice versa). [stPersistentTopLevelModuleNames] :: PersistentTCState -> !BiMap RawTopLevelModuleName ModuleNameHash [stPersistentOptions] :: PersistentTCState -> CommandLineOptions -- | Callback function to call when there is a response to give to the -- interactive frontend. See the documentation of -- InteractionOutputCallback. [stInteractionOutputCallback] :: PersistentTCState -> InteractionOutputCallback -- | Structure to track how much CPU time was spent on which Agda phase. -- Needs to be a strict field to avoid space leaks! [stBenchmark] :: PersistentTCState -> !Benchmark -- | 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 -- | Current backends with their options [stPersistBackends] :: PersistentTCState -> [Backend] type VisitedModules = Map TopLevelModuleName ModuleInfo type BuiltinThings pf = Map String (Builtin pf) type DisplayForms = HashMap QName [LocalDisplayForm] -- | The instance table is a Map associating to every name of -- recorddata typepostulate its list of instances type InstanceTable = Map QName (Set QName) -- | Used for meta-variables from other modules (and in Interfaces). type RemoteMetaStore = HashMap MetaId RemoteMetaVariable -- | Name disambiguation for the sake of highlighting. data DisambiguatedName DisambiguatedName :: NameKind -> QName -> DisambiguatedName type DisambiguatedNames = IntMap DisambiguatedName type ConcreteNames = Map Name [Name] -- | Used for meta-variables from the current module. type LocalMetaStore = Map MetaId MetaVariable -- | 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 newtype CheckpointId CheckpointId :: Int -> CheckpointId -- | 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) newtype MutualId MutId :: Int32 -> MutualId -- | 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 type DecodedModules = Map TopLevelModuleName ModuleInfo data LoadedFileCache LoadedFileCache :: !CachedTypeCheckLog -> !CurrentTypeCheckLog -> LoadedFileCache [lfcCached] :: LoadedFileCache -> !CachedTypeCheckLog [lfcCurrent] :: LoadedFileCache -> !CurrentTypeCheckLog -- | 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)] -- | 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)] -- | A complete log for a module will look like this: -- --
-- mkPi dom t = telePi (telFromList [dom]) t --mkPi :: Dom (ArgName, Type) -> Type -> Type lamView :: Term -> ([Arg ArgName], Term) -- | 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 :: forall t. (Coercible Term t, Apply t, EndoSubst t) => (Empty -> Term -> Elims -> Term) -> t -> Elims -> t -- | 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 -- | Eliminate a constructed term. conApp :: forall t. (Coercible t Term, Apply t) => (Empty -> Term -> Elims -> Term) -> ConHead -> ConInfo -> Elims -> Elims -> Term -- | If v is a record or constructed value, canProject f -- v returns its field f. canProject :: QName -> Term -> Maybe (Arg Term) relToDontCare :: LensRelevance a => a -> Term -> Term argToDontCare :: Arg Term -> Term -- |
-- (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 applyNLPatSubst :: TermSubst a => Substitution' NLPat -> a -> a -- | 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 -- | Everything will be an Abs. telePi_ :: Telescope -> Type -> Type namedTelVars :: Int -> Telescope -> [NamedArg DeBruijnPattern] telVars :: Int -> Telescope -> [Arg DeBruijnPattern] abstractArgs :: Abstract a => Args -> a -> a -- | The permutation should permute the corresponding context. -- (right-to-left list) renameP :: Subst a => Impossible -> Permutation -> a -> a applySubstTerm :: forall t. (Coercible t Term, EndoSubst t, Apply t) => Substitution' t -> t -> t levelTm :: Level -> Term applyNLSubstToDom :: SubstWith NLPat a => Substitution' NLPat -> Dom a -> Dom a fromPatternSubstitution :: PatternSubstitution -> Substitution applyPatSubst :: TermSubst a => PatternSubstitution -> a -> a usePatOrigin :: PatOrigin -> Pattern' a -> Pattern' a usePatternInfo :: PatternInfo -> Pattern' a -> Pattern' a -- |
-- 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 -- | 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 -- | Add given binding to the front of the telescope. absV :: Dom a -> ArgName -> TelV a -> TelV a -- | Turn a typed binding (x1 .. xn : A) into a telescope. bindsToTel' :: (Name -> a) -> [Name] -> Dom Type -> ListTel' a bindsToTel :: [Name] -> Dom Type -> ListTel bindsToTel'1 :: (Name -> a) -> List1 Name -> Dom Type -> ListTel' a bindsToTel1 :: List1 Name -> Dom Type -> ListTel -- | Turn a typed binding (x1 .. xn : A) into a telescope. namedBindsToTel :: [NamedArg Name] -> Type -> Telescope domFromNamedArgName :: NamedArg Name -> Dom () namedBindsToTel1 :: List1 (NamedArg Name) -> Type -> Telescope mkPiSort :: Dom Type -> Abs Type -> Sort unlamView :: [Arg ArgName] -> Term -> Term telePi' :: (Abs Type -> Abs Type) -> Telescope -> Type -> Type -- | Uses free variable analysis to introduce NoAbs bindings. telePi :: 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 -- | Given arguments vs : tel (vector typing), extract their -- individual types. Returns Nothing is tel is not long -- enough. typeArgsWithTel :: Telescope -> [Term] -> Maybe [Dom Type] -- | 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 -- | 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 ssort :: Level -> Type -- | Returns Left blocker for unknown (blocked) sorts, and -- otherwise returns Right s where s indicates the size -- and fibrancy. sizeOfSort :: Sort -> Either Blocker SizeOfSort isSmallSort :: Sort -> Bool fibrantLub :: IsFibrant -> IsFibrant -> IsFibrant -- | Compute the sort of a function type from the sorts of its domain and -- codomain. funSort' :: Sort -> Sort -> Either Blocker Sort -- | Given two levels a and b, compute a ⊔ b and -- return its canonical form. levelLub :: Level -> Level -> Level -- | Compute the sort of a pi type from the sorts of its domain and -- codomain. piSort' :: Dom Term -> Sort -> Abs Sort -> Either Blocker Sort levelMax :: Integer -> [PlusLevel] -> Level -- | 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 GHC.Base.Functor Agda.TypeChecking.Substitute.TelV instance GHC.Show.Show a => GHC.Show.Show (Agda.TypeChecking.Substitute.TelV a) instance (Agda.TypeChecking.Substitute.Class.TermSubst a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.TypeChecking.Substitute.TelV a) instance (Agda.TypeChecking.Substitute.Class.TermSubst a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.TypeChecking.Substitute.TelV a) instance GHC.Classes.Eq Agda.Syntax.Internal.Substitution instance GHC.Classes.Ord Agda.Syntax.Internal.Substitution instance GHC.Classes.Eq Agda.Syntax.Internal.Sort instance GHC.Classes.Ord Agda.Syntax.Internal.Sort instance GHC.Classes.Eq Agda.Syntax.Internal.Level instance GHC.Classes.Ord Agda.Syntax.Internal.Level instance GHC.Classes.Eq Agda.Syntax.Internal.PlusLevel instance GHC.Classes.Eq Agda.Syntax.Internal.NotBlocked instance GHC.Classes.Eq t => GHC.Classes.Eq (Agda.Syntax.Internal.Blocked t) instance GHC.Classes.Eq Agda.TypeChecking.Monad.Base.CandidateKind instance GHC.Classes.Eq Agda.TypeChecking.Monad.Base.Candidate instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Internal.Tele a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Internal.Tele a) instance GHC.Classes.Eq Agda.TypeChecking.Monad.Base.Section instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Substitute.TeleNoAbs Agda.Syntax.Internal.ListTel instance Agda.TypeChecking.Substitute.TeleNoAbs Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.Term instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.BraveTerm instance Agda.TypeChecking.Substitute.Class.Apply Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Substitute.Class.TermSubst a => Agda.TypeChecking.Substitute.Class.Apply (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.RewriteRule instance Agda.TypeChecking.Substitute.Class.Apply [Agda.TypeChecking.Positivity.Occurrence.Occurrence] instance Agda.TypeChecking.Substitute.Class.Apply [Agda.TypeChecking.Monad.Base.Polarity] instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.TypeChecking.Substitute.Class.Apply [Agda.Syntax.Common.NamedArg (Agda.Syntax.Internal.Pattern' a)] instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.Projection instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.ProjLams instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.PrimFun 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.ExtLamInfo instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Substitute.Class.Apply a => Agda.TypeChecking.Substitute.Class.Apply (Agda.TypeChecking.CompiledClause.WithArity a) instance Agda.TypeChecking.Substitute.Class.Apply a => Agda.TypeChecking.Substitute.Class.Apply (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.Substitute.Class.Apply Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply [t] instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply (Agda.Syntax.Internal.Blocked t) instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply (GHC.Maybe.Maybe t) instance Agda.TypeChecking.Substitute.Class.Apply t => Agda.TypeChecking.Substitute.Class.Apply (Data.Strict.Maybe.Maybe 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 v => Agda.TypeChecking.Substitute.Class.Apply (Data.HashMap.Internal.HashMap k v) 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.Utils.Permutation.DoDrop a => Agda.TypeChecking.Substitute.Class.Apply (Agda.Utils.Permutation.Drop a) instance Agda.Utils.Permutation.DoDrop a => Agda.TypeChecking.Substitute.Class.Abstract (Agda.Utils.Permutation.Drop a) instance Agda.TypeChecking.Substitute.Class.Apply Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Utils.Permutation.Permutation 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 Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Substitute.Class.Abstract Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.RewriteRule instance Agda.TypeChecking.Substitute.Class.Abstract [Agda.TypeChecking.Positivity.Occurrence.Occurrence] instance Agda.TypeChecking.Substitute.Class.Abstract [Agda.TypeChecking.Monad.Base.Polarity] instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.Projection instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.ProjLams instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.PrimFun 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 a => Agda.TypeChecking.Substitute.Class.Abstract (Agda.TypeChecking.CompiledClause.WithArity a) instance Agda.TypeChecking.Substitute.Class.Abstract a => Agda.TypeChecking.Substitute.Class.Abstract (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.Substitute.Class.Abstract t => Agda.TypeChecking.Substitute.Class.Abstract [t] instance Agda.TypeChecking.Substitute.Class.Abstract t => Agda.TypeChecking.Substitute.Class.Abstract (GHC.Maybe.Maybe 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 v => Agda.TypeChecking.Substitute.Class.Abstract (Data.HashMap.Internal.HashMap k v) instance Agda.TypeChecking.Substitute.Class.EndoSubst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Substitution' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.BraveTerm instance (GHC.Types.Coercible a Agda.Syntax.Internal.Term, Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b) => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Type'' a b) instance (GHC.Types.Coercible a Agda.Syntax.Internal.Term, Agda.TypeChecking.Substitute.Class.Subst a) => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Sort' a) 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 (Agda.Syntax.Internal.PlusLevel' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Pattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Abstract.ProblemEq instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.BraveTerm instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.NLPType instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.NLPSort instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.RewriteRule instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Blocked a) 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 (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst (Agda.Syntax.Internal.Elim.Elim' 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.Common.Named name a) instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.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 (GHC.Maybe.Maybe a) instance Agda.TypeChecking.Substitute.Class.Subst a => Agda.TypeChecking.Substitute.Class.Subst [a] instance (GHC.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 (Agda.Syntax.Common.WithHiding a) instance Agda.TypeChecking.Substitute.Class.Subst () instance (Agda.TypeChecking.Substitute.Class.Subst a, Agda.TypeChecking.Substitute.Class.Subst b, Agda.TypeChecking.Substitute.Class.SubstArg a GHC.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.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b, Agda.TypeChecking.Substitute.Class.SubstArg b GHC.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.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg b, Agda.TypeChecking.Substitute.Class.SubstArg b GHC.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg c, Agda.TypeChecking.Substitute.Class.SubstArg c GHC.Types.~ Agda.TypeChecking.Substitute.Class.SubstArg d) => Agda.TypeChecking.Substitute.Class.Subst (a, b, c, d) instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.EqualityTypeData instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn a => Agda.TypeChecking.Substitute.DeBruijn.DeBruijn (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.DeBruijnPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Position.Range instance GHC.Classes.Ord Agda.Syntax.Internal.PlusLevel instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Internal.Type' a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Syntax.Internal.Type' a) instance GHC.Classes.Eq Agda.Syntax.Internal.Term instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Internal.Pattern' a) instance GHC.Classes.Ord Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Internal.Abs a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Internal.Abs a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Internal.Elim.Elim' a) instance (Agda.TypeChecking.Substitute.Class.Subst a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Internal.Elim.Elim' a) 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) -- | 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! checkpoint :: (MonadDebug tcm, MonadTCM tcm, MonadFresh CheckpointId tcm, ReadTCState tcm) => Substitution -> tcm a -> tcm 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 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 -- | 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 -- | Add a let bound variable to the context addLetBinding' :: MonadAddContext m => Name -> Term -> Dom Type -> 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 withFreshName :: MonadAddContext m => Range -> ArgName -> (Name -> m a) -> m a -- | addCtx x arg cont add a variable to the context. -- -- Chooses an unused Name. -- -- Warning: Does not update module parameter substitution! addCtx :: (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, MonadAddContext n, MonadTransControl t, t n ~ m) => Name -> Term -> Dom Type -> m a -> m a -- | Update the context. Requires a substitution that transports things -- living in the old context to the new. updateContext :: (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => Substitution -> (Context -> Context) -> m a -> m a withFreshName :: (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 withFreshName_ :: MonadAddContext m => ArgName -> (Name -> m a) -> m a -- | Run the given TCM action, and register the given variable as being -- shadowed by all the names with the same root that are added to the -- context during this TCM action. withShadowingNameTCM :: Name -> TCM b -> TCM b 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 -- TypeError. Used when adding a user-provided, but already type -- checked, telescope to the context. newtype KeepNames a KeepNames :: a -> KeepNames a -- | 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, Subst b, MonadAddContext m) => Dom Type -> (a -> m b) -> Abs a -> m (Abs b) getLetBindings :: MonadTCM tcm => tcm [(Name, (Term, Dom Type))] -- | Add a let bound variable defaultAddLetBinding' :: (ReadTCState m, MonadTCEnv m) => Name -> Term -> Dom Type -> m a -> m a -- | Add a let bound variable addLetBinding :: MonadAddContext m => ArgInfo -> Name -> Term -> Type -> m a -> m a -- | Get the current context. getContext :: MonadTCEnv m => m Context -- | Get the size of the current context. getContextSize :: (Applicative m, MonadTCEnv m) => m Nat -- | Generate [var (n - 1), ..., var 0] for all declarations in -- the context. getContextArgs :: (Applicative m, MonadTCEnv m) => m Args -- | Generate [var (n - 1), ..., var 0] for all declarations in -- the context. getContextTerms :: (Applicative m, MonadTCEnv m) => m [Term] -- | Get the current context as a Telescope. getContextTelescope :: (Applicative m, MonadTCEnv m) => m Telescope -- | Get the names of all declarations in the context. getContextNames :: (Applicative m, MonadTCEnv m) => m [Name] -- | get type of bound variable (i.e. deBruijn index) lookupBV' :: MonadTCEnv m => Nat -> m (Maybe ContextEntry) lookupBV :: (MonadFail m, MonadTCEnv m) => Nat -> m (Dom (Name, Type)) domOfBV :: (Applicative m, MonadFail m, MonadTCEnv m) => Nat -> m (Dom Type) typeOfBV :: (Applicative m, MonadFail m, MonadTCEnv m) => Nat -> m Type nameOfBV' :: (Applicative m, MonadFail m, MonadTCEnv m) => Nat -> m (Maybe Name) nameOfBV :: (Applicative m, MonadFail 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 :: (MonadFail m, MonadTCEnv m) => Name -> m (Term, Dom Type) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.TypeChecking.Monad.Context.KeepNames GHC.Base.String, 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 (Agda.Syntax.Abstract.Name.Name, Agda.Syntax.Internal.Dom 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.Syntax.Internal.Dom (GHC.Base.String, 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 ([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 (GHC.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.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Monad.Context.AddContext GHC.Base.String instance Agda.TypeChecking.Monad.Context.AddContext Agda.Syntax.Internal.Telescope 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 (Control.Monad.Trans.Maybe.MaybeT 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 (Control.Monad.Trans.State.Lazy.StateT r m) instance (GHC.Base.Monoid w, Agda.TypeChecking.Monad.Context.MonadAddContext m) => Agda.TypeChecking.Monad.Context.MonadAddContext (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.Context.MonadAddContext m => Agda.TypeChecking.Monad.Context.MonadAddContext (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Context.MonadAddContext Agda.TypeChecking.Monad.Base.TCM module Agda.TypeChecking.Monad.Builtin class (Functor m, Applicative m, MonadFail m) => HasBuiltins m getBuiltinThing :: HasBuiltins m => String -> m (Maybe (Builtin PrimFun)) getBuiltinThing :: (HasBuiltins m, MonadTrans t, HasBuiltins n, t n ~ m) => String -> m (Maybe (Builtin PrimFun)) -- | The coinductive primitives. data CoinductionKit CoinductionKit :: QName -> QName -> QName -> CoinductionKit [nameOfInf] :: CoinductionKit -> QName [nameOfSharp] :: CoinductionKit -> QName [nameOfFlat] :: CoinductionKit -> QName -- | Sort primitives. data SortKit SortKit :: QName -> QName -> QName -> (IsFibrant -> QName) -> SortKit [nameOfSet] :: SortKit -> QName [nameOfProp] :: SortKit -> QName [nameOfSSet] :: SortKit -> QName [nameOfSetOmega] :: SortKit -> IsFibrant -> QName -- | Revert the EqualityView. -- -- Postcondition: type is reduced. class EqualityUnview a equalityUnview :: EqualityUnview a => a -> Type -- | Rewrite a literal to constructor form if possible. constructorForm :: HasBuiltins m => Term -> m Term getBuiltinName' :: HasBuiltins m => String -> m (Maybe QName) -- | Get the name of the equality type. primEqualityName :: TCM QName getName' :: HasBuiltins m => String -> m (Maybe QName) primConId :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIdElim :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIMin :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primINeg :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primGlue :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFaceForall :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primHComp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSubOut :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLockUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term litType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => Literal -> m Type primZero :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primWord64 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFloat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primChar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primQName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term setBuiltinThings :: BuiltinThings PrimFun -> TCM () bindBuiltinName :: String -> Term -> TCM () bindPrimitive :: String -> PrimFun -> TCM () -- | Add one (more) relation symbol to the rewrite relations. bindBuiltinRewriteRelation :: QName -> TCM () -- | Get the currently registered rewrite relation symbols. getBuiltinRewriteRelations :: HasBuiltins m => m (Maybe (Set QName)) getBuiltin :: (HasBuiltins m, MonadTCError m) => String -> m Term getBuiltin' :: HasBuiltins m => String -> m (Maybe Term) getPrimitive' :: HasBuiltins m => String -> m (Maybe PrimFun) getPrimitive :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => String -> m PrimFun getPrimitiveTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => String -> m Term getPrimitiveTerm' :: HasBuiltins m => String -> m (Maybe Term) getPrimitiveName' :: HasBuiltins m => String -> m (Maybe QName) getTerm' :: HasBuiltins m => String -> 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 => String -> String -> m Term constructorForm' :: Applicative m => m Term -> m Term -> Term -> m Term primInteger :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIntegerPos :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIntegerNegSuc :: (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 primBool :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primTrue :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFalse :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSigma :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primList :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNil :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primCons :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIO :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primMaybe :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNothing :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primJust :: (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 primIntervalUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInterval :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIZero :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primIOne :: (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 primIsOne :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primItIsOne :: (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 primSub :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSubIn :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primTrans :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primId :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term 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 primTranspProof :: (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_unglue :: (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_unglueU :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatPlus :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatMinus :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatTimes :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatDivSucAux :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primNatModSucAux :: (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 primSizeUniv :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSize :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeLt :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeInf :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSizeMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInf :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSharp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFlat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primEquality :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primRefl :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevel :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelZero :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelSuc :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primLevelMax :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSet :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primProp :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSetOmega :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primStrictSet :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primSSetOmega :: (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 primArgInfo :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primArgArgInfo :: (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 primAbs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAbsAbs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermVar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermLam :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermExtLam :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermCon :: (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 primAgdaTermLit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermUnsupported :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTermMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPart :: (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 primAgdaErrorPartPatt :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaErrorPartName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primHiding :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primHidden :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primInstance :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primVisible :: (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 primIrrelevant :: (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 primModality :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primModalityConstructor :: (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 primAssocRight :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAssocNon :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primPrecedence :: (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 primFixity :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primFixityFixity :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLiteral :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitNat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitWord64 :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitFloat :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitString :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitChar :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitQName :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaLitMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSort :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortSet :: (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 primAgdaSortInf :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaSortUnsupported :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinition :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionFunDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionDataDef :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaDefinitionRecordDef :: (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 primAgdaDefinitionDataConstructor :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaClause :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaClauseClause :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaClauseAbsurd :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPattern :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatCon :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaPatVar :: (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 primAgdaPatAbsurd :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCM :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMReturn :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMBind :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMUnify :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMTypeError :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMInferType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCheckType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMNormalise :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMReduce :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCatchError :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetContext :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMExtendContext :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMInContext :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMFreshName :: (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 primAgdaTCMDeclareData :: (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 primAgdaTCMGetType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetDefinition :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMQuoteTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMUnquoteTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMQuoteOmegaTerm :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMBlockOnMeta :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMCommit :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMIsMacro :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMFormatErrorParts :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDebugPrint :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWithNormalisation :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMWithReconsParams :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMOnlyReduceDefs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMDontReduceDefs :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMNoConstraints :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMRunSpeculative :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMExec :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term primAgdaTCMGetInstances :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Term -- | Tries to build a CoinductionKit. coinductionKit' :: TCM CoinductionKit coinductionKit :: TCM (Maybe CoinductionKit) -- | 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. TCMT), we report a type error rather than -- exploding. sortKit :: (HasBuiltins m, MonadTCError m, HasOptions m) => m SortKit -- | 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 getPrimName :: Term -> QName isPrimitive :: HasBuiltins m => String -> QName -> m Bool intervalSort :: Sort intervalView' :: HasBuiltins m => m (Term -> IntervalView) intervalView :: HasBuiltins m => Term -> m IntervalView intervalUnview :: HasBuiltins m => IntervalView -> m Term intervalUnview' :: HasBuiltins m => m (IntervalView -> Term) -- | 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) -- | Non dependent Path idViewAsPath :: HasBuiltins m => Type -> m PathView boldPathView :: Type -> PathView -- | Revert the PathView. -- -- Postcondition: type is reduced. pathUnview :: PathView -> Type conidView' :: HasBuiltins m => m (Term -> Term -> Maybe (Arg Term, Arg Term)) -- | Check whether the type is actually an equality (lhs ≡ rhs) and extract -- lhs, rhs, and their type. -- -- Precondition: type is reduced. equalityView :: Type -> TCM EqualityView -- | Primitives with typechecking constrants. constrainedPrims :: [String] getNameOfConstrained :: HasBuiltins m => String -> m (Maybe QName) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.TypeChecking.Monad.Base.BlockT m) instance Agda.TypeChecking.Monad.Builtin.EqualityUnview Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Monad.Builtin.EqualityUnview Agda.Syntax.Internal.EqualityTypeData 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 (Control.Monad.Trans.Reader.ReaderT e m) instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.State.Lazy.StateT s m) instance (Agda.TypeChecking.Monad.Builtin.HasBuiltins m, GHC.Base.Monoid w) => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.TypeChecking.Monad.Base.TCMT m) -- | 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 -- | 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) getBuiltinDefName :: HasBuiltins m => String -> m (Maybe QName) getBuiltinSize :: HasBuiltins m => m (Maybe QName, Maybe QName) isSizeNameTest :: (HasOptions m, HasBuiltins m) => m (QName -> Bool) isSizeNameTestRaw :: (HasOptions m, HasBuiltins m) => m (QName -> Bool) -- | Test whether OPTIONS --sized-types and whether the size built-ins are -- defined. haveSizedTypes :: TCM Bool -- | Test whether the SIZELT builtin is defined. haveSizeLt :: TCM Bool -- | Add polarity info to a SIZE builtin. builtinSizeHook :: String -> QName -> Type -> TCM () -- | 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, MonadTCEnv m, ReadTCState 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, MonadTCEnv m, ReadTCState 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.Show.Show Agda.TypeChecking.Monad.SizedTypes.BoundedSize instance GHC.Classes.Eq Agda.TypeChecking.Monad.SizedTypes.BoundedSize instance GHC.Show.Show Agda.TypeChecking.Monad.SizedTypes.ProjectedVar instance GHC.Show.Show Agda.TypeChecking.Monad.SizedTypes.DeepSizeView instance GHC.Base.Functor Agda.TypeChecking.Monad.SizedTypes.SizeViewComparable instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Monad.SizedTypes.DeepSizeView instance GHC.Classes.Eq Agda.TypeChecking.Monad.SizedTypes.ProjectedVar instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType a => Agda.TypeChecking.Monad.SizedTypes.IsSizeType (Agda.Syntax.Internal.Dom a) 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.TypeChecking.Monad.SizedTypes.IsSizeType Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType Agda.TypeChecking.Monad.Base.CompareAs -- | The scope monad with operations. module Agda.Syntax.Scope.Monad -- | To simplify interaction between scope checking and type checking (in -- particular when chasing imports), we use the same monad. type ScopeM = TCM printLocals :: Int -> String -> ScopeM () scopeWarning' :: CallStack -> DeclarationWarning' -> ScopeM () scopeWarning :: HasCallStack => DeclarationWarning' -> ScopeM () isDatatypeModule :: ReadTCState m => ModuleName -> m (Maybe DataOrRecordModule) 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 getNamedScope :: ModuleName -> ScopeM Scope getCurrentScope :: ScopeM Scope -- | 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 () -- | Apply a function to the scope map. modifyScopes :: (Map ModuleName Scope -> Map ModuleName Scope) -> ScopeM () -- | Apply a function to the given scope. modifyNamedScope :: ModuleName -> (Scope -> Scope) -> ScopeM () setNamedScope :: ModuleName -> Scope -> ScopeM () -- | Apply a monadic function to the top scope. modifyNamedScopeM :: ModuleName -> (Scope -> ScopeM (a, Scope)) -> ScopeM a -- | Apply a function to the current scope. modifyCurrentScope :: (Scope -> Scope) -> ScopeM () modifyCurrentScopeM :: (Scope -> ScopeM (a, Scope)) -> ScopeM a -- | Apply a function to the public or private name space. modifyCurrentNameSpace :: NameSpaceId -> (NameSpace -> NameSpace) -> ScopeM () setContextPrecedence :: PrecedenceStack -> ScopeM () withContextPrecedence :: ReadTCState m => Precedence -> m a -> m a getLocalVars :: ReadTCState m => m LocalVars modifyLocalVars :: (LocalVars -> LocalVars) -> ScopeM () setLocalVars :: LocalVars -> ScopeM () -- | Run a computation without changing the local variables. withLocalVars :: ScopeM a -> ScopeM a -- | 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 -- | Check that the newly added variable have unique names. withCheckNoShadowing :: ScopeM a -> ScopeM a checkNoShadowing :: LocalVars -> LocalVars -> ScopeM () getVarsToBind :: ScopeM LocalVars addVarToBind :: Name -> LocalVar -> ScopeM () -- | After collecting some variable names in the scopeVarsToBind, bind them -- all simultaneously. bindVarsToBind :: ScopeM () annotateDecls :: ReadTCState m => m [Declaration] -> m Declaration annotateExpr :: ReadTCState m => m Expr -> m Expr -- | 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 -- | 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 (Set Name) -> QName -> ScopeM ResolvedName tryResolveName :: forall m. (ReadTCState m, HasBuiltins m, MonadError AmbiguousNameReason m) => KindsOfNames -> Maybe (Set Name) -> QName -> m ResolvedName -- | Test if a given abstract name can appear with a suffix. Currently only -- true for the names of builtin sorts Set and Prop. canHaveSuffixTest :: HasBuiltins m => m (QName -> Bool) -- | Look up a module in the scope. resolveModule :: QName -> ScopeM AbstractModule -- | 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 [Occurrence]) -- | 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 -- | Get the notation of a name. The name is assumed to be in scope. getNotation :: QName -> Set Name -> ScopeM NewNotation -- | Bind a variable. bindVariable :: BindingSource -> Name -> Name -> ScopeM () -- | Temporarily unbind a variable. Used for non-recursive lets. unbindVariable :: Name -> ScopeM a -> ScopeM a -- | 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) -- | 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 -> Name -> QName -> ScopeM () -- | Bind a module name. bindModule :: Access -> Name -> ModuleName -> ScopeM () -- | Bind a qualified module name. Adds it to the imports field of the -- scope. bindQModule :: Access -> QName -> ModuleName -> ScopeM () -- | Clear the scope of any no names. stripNoNames :: ScopeM () type WSM = StateT ScopeMemo ScopeM 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) memoToScopeInfo :: ScopeMemo -> ScopeCopyInfo -- | 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) -- | Warn about useless fixity declarations in renaming -- directives. Monadic for the sake of error reporting. checkNoFixityInRenamingModule :: [Renaming] -> ScopeM () -- | Check that an import directive doesn't contain repeated names. verifyImportDirective :: [ImportedName] -> HidingDirective -> RenamingDirective -> ScopeM () -- | 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) -- | Translation of ImportDirective. mapImportDir :: (Ord n1, Ord m1) => [ImportedName' (n1, n2) (m1, m2)] -> [ImportedName' (n1, n2) (m1, m2)] -> ImportDirective' n1 m1 -> ImportDirective' n2 m2 -- | 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 -- | Create a ImportedNameMap. importedNameMapFromList :: (Ord n1, Ord m1) => [ImportedName' (n1, n2) (m1, m2)] -> ImportedNameMap n1 n2 m1 m2 -- | Apply a ImportedNameMap. lookupImportedName :: (Ord n1, Ord m1) => ImportedNameMap n1 n2 m1 m2 -> ImportedName' n1 m1 -> ImportedName' 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 data OpenKind LetOpenModule :: OpenKind TopOpenModule :: OpenKind noGeneralizedVarsIfLetOpen :: OpenKind -> Scope -> Scope -- | Open a module. openModule_ :: OpenKind -> QName -> ImportDirective -> ScopeM ImportDirective -- | Open a module, possibly given an already resolved module name. openModule :: OpenKind -> Maybe ModuleName -> QName -> ImportDirective -> ScopeM ImportDirective instance Agda.Syntax.Concrete.Fixity.MonadFixityError Agda.Syntax.Scope.Monad.ScopeM -- | Flattened scopes. module Agda.Syntax.Scope.Flat -- | Flattened scopes. data FlatScope -- | Compute a flattened scope. Only include unqualified names or names -- qualified by modules in the first argument. flattenScope :: [[Name]] -> ScopeInfo -> FlatScope -- | Compute all defined names in scope and their fixities/notations. Note -- that overloaded names (constructors) can have several -- fixities/notations. Then we mergeNotations. (See issue 1194.) getDefinedNames :: KindsOfNames -> FlatScope -> [[NewNotation]] -- | Compute all names (first component) and operators/notations (second -- component) in scope. localNames :: FlatScope -> ScopeM ([QName], [NewNotation]) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Flat.FlatScope -- | 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 an expression into a module application (an identifier plus a -- list of arguments). parseModuleApplication :: Expr -> ScopeM (QName, [NamedArg Expr]) -- | Parses a left-hand side, and makes sure that it defined the expected -- name. parseLHS :: QName -> Pattern -> ScopeM LHSCore -- | Parses a pattern. parsePattern :: Pattern -> ScopeM Pattern parsePatternSyn :: Pattern -> ScopeM Pattern instance GHC.Show.Show Agda.Syntax.Concrete.Operators.ExprKind instance GHC.Classes.Eq Agda.Syntax.Concrete.Operators.ExprKind instance Agda.Utils.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 a => Agda.TypeChecking.DropArgs.DropArgs (GHC.Maybe.Maybe a) instance Agda.TypeChecking.DropArgs.DropArgs Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.DropArgs.DropArgs Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.DropArgs.DropArgs Agda.Syntax.Internal.Clause instance Agda.TypeChecking.DropArgs.DropArgs Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.DropArgs.DropArgs Agda.Syntax.Internal.Term instance Agda.TypeChecking.DropArgs.DropArgs Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.DropArgs.DropArgs Agda.TypeChecking.Coverage.SplitTree.SplitTree 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 -> Map Int 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 GHC.Base.Monoid Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Base.Semigroup Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Show.Show Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Classes.Ord Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Classes.Eq Agda.Compiler.Treeless.Subst.UnderLambda instance GHC.Base.Monoid Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Base.Semigroup Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Show.Show Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Classes.Ord Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Classes.Eq Agda.Compiler.Treeless.Subst.SeqArg instance GHC.Show.Show Agda.Compiler.Treeless.Subst.Occurs instance GHC.Classes.Ord Agda.Compiler.Treeless.Subst.Occurs instance GHC.Classes.Eq Agda.Compiler.Treeless.Subst.Occurs instance Agda.Compiler.Treeless.Subst.HasFree a => Agda.Compiler.Treeless.Subst.HasFree (Agda.Compiler.Treeless.Subst.InSeq a) instance Agda.Compiler.Treeless.Subst.HasFree Agda.Syntax.Treeless.TTerm instance Agda.Compiler.Treeless.Subst.HasFree a => Agda.Compiler.Treeless.Subst.HasFree (Agda.Compiler.Treeless.Subst.Binder a) instance Agda.Compiler.Treeless.Subst.HasFree Agda.Syntax.Treeless.TAlt instance Agda.Compiler.Treeless.Subst.HasFree GHC.Types.Int instance Agda.Compiler.Treeless.Subst.HasFree a => Agda.Compiler.Treeless.Subst.HasFree [a] instance (Agda.Compiler.Treeless.Subst.HasFree a, Agda.Compiler.Treeless.Subst.HasFree b) => Agda.Compiler.Treeless.Subst.HasFree (a, b) instance GHC.Base.Semigroup Agda.Compiler.Treeless.Subst.Occurs instance GHC.Base.Monoid Agda.Compiler.Treeless.Subst.Occurs instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Treeless.TTerm instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Treeless.TTerm instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Treeless.TAlt module Agda.Compiler.Treeless.Pretty instance Agda.Utils.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 -- | Add a constant to the signature. Lifts the definition to top level. addConstant :: QName -> Definition -> TCM () -- | A combination of addConstant and defaultDefn. The -- Language does not need to be supplied. addConstant' :: QName -> ArgInfo -> QName -> Type -> Defn -> TCM () -- | Set termination info of a defined function symbol. setTerminates :: MonadTCState m => QName -> 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 () unionSignatures :: [Signature] -> Signature -- | Add a section to the signature. -- -- The current context will be stored as the cumulative module parameters -- for this section. addSection :: ModuleName -> TCM () -- | Sets the checkpoint for the given module to the current checkpoint. setModuleCheckpoint :: ModuleName -> 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 :: (Functor m, 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 :: (Functor m, 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 --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] -- | Find all names used (recursively) by display forms of a given name. chaseDisplayForms :: QName -> TCM (Set QName) -- | Check if a display form is looping. hasLoopingDisplayForm :: QName -> TCM Bool canonicalName :: HasConstInfo m => QName -> m QName sameDef :: HasConstInfo m => QName -> QName -> m (Maybe QName) -- | Can be called on either a (co)datatype, a record type or a -- (co)constructor. whatInduction :: MonadTCM tcm => QName -> tcm Induction -- | 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 -- | Standard eliminator for SigError. sigError :: (String -> a) -> a -> SigError -> a class (Functor m, Applicative m, MonadFail m, HasOptions m, MonadDebug m, MonadTCEnv m) => HasConstInfo m -- | 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) -- | Lookup the rewrite rules with the given head symbol. getRewriteRulesFor :: HasConstInfo m => QName -> m RewriteRules -- | Version that reports exceptions: getConstInfo' :: (HasConstInfo m, HasConstInfo n, MonadTrans t, m ~ t n) => QName -> m (Either SigError Definition) -- | Lookup the rewrite rules with the given head symbol. getRewriteRulesFor :: (HasConstInfo m, HasConstInfo n, MonadTrans t, m ~ t n) => QName -> 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 :: (ReadTCState m, HasConstInfo m) => QName -> m Definition defaultGetRewriteRulesFor :: (ReadTCState m, MonadTCEnv m) => QName -> m RewriteRules -- | Get the original name of the projection (the current one could be from -- a module application). getOriginalProjection :: HasConstInfo m => QName -> m QName defaultGetConstInfo :: (HasOptions m, MonadDebug m, MonadTCEnv m) => TCState -> TCEnv -> QName -> m (Either SigError Definition) getConInfo :: HasConstInfo m => ConHead -> m Definition -- | Look up the polarity of a definition. getPolarity :: HasConstInfo m => QName -> m [Polarity] -- | Look up polarity of a definition and compose with polarity represented -- by Comparison. getPolarity' :: 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] -- | Get argument occurrence info for argument i of definition -- d (never fails). getArgOccurrence :: 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 () 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 :: 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. setMutual :: QName -> [QName] -> TCM () -- | Check whether two definitions are mutually recursive. mutuallyRecursive :: QName -> QName -> TCM Bool -- | A functiondatarecord definition is nonRecursive 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 :: (Functor m, Applicative m, ReadTCState m, MonadTCEnv m) => QName -> m Nat freeVarsToApply :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => QName -> m Args getModuleFreeVars :: (Functor m, Applicative m, 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 :: (Functor m, Applicative m, 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 :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => Definition -> m Definition instantiateRewriteRule :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => RewriteRule -> m RewriteRule instantiateRewriteRules :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => RewriteRules -> m RewriteRules -- | Give the abstract view of a definition. makeAbstract :: 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 -- | Enter concrete or abstract mode depending on whether the given -- identifier is concrete or abstract. inConcreteOrAbstractMode :: (MonadTCEnv m, HasConstInfo m) => QName -> (Definition -> m a) -> m a -- | Check whether a name might have to be treated abstractly (either if -- we're inAbstractMode or it's not a local name). Returns true -- for things not declared abstract as well, but for those -- makeAbstract will have no effect. treatAbstractly :: MonadTCEnv m => QName -> m Bool -- | Andreas, 2015-07-01: If the current module is a weak suffix -- of the identifier module, we can see through its abstract definition -- if we are abstract. (Then treatAbstractly' returns -- False). -- -- If I am not mistaken, then we cannot see definitions in the -- where block of an abstract function from the perspective of -- the function, because then the current module is a strict prefix of -- the module of the local identifier. This problem is fixed by removing -- trailing anonymous module name parts (underscores) from both names. treatAbstractly' :: QName -> TCEnv -> Bool -- | 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? isProjection :: HasConstInfo m => QName -> m (Maybe Projection) isProjection_ :: Defn -> Maybe Projection -- | Is it the name of a non-irrelevant record projection? isRelevantProjection :: HasConstInfo m => QName -> m (Maybe Projection) 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 -- | 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.HasConstInfo (Agda.TypeChecking.Monad.Base.TCMT GHC.Types.IO) 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 (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.State.Lazy.StateT s m) instance (GHC.Base.Monoid w, Agda.TypeChecking.Monad.Signature.HasConstInfo m) => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Agda.TypeChecking.Monad.Base.BlockT 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, MonadReduce m, MonadTCEnv m, ReadTCState m) => PureTCM m instance Agda.TypeChecking.Monad.Pure.PureTCM Agda.TypeChecking.Monad.Base.TCM 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 (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 (Control.Monad.Trans.Reader.ReaderT r m) instance (Agda.TypeChecking.Monad.Pure.PureTCM m, GHC.Base.Monoid w) => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Agda.TypeChecking.Monad.Pure.PureTCM m => Agda.TypeChecking.Monad.Pure.PureTCM (Control.Monad.Trans.State.Lazy.StateT s m) module Agda.TypeChecking.Monad.MetaVars -- | Various kinds of metavariables. data MetaKind -- | Meta variables of record type. Records :: MetaKind -- | Meta variables of "hereditarily singleton" record type. SingletonRecords :: MetaKind -- | Meta variables of level type, if type-in-type is activated. Levels :: MetaKind -- | All possible metavariable kinds. allMetaKinds :: [MetaKind] 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 -- | 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, MonadMetaSolver m) => MetaId -> [Arg ArgName] -> Term -> m () -- | 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. etaExpandMeta :: MonadMetaSolver m => [MetaKind] -> 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, HasOptions 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 :: forall m a. 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 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, MonadTCEnv m, ReadTCState 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, MonadFail m, ReadTCState m) => a -> m Bool isInstantiatedMeta' :: (MonadFail m, 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 freshInteractionId :: MonadInteractionPoints m => m InteractionId freshInteractionId :: (MonadInteractionPoints m, MonadTrans t, MonadInteractionPoints n, t n ~ m) => m InteractionId modifyInteractionPoints :: MonadInteractionPoints m => (InteractionPoints -> InteractionPoints) -> m () modifyInteractionPoints :: (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 :: forall m. 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 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 :: (MonadFail m, ReadTCState m, MonadError TCErr m) => InteractionId -> m InteractionPoint -- | Get MetaId for an interaction point. Precondition: interaction -- point is connected. lookupInteractionId :: (MonadFail m, 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, MonadFail m, MonadError TCErr m) => InteractionId -> m Range -- | Get the Range' for a local meta-variable. getMetaRange :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m Range getInteractionScope :: (MonadDebug m, MonadFail m, ReadTCState m, MonadError TCErr m, MonadTCEnv m) => InteractionId -> m ScopeInfo withMetaInfo' :: (MonadTCEnv m, ReadTCState m, MonadTrace m) => MetaVariable -> m a -> m a withMetaInfo :: (MonadTCEnv m, ReadTCState m, MonadTrace m) => Closure Range -> m a -> m a withInteractionId :: (MonadDebug m, MonadFail m, ReadTCState m, MonadError TCErr m, MonadTCEnv m, MonadTrace m) => InteractionId -> m a -> m a withMetaId :: (HasCallStack, MonadDebug m, MonadTCEnv m, MonadTrace m, ReadTCState 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 => LocalMetaStore -> m (Set MetaId) -- | Thaw all open meta variables. unfreezeMetas :: TCM () isFrozen :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m Bool 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.Show.Show Agda.TypeChecking.Monad.MetaVars.MetaKind instance GHC.Enum.Bounded Agda.TypeChecking.Monad.MetaVars.MetaKind instance GHC.Enum.Enum Agda.TypeChecking.Monad.MetaVars.MetaKind instance GHC.Classes.Eq Agda.TypeChecking.Monad.MetaVars.MetaKind instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Type instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.Level instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta a => Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta [a] instance Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta a => Agda.TypeChecking.Monad.MetaVars.UnFreezeMeta (Agda.Syntax.Internal.Abs a) 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.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.IsInstantiatedMeta Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Internal.Term instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Internal.Level instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta Agda.Syntax.Internal.PlusLevel 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.Maybe.Maybe a) instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta a => Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta a => Agda.TypeChecking.Monad.MetaVars.IsInstantiatedMeta (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver m => Agda.TypeChecking.Monad.MetaVars.MonadMetaSolver (Control.Monad.Trans.Reader.ReaderT r m) -- | 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 => a -> AbsToCon (ConOfAbs a) bindToConcrete :: ToConcrete a => a -> (ConOfAbs a -> AbsToCon b) -> AbsToCon b -- | Translate something in a context of the given precedence. toConcreteCtx :: ToConcrete a => Precedence -> a -> AbsToCon (ConOfAbs a) abstractToConcrete_ :: (ToConcrete a, MonadAbsToCon m) => a -> m (ConOfAbs a) abstractToConcreteScope :: (ToConcrete a, MonadAbsToCon m) => ScopeInfo -> a -> m (ConOfAbs a) abstractToConcreteHiding :: (LensHiding i, ToConcrete a, MonadAbsToCon m) => i -> a -> m (ConOfAbs a) runAbsToCon :: MonadAbsToCon m => AbsToCon c -> m c data RangeAndPragma RangeAndPragma :: Range -> Pragma -> RangeAndPragma abstractToConcreteCtx :: (ToConcrete a, MonadAbsToCon m) => Precedence -> a -> m (ConOfAbs a) withScope :: ScopeInfo -> AbsToCon a -> AbsToCon a preserveInteractionIds :: AbsToCon a -> AbsToCon a -- | The function runAbsToCon can target any monad that satisfies -- the constraints of MonadAbsToCon. type MonadAbsToCon m = (MonadFresh NameId m, MonadInteractionPoints m, MonadStConcreteNames m, HasOptions m, PureTCM m, IsString (m Doc), Null (m Doc), Semigroup (m Doc)) data AbsToCon a data Env noTakenNames :: AbsToCon a -> AbsToCon a lookupQName :: AllowAmbiguousNames -> QName -> AbsToCon QName instance Data.Traversable.Traversable Agda.Syntax.Translation.AbstractToConcrete.MaybeSection instance Data.Foldable.Foldable Agda.Syntax.Translation.AbstractToConcrete.MaybeSection instance GHC.Base.Functor Agda.Syntax.Translation.AbstractToConcrete.MaybeSection instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Translation.AbstractToConcrete.MaybeSection a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Translation.AbstractToConcrete.MaybeSection a) instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Translation.AbstractToConcrete.MaybeSection a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Expr instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.FreshenName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.BindingPattern 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 Agda.Syntax.Abstract.Pattern 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.Declaration instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.RangeAndPragma instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete () instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete GHC.Types.Bool 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 (Agda.Utils.List1.List1 a) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Data.Either.Either a1 a2) 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 a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.WithHiding a) 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.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.BindName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Scope.Base.AbstractName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Scope.Base.ResolvedName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Concrete.FieldAssignment' a) 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.Abstract.LamBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.RHS 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 (GHC.Maybe.Maybe Agda.Syntax.Abstract.BindName) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (GHC.Maybe.Maybe Agda.Syntax.Abstract.Name.QName) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Constr Agda.Syntax.Abstract.Constructor) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a, Agda.Syntax.Translation.AbstractToConcrete.ConOfAbs a GHC.Types.~ Agda.Syntax.Concrete.LHS) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Abstract.Clause' a) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.ModuleApplication instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.SpineLHS 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 (GHC.Maybe.Maybe Agda.Syntax.Abstract.Pattern) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Common.InteractionId instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.TypeChecking.Monad.Base.NamedMeta instance GHC.Base.Functor Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance GHC.Base.Applicative Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance GHC.Base.Monad Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Control.Monad.Fail.MonadFail Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Control.Monad.Reader.Class.MonadReader Agda.Syntax.Translation.AbstractToConcrete.Env Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Base.ReadTCState Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Base.MonadStConcreteNames Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Builtin.HasBuiltins Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.Interaction.Options.HasOptions.HasOptions Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Context.MonadAddContext Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Base.MonadReduce Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Pure.PureTCM Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.Base.MonadFresh Agda.Syntax.Common.NameId Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Agda.TypeChecking.Monad.MetaVars.MonadInteractionPoints Agda.Syntax.Translation.AbstractToConcrete.AbsToCon instance Data.String.IsString (Agda.Syntax.Translation.AbstractToConcrete.AbsToCon Text.PrettyPrint.HughesPJ.Doc) instance Agda.Utils.Null.Null (Agda.Syntax.Translation.AbstractToConcrete.AbsToCon Text.PrettyPrint.HughesPJ.Doc) instance GHC.Base.Semigroup (Agda.Syntax.Translation.AbstractToConcrete.AbsToCon Text.PrettyPrint.HughesPJ.Doc) 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 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 module Agda.TypeChecking.Serialise.Instances.Internal instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Dom a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Signature instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Section instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.Permutation.Drop a) 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.Syntax.Internal.DataOrRecord instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Internal.Type' a) 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.Term instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Level instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.IsFibrant instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.DisplayForm 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.TypeChecking.Monad.Base.CheckpointId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.MutualId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.CompKit instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.NotBlocked instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Blocked_ instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.NLPType instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.NLPSort instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.RewriteRule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Projection instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ProjLams instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Polarity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.IsForced instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.NumGeneralizableArgs instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.DoGeneralize instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.EtaEquality instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.ProjectionLikenessMissing instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Coverage.SplitTree.LazySplit 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 Agda.TypeChecking.Monad.Base.FunctionFlag instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.CompiledClause.WithArity a) 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.CompiledClause.CompiledClauses 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.TermHead instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Internal.Clause 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.PatternInfo 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 a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.TypeChecking.Monad.Base.Builtin 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.Instantiation instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Comparison 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.Monad.Base.RemoteMetaVariable module Agda.TypeChecking.Serialise.Instances.Errors instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.TCWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Warning 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.TypeChecking.Monad.Base.RecordFieldWarning 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.Interaction.Library.Base.LibWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.LibWarning' instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.ExecutablesFile instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Library.Base.LibPositionInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Text.PrettyPrint.HughesPJ.Doc instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Base.InfectiveCoinfective instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Base.PragmaOptions instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.ProfileOptions.ProfileOptions instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.ProfileOptions.ProfileOption instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Glyph.UnicodeOrAscii instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Base.ConfluenceCheck instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Warnings.WarningMode instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Options.Warnings.WarningName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Termination.CutOff.CutOff 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 -- | Encodes something. 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. -- -- An uncompressed bytestring corresponding to the encoded interface is -- returned. encodeFile :: FilePath -> Interface -> TCM ByteString encodeInterface :: Interface -> TCM Encoded -- | Decodes an uncompressed bytestring (without extra hashes or magic -- numbers). The result depends on the include path. -- -- Returns Nothing if a decoding error is encountered. decode :: EmbPrj a => ByteString -> TCM (Maybe a) decodeFile :: FilePath -> TCM (Maybe Interface) -- | Decodes an interface. The result depends on the include path. -- -- Returns Nothing if the file does not start with the right magic -- number or some other decoding error is encountered. decodeInterface :: ByteString -> TCM (Maybe Interface) decodeHashes :: ByteString -> Maybe (Hash, Hash) class Typeable a => EmbPrj a instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Agda.TypeChecking.Serialise.ListLike a) module Agda.TypeChecking.Rewriting.Clause -- | Get all the clauses of a definition and convert them to rewrite rules. getClausesAsRewriteRules :: (HasConstInfo m, MonadFresh NameId m) => QName -> m [RewriteRule] -- | 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 :: QName -> QName -> Clause -> Maybe RewriteRule class ToNLPat a b toNLPat :: ToNLPat a b => a -> b toNLPat :: (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 [a] [b] 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 (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.TypeChecking.Monad.Base.NLPat) instance Agda.TypeChecking.Rewriting.Clause.ToNLPat (Agda.Syntax.Common.NamedArg Agda.Syntax.Internal.DeBruijnPattern) (Agda.Syntax.Internal.Elim.Elim' Agda.TypeChecking.Monad.Base.NLPat) module Agda.TypeChecking.Reduce.Monad constructorForm :: HasBuiltins m => Term -> m Term enterClosure :: LensClosure a c => c -> (a -> ReduceM b) -> ReduceM 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.Context.MonadAddContext Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Signature.HasConstInfo 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 -- | 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' :: forall e. Pattern' e -> TCM (Pattern' e) class ExpandPatternSynonyms a expandPatternSynonyms :: ExpandPatternSynonyms a => a -> TCM a expandPatternSynonyms :: (ExpandPatternSynonyms a, Traversable f, ExpandPatternSynonyms b, f b ~ a) => a -> TCM a instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (GHC.Maybe.Maybe 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 (Agda.Syntax.Common.Arg 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 a => Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.TypeChecking.Patterns.Abstract.ExpandPatternSynonyms (Agda.Syntax.Abstract.Pattern' e) 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 Agda.Syntax.Internal.Term instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Level instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Type instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Sort 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 t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta [t] instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta t => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (GHC.Maybe.Maybe t) 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 (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.Syntax.Internal.Elim instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta a => Agda.TypeChecking.MetaVars.Mention.MentionsMeta (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.MetaVars.Mention.MentionsMeta Agda.TypeChecking.Monad.Base.CompareAs -- | 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 :: (MonadTCEnv m, HasConstInfo m, HasOptions m, TermLike a) => a -> m a etaOnce :: (MonadTCEnv m, HasConstInfo m, HasOptions m) => Term -> m Term -- | If record constructor, call eta-contraction function. etaCon :: (MonadTCEnv m, HasConstInfo m, HasOptions 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, HasConstInfo 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 -- | Instantiates everything except for definitions in the signature. instantiateFullExceptForDefinitions :: MonadReduce m => Interface -> m Interface -- | 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 :: forall m. PureTCM m => QName -> Elims -> m (Reduced () Term) -- | Specialized version to put in boot file. reduceDefCopyTCM :: QName -> Elims -> TCM (Reduced () 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 :: Bool -> (Term -> ReduceM (Blocked Term)) -> Term -> QName -> Elims -> ReduceM (Blocked Term) unfoldDefinitionStep :: Bool -> Term -> QName -> Elims -> ReduceM (Reduced (Blocked Term) Term) -- | Unfold a single inlined function. unfoldInlined :: PureTCM m => Term -> m 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) -- | 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.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull [t] 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 (Data.Map.Internal.Map k t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (GHC.Maybe.Maybe 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 (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Elim.Elim' t) 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.TypeChecking.CompiledClause.WithArity t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.IPBoundary' t) 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 GHC.Types.Bool instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Types.Char instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Types.Int instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Scope.Base.Scope instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Substitution instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Pattern' a) 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 e) => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Dom' t e) 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.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Signature instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Section 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.TypeChecking.Monad.Base.Definition instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.NLPType instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.NLPSort instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.RewriteRule 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 Agda.TypeChecking.Monad.Base.Defn instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.ExtLamInfo instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.System instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.FunctionInverse instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.CompiledClause.Case a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Clause instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Instantiation instance Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Judgement Agda.Syntax.Common.MetaId) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.RemoteMetaVariable instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Monad.Base.Interface 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 Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise [t] 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 (GHC.Maybe.Maybe 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 (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.TypeChecking.Monad.Base.IPBoundary' t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Common.WithHiding t) 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 GHC.Types.Bool instance Agda.TypeChecking.Reduce.Normalise GHC.Types.Char instance Agda.TypeChecking.Reduce.Normalise GHC.Types.Int instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.PlusLevel 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 t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Dom t) instance Agda.TypeChecking.Reduce.Normalise a => Agda.TypeChecking.Reduce.Normalise (Agda.TypeChecking.Monad.Base.Closure a) 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.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Reduce.Normalise a => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify [t] 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 (GHC.Maybe.Maybe 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 (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.TypeChecking.Monad.Base.IPBoundary' t) 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 GHC.Types.Bool instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.PlusLevel 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.Internal.Dom t) instance Agda.TypeChecking.Reduce.Simplify a => Agda.TypeChecking.Reduce.Simplify (Agda.TypeChecking.Monad.Base.Closure a) 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.TypeChecking.Monad.Base.ProblemConstraint instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Reduce.Simplify Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Type instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Elim instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.PlusLevel 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 [t] instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (GHC.Maybe.Maybe t) instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (Agda.Syntax.Internal.Dom t) 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.DeBruijnPattern instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Reduce a => Agda.TypeChecking.Reduce.Reduce (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Reduce e => Agda.TypeChecking.Reduce.Reduce (Data.Map.Internal.Map k e) instance Agda.TypeChecking.Reduce.Reduce Agda.TypeChecking.Monad.Base.Candidate 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.IsMeta Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.Sort' a) instance Agda.TypeChecking.Reduce.IsMeta a => Agda.TypeChecking.Reduce.IsMeta (Agda.Syntax.Internal.Type'' t a) 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.Common.Arg 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.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate [t] 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 (GHC.Maybe.Maybe 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 (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 t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Elim.Elim' t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Tele t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.TypeChecking.Monad.Base.IPBoundary' t) 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 Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Type' t) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.PlusLevel' 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.Syntax.Internal.Sort instance (Agda.TypeChecking.Reduce.Instantiate t, Agda.TypeChecking.Reduce.Instantiate e) => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Dom' t e) 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.Constraint instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.EqualityView module Agda.TypeChecking.Telescope -- | Flatten telescope: (Γ : Tel) -> [Type Γ] flattenTel :: TermSubst a => Tele (Dom a) -> [Dom a] -- | Order a flattened telescope in the correct dependeny 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] teleArgs :: DeBruijn a => Tele (Dom t) -> [Arg a] 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. 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! renaming _ (flipP perm) -- = [error, var 1, var 0] -- The correct renaming! 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 -- | Recursively computes dependencies of a set of variables in a given -- telescope. Any dependencies outside of the telescope are ignored. varDependencies :: Telescope -> IntSet -> IntSet -- | 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. varDependents :: Telescope -> IntSet -> IntSet -- | A telescope split in two. data SplitTel SplitTel :: Telescope -> Telescope -> Permutation -> SplitTel [firstPart] :: SplitTel -> Telescope [secondPart] :: SplitTel -> Telescope -- | The permutation 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 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 -- |
-- 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. Precondition: the type is of the form -- Γ → D vs and the vs are in normal form. computeForcingAnnotations :: QName -> Type -> TCM [IsForced] isForced :: IsForced -> Bool nextIsForced :: [IsForced] -> (IsForced, [IsForced]) instance Agda.TypeChecking.Forcing.ForcedVariables a => Agda.TypeChecking.Forcing.ForcedVariables [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 (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Forcing.ForcedVariables Agda.Syntax.Internal.Term -- | 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.SubstWithOrigin a => Agda.TypeChecking.DisplayForm.SubstWithOrigin [a] 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 (Agda.Syntax.Common.Arg Agda.Syntax.Internal.Term) instance Agda.TypeChecking.DisplayForm.SubstWithOrigin Agda.Syntax.Internal.Term instance Agda.TypeChecking.DisplayForm.SubstWithOrigin Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Common.Arg Agda.TypeChecking.Monad.Base.DisplayTerm) instance Agda.TypeChecking.DisplayForm.Match a => Agda.TypeChecking.DisplayForm.Match [a] 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.Term instance Agda.TypeChecking.DisplayForm.Match Agda.Syntax.Internal.Sort instance Agda.TypeChecking.DisplayForm.Match Agda.Syntax.Internal.Level module Agda.TypeChecking.DeadCode -- | Run before serialisation to remove any definitions and meta-variables -- that are not reachable from the module's public interface. -- -- Things that are reachable only from warnings are removed. eliminateDeadCode :: BuiltinThings PrimFun -> DisplayForms -> Signature -> LocalMetaStore -> TCM (DisplayForms, Signature, RemoteMetaStore) 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: -- --
-- >>> [1,2,3] <> [4,5,6] -- [1,2,3,4,5,6] --(<>) :: Semigroup a => a -> a -> a infixr 6 <> -- | The function runAbsToCon can target any monad that satisfies -- the constraints of MonadAbsToCon. type MonadAbsToCon 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.PrettyTCMWithNode Agda.TypeChecking.Positivity.Occurrence.Occurrence 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.TypeChecking.Pretty.PrettyContext instance Agda.TypeChecking.Pretty.PrettyTCM GHC.Base.String instance Agda.TypeChecking.Pretty.PrettyTCM GHC.Types.Bool instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Concrete.Name.Name instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Concrete.Name.QName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.TopLevelModuleName.TopLevelModuleName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Comparison instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Literal.Literal instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Nat instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.ProblemId instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Position.Range instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.CheckpointId instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM [a] instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (GHC.Maybe.Maybe a) 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.Term instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Type instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Translation.InternalToAbstract.NamedClause instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Abstract.Name.QNamed Agda.Syntax.Internal.Clause) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Level instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.Named_ Agda.Syntax.Internal.Term) 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.Types.Bool) 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 (Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.ContextEntry instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Utils.Permutation.Permutation instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Polarity instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.IsForced instance (Agda.Utils.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.Clause instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.Judgement a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.NamedMeta instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Blocked a) 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 Agda.Syntax.Internal.Elim instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Monad.Base.MaybeReduced a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Expr instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.TypedBinding instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Pattern instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Relevance instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Quantity instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Common.Modality instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Blockers.Blocker instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.CompareAs instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.TypeCheckingProblem instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Common.WithHiding a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Scope.Base.AbstractName instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Pattern' a) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Elim.Elim' Agda.TypeChecking.Monad.Base.DisplayTerm) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.NLPType instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.NLPSort instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Elim.Elim' Agda.TypeChecking.Monad.Base.NLPat) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.Syntax.Internal.Type' Agda.TypeChecking.Monad.Base.NLPat) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.RewriteRule instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Coverage.SplitTree.SplitTag instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Candidate instance GHC.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 telViewPathBoundaryP'ed 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 -> [(Int, (Term, Term))] -> 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, MonadReduce m) => Type -> m Bool instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn a => Agda.TypeChecking.Telescope.Path.IApplyVars (Agda.Syntax.Internal.Pattern' a) 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] -- | 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 -- | Error messages produced by the constraint simplification monad. type Error = TCM Doc type CTrans r f = Constraint' r f -> Either Error [Constraint' r f] -- | Returns an error message if we have a contradictory constraint. simplify1 :: (Pretty f, Pretty r, 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) instance GHC.Enum.Enum Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Num.Num Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Offset instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Rigid instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Rigid instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Flex instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Flex instance Data.Traversable.Traversable (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid) instance Data.Foldable.Foldable (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid) instance GHC.Base.Functor (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid) instance (GHC.Classes.Ord rigid, GHC.Classes.Ord flex) => GHC.Classes.Ord (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance (GHC.Classes.Eq rigid, GHC.Classes.Eq flex) => GHC.Classes.Eq (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance (GHC.Show.Show rigid, GHC.Show.Show flex) => GHC.Show.Show (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Enum.Enum Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Enum.Bounded Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Cmp instance Data.Traversable.Traversable (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid) instance Data.Foldable.Foldable (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid) instance GHC.Base.Functor (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid) instance (GHC.Show.Show rigid, GHC.Show.Show flex) => GHC.Show.Show (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid flex) instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Polarity instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.Syntax.Polarity instance Agda.Utils.Null.Null (Agda.TypeChecking.SizedTypes.Syntax.Solution rigid flex) instance (GHC.Show.Show flex, GHC.Show.Show rigid) => GHC.Show.Show (Agda.TypeChecking.SizedTypes.Syntax.Solution rigid flex) instance Agda.TypeChecking.SizedTypes.Syntax.Flexs a => Agda.TypeChecking.SizedTypes.Syntax.Flexs [a] instance GHC.Classes.Ord flex => Agda.TypeChecking.SizedTypes.Syntax.Flexs (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' rigid flex) instance GHC.Classes.Ord flex => Agda.TypeChecking.SizedTypes.Syntax.Flexs (Agda.TypeChecking.SizedTypes.Syntax.Constraint' rigid flex) instance Agda.TypeChecking.SizedTypes.Syntax.Rigids a => Agda.TypeChecking.SizedTypes.Syntax.Rigids [a] instance GHC.Classes.Ord r => Agda.TypeChecking.SizedTypes.Syntax.Rigids (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance GHC.Classes.Ord r => Agda.TypeChecking.SizedTypes.Syntax.Rigids (Agda.TypeChecking.SizedTypes.Syntax.Constraint' r f) 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) instance GHC.Classes.Ord f => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance GHC.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.Classes.Ord f => Agda.TypeChecking.SizedTypes.Syntax.Substitute r f (Agda.TypeChecking.SizedTypes.Syntax.Solution r f) instance (Agda.Utils.Pretty.Pretty r, Agda.Utils.Pretty.Pretty f) => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.Solution r f) instance Agda.Utils.Pretty.Pretty flex => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.PolarityAssignment flex) instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Polarity instance (Agda.Utils.Pretty.Pretty r, Agda.Utils.Pretty.Pretty f) => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.Constraint' r f) instance Agda.TypeChecking.SizedTypes.Utils.Dioid Agda.TypeChecking.SizedTypes.Syntax.Cmp instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.Syntax.Cmp instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.Syntax.Cmp instance Agda.TypeChecking.SizedTypes.Utils.Top Agda.TypeChecking.SizedTypes.Syntax.Cmp instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Cmp 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.Utils.Pretty.Pretty r, Agda.Utils.Pretty.Pretty f) => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) instance GHC.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Flex instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Flex instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.SizedTypes.Syntax.Flex instance GHC.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Rigid instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Rigid instance GHC.Show.Show Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.Utils.Plus Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.Syntax.Offset 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 :: forall n a. (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 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' :: forall r f. (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' :: forall r f. (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, Show r, Show 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.Show.Show Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Show.Show Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance (GHC.Classes.Ord rigid, GHC.Classes.Ord flex) => GHC.Classes.Ord (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance (GHC.Classes.Eq rigid, GHC.Classes.Eq flex) => GHC.Classes.Eq (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance (GHC.Show.Show rigid, GHC.Show.Show flex) => GHC.Show.Show (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance GHC.Classes.Eq f => Agda.TypeChecking.SizedTypes.WarshallSolver.SetToInfty f (Agda.TypeChecking.SizedTypes.WarshallSolver.Node r f) instance GHC.Classes.Eq f => Agda.TypeChecking.SizedTypes.WarshallSolver.SetToInfty f (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (GHC.Classes.Ord r, GHC.Classes.Ord f) => Agda.TypeChecking.SizedTypes.WarshallSolver.SetToInfty f (Agda.TypeChecking.SizedTypes.WarshallSolver.ConGraph r f) instance (GHC.Classes.Ord r, GHC.Classes.Ord f, Agda.TypeChecking.SizedTypes.WarshallSolver.Negative a) => Agda.TypeChecking.SizedTypes.WarshallSolver.Negative (Agda.TypeChecking.SizedTypes.WarshallSolver.Graphs r f a) instance (GHC.Classes.Ord r, GHC.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 a => Agda.TypeChecking.SizedTypes.WarshallSolver.Negative (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (GHC.Classes.Ord r, GHC.Classes.Ord f, Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice a) => Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (GHC.Classes.Ord r, GHC.Classes.Ord f, Agda.TypeChecking.SizedTypes.Utils.Top a) => Agda.TypeChecking.SizedTypes.Utils.Top (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (GHC.Classes.Ord r, GHC.Classes.Ord f, Agda.TypeChecking.SizedTypes.Utils.Dioid a) => Agda.TypeChecking.SizedTypes.Utils.Dioid (Agda.TypeChecking.SizedTypes.WarshallSolver.Edge' r f a) instance (Agda.Utils.Pretty.Pretty rigid, Agda.Utils.Pretty.Pretty flex) => Agda.Utils.Pretty.Pretty (Agda.TypeChecking.SizedTypes.WarshallSolver.Node rigid flex) instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.TypeChecking.SizedTypes.Utils.Top Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance Agda.TypeChecking.SizedTypes.Utils.Dioid Agda.TypeChecking.SizedTypes.WarshallSolver.Label 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.WarshallSolver.Negative GHC.Types.Int instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative Agda.TypeChecking.SizedTypes.Syntax.Offset instance Agda.TypeChecking.SizedTypes.WarshallSolver.Negative Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Classes.Ord Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.Utils.MeetSemiLattice Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.Utils.Top Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Enum.Enum Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Num.Num Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.Utils.Plus Agda.TypeChecking.SizedTypes.WarshallSolver.Weight Agda.TypeChecking.SizedTypes.Syntax.Offset Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance Agda.TypeChecking.SizedTypes.Utils.Dioid 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.Weight (Agda.TypeChecking.SizedTypes.Syntax.SizeExpr' r f) module Agda.TypeChecking.Rules.Display checkDisplayPragma :: QName -> [NamedArg Pattern] -> Expr -> TCM () module Agda.TypeChecking.Pretty.Call sayWhere :: MonadPretty m => HasRange a => a -> m Doc -> m Doc sayWhen :: MonadPretty m => Range -> Maybe (Closure Call) -> m Doc -> m Doc instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.CallInfo instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Monad.Base.Call -- | 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 -- | 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 -- | (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, LensRelevance r) => r -> tcm a -> tcm a -- | Sets the current quantity (unless the given quantity is 1). applyQuantityToContext :: (MonadTCEnv tcm, LensQuantity q) => q -> tcm a -> tcm a -- | Apply quantity q the the quantity annotation of the -- (typing/equality) judgement. This is part of the work done when going -- into a q-context. -- -- Precondition: Quantity /= Quantity1 applyQuantityToJudgementOnly :: MonadTCEnv tcm => Quantity -> 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 -- | (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, LensModality m) => m -> 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. -- -- This function might also do something for other modalities, but not -- for quantities. -- -- Precondition: Modality /= Relevant applyModalityToContextOnly :: MonadTCEnv tcm => Modality -> tcm a -> tcm a -- | Apply modality m the the modality annotation of the -- (typing/equality) judgement. This is part of the work done when going -- into a m-context. -- -- Precondition: Modality /= Relevant applyModalityToJudgementOnly :: MonadTCEnv tcm => Modality -> tcm a -> tcm a -- | Like applyModalityToContext, but only act on context (for -- Relevance) if --irrelevant-projections. See issue #2170. applyModalityToContextFunBody :: (MonadTCM tcm, LensModality r) => 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 -- | 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, MonadTCEnv m, MonadAddContext m, MonadDebug 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, ReadTCState m, HasConstInfo m, MonadTCEnv m, MonadAddContext m, MonadDebug m, MonadReduce m, MonadError Blocker m) => Modality -> a -> m Bool usableModAbs :: (Subst a, MonadAddContext m, UsableModality a, ReadTCState m, 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 () -- | 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 -- | Is a type fibrant (i.e. Type, Prop)? isFibrant :: (LensSort a, PureTCM m, MonadBlock m) => a -> m Bool -- | Cofibrant types are those that could be the domain of a fibrant pi -- type. (Notion by C. Sattler). isCoFibrantSort :: (LensSort a, PureTCM m, MonadBlock m) => a -> m Bool instance Agda.TypeChecking.Irrelevance.UsableModality Agda.Syntax.Internal.Term instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableModality (Agda.Syntax.Internal.Type' a) instance Agda.TypeChecking.Irrelevance.UsableModality Agda.Syntax.Internal.Sort 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 a, Agda.TypeChecking.Irrelevance.UsableModality b) => Agda.TypeChecking.Irrelevance.UsableModality (a, b) instance Agda.TypeChecking.Irrelevance.UsableModality a => Agda.TypeChecking.Irrelevance.UsableModality (Agda.Syntax.Internal.Elim.Elim' a) 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.UsableRelevance Agda.Syntax.Internal.Term instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Type' a) instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.Level instance Agda.TypeChecking.Irrelevance.UsableRelevance Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Irrelevance.UsableRelevance a => Agda.TypeChecking.Irrelevance.UsableRelevance [a] 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.Elim.Elim' 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.Substitute.Class.Subst a, Agda.TypeChecking.Irrelevance.UsableRelevance a) => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Abs a) module Agda.TypeChecking.Records mkCon :: ConHead -> ConInfo -> Args -> Term -- | Order the fields of a record construction. orderFields :: forall a. 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 :: forall a. 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 :: forall a. 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 :: forall a. 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 :: forall a. 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 :: forall a. HasRange a => QName -> (Name -> a) -> [FieldAssignment' a] -> [Arg Name] -> TCM [NamedArg a] -- | Get the definition for a record. Throws an exception if the name does -- not refer to a record or the record is abstract. getRecordDef :: (HasConstInfo m, ReadTCState m, MonadError TCErr m) => QName -> m Defn -- | Get the record name belonging to a field name. getRecordOfField :: QName -> TCM (Maybe QName) -- | Get the field names of a record. getRecordFieldNames :: (HasConstInfo m, ReadTCState m, MonadError TCErr m) => QName -> m [Dom Name] getRecordFieldNames_ :: (HasConstInfo m, ReadTCState m) => QName -> m (Maybe [Dom Name]) recordFieldNames :: Defn -> [Dom Name] -- | Find all records with at least the given fields. findPossibleRecords :: [Name] -> TCM [QName] -- | Get the field types of a record. getRecordFieldTypes :: QName -> TCM Telescope -- | Get the field names belonging to a record type. getRecordTypeFields :: Type -> TCM [Dom QName] -- | Returns the given record type's constructor name (with an empty -- range). getRecordConstructor :: (HasConstInfo m, ReadTCState m, MonadError TCErr m) => QName -> m ConHead -- | Check if a name refers to a record. If yes, return record definition. isRecord :: HasConstInfo m => QName -> m (Maybe Defn) -- | 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 :: PureTCM m => Type -> m (Maybe (QName, Args, Defn)) -- | 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 :: PureTCM m => Type -> m (Either (Blocked Type) (QName, Args, Defn)) -- | Get the original projection info for name. origProjection :: 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) -- | 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] -- | 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 :: HasConstInfo m => QName -> m Bool isEtaCon :: HasConstInfo m => QName -> m Bool -- | Going under one of these does not count as a decrease in size for the -- termination checker. isEtaOrCoinductiveRecordConstructor :: HasConstInfo m => QName -> m Bool -- | Check if a name refers to a record which is not coinductive. -- (Projections are then size-preserving) isInductiveRecord :: QName -> TCM Bool -- | Check if a type is an eta expandable record and return the record -- identifier and the parameters. isEtaRecordType :: HasConstInfo m => Type -> m (Maybe (QName, Args)) -- | Check if a name refers to a record constructor. If yes, return record -- definition. isRecordConstructor :: HasConstInfo m => QName -> m (Maybe (QName, Defn)) -- | Check if a constructor name is the internally generated record -- constructor. -- -- Works also for abstract constructors. isGeneratedRecordConstructor :: (MonadTCEnv m, HasConstInfo m) => QName -> m Bool -- | Turn off eta for unguarded recursive records. Projections do not -- preserve guardedness. unguardedRecord :: QName -> PatternOrCopattern -> TCM () -- | Turn on eta for non-recursive and inductive guarded recursive records, -- unless user declared otherwise. Projections do not preserve -- guardedness. updateEtaForRecord :: QName -> TCM () -- | Turn on eta for inductive guarded recursive records. Projections do -- not preserve guardedness. recursiveRecord :: QName -> TCM () -- | Turn on eta for non-recursive record, unless user declared otherwise. nonRecursiveRecord :: 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, MonadDebug m, ReadTCState m) => QName -> Args -> Term -> m (Telescope, Args) -- | Eta expand a record regardless of whether it's an eta-record or not. forceEtaExpandRecord :: (HasConstInfo m, MonadDebug m, ReadTCState m, MonadError TCErr m) => QName -> Args -> Term -> m (Telescope, Args) etaExpandRecord' :: (HasConstInfo m, MonadDebug m, ReadTCState m) => Bool -> QName -> Args -> Term -> m (Telescope, Args) etaExpandRecord_ :: HasConstInfo m => QName -> Args -> Defn -> Term -> m (Telescope, ConHead, ConInfo, Args) etaExpandRecord'_ :: HasConstInfo m => Bool -> QName -> Args -> Defn -> Term -> m (Telescope, ConHead, ConInfo, Args) etaExpandAtRecordType :: Type -> Term -> TCM (Telescope, Term) -- | 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' :: forall m. (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' :: forall m. (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 :: forall m. 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 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.Arg 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.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 :: Lens' [ProblemEq] (Problem a) problemRestPats :: Lens' [NamedArg Pattern] (Problem a) problemCont :: Lens' (LHSState a -> TCM a) (Problem a) problemInPats :: Problem a -> [Pattern] data AsBinding AsB :: Name -> Term -> Type -> Modality -> AsBinding data DotPattern Dot :: Expr -> Term -> Dom Type -> DotPattern data AbsurdPattern Absurd :: Range -> 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 -> 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 lhsTel :: Lens' Telescope (LHSState a) lhsOutPat :: Lens' [NamedArg DeBruijnPattern] (LHSState a) lhsProblem :: Lens' (Problem a) (LHSState a) lhsTarget :: Lens' (Arg Type) (LHSState a) data LeftoverPatterns LeftoverPatterns :: IntMap [(Name, PatVarPosition)] -> [AsBinding] -> [DotPattern] -> [AbsurdPattern] -> [AnnotationPattern] -> [Pattern] -> LeftoverPatterns [patternVariables] :: LeftoverPatterns -> IntMap [(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 :: forall m. PureTCM 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 [(Name, PatVarPosition)] -> ([Maybe Name], [AsBinding]) instance GHC.Show.Show Agda.TypeChecking.Rules.LHS.Problem.FlexibleVarKind instance GHC.Classes.Eq Agda.TypeChecking.Rules.LHS.Problem.FlexibleVarKind instance Data.Traversable.Traversable Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar instance Data.Foldable.Foldable Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar instance GHC.Base.Functor Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar instance GHC.Show.Show a => GHC.Show.Show (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance GHC.Show.Show Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Classes.Eq Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Show.Show (Agda.TypeChecking.Rules.LHS.Problem.Problem a) instance GHC.Classes.Eq Agda.TypeChecking.Rules.LHS.Problem.PatVarPosition instance GHC.Show.Show Agda.TypeChecking.Rules.LHS.Problem.PatVarPosition instance GHC.Base.Semigroup Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance Agda.Utils.Null.Null Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance GHC.Base.Monoid Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.LeftoverPatterns instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Rules.LHS.Problem.PatVarPosition instance Agda.TypeChecking.Substitute.Class.Subst (Agda.TypeChecking.Rules.LHS.Problem.Problem a) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.Rules.LHS.Problem.LHSState a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.AnnotationPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Rules.LHS.Problem.AbsurdPattern instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.AbsurdPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Rules.LHS.Problem.DotPattern instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.DotPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.TypeChecking.Reduce.InstantiateFull Agda.TypeChecking.Rules.LHS.Problem.AsBinding instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.TypeChecking.Rules.LHS.Problem.FlexibleVarKind 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.Maybe.Maybe a) instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.TypeChecking.Monad.Base.IsForced instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.Syntax.Common.Hiding instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex Agda.Syntax.Common.Origin instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex GHC.Types.Int instance Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex a => Agda.TypeChecking.Rules.LHS.Problem.ChooseFlex (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance GHC.Base.Semigroup Agda.TypeChecking.Rules.LHS.Problem.FlexChoice instance GHC.Base.Monoid Agda.TypeChecking.Rules.LHS.Problem.FlexChoice 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.LensOrigin (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance Agda.Syntax.Common.LensModality (Agda.TypeChecking.Rules.LHS.Problem.FlexibleVar a) instance Agda.TypeChecking.Pretty.PrettyTCM Agda.Syntax.Abstract.ProblemEq -- | Pattern matcher used in the reducer for clauses that have not been -- compiled to case trees yet. module Agda.TypeChecking.Patterns.Match -- | If matching is inconclusive (DontKnow) we want to know -- whether it is due to a particular meta variable. data Match a Yes :: Simplification -> IntMap (Arg a) -> Match a No :: Match a DontKnow :: 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 -- | 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 = 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, b) -> (Match a, b) -- | Match a single pattern. matchPatternP :: MonadMatch m => DeBruijnPattern -> Arg DeBruijnPattern -> m (Match DeBruijnPattern) matchPatternsP :: MonadMatch m => [NamedArg DeBruijnPattern] -> [Arg DeBruijnPattern] -> m (Match DeBruijnPattern) instance GHC.Base.Functor Agda.TypeChecking.Patterns.Match.Match instance Agda.Utils.Null.Null (Agda.TypeChecking.Patterns.Match.Match a) instance GHC.Base.Semigroup (Agda.TypeChecking.Patterns.Match.Match a) instance GHC.Base.Monoid (Agda.TypeChecking.Patterns.Match.Match a) -- | Functions for inserting implicit arguments at the right places. module Agda.TypeChecking.Implicit -- | Insert implicit binders in a list of binders, but not at the end. insertImplicitBindersT :: (PureTCM m, MonadError TCErr m, MonadFresh NameId m, MonadTrace m) => [NamedArg Binder] -> Type -> m [NamedArg Binder] -- | Insert implicit binders in a list of binders, but not at the end. insertImplicitBindersT1 :: (PureTCM m, MonadError TCErr m, MonadFresh NameId m, MonadTrace m) => List1 (NamedArg Binder) -> Type -> m (List1 (NamedArg Binder)) -- | 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 :: (PureTCM m, MonadMetaSolver m, MonadTCM m) => Int -> (Hiding -> Bool) -> Type -> m (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 :: (PureTCM m, MonadMetaSolver m, MonadTCM m) => Int -> (Hiding -> ArgName -> Bool) -> Type -> m (NamedArgs, Type) -- | Create a metavariable according to the Hiding info. newMetaArg :: (PureTCM m, MonadMetaSolver m) => ArgInfo -> ArgName -> Comparison -> Type -> m (MetaId, Term) -- | Create a questionmark according to the Hiding info. 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.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 :: forall m. PureTCM 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 :: forall m a. (PureTCM m, MonadError TCErr m, MonadTrace m, MonadFresh NameId m) => LHSState a -> m (LHSState a) module Agda.TypeChecking.Functions -- | Expand a clause to the maximal arity, by inserting variable patterns -- and applying the body to variables. etaExpandClause :: MonadTCM tcm => Clause -> tcm 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) module Agda.TypeChecking.Datatypes -- | Get true constructor with record fields. getConHead :: HasConstInfo m => QName -> m (Either SigError ConHead) isConstructor :: HasConstInfo m => QName -> m Bool -- | Get true constructor with fields, expanding literals to constructors -- if possible. getConForm :: QName -> TCM (Either SigError ConHead) -- | Augment constructor with record fields (preserve constructor name). -- The true constructor might only surface via reduce. getOrigConHead :: QName -> TCM (Either SigError ConHead) -- | Get the name of the datatype constructed by a given constructor. -- Precondition: The argument must refer to a constructor getConstructorData :: 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 :: HasConstInfo m => QName -> m Bool isPathCons :: HasConstInfo m => QName -> m Bool -- | 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 => ConHead -> Type -> m (Maybe ((QName, Type, Args), Type)) -- | 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)) data ConstructorInfo -- | Arity. DataCon :: Nat -> ConstructorInfo -- | List of field names. RecordCon :: PatternOrCopattern -> HasEta -> [Dom QName] -> ConstructorInfo -- | Return the number of non-parameter arguments to a data constructor, or -- the field names of a record constructor. -- -- For getting just the arity of constructor c, use either -- id size $ getConstructorArity c. getConstructorInfo :: HasConstInfo m => QName -> m ConstructorInfo getConstructorInfo' :: 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) getNumberOfParameters :: 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 :: 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] -- | Code which replaces pattern matching on record constructors with uses -- of projection functions. module Agda.TypeChecking.RecordPatterns -- | Replaces pattern matching on record constructors with uses of -- projection functions. Does not remove record constructor patterns -- which have sub-patterns containing non-record constructor or literal -- patterns. translateRecordPatterns :: Clause -> TCM Clause translateCompiledClauses :: forall m. (HasConstInfo m, MonadChange m) => CompiledClauses -> m CompiledClauses -- | Split tree annotated for record pattern translation. type -- RecordSplitTree = SplitTree' RecordSplitNode type RecordSplitTrees = -- SplitTrees' RecordSplitNode -- -- Bottom-up procedure to record-pattern-translate split tree. translateSplitTree :: SplitTree -> TCM SplitTree -- | Take a record pattern p 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 ]. -- -- If it is not a record pattern, error ShouldBeRecordPattern is -- raised. recordPatternToProjections :: DeBruijnPattern -> TCM [Term -> Term] instance Agda.TypeChecking.Monad.Base.MonadTCState Agda.TypeChecking.RecordPatterns.RecPatM instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.TypeChecking.RecordPatterns.RecPatM instance Agda.Interaction.Options.HasOptions.HasOptions Agda.TypeChecking.RecordPatterns.RecPatM instance Agda.TypeChecking.Monad.Base.MonadTCM Agda.TypeChecking.RecordPatterns.RecPatM instance Control.Monad.IO.Class.MonadIO Agda.TypeChecking.RecordPatterns.RecPatM instance GHC.Base.Monad Agda.TypeChecking.RecordPatterns.RecPatM instance GHC.Base.Applicative Agda.TypeChecking.RecordPatterns.RecPatM instance GHC.Base.Functor Agda.TypeChecking.RecordPatterns.RecPatM instance GHC.Classes.Eq Agda.TypeChecking.RecordPatterns.Kind instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.RecordPatterns.Change instance Agda.Utils.Pretty.Pretty (Agda.TypeChecking.RecordPatterns.Kind -> Agda.Syntax.Common.Nat) instance Agda.TypeChecking.Pretty.PrettyTCM (Agda.TypeChecking.RecordPatterns.Kind -> Agda.Syntax.Common.Nat) instance Agda.TypeChecking.RecordPatterns.DropFrom (Agda.TypeChecking.Coverage.SplitTree.SplitTree' c) instance Agda.TypeChecking.RecordPatterns.DropFrom (c, Agda.TypeChecking.Coverage.SplitTree.SplitTree' c) instance Agda.TypeChecking.RecordPatterns.DropFrom a => Agda.TypeChecking.RecordPatterns.DropFrom [a] -- | Check that a datatype is strictly positive. module Agda.TypeChecking.Positivity type Graph n e = Graph n e -- | Check that the datatypes in the mutual block containing the given -- declarations are strictly positive. -- -- Also add information about positivity and recursivity of records to -- the signature. checkStrictlyPositive :: MutualInfo -> Set QName -> TCM () getDefArity :: Definition -> TCM Int data Item AnArg :: Nat -> Item ADef :: QName -> Item type Occurrences = Map Item [OccursWhere] -- | Used to build Occurrences and occurrence graphs. data OccurrencesBuilder Concat :: [OccurrencesBuilder] -> OccurrencesBuilder OccursAs :: Where -> OccurrencesBuilder -> OccurrencesBuilder OccursHere :: Item -> OccurrencesBuilder -- | OnlyVarsUpTo n occs discards occurrences of de Bruijn index -- >= n. OnlyVarsUpTo :: Nat -> OccurrencesBuilder -> OccurrencesBuilder -- | Used to build Occurrences and occurrence graphs. data OccurrencesBuilder' Concat' :: [OccurrencesBuilder'] -> OccurrencesBuilder' OccursAs' :: Where -> OccurrencesBuilder' -> OccurrencesBuilder' OccursHere' :: Item -> OccurrencesBuilder' -- | Removes OnlyVarsUpTo entries. preprocess :: OccurrencesBuilder -> OccurrencesBuilder' -- | An interpreter for OccurrencesBuilder. -- -- WARNING: There can be lots of sharing between the generated -- OccursWhere entries. Traversing all of these entries could be -- expensive. (See computeEdges for an example.) flatten :: OccurrencesBuilder -> Map Item Integer -- | Context for computing occurrences. data OccEnv OccEnv :: [Maybe Item] -> Maybe QName -> OccEnv -- | Items corresponding to the free variables. -- -- Potential invariant: It seems as if the list has the form -- genericReplicate n Nothing ++ map -- (Just . AnArg) is, for some n and -- is, where is is decreasing (non-strictly). [vars] :: OccEnv -> [Maybe Item] -- | Name for ∞ builtin. [inf] :: OccEnv -> Maybe QName -- | Monad for computing occurrences. type OccM = Reader OccEnv withExtendedOccEnv :: Maybe Item -> OccM a -> OccM a withExtendedOccEnv' :: [Maybe Item] -> OccM a -> OccM a -- | Running the monad getOccurrences :: (Show a, PrettyTCM a, ComputeOccurrences a) => [Maybe Item] -> a -> TCM OccurrencesBuilder class ComputeOccurrences a occurrences :: ComputeOccurrences a => a -> OccM OccurrencesBuilder occurrences :: (ComputeOccurrences a, Foldable t, ComputeOccurrences b, t b ~ a) => a -> OccM OccurrencesBuilder -- | Computes the number of occurrences of different Items in the -- given definition. -- -- WARNING: There can be lots of sharing between the OccursWhere -- entries. Traversing all of these entries could be expensive. (See -- computeEdges for an example.) computeOccurrences :: QName -> TCM (Map Item Integer) -- | Computes the occurrences in the given definition. computeOccurrences' :: QName -> TCM OccurrencesBuilder data Node DefNode :: !QName -> Node ArgNode :: !QName -> !Nat -> Node -- | Edge labels for the positivity graph. data Edge a Edge :: !Occurrence -> a -> Edge a -- | Merges two edges between the same source and target. mergeEdges :: Edge a -> Edge a -> Edge a -- | WARNING: There can be lots of sharing between the OccursWhere -- entries in the edges. Traversing all of these entries could be -- expensive. (See computeEdges for an example.) buildOccurrenceGraph :: Set QName -> TCM (Graph Node (Edge OccursWhere)) -- | Computes all non-ozero occurrence graph edges represented by -- the given OccurrencesBuilder. -- -- WARNING: There can be lots of sharing between the OccursWhere -- entries in the edges. Traversing all of these entries could be -- expensive. For instance, for the function F in -- benchmarkmiscSlowOccurrences.agda a large number of -- edges from the argument X to the function F are -- computed. These edges have polarity StrictPos, JustNeg -- or JustPos, and contain the following OccursWhere -- elements: -- --
-- primEraseEquality : {a : Level} {A : Set a} {x y : A} -> x ≡ y -> x ≡ y --primEraseEquality :: TCM PrimitiveImpl -- | Used for both primForce and primForceLemma. genPrimForce :: TCM Type -> (Term -> Arg Term -> Term) -> TCM PrimitiveImpl primForceLemma :: TCM PrimitiveImpl mkPrimLevelZero :: TCM PrimitiveImpl mkPrimLevelSuc :: TCM PrimitiveImpl mkPrimLevelMax :: TCM PrimitiveImpl mkPrimSetOmega :: IsFibrant -> TCM PrimitiveImpl primLockUniv' :: TCM PrimitiveImpl mkPrimFun1TCM :: (FromTerm a, ToTerm b) => TCM Type -> (a -> ReduceM b) -> TCM PrimitiveImpl mkPrimFun1 :: (PrimType a, FromTerm a, PrimType b, ToTerm b) => (a -> 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 instance GHC.Real.Real Agda.TypeChecking.Primitive.Nat instance GHC.Enum.Enum Agda.TypeChecking.Primitive.Nat instance GHC.Num.Num Agda.TypeChecking.Primitive.Nat instance GHC.Classes.Ord Agda.TypeChecking.Primitive.Nat instance GHC.Classes.Eq Agda.TypeChecking.Primitive.Nat instance GHC.Classes.Ord Agda.TypeChecking.Primitive.Lvl instance GHC.Classes.Eq Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.FromTerm GHC.Num.Integer.Integer instance Agda.TypeChecking.Primitive.FromTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.FromTerm GHC.Word.Word64 instance Agda.TypeChecking.Primitive.FromTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.FromTerm GHC.Types.Double instance Agda.TypeChecking.Primitive.FromTerm GHC.Types.Char instance Agda.TypeChecking.Primitive.FromTerm Data.Text.Internal.Text instance Agda.TypeChecking.Primitive.FromTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.FromTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.FromTerm GHC.Types.Bool instance (Agda.TypeChecking.Primitive.ToTerm a, Agda.TypeChecking.Primitive.FromTerm a) => Agda.TypeChecking.Primitive.FromTerm [a] instance Agda.TypeChecking.Primitive.FromTerm a => Agda.TypeChecking.Primitive.FromTerm (GHC.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.ToTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.ToTerm GHC.Word.Word64 instance Agda.TypeChecking.Primitive.ToTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.ToTerm GHC.Types.Double instance Agda.TypeChecking.Primitive.ToTerm GHC.Types.Char instance Agda.TypeChecking.Primitive.ToTerm Data.Text.Internal.Text instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.ToTerm GHC.Num.Integer.Integer instance Agda.TypeChecking.Primitive.ToTerm GHC.Types.Bool instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Internal.Term instance Agda.TypeChecking.Primitive.ToTerm (Agda.Syntax.Internal.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.ArgInfo 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.Associativity instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.FixityLevel instance (Agda.TypeChecking.Primitive.ToTerm a, Agda.TypeChecking.Primitive.ToTerm b) => Agda.TypeChecking.Primitive.ToTerm (a, b) instance Agda.TypeChecking.Primitive.ToTerm a => Agda.TypeChecking.Primitive.ToTerm [a] instance Agda.TypeChecking.Primitive.ToTerm a => Agda.TypeChecking.Primitive.ToTerm (GHC.Maybe.Maybe a) instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimType (a -> b) instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimTerm (a -> b) instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimType (a, b) instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimTerm (a, b) instance Agda.TypeChecking.Primitive.PrimType GHC.Num.Integer.Integer instance Agda.TypeChecking.Primitive.PrimTerm GHC.Num.Integer.Integer instance Agda.TypeChecking.Primitive.PrimType GHC.Word.Word64 instance Agda.TypeChecking.Primitive.PrimTerm GHC.Word.Word64 instance Agda.TypeChecking.Primitive.PrimType GHC.Types.Bool instance Agda.TypeChecking.Primitive.PrimTerm GHC.Types.Bool instance Agda.TypeChecking.Primitive.PrimType GHC.Types.Char instance Agda.TypeChecking.Primitive.PrimTerm GHC.Types.Char instance Agda.TypeChecking.Primitive.PrimType GHC.Types.Double instance Agda.TypeChecking.Primitive.PrimTerm GHC.Types.Double instance Agda.TypeChecking.Primitive.PrimType Data.Text.Internal.Text instance Agda.TypeChecking.Primitive.PrimTerm Data.Text.Internal.Text instance Agda.TypeChecking.Primitive.PrimType Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.PrimTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.PrimType Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.PrimTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.PrimType Agda.Syntax.Common.Fixity' instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Common.Fixity' instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType [a] instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm [a] instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType (GHC.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm (GHC.Maybe.Maybe a) instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType (GHC.Types.IO a) instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm (GHC.Types.IO a) instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Primitive.Lvl instance GHC.Real.Integral Agda.TypeChecking.Primitive.Nat instance Agda.Syntax.Internal.Generic.TermLike Agda.TypeChecking.Primitive.Nat instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.Primitive.Nat -- | 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? -- --
-- piAbstract (v, a) b[v] = (w : a) -> b[w] ---- -- For the inspect idiom, it does something special: @piAbstract (v, a) -- b[v] = (w : a) {w' : Eq a w v} -> b[w] -- -- 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 u . absTerm u == id --absTerm :: AbsTerm a => 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.Abstract.IsPrefixOf Agda.Syntax.Internal.Elims instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Args instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Term instance Agda.TypeChecking.Abstract.EqualSy a => Agda.TypeChecking.Abstract.EqualSy [a] instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.Term instance Agda.TypeChecking.Abstract.EqualSy Agda.Syntax.Internal.Level 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.Type instance Agda.TypeChecking.Abstract.EqualSy a => Agda.TypeChecking.Abstract.EqualSy (Agda.Syntax.Internal.Elim.Elim' a) 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 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.Common.Arg a) instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Term instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Type instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.Level instance Agda.TypeChecking.Abstract.AbsTerm Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (Agda.Syntax.Internal.Elim.Elim' 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 [a] instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (GHC.Maybe.Maybe a) 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 b) => Agda.TypeChecking.Abstract.AbsTerm (a, b) module Agda.TypeChecking.With -- | Split pattern variables according to with-expressions. splitTelForWith :: Telescope -> Type -> [Arg (Term, EqualityView)] -> (Telescope, Telescope, Permutation, Type, [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 -> [Arg (Term, EqualityView)] -> Telescope -> Type -> [(Int, (Term, Term))] -> TCM (Type, Nat) countWithArgs :: [EqualityView] -> Nat -- | From a list of with and rewrite expressions and -- their types, compute the list of final with expressions -- (after expanding the rewrites). withArguments :: [Arg (Term, EqualityView)] -> TCM [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 -> [SpineClause] -> TCM [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]) -- | 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.StripAllProjections a => Agda.Termination.TermCheck.StripAllProjections (Agda.Syntax.Common.Arg a) instance Agda.Termination.TermCheck.StripAllProjections Agda.Syntax.Internal.Elims instance Agda.Termination.TermCheck.StripAllProjections Agda.Syntax.Internal.Args instance Agda.Termination.TermCheck.StripAllProjections Agda.Syntax.Internal.Term 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 a => Agda.Termination.TermCheck.ExtractCalls [a] 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.Sort instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Type 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 Agda.Syntax.Internal.Level instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.PlusLevel instance Agda.Termination.TermCheck.TermToPattern a b => Agda.Termination.TermCheck.TermToPattern [a] [b] instance Agda.Termination.TermCheck.TermToPattern a b => Agda.Termination.TermCheck.TermToPattern (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.Termination.TermCheck.TermToPattern a b => Agda.Termination.TermCheck.TermToPattern (Agda.Syntax.Common.Named c a) (Agda.Syntax.Common.Named c b) 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 -> [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 :: Range -> 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 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 instance Agda.TypeChecking.Monad.Base.MonadTCEnv Agda.Interaction.Monad.IM instance Agda.Interaction.Options.HasOptions.HasOptions Agda.Interaction.Monad.IM instance Control.Monad.IO.Class.MonadIO Agda.Interaction.Monad.IM instance GHC.Base.Monad Agda.Interaction.Monad.IM instance GHC.Base.Applicative Agda.Interaction.Monad.IM instance GHC.Base.Functor Agda.Interaction.Monad.IM instance Control.Monad.Error.Class.MonadError Agda.TypeChecking.Monad.Base.TCErr Agda.Interaction.Monad.IM -- | Encoding stuff into JSON values in TCM module Agda.Interaction.JSON type Array = Vector Value data () => One data () => Key data () => Options type Object = KeyMap Value type Encoding = Encoding' Value data () => Zero data () => Value Object :: !Object -> Value Array :: !Array -> Value String :: !Text -> Value Number :: !Scientific -> Value Bool :: !Bool -> Value Null :: Value class () => ToJSON a toJSON :: ToJSON a => a -> Value toEncoding :: ToJSON a => a -> Encoding toJSONList :: ToJSON a => [a] -> Value toEncodingList :: ToJSON a => [a] -> Encoding data () => Series 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] class () => FromJSON1 (f :: Type -> Type) liftParseJSON :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) liftParseJSONList :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a] class () => FromJSON2 (f :: Type -> Type -> Type) liftParseJSON2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b) liftParseJSONList2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [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) newtype () => DotNetTime DotNetTime :: UTCTime -> DotNetTime [fromDotNetTime] :: DotNetTime -> UTCTime data () => JSONKeyOptions type JSONPath = [JSONPathElement] data () => SumEncoding TaggedObject :: String -> String -> SumEncoding [tagFieldName] :: SumEncoding -> String [contentsFieldName] :: SumEncoding -> String UntaggedValue :: SumEncoding ObjectWithSingleField :: SumEncoding TwoElemArray :: SumEncoding class () => GToJSON' enc arity (f :: Type -> Type) class GetConName f => GToJSONKey (f :: k -> Type) class () => KeyValue kv data () => ToArgs res arity a class () => ToJSON1 (f :: Type -> Type) liftToJSON :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> f a -> Value liftToJSONList :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> [f a] -> Value liftToEncoding :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding liftToEncodingList :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding class () => ToJSON2 (f :: Type -> Type -> Type) liftToJSON2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value liftToJSONList2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value liftToEncoding2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding liftToEncodingList2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding 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 encode :: ToJSON a => a -> ByteString withArray :: String -> (Array -> Parser a) -> Value -> Parser a -- | Left-to-right composition of Kleisli arrows. -- -- '(bs >=> cs) a' can be understood as the -- do expression -- --
-- do b <- bs a -- cs b --(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 >=> -- | 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 <=< decode :: FromJSON a => ByteString -> Maybe a encodeFile :: ToJSON a => FilePath -> a -> IO () (>) :: Parser a -> JSONPathElement -> Parser a defaultOptions :: Options pairs :: Series -> Encoding object :: [Pair] -> Value (.:) :: FromJSON a => Object -> Key -> Parser a fromEncoding :: Encoding' tag -> Builder json :: Parser Value json' :: Parser Value foldable :: (Foldable t, ToJSON a) => t a -> Encoding (.!=) :: Parser (Maybe a) -> a -> Parser a (.:!) :: FromJSON a => Object -> Key -> Parser (Maybe a) (.:?) :: FromJSON a => Object -> Key -> Parser (Maybe a) fromJSON :: FromJSON a => Value -> Result a genericFromJSONKey :: (Generic a, GFromJSONKey (Rep a)) => JSONKeyOptions -> FromJSONKeyFunction a genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a 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) 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 camelTo2 :: Char -> String -> String defaultJSONKeyOptions :: JSONKeyOptions defaultTaggedObject :: SumEncoding genericLiftToEncoding :: (Generic1 f, GToJSON' Encoding One (Rep1 f)) => Options -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding genericLiftToJSON :: (Generic1 f, GToJSON' Value One (Rep1 f)) => Options -> (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 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 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 decodeStrict' :: FromJSON a => ByteString -> Maybe a eitherDecode :: FromJSON a => ByteString -> Either String 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 eitherDecodeStrict' :: FromJSON a => ByteString -> Either String a -- | The JSON version ofPrettyTCM, for encoding JSON value in TCM class EncodeTCM a encodeTCM :: EncodeTCM a => a -> TCM Value encodeTCM :: (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 a => Agda.Interaction.JSON.EncodeTCM [a] instance Agda.Interaction.JSON.EncodeTCM GHC.Base.String instance Agda.Interaction.JSON.EncodeTCM GHC.Types.Bool instance Agda.Interaction.JSON.EncodeTCM GHC.Types.Int instance Agda.Interaction.JSON.EncodeTCM GHC.Int.Int32 instance Agda.Interaction.JSON.EncodeTCM Data.Aeson.Types.Internal.Value instance Agda.Interaction.JSON.EncodeTCM Text.PrettyPrint.HughesPJ.Doc instance Agda.Interaction.JSON.EncodeTCM a => Agda.Interaction.JSON.EncodeTCM (GHC.Maybe.Maybe a) instance Data.Aeson.Types.ToJSON.ToJSON Text.PrettyPrint.HughesPJ.Doc instance Data.Aeson.Types.ToJSON.ToJSON Agda.Utils.FileName.AbsolutePath module Agda.Interaction.Highlighting.Vim vimFile :: FilePath -> FilePath escape :: String -> String wordBounded :: String -> String keyword :: String -> [String] -> String match :: String -> [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 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.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 a => Agda.Interaction.Highlighting.FromAbstract.Hilite [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.Interaction.Highlighting.FromAbstract.Hilite (GHC.Maybe.Maybe a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Common.WithHiding a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Data.Void.Void instance (Agda.Interaction.Highlighting.FromAbstract.Hilite a, Agda.Interaction.Highlighting.FromAbstract.Hilite b) => Agda.Interaction.Highlighting.FromAbstract.Hilite (Data.Either.Either a b) 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.RecordDirectives instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Declaration instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Pragma instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Expr 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.Literal.Literal 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.RHS 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.Abstract.Clause' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.ProblemEq instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.WhereDeclarations instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.GeneralizeTelescope instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.DataDefParams instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.ModuleApplication instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.LetBinding instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.TypedBindingInfo instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.TypedBinding instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.LamBinding instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Abstract.Binder' a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.BindName instance Agda.Interaction.Highlighting.FromAbstract.Hilite a => Agda.Interaction.Highlighting.FromAbstract.Hilite (Agda.Syntax.Concrete.FieldAssignment' a) 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.Syntax.Common.Arg a) instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.ArgInfo instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.Modality instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.Quantity instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Common.Erased instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Info.ModuleInfo 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 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.TypeChecking.Monad.Base.DisambiguatedName instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Scope.Base.ResolvedName instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Name.QName instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.Interaction.Highlighting.FromAbstract.Hilite Agda.Syntax.Abstract.Name.ModuleName instance GHC.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: -- --
-- checkRecordUpdate cmp ei recexpr fs e t ---- -- Preconditions: e = RecUpdate ei recexpr fs and t is -- reduced. checkRecordUpdate :: Comparison -> ExprInfo -> Expr -> Assigns -> Expr -> Type -> TCM Term checkLiteral :: Literal -> Type -> TCM Term -- | 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 :: Comparison -> Type -> MetaInfo -> TCM Term -- | Type check a meta variable. checkMeta :: (Comparison -> Type -> TCM (MetaId, Term)) -> Comparison -> Type -> MetaInfo -> TCM Term -- | Infer the type of a meta variable. If it is a new one, we create a new -- meta for its type. inferMeta :: (Comparison -> Type -> TCM (MetaId, Term)) -> MetaInfo -> 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 :: (Comparison -> Type -> TCM (MetaId, Term)) -> Maybe (Comparison, Type) -> MetaInfo -> 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 instance GHC.Show.Show Agda.TypeChecking.Rules.Term.LamOrPi instance GHC.Classes.Eq Agda.TypeChecking.Rules.Term.LamOrPi module Agda.TypeChecking.Rules.Builtin -- | Bind a builtin thing to an expression. bindBuiltin :: String -> 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 :: String -> QName -> TCM () builtinKindOfName :: String -> 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 :: String -> ResolvedName -> (QName -> Definition -> TCM Term) -> TCM () isUntypedBuiltin :: String -> Bool bindUntypedBuiltin :: String -> ResolvedName -> TCM () -- | 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 () -- | 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 GHC.Show.Show Agda.TypeChecking.Coverage.SplitClause.UnifyEquiv instance GHC.Show.Show Agda.TypeChecking.Coverage.SplitClause.IInfo 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 -- | If given TheInfo{} then assumes "x : Id u v" and returns both -- a SplittingDone for conId, and the Clause that -- covers it. createMissingConIdClause :: QName -> Arg Nat -> BlockingVar -> SplitClause -> IInfo -> TCM (Maybe ((SplitTag, SplitTree), Clause)) -- | Append an hcomp clause to the clauses of a function. createMissingHCompClause :: QName -> Arg Nat -> BlockingVar -> SplitClause -> SplitClause -> [Clause] -> TCM ([(SplitTag, CoverResult)], [Clause]) -- | 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: -- --
-- 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.Classes.Eq Agda.TypeChecking.CompiledClause.Compile.RunRecordPatternTranslation instance GHC.Show.Show Agda.TypeChecking.CompiledClause.Compile.Cl instance Agda.Utils.Pretty.Pretty Agda.TypeChecking.CompiledClause.Compile.Cl instance Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars a => Agda.TypeChecking.Free.Precompute.PrecomputeFreeVars (Agda.TypeChecking.CompiledClause.CompiledClauses' a) module Agda.TypeChecking.Rules.Record -- |
-- checkRecDef i name con ps contel fields ---- --
-- COMPILE GHC x as f --HsExport :: Range -> HaskellCode -> HaskellPragma parsePragma :: CompilerPragma -> Either String HaskellPragma parseHaskellPragma :: (MonadTCError m, MonadTrace m) => CompilerPragma -> m HaskellPragma getHaskellPragma :: QName -> TCM (Maybe HaskellPragma) sanityCheckPragma :: (HasBuiltins m, MonadTCError m, MonadReduce m) => Definition -> Maybe HaskellPragma -> m () getHaskellConstructor :: QName -> HsCompileM (Maybe HaskellCode) -- | Get content of FOREIGN GHC pragmas, sorted by -- KindOfForeignCode: file header pragmas, import statements, -- rest. foreignHaskell :: Interface -> ([String], [String], [String]) -- | 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.Classes.Eq Agda.Compiler.MAlonzo.Pragmas.HaskellPragma instance GHC.Show.Show Agda.Compiler.MAlonzo.Pragmas.HaskellPragma instance Agda.Syntax.Position.HasRange Agda.Compiler.MAlonzo.Pragmas.HaskellPragma instance Agda.Utils.Pretty.Pretty 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.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Module instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.ModulePragma instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.ImportDecl instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.ImportSpec instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Decl instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.ConDecl instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Strictness instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Match instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Pat instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Binds instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.DataOrNew instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.TyVarBind instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Type instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Stmt instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Literal instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Exp instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Alt instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.ModuleName instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.QName instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.Name instance Agda.Utils.Pretty.Pretty Agda.Utils.Haskell.Syntax.QOp 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 treelessPrimName :: TPrim -> String -- | Haskell modules to be imported for BUILT-INs importsForPrim :: BuiltinThings PrimFun -> [Definition] -> [ModuleName] xForPrim :: Map String a -> BuiltinThings PrimFun -> [Definition] -> [a] -- | Definition bodies for primitive functions primBody :: MonadTCError m => String -> m Exp noCheckCover :: (HasBuiltins m, MonadReduce m) => QName -> m Bool bltQual' :: String -> String -> HsCompileM String -- | 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 checkConstructorCount :: QName -> [QName] -> [HaskellCode] -> TCM () hsTelApproximation :: Type -> HsCompileM ([Type], Type) hsTelApproximation' :: PolyApprox -> Type -> HsCompileM ([Type], Type) instance GHC.Classes.Eq Agda.Compiler.MAlonzo.HaskellTypes.PolyApprox -- | Interface for compiler backend writers. module Agda.Compiler.Backend data Backend [Backend] :: NFData opts => Backend' opts env menv mod def -> Backend data Backend' opts env menv mod def Backend' :: String -> Maybe String -> 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) -> Backend' opts env menv mod def [backendName] :: Backend' opts env menv mod def -> String -- | Optional version information to be printed with --version. [backendVersion] :: Backend' opts env menv mod def -> Maybe String -- | Default options [options] :: Backend' opts env menv mod def -> opts -- | Backend-specific command-line flags. Should at minimum contain a flag -- to enable the backend. [commandLineFlags] :: Backend' opts env menv mod def -> [OptDescr (Flag opts)] -- | Unless the backend has been enabled, runAgda will fall back -- to vanilla Agda behaviour. [isEnabled] :: Backend' opts env menv mod def -> opts -> Bool -- | Called after type checking completes, but before compilation starts. [preCompile] :: Backend' 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' 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' 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' opts env menv mod def -> env -> menv -> IsMain -> TopLevelModuleName -> [def] -> TCM mod -- | Compile a single definition. [compileDef] :: Backend' opts env menv mod def -> env -> menv -> IsMain -> Definition -> TCM def -- | True if the backend works if --only-scope-checking is used. [scopeCheckingSuffices] :: Backend' 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' opts env menv mod def -> QName -> TCM Bool 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 -- | 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. toTreeless :: EvaluationStrategy -> QName -> TCM (Maybe TTerm) 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 Term 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 -> Type -> Constraint -- | Check that the Term is either not a SIZELT or a non-empty -- SIZELT. CheckSizeLtSat :: Term -> Constraint -- | the first argument is the instance argument and the second one is the -- list of candidates (or Nothing if we haven’t determined the list of -- candidates yet) FindInstance :: MetaId -> Maybe [Candidate] -> Constraint -- | Last argument is the error causing us to postpone. CheckFunDef :: Delayed -> 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 data TypeError InternalError :: String -> TypeError NotImplemented :: String -> TypeError NotSupported :: String -> TypeError CompilationError :: String -> TypeError PropMustBeSingleton :: TypeError DataMustEndInSort :: Term -> TypeError -- | The target of a constructor isn't an application of its datatype. The -- Type records what it does target. ShouldEndInApplicationOfTheDatatype :: Type -> TypeError -- | The target of a constructor isn't its datatype applied to something -- that isn't the parameters. First term is the correct target and the -- second term is the actual target. ShouldBeAppliedToTheDatatypeParameters :: Term -> Term -> TypeError -- | Expected a type to be an application of a particular datatype. ShouldBeApplicationOf :: Type -> QName -> TypeError -- | constructor, datatype ConstructorPatternInWrongDatatype :: QName -> QName -> TypeError -- | Datatype, constructors. CantResolveOverloadedConstructorsTargetingSameDatatype :: QName -> List1 QName -> TypeError -- | constructor, type DoesNotConstructAnElementOf :: QName -> Type -> 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 -- | 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 -> [NamedName] -> 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 -- | 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 relevane. RelevanceMismatch :: Relevance -> Relevance -> TypeError UninstantiatedDotPattern :: Expr -> TypeError ForcedConstructorNotInstantiated :: Pattern -> TypeError IllformedProjectionPattern :: Pattern -> TypeError CannotEliminateWithPattern :: Maybe Blocker -> NamedArg Pattern -> Type -> TypeError WrongNumberOfConstructorArguments :: QName -> Nat -> Nat -> TypeError 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 :: DeBruijnPattern -> TypeError NotAProjectionPattern :: NamedArg Pattern -> TypeError NotAProperTerm :: TypeError -- | This sort is not a type expression. InvalidTypeSort :: Sort -> TypeError -- | This term is not a type expression. InvalidType :: Term -> TypeError -- | This term, a function type constructor, lives in SizeUniv, -- which is not allowed. FunctionTypeInSizeUniv :: Term -> TypeError SplitOnIrrelevant :: Dom Type -> TypeError SplitOnUnusableCohesion :: Dom Type -> TypeError SplitOnNonVariable :: Term -> Type -> TypeError SplitOnNonEtaRecord :: QName -> TypeError DefinitionIsIrrelevant :: QName -> TypeError DefinitionIsErased :: QName -> TypeError VariableIsIrrelevant :: Name -> TypeError VariableIsErased :: Name -> TypeError VariableIsOfUnusableCohesion :: Name -> Cohesion -> TypeError UnequalLevel :: Comparison -> Level -> Level -> TypeError UnequalTerms :: Comparison -> Term -> Term -> CompareAs -> TypeError UnequalTypes :: Comparison -> Type -> Type -> TypeError -- | The two function types have different relevance. UnequalRelevance :: Comparison -> Term -> Term -> TypeError -- | The two function types have different relevance. UnequalQuantity :: Comparison -> Term -> Term -> TypeError -- | The two function types have different cohesion. UnequalCohesion :: Comparison -> Term -> Term -> TypeError -- | One of the function types has a finite domain (i.e. is a -- Partial@) and the other isonot. UnequalFiniteness :: Comparison -> Term -> Term -> TypeError -- | The two function types have different hiding. UnequalHiding :: Term -> Term -> TypeError UnequalSorts :: Sort -> Sort -> TypeError UnequalBecauseOfUniverseConflict :: Comparison -> Term -> Term -> TypeError NotLeqSort :: Sort -> Sort -> TypeError -- | The arguments are the meta variable and the parameter that it wants to -- depend on. MetaCannotDependOn :: MetaId -> Nat -> TypeError MetaOccursInItself :: MetaId -> TypeError MetaIrrelevantSolution :: MetaId -> Term -> TypeError MetaErasedSolution :: MetaId -> Term -> TypeError GenericError :: String -> TypeError GenericDocError :: Doc -> TypeError -- | the meta is what we might be blocked on. SortOfSplitVarError :: Maybe Blocker -> Doc -> TypeError BuiltinMustBeConstructor :: String -> Expr -> TypeError NoSuchBuiltinName :: String -> TypeError DuplicateBuiltinBinding :: String -> Term -> Term -> TypeError NoBindingForBuiltin :: String -> TypeError NoSuchPrimitiveFunction :: String -> TypeError DuplicatePrimitiveBinding :: String -> QName -> QName -> TypeError WrongModalityForPrimitive :: String -> ArgInfo -> ArgInfo -> TypeError ShadowedModule :: Name -> [ModuleName] -> TypeError BuiltinInParameterisedModule :: String -> TypeError IllegalLetInTelescope :: TypedBinding -> TypeError IllegalPatternInTelescope :: Binder -> TypeError NoRHSRequiresAbsurdPattern :: [NamedArg Pattern] -> TypeError -- | Record type, fields not supplied by user, non-fields but supplied. TooManyFields :: QName -> [Name] -> [Name] -> TypeError DuplicateFields :: [Name] -> TypeError DuplicateConstructors :: [Name] -> TypeError WithOnFreeVariable :: Expr -> Term -> TypeError UnexpectedWithPatterns :: [Pattern] -> TypeError WithClausePatternMismatch :: Pattern -> NamedArg DeBruijnPattern -> TypeError FieldOutsideRecord :: TypeError ModuleArityMismatch :: ModuleName -> Telescope -> [NamedArg Expr] -> TypeError GeneralizeCyclicDependency :: TypeError GeneralizeUnsolvedMeta :: TypeError SplitError :: SplitError -> TypeError ImpossibleConstructor :: QName -> NegativeUnification -> TypeError TooManyPolarities :: QName -> Int -> TypeError LocalVsImportedModuleClash :: ModuleName -> TypeError -- | Some interaction points (holes) have not been filled by user. There -- are not UnsolvedMetas since unification solved them. This is -- an error, since interaction points are never filled without user -- interaction. SolvedButOpenHoles :: TypeError CyclicModuleDependency :: [TopLevelModuleName] -> TypeError FileNotFound :: TopLevelModuleName -> [AbsolutePath] -> TypeError OverlappingProjects :: AbsolutePath -> TopLevelModuleName -> TopLevelModuleName -> TypeError AmbiguousTopLevelModuleName :: TopLevelModuleName -> [AbsolutePath] -> TypeError -- | Found module name, expected module name. ModuleNameUnexpected :: TopLevelModuleName -> TopLevelModuleName -> TypeError ModuleNameDoesntMatchFileName :: TopLevelModuleName -> [AbsolutePath] -> TypeError ClashingFileNamesFor :: ModuleName -> [AbsolutePath] -> TypeError -- | Module name, file from which it was loaded, file which the include -- path says contains the module. Scope errors ModuleDefinedInOtherFile :: TopLevelModuleName -> AbsolutePath -> AbsolutePath -> TypeError BothWithAndRHS :: TypeError AbstractConstructorNotInScope :: QName -> TypeError NotInScope :: [QName] -> TypeError NoSuchModule :: QName -> TypeError AmbiguousName :: QName -> AmbiguousNameReason -> TypeError AmbiguousModule :: QName -> List1 ModuleName -> TypeError ClashingDefinition :: QName -> QName -> Maybe NiceDeclaration -> TypeError ClashingModule :: ModuleName -> ModuleName -> TypeError ClashingImport :: Name -> QName -> TypeError ClashingModuleImport :: Name -> ModuleName -> TypeError PatternShadowsConstructor :: Name -> QName -> TypeError DuplicateImports :: QName -> [ImportedName] -> TypeError InvalidPattern :: Pattern -> TypeError RepeatedVariablesInPattern :: [Name] -> TypeError GeneralizeNotSupportedHere :: QName -> TypeError MultipleFixityDecls :: [(Name, [Fixity'])] -> TypeError MultiplePolarityPragmas :: [Name] -> TypeError -- | The expr was used in the right hand side of an implicit module -- definition, but it wasn't of the form m Delta. NotAModuleExpr :: Expr -> TypeError NotAnExpression :: Expr -> TypeError NotAValidLetBinding :: NiceDeclaration -> TypeError NotValidBeforeField :: NiceDeclaration -> TypeError NothingAppliedToHiddenArg :: Expr -> TypeError NothingAppliedToInstanceArg :: Expr -> TypeError BadArgumentsToPatternSynonym :: AmbiguousQName -> TypeError TooFewArgumentsToPatternSynonym :: AmbiguousQName -> TypeError CannotResolveAmbiguousPatternSynonym :: List1 (QName, PatternSynDefn) -> TypeError UnusedVariableInPatternSynonym :: 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 -> [Pattern] -> TypeError OperatorInformation :: [NotationSection] -> TypeError -> TypeError InstanceNoCandidate :: Type -> [(Term, TCErr)] -> TypeError UnquoteFailed :: UnquoteError -> TypeError DeBruijnIndexOutOfScope :: Nat -> Telescope -> [Name] -> TypeError NeedOptionCopatterns :: TypeError NeedOptionRewriting :: TypeError NeedOptionProp :: TypeError NeedOptionTwoLevel :: TypeError NonFatalErrors :: [TCWarning] -> TypeError InstanceSearchDepthExhausted :: Term -> Type -> Int -> TypeError TriedToCopyConstrainedPrim :: QName -> TypeError data Comparison CmpEq :: Comparison CmpLeq :: Comparison data ModuleInfo ModuleInfo :: Interface -> [TCWarning] -> Bool -> ModuleCheckMode -> 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 -> [TCWarning] -- | True if the module is a primitive module, which should always -- be importable. [miPrimitive] :: ModuleInfo -> Bool -- | The ModuleCheckMode used to create the Interface [miMode] :: ModuleInfo -> ModuleCheckMode -- | 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)] -- | Type checking monad. type TCM = TCMT IO data Signature Sig :: Sections -> Definitions -> RewriteRuleMap -> Signature [_sigSections] :: Signature -> Sections [_sigDefinitions] :: Signature -> Definitions -- | The rewrite rules defined in this file. [_sigRewriteRules] :: Signature -> RewriteRuleMap -- | The Context is a stack of ContextEntrys. type Context = [ContextEntry] type Constraints = [ProblemConstraint] data Builtin pf Builtin :: Term -> Builtin pf Prim :: pf -> Builtin pf -- | BUILTIN REWRITE. We can have several rewrite relations. BuiltinRewriteRelations :: Set QName -> Builtin pf class (Functor m, Applicative m, MonadFail m, HasOptions m, MonadDebug m, MonadTCEnv m) => HasConstInfo m -- | 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) -- | Lookup the rewrite rules with the given head symbol. getRewriteRulesFor :: HasConstInfo m => QName -> m RewriteRules -- | Version that reports exceptions: getConstInfo' :: (HasConstInfo m, HasConstInfo n, MonadTrans t, m ~ t n) => QName -> m (Either SigError Definition) -- | Lookup the rewrite rules with the given head symbol. getRewriteRulesFor :: (HasConstInfo m, HasConstInfo n, MonadTrans t, m ~ t n) => QName -> m RewriteRules newtype ReduceM a ReduceM :: (ReduceEnv -> a) -> ReduceM a [unReduceM] :: ReduceM a -> ReduceEnv -> a class (Functor m, Applicative m, Monad m) => MonadDebug m formatDebugMessage :: MonadDebug m => VerboseKey -> VerboseLevel -> TCM Doc -> m String traceDebugMessage :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m a -> m a -- | Print brackets around debug messages issued by a computation. verboseBracket :: MonadDebug m => VerboseKey -> VerboseLevel -> String -> m a -> m a getVerbosity :: MonadDebug m => m Verbosity getProfileOptions :: MonadDebug m => m ProfileOptions -- | Check whether we are currently debug printing. isDebugPrinting :: MonadDebug m => m Bool -- | Flag in a computation that we are currently debug printing. nowDebugPrinting :: MonadDebug m => m a -> m a formatDebugMessage :: (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => VerboseKey -> VerboseLevel -> TCM Doc -> m String traceDebugMessage :: (MonadDebug m, MonadTransControl t, MonadDebug n, m ~ t n) => VerboseKey -> VerboseLevel -> String -> m a -> m a -- | Print brackets around debug messages issued by a computation. verboseBracket :: (MonadDebug m, MonadTransControl t, MonadDebug n, m ~ t n) => VerboseKey -> VerboseLevel -> String -> m a -> m a getVerbosity :: (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => m Verbosity getProfileOptions :: (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => m ProfileOptions -- | Check whether we are currently debug printing. isDebugPrinting :: (MonadDebug m, MonadTrans t, MonadDebug n, m ~ t n) => m Bool -- | Flag in a computation that we are currently debug printing. nowDebugPrinting :: (MonadDebug m, MonadTransControl t, MonadDebug n, m ~ t n) => m a -> m a -- | 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 -- | Polarity for equality and subtype checking. data Polarity -- | monotone Covariant :: Polarity -- | antitone Contravariant :: Polarity -- | no information (mixed variance) Invariant :: Polarity -- | constant Nonvariant :: Polarity -- | 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 Exception :: Range -> Doc -> TCErr -- | The first argument is the state in which the error was raised. IOException :: 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 -- | 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 -- | 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 -- | 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 :: [TerminationError] -> Warning -- | `UnreachableClauses f rs` means that the clauses in f whose -- ranges are rs are unreachable UnreachableClauses :: QName -> [Range] -> Warning -- | `CoverageIssue f pss` means that pss are not covered in -- f CoverageIssue :: QName -> [(Telescope, [NamedArg DeBruijnPattern])] -> Warning CoverageNoExactSplit :: QName -> [Clause] -> Warning NotStrictlyPositive :: QName -> Seq OccursWhere -> Warning -- | Do not use directly with warning UnsolvedMetaVariables :: [Range] -> Warning -- | Do not use directly with warning UnsolvedInteractionMetas :: [Range] -> Warning -- | Do not use directly with warning UnsolvedConstraints :: Constraints -> Warning CantGeneralizeOverSorts :: [MetaId] -> Warning AbsurdPatternRequiresNoRHS :: [NamedArg DeBruijnPattern] -> Warning -- | In `OldBuiltin old new`, the BUILTIN old has been replaced by new OldBuiltin :: String -> String -> Warning -- | If the user wrote just {-# REWRITE #-}. EmptyRewritePragma :: Warning -- | An empty where block is dead code. EmptyWhere :: 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 -- | If a renaming import directive introduces a name or module -- name clash in the exported names of a module. (See issue #4154.) ClashesViaRenaming :: NameOrModule -> [Name] -> 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 -- | If the user opens a module public before the module header. (See issue -- #2377.) UselessPublic :: Warning -- | Names in hiding directive that don't hide anything imported by -- a using directive. UselessHiding :: [ImportedName] -> Warning UselessInline :: QName -> Warning WrongInstanceDeclaration :: Warning -- | An instance was declared with an implicit argument, which means it -- will never actually be considered by instance search. InstanceWithExplicitArg :: 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 -- | A coinductive record was declared but neither --guardedness nor -- --sized-types is enabled. NoGuardednessFlag :: QName -> Warning -- | Harmless generic warning (not an error) GenericWarning :: Doc -> Warning -- | Generic error which doesn't abort proceedings (not a warning) GenericNonFatalError :: Doc -> Warning -- | Generic warning when code is useless and thus ignored. Range' -- is for dead code highlighting. GenericUseless :: Range -> Doc -> Warning SafeFlagPostulate :: Name -> Warning -- | Unsafe OPTIONS. SafeFlagPragma :: [String] -> Warning SafeFlagNonTerminating :: Warning SafeFlagTerminating :: Warning SafeFlagWithoutKFlagPrimEraseEquality :: Warning WithoutKFlagPrimEraseEquality :: Warning SafeFlagNoPositivityCheck :: Warning SafeFlagPolarity :: Warning SafeFlagNoUniverseCheck :: Warning SafeFlagNoCoverageCheck :: Warning SafeFlagInjective :: Warning -- | ETA pragma is unsafe. SafeFlagEta :: Warning OptionWarning :: OptionWarning -> Warning ParseWarning :: ParseWarning -> Warning LibraryWarning :: LibWarning -> Warning -- | `DeprecationWarning old new version`: old is deprecated, use -- new instead. This will be an error in Agda version. DeprecationWarning :: String -> 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] -> [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 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 -- | COMPILE directive for an erased symbol PragmaCompileErased :: BackendName -> QName -> 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 -- (False) or pattern synonym name (True), because this -- can be confusing to read. AsPatternShadowsConstructorOrPatternSynonym :: Bool -> Warning RecordFieldWarning :: RecordFieldWarning -> Warning data TCWarning TCWarning :: CallStack -> Range -> Warning -> Doc -> 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 [tcWarningPrintedWarning] :: TCWarning -> Doc -- | Should the warning be affected by caching. [tcWarningCached] :: TCWarning -> Bool -- | For printing, we couple a meta with its name suggestion. data NamedMeta NamedMeta :: MetaNameSuggestion -> MetaId -> NamedMeta [nmSuggestion] :: NamedMeta -> MetaNameSuggestion [nmid] :: NamedMeta -> MetaId -- | Maps top-level module names to the corresponding source file names. type ModuleToSource = Map TopLevelModuleName AbsolutePath type Definitions = HashMap QName Definition -- | Datatype representing a single boundary condition: x_0 = u_0, ... ,x_n -- = u_n ⊢ t = ?n es data IPBoundary' t IPBoundary :: [(t, t)] -> t -> t -> Overapplied -> IPBoundary' t -- |
-- t --[ipbValue] :: IPBoundary' t -> t -- |
-- ?n es --[ipbMetaApp] :: IPBoundary' t -> t -- | Is ?n overapplied in ?n es ? [ipbOverapplied] :: IPBoundary' t -> Overapplied class (Functor m, Applicative m, Monad m) => HasOptions m -- | Returns the pragma options which are currently in effect. pragmaOptions :: HasOptions m => m PragmaOptions -- | Returns the command line options which are currently in effect. commandLineOptions :: HasOptions m => m CommandLineOptions -- | Returns the pragma options which are currently in effect. pragmaOptions :: (HasOptions m, HasOptions n, MonadTrans t, m ~ t n) => m PragmaOptions -- | Returns the command line options which are currently in effect. commandLineOptions :: (HasOptions m, HasOptions n, MonadTrans t, m ~ t n) => m CommandLineOptions -- | MonadTCEnv made into its own dedicated service class. This -- allows us to use MonadReader for ReaderT extensions of -- TCM. class Monad m => MonadTCEnv m askTC :: MonadTCEnv m => m TCEnv localTC :: MonadTCEnv m => (TCEnv -> TCEnv) -> m a -> m a askTC :: (MonadTCEnv m, MonadTrans t, MonadTCEnv n, t n ~ m) => m TCEnv localTC :: (MonadTCEnv m, MonadTransControl t, MonadTCEnv n, t n ~ m) => (TCEnv -> TCEnv) -> m a -> m a -- | Embedding a TCM computation. class (Applicative tcm, MonadIO tcm, MonadTCEnv tcm, MonadTCState tcm, HasOptions tcm) => MonadTCM tcm liftTCM :: MonadTCM tcm => TCM a -> tcm a liftTCM :: (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 getTC :: MonadTCState m => m TCState putTC :: MonadTCState m => TCState -> m () modifyTC :: MonadTCState m => (TCState -> TCState) -> m () getTC :: (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => m TCState putTC :: (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => TCState -> m () modifyTC :: (MonadTCState m, MonadTrans t, MonadTCState n, t n ~ m) => (TCState -> TCState) -> m () class Monad m => ReadTCState m getTCState :: ReadTCState m => m TCState locallyTCState :: ReadTCState m => Lens' a TCState -> (a -> a) -> m b -> m b withTCState :: ReadTCState m => (TCState -> TCState) -> m a -> m a getTCState :: (ReadTCState m, MonadTrans t, ReadTCState n, t n ~ m) => m TCState locallyTCState :: (ReadTCState m, MonadTransControl t, ReadTCState n, t n ~ m) => Lens' a TCState -> (a -> a) -> m b -> m b -- | The type checking monad transformer. Adds readonly TCEnv and -- mutable TCState. newtype TCMT m a TCM :: (IORef TCState -> TCEnv -> m a) -> TCMT m a [unTCM] :: TCMT m a -> IORef TCState -> TCEnv -> m a -- | Distinguish error message when parsing lhs or pattern synonym, resp. data LHSOrPatSyn IsLHS :: LHSOrPatSyn IsPatSyn :: LHSOrPatSyn class (Functor m, Applicative m, MonadFail m) => HasBuiltins m getBuiltinThing :: HasBuiltins m => String -> m (Maybe (Builtin PrimFun)) getBuiltinThing :: (HasBuiltins m, MonadTrans t, HasBuiltins n, t n ~ m) => String -> m (Maybe (Builtin PrimFun)) -- | 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 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 :: Range -> [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 CheckConstructorFitsIn :: QName -> Type -> Sort -> Call -- | Highlight (interactively) if and only if the boolean is True. CheckFunDefCall :: Range -> QName -> [Clause] -> Bool -> Call CheckPragma :: Range -> Pragma -> Call CheckPrimitive :: Range -> QName -> Expr -> Call CheckIsEmpty :: Range -> Type -> Call CheckConfluence :: QName -> QName -> Call CheckWithFunctionType :: Type -> Call CheckSectionApplication :: Range -> 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 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 -- | 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 -- | 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 () modifyAwakeConstraints :: MonadConstraint m => (Constraints -> Constraints) -> m () modifySleepingConstraints :: MonadConstraint m => (Constraints -> Constraints) -> m () data Closure a Closure :: Signature -> TCEnv -> ScopeInfo -> Map ModuleName CheckpointId -> a -> Closure a [clSignature] :: Closure a -> Signature [clEnv] :: Closure a -> TCEnv [clScope] :: Closure a -> ScopeInfo [clModuleCheckpoints] :: Closure a -> Map ModuleName CheckpointId [clValue] :: Closure a -> a -- | 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 class MonadTCEnv m => MonadAddContext m -- | 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 -- | Add a let bound variable to the context addLetBinding' :: MonadAddContext m => Name -> Term -> Dom Type -> 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 withFreshName :: MonadAddContext m => Range -> ArgName -> (Name -> m a) -> m a -- | addCtx x arg cont add a variable to the context. -- -- Chooses an unused Name. -- -- Warning: Does not update module parameter substitution! addCtx :: (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, MonadAddContext n, MonadTransControl t, t n ~ m) => Name -> Term -> Dom Type -> m a -> m a -- | Update the context. Requires a substitution that transports things -- living in the old context to the new. updateContext :: (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => Substitution -> (Context -> Context) -> m a -> m a withFreshName :: (MonadAddContext m, MonadAddContext n, MonadTransControl t, t n ~ m) => Range -> ArgName -> (Name -> m a) -> m a class (Applicative m, MonadTCEnv m, ReadTCState m, HasOptions m) => MonadReduce m liftReduce :: MonadReduce m => ReduceM a -> m a liftReduce :: (MonadReduce m, MonadTrans t, MonadReduce n, t n ~ m) => ReduceM a -> m a class ReadTCState m => MonadStatistics m modifyCounter :: MonadStatistics m => String -> (Integer -> Integer) -> m () modifyCounter :: (MonadStatistics m, MonadStatistics n, MonadTrans t, t n ~ m) => String -> (Integer -> Integer) -> m () type Statistics = Map String Integer -- | The backends are responsible for parsing their own pragmas. data CompilerPragma CompilerPragma :: Range -> String -> CompilerPragma type Offset = Nat data TCEnv TCEnv :: Context -> LetBindings -> ModuleName -> Maybe AbsolutePath -> [(ModuleName, Nat)] -> [TopLevelModuleName] -> Maybe MutualId -> TerminationCheck () -> CoverageCheck -> Bool -> Bool -> Bool -> Bool -> Bool -> Set ProblemId -> AbstractMode -> Modality -> Bool -> Bool -> Range -> Range -> IPClause -> Maybe (Closure Call) -> HighlightingLevel -> HighlightingMethod -> ExpandHidden -> Maybe QName -> Simplification -> AllowedReductions -> ReduceDefs -> Bool -> Int -> Bool -> Bool -> Bool -> Bool -> UnquoteFlags -> !Int -> Bool -> [QName] -> Bool -> CheckpointId -> Map CheckpointId Substitution -> DoGeneralize -> Map QName GeneralizedValue -> Maybe BackendName -> Bool -> Bool -> !Maybe Int -> TCEnv [envContext] :: TCEnv -> Context [envLetBindings] :: TCEnv -> LetBindings [envCurrentModule] :: TCEnv -> ModuleName -- | 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] :: TCEnv -> Maybe AbsolutePath -- | anonymous modules and their number of free variables [envAnonymousModules] :: TCEnv -> [(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. [envImportPath] :: TCEnv -> [TopLevelModuleName] -- | the current (if any) mutual block [envMutualBlock] :: TCEnv -> Maybe MutualId -- | are we inside the scope of a termination pragma [envTerminationCheck] :: TCEnv -> TerminationCheck () -- | are we inside the scope of a coverage pragma [envCoverageCheck] :: TCEnv -> CoverageCheck -- | are we inside a make-case (if so, ignore forcing analysis in unifier) [envMakeCase] :: TCEnv -> Bool -- | Are we currently in the process of solving active constraints? [envSolvingConstraints] :: TCEnv -> Bool -- | Have we stepped into the where-declarations of a clause? Everything -- under a where will be checked with this flag on. [envCheckingWhere] :: TCEnv -> Bool -- | Are we working on types? Turned on by workOnTypes. [envWorkingOnTypes] :: TCEnv -> Bool -- | Are we allowed to assign metas? [envAssignMetas] :: TCEnv -> Bool [envActiveProblems] :: TCEnv -> Set 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] :: TCEnv -> AbstractMode -- | Relevance component: Are we checking an irrelevant argument? -- (=Irrelevant) Then top-level irrelevant declarations are -- enabled. Other value: Relevant, then only relevant decls. are -- available. -- -- Quantity component: Are we checking a runtime-irrelevant thing? -- (=Quantity0) Then runtime-irrelevant things are usable. Other -- value: Quantity1, runtime relevant. Quantityω is not -- allowed here, see Bob Atkey, LiCS 2018. [envModality] :: TCEnv -> Modality -- | 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] :: TCEnv -> Bool -- | Sometimes we want to disable display forms. [envDisplayFormsEnabled] :: TCEnv -> Bool [envRange] :: TCEnv -> Range -- | Interactive highlighting uses this range rather than envRange. [envHighlightingRange] :: TCEnv -> Range -- | What is the current clause we are type-checking? Will be recorded in -- interaction points in this clause. [envClause] :: TCEnv -> IPClause -- | what we're doing at the moment [envCall] :: TCEnv -> Maybe (Closure Call) -- | Set to None when imported modules are type-checked. [envHighlightingLevel] :: TCEnv -> HighlightingLevel [envHighlightingMethod] :: TCEnv -> 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] :: TCEnv -> ExpandHidden -- | We are reducing an application of this function. (For tracking of -- incomplete matches.) [envAppDef] :: TCEnv -> Maybe QName -- | Did we encounter a simplification (proper match) during the current -- reduction process? [envSimplification] :: TCEnv -> Simplification [envAllowedReductions] :: TCEnv -> AllowedReductions [envReduceDefs] :: TCEnv -> ReduceDefs [envReconstructed] :: TCEnv -> Bool -- | Injectivity can cause non-termination for unsolvable contraints (#431, -- #3067). Keep a limit on the nesting depth of injectivity uses. [envInjectivityDepth] :: TCEnv -> Int -- | 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] :: TCEnv -> Bool -- | When True, types will be omitted from printed pi types if -- they can be inferred. [envPrintDomainFreePi] :: TCEnv -> 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] :: TCEnv -> 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] :: TCEnv -> Bool [envUnquoteFlags] :: TCEnv -> UnquoteFlags -- | Until we get a termination checker for instance search (#1743) we -- limit the search depth to ensure termination. [envInstanceDepth] :: TCEnv -> !Int [envIsDebugPrinting] :: TCEnv -> Bool -- | #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] :: TCEnv -> [QName] -- | Use call-by-need evaluation for reductions. [envCallByNeed] :: TCEnv -> Bool -- | Checkpoints track the evolution of the context as we go under binders -- or refine it by pattern matching. [envCurrentCheckpoint] :: TCEnv -> CheckpointId -- | Keeps the substitution from each previous checkpoint to the current -- context. [envCheckpoints] :: TCEnv -> Map CheckpointId Substitution -- | Should new metas generalized over. [envGeneralizeMetas] :: TCEnv -> DoGeneralize -- | Values for used generalizable variables. [envGeneralizedVars] :: TCEnv -> Map QName GeneralizedValue -- | Is some backend active at the moment, and if yes, which? NB: we only -- store the BackendName here, otherwise instance Data -- TCEnv is not derivable. The actual backend can be obtained from -- the name via stBackends. [envActiveBackendName] :: TCEnv -> Maybe BackendName -- | Are we currently computing the overlap between two rewrite rules for -- the purpose of confluence checking? [envConflComputingOverlap] :: TCEnv -> Bool -- | Are we currently in the process of executing an elaborate-and-give -- interactive command? [envCurrentlyElaborating] :: TCEnv -> Bool -- | 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] :: TCEnv -> !Maybe Int data Definition Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> NumGeneralizableArgs -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe QName -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> !Language -> 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] -- | How many arguments should be generalised. [defArgGeneralizable] :: Definition -> NumGeneralizableArgs -- | 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 of class q [defInstance] :: Definition -> Maybe QName -- | Has this function been created by a module instantiation? [defCopy] :: Definition -> Bool -- | The set of symbols with rewrite rules that match against this symbol [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? [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 [theDef] :: Definition -> Defn data Interface Interface :: Hash -> Text -> FileType -> [(TopLevelModuleName, Hash)] -> ModuleName -> TopLevelModuleName -> Map ModuleName Scope -> ScopeInfo -> Signature -> RemoteMetaStore -> DisplayForms -> Map QName Text -> Maybe Text -> BuiltinThings (String, QName) -> Map BackendName [ForeignCode] -> HighlightingInfo -> [OptionsPragma] -> [OptionsPragma] -> PragmaOptions -> PatternSynDefns -> [TCWarning] -> Set QName -> 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 -> Map QName Text -- | Whether this module should raise a warning when imported [iImportWarning] :: Interface -> Maybe Text [iBuiltin] :: Interface -> BuiltinThings (String, QName) [iForeignCode] :: Interface -> Map BackendName [ForeignCode] [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 -> [TCWarning] [iPartialDefs] :: Interface -> Set QName -- | The constraints needed for typeError and similar. type MonadTCError m = (MonadTCEnv m, ReadTCState m, MonadError TCErr m) type BackendName = String data TCState TCSt :: !PreScopeState -> !PostScopeState -> !PersistentTCState -> TCState -- | The state which is frozen after scope checking. [stPreScopeState] :: TCState -> !PreScopeState -- | The state which is modified after scope checking. [stPostScopeState] :: TCState -> !PostScopeState -- | State which is forever, like a diamond. [stPersistentState] :: TCState -> !PersistentTCState class (MonadTCEnv m, ReadTCState m) => MonadInteractionPoints m freshInteractionId :: MonadInteractionPoints m => m InteractionId freshInteractionId :: (MonadInteractionPoints m, MonadTrans t, MonadInteractionPoints n, t n ~ m) => m InteractionId modifyInteractionPoints :: MonadInteractionPoints m => (InteractionPoints -> InteractionPoints) -> m () modifyInteractionPoints :: (MonadInteractionPoints m, MonadTrans t, MonadInteractionPoints n, t n ~ m) => (InteractionPoints -> InteractionPoints) -> m () class (HasBuiltins m, HasConstInfo m, MonadAddContext m, MonadDebug m, MonadReduce m, MonadTCEnv m, ReadTCState m) => PureTCM m type RewriteRules = [RewriteRule] -- | 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 data PrimFun PrimFun :: QName -> Arity -> ([Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term)) -> PrimFun [primFunName] :: PrimFun -> QName [primFunArity] :: PrimFun -> Arity [primFunImplementation] :: PrimFun -> [Arg Term] -> Int -> ReduceM (Reduced MaybeReducedArgs Term) data RunMetaOccursCheck RunMetaOccursCheck :: RunMetaOccursCheck DontRunMetaOccursCheck :: RunMetaOccursCheck -- | 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 -- | 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 -- | 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, MonadMetaSolver m) => MetaId -> [Arg ArgName] -> Term -> m () -- | 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. etaExpandMeta :: MonadMetaSolver m => [MetaKind] -> 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 () class Monad m => MonadBlock m -- | `patternViolation b` aborts the current computation patternViolation :: MonadBlock m => Blocker -> m a -- | `patternViolation b` aborts the current computation patternViolation :: (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 data Reduced no yes NoReduction :: no -> Reduced no yes YesReduction :: Simplification -> yes -> Reduced no yes data ProblemConstraint PConstr :: Set ProblemId -> Blocker -> Closure Constraint -> ProblemConstraint [constraintProblems] :: ProblemConstraint -> Set ProblemId [constraintUnblocker] :: ProblemConstraint -> Blocker [theConstraint] :: ProblemConstraint -> Closure Constraint newtype Fields Fields :: [(Name, Type)] -> Fields data ForeignCode ForeignCode :: Range -> String -> ForeignCode newtype Section Section :: Telescope -> Section [_secTelescope] :: Section -> Telescope data PreScopeState PreScopeState :: !HighlightingInfo -> !Signature -> !HashSet TopLevelModuleName -> !ModuleToSource -> !VisitedModules -> !ScopeInfo -> !PatternSynDefns -> !PatternSynDefns -> !Maybe (Set QName) -> !PragmaOptions -> !BuiltinThings PrimFun -> !DisplayForms -> !InstanceTable -> !Map BackendName [ForeignCode] -> !InteractionId -> !Map QName Text -> !Map QName Text -> !Maybe Text -> !Set QName -> !Map FilePath ProjectConfig -> !Map FilePath AgdaLibFile -> !RemoteMetaStore -> PreScopeState -- | 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 most not be serialized! [stPreImports] :: PreScopeState -> !Signature -- | The top-level modules imported by the current module. [stPreImportedModules] :: PreScopeState -> !HashSet TopLevelModuleName [stPreModuleToSource] :: PreScopeState -> !ModuleToSource [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 generalizable variables; used during scope checking of terms [stPreGeneralizedVars] :: PreScopeState -> !Maybe (Set QName) -- | Options applying to the current file. OPTIONS pragmas only -- affect this field. [stPrePragmaOptions] :: PreScopeState -> !PragmaOptions [stPreImportedBuiltins] :: PreScopeState -> !BuiltinThings PrimFun -- | Display forms added by someone else to imported identifiers [stPreImportedDisplayForms] :: PreScopeState -> !DisplayForms [stPreImportedInstanceDefs] :: PreScopeState -> !InstanceTable -- | {-# FOREIGN #-} code that should be included in the compiled -- output. Does not include code for imported modules. [stPreForeignCode] :: PreScopeState -> !Map BackendName [ForeignCode] [stPreFreshInteractionId] :: PreScopeState -> !InteractionId -- | Imported UserWarnings, not to be stored in the -- Interface [stPreImportedUserWarnings] :: PreScopeState -> !Map QName Text -- | Locally defined UserWarnings, to be stored in the -- Interface [stPreLocalUserWarnings] :: PreScopeState -> !Map QName Text -- | 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 -- | Map from directories to paths of closest enclosing .agda-lib files (or -- Nothing if there are none). [stPreProjectConfigs] :: PreScopeState -> !Map FilePath ProjectConfig -- | Contents of .agda-lib files that have already been parsed. [stPreAgdaLibFiles] :: PreScopeState -> !Map FilePath AgdaLibFile -- | Used for meta-variables from other modules. [stPreImportedMetaStore] :: PreScopeState -> !RemoteMetaStore data PostScopeState PostScopeState :: !HighlightingInfo -> !DisambiguatedNames -> !LocalMetaStore -> !LocalMetaStore -> !InteractionPoints -> !Constraints -> !Constraints -> !Bool -> !Set QName -> !Signature -> !Map ModuleName CheckpointId -> !DisplayForms -> !Maybe (ModuleName, TopLevelModuleName) -> !TempInstanceTable -> !ConcreteNames -> !Map RawName (DList RawName) -> !Map Name (DList RawName) -> !Statistics -> ![TCWarning] -> !Map MutualId MutualBlock -> !BuiltinThings PrimFun -> !MetaId -> !MutualId -> !ProblemId -> !CheckpointId -> !Int -> !NameId -> !Bool -> !Bool -> !Bool -> !Bool -> !Set QName -> PostScopeState -- | Highlighting info. [stPostSyntaxInfo] :: PostScopeState -> !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] :: PostScopeState -> !DisambiguatedNames -- | Used for open meta-variables. [stPostOpenMetaStore] :: PostScopeState -> !LocalMetaStore -- | Used for local, instantiated meta-variables. [stPostSolvedMetaStore] :: PostScopeState -> !LocalMetaStore [stPostInteractionPoints] :: PostScopeState -> !InteractionPoints [stPostAwakeConstraints] :: PostScopeState -> !Constraints [stPostSleepingConstraints] :: PostScopeState -> !Constraints -- | Dirty when a constraint is added, used to prevent pointer update. -- Currently unused. [stPostDirty] :: PostScopeState -> !Bool -- | 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] :: PostScopeState -> !Set QName -- | Declared identifiers of the current file. These will be serialized -- after successful type checking. [stPostSignature] :: PostScopeState -> !Signature -- | For each module remember the checkpoint corresponding to the orignal -- context of the module parameters. [stPostModuleCheckpoints] :: PostScopeState -> !Map ModuleName CheckpointId -- | Display forms we add for imported identifiers [stPostImportsDisplayForms] :: PostScopeState -> !DisplayForms -- | The current module is available after it has been type checked. [stPostCurrentModule] :: PostScopeState -> !Maybe (ModuleName, TopLevelModuleName) [stPostInstanceDefs] :: PostScopeState -> !TempInstanceTable -- | 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] :: PostScopeState -> !ConcreteNames -- | Map keeping track for each name root (= name w/o numeric suffixes) -- what names with the same root have been used during a TC computation. -- This information is used to build the ShadowingNames map. [stPostUsedNames] :: PostScopeState -> !Map RawName (DList RawName) -- | Map keeping track for each (abstract) name the list of all (raw) names -- that it could maybe be shadowed by. [stPostShadowingNames] :: PostScopeState -> !Map Name (DList RawName) -- | Counters to collect various statistics about meta variables etc. Only -- for current file. [stPostStatistics] :: PostScopeState -> !Statistics [stPostTCWarnings] :: PostScopeState -> ![TCWarning] [stPostMutualBlocks] :: PostScopeState -> !Map MutualId MutualBlock [stPostLocalBuiltins] :: PostScopeState -> !BuiltinThings PrimFun [stPostFreshMetaId] :: PostScopeState -> !MetaId [stPostFreshMutualId] :: PostScopeState -> !MutualId [stPostFreshProblemId] :: PostScopeState -> !ProblemId [stPostFreshCheckpointId] :: PostScopeState -> !CheckpointId [stPostFreshInt] :: PostScopeState -> !Int [stPostFreshNameId] :: PostScopeState -> !NameId [stPostAreWeCaching] :: PostScopeState -> !Bool [stPostPostponeInstanceSearch] :: PostScopeState -> !Bool [stPostConsideringInstance] :: 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. [stPostInstantiateBlocking] :: PostScopeState -> !Bool -- | Local partial definitions, to be stored in the Interface [stPostLocalPartialDefs] :: PostScopeState -> !Set QName -- | A part of the state which is not reverted when an error is thrown or -- the state is reset. data PersistentTCState PersistentTCSt :: !DecodedModules -> !BiMap RawTopLevelModuleName ModuleNameHash -> CommandLineOptions -> InteractionOutputCallback -> !Benchmark -> !Statistics -> !Maybe LoadedFileCache -> [Backend] -> PersistentTCState [stDecodedModules] :: PersistentTCState -> !DecodedModules -- | Module name hashes for top-level module names (and vice versa). [stPersistentTopLevelModuleNames] :: PersistentTCState -> !BiMap RawTopLevelModuleName ModuleNameHash [stPersistentOptions] :: PersistentTCState -> CommandLineOptions -- | Callback function to call when there is a response to give to the -- interactive frontend. See the documentation of -- InteractionOutputCallback. [stInteractionOutputCallback] :: PersistentTCState -> InteractionOutputCallback -- | Structure to track how much CPU time was spent on which Agda phase. -- Needs to be a strict field to avoid space leaks! [stBenchmark] :: PersistentTCState -> !Benchmark -- | 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 -- | Current backends with their options [stPersistBackends] :: PersistentTCState -> [Backend] type VisitedModules = Map TopLevelModuleName ModuleInfo type BuiltinThings pf = Map String (Builtin pf) type DisplayForms = HashMap QName [LocalDisplayForm] -- | The instance table is a Map associating to every name of -- recorddata typepostulate its list of instances type InstanceTable = Map QName (Set QName) -- | Used for meta-variables from other modules (and in Interfaces). type RemoteMetaStore = HashMap MetaId RemoteMetaVariable -- | Name disambiguation for the sake of highlighting. data DisambiguatedName DisambiguatedName :: NameKind -> QName -> DisambiguatedName type DisambiguatedNames = IntMap DisambiguatedName type ConcreteNames = Map Name [Name] -- | Used for meta-variables from the current module. type LocalMetaStore = Map MetaId MetaVariable -- | 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 newtype CheckpointId CheckpointId :: Int -> CheckpointId -- | 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) newtype MutualId MutId :: Int32 -> MutualId -- | 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 type DecodedModules = Map TopLevelModuleName ModuleInfo data LoadedFileCache LoadedFileCache :: !CachedTypeCheckLog -> !CurrentTypeCheckLog -> LoadedFileCache [lfcCached] :: LoadedFileCache -> !CachedTypeCheckLog [lfcCurrent] :: LoadedFileCache -> !CurrentTypeCheckLog -- | 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)] -- | 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)] -- | A complete log for a module will look like this: -- --
-- λ 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 --addDisplayForms :: QName -> TCM () -- | Number of dropped initial arguments of a projection(-like) function. projectionArgs :: Definition -> Int -- | Add a display form to a definition (could be in this or imported -- signature). addDisplayForm :: QName -> DisplayForm -> TCM () -- | Module application (followed by module parameter abstraction). applySection :: ModuleName -> Telescope -> ModuleName -> Args -> ScopeCopyInfo -> TCM () applySection' :: ModuleName -> Telescope -> ModuleName -> Args -> ScopeCopyInfo -> TCM () -- | Check if a display form is looping. hasLoopingDisplayForm :: QName -> TCM Bool getDisplayForms :: (HasConstInfo m, ReadTCState m) => QName -> m [LocalDisplayForm] -- | Find all names used (recursively) by display forms of a given name. chaseDisplayForms :: QName -> TCM (Set QName) canonicalName :: HasConstInfo m => QName -> m QName sameDef :: HasConstInfo m => QName -> QName -> m (Maybe QName) -- | Can be called on either a (co)datatype, a record type or a -- (co)constructor. whatInduction :: MonadTCM tcm => QName -> tcm Induction -- | Does the given constructor come from a single-constructor type? -- -- Precondition: The name has to refer to a constructor. singleConstructorType :: QName -> TCM Bool -- | Standard eliminator for SigError. sigError :: (String -> a) -> a -> SigError -> a -- | 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 :: (ReadTCState m, HasConstInfo m) => QName -> m Definition defaultGetRewriteRulesFor :: (ReadTCState m, MonadTCEnv m) => QName -> m RewriteRules -- | Get the original name of the projection (the current one could be from -- a module application). getOriginalProjection :: HasConstInfo m => QName -> m QName -- | Is it the name of a record projection? isProjection :: HasConstInfo m => QName -> m (Maybe Projection) defaultGetConstInfo :: (HasOptions m, MonadDebug m, MonadTCEnv m) => TCState -> TCEnv -> QName -> m (Either SigError Definition) -- | Andreas, 2015-07-01: If the current module is a weak suffix -- of the identifier module, we can see through its abstract definition -- if we are abstract. (Then treatAbstractly' returns -- False). -- -- If I am not mistaken, then we cannot see definitions in the -- where block of an abstract function from the perspective of -- the function, because then the current module is a strict prefix of -- the module of the local identifier. This problem is fixed by removing -- trailing anonymous module name parts (underscores) from both names. treatAbstractly' :: QName -> TCEnv -> Bool -- | Give the abstract view of a definition. makeAbstract :: Definition -> Maybe Definition getConInfo :: HasConstInfo m => ConHead -> m Definition -- | Look up the polarity of a definition. getPolarity :: HasConstInfo m => QName -> m [Polarity] -- | Look up polarity of a definition and compose with polarity represented -- by Comparison. getPolarity' :: 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] -- | Get argument occurrence info for argument i of definition -- d (never fails). getArgOccurrence :: 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 () setTreeless :: QName -> TTerm -> TCM () setCompiledArgUse :: QName -> [ArgUsage] -> TCM () getCompiled :: HasConstInfo m => QName -> m (Maybe Compiled) setErasedConArgs :: QName -> [Bool] -> TCM () 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. setMutual :: QName -> [QName] -> TCM () -- | Check whether two definitions are mutually recursive. mutuallyRecursive :: QName -> QName -> TCM Bool -- | A functiondatarecord definition is nonRecursive 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) getModuleFreeVars :: (Functor m, Applicative m, MonadTCEnv m, ReadTCState m) => ModuleName -> m Nat freeVarsToApply :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => QName -> m Args -- | 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 :: (Functor m, Applicative m, HasOptions m, MonadTCEnv m, ReadTCState m, MonadDebug m) => ModuleName -> m Args -- | Instantiate a closed definition with the correct part of the current -- context. instantiateDef :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => Definition -> m Definition instantiateRewriteRule :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => RewriteRule -> m RewriteRule instantiateRewriteRules :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadTCEnv m, MonadDebug m) => RewriteRules -> m RewriteRules -- | 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 -- | Enter concrete or abstract mode depending on whether the given -- identifier is concrete or abstract. inConcreteOrAbstractMode :: (MonadTCEnv m, HasConstInfo m) => QName -> (Definition -> m a) -> m a -- | Check whether a name might have to be treated abstractly (either if -- we're inAbstractMode or it's not a local name). Returns true -- for things not declared abstract as well, but for those -- makeAbstract will have no effect. treatAbstractly :: MonadTCEnv m => QName -> m Bool -- | 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 isProjection_ :: Defn -> Maybe Projection -- | Is it the name of a non-irrelevant record projection? isRelevantProjection :: HasConstInfo m => QName -> m (Maybe Projection) 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 -- | Check whether a definition uses copatterns. usesCopatterns :: HasConstInfo m => QName -> m Bool -- | All possible metavariable kinds. allMetaKinds :: [MetaKind] -- | Switch off assignment of metas. dontAssignMetas :: (MonadTCEnv m, HasOptions 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 -- | Run a computation and record which new metas it created. metasCreatedBy :: forall m a. 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 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 -- | Update the information associated with a local meta-variable. updateMetaVarTCM :: HasCallStack => MetaId -> (MetaVariable -> MetaVariable) -> TCM () isOpenMeta :: MetaInstantiation -> Bool -- | 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 isSortJudgement :: Judgement a -> Bool isSortMeta_ :: MetaVariable -> Bool 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, MonadTCEnv m, ReadTCState m) => MetaId -> m Type -- | Is it a local meta-variable that might be generalized? isGeneralizableMeta :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m DoGeneralize isInstantiatedMeta' :: (MonadFail m, 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) -- | Get the listeners for a local meta-variable. getMetaListeners :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m [Listener] -- | 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 () setMetaNameSuggestion :: MonadMetaSolver m => MetaId -> MetaNameSuggestion -> m () getMetaNameSuggestion :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m MetaNameSuggestion -- | 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 () -- | 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 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] getOpenMetas :: ReadTCState m => m [MetaId] 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 MetaId for an interaction point. Precondition: interaction -- point is connected. lookupInteractionId :: (MonadFail m, 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 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 getInteractionScope :: (MonadDebug m, MonadFail m, ReadTCState m, MonadError TCErr m, MonadTCEnv m) => InteractionId -> m ScopeInfo withMetaInfo' :: (MonadTCEnv m, ReadTCState m, MonadTrace m) => MetaVariable -> m a -> m a -- | 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 () 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 => LocalMetaStore -> m (Set MetaId) -- | Thaw all open meta variables. unfreezeMetas :: TCM () isFrozen :: (HasCallStack, MonadDebug m, ReadTCState m) => MetaId -> m Bool withFrozenMetas :: (MonadMetaSolver m, MonadTCState m) => m a -> m a -- | 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 -> [TCWarning] -> ModuleCheckMode -> Source -> CheckResult crInterface :: CheckResult -> Interface crWarnings :: CheckResult -> [TCWarning] crMode :: CheckResult -> ModuleCheckMode -- | Ask the active backend whether a type may be erased. See issue #3732. activeBackendMayEraseType :: QName -> TCM Bool backendInteraction :: AbsolutePath -> [Backend] -> TCM () -> (AbsolutePath -> TCM CheckResult) -> TCM () parseBackendOptions :: [Backend] -> [String] -> CommandLineOptions -> OptM ([Backend], CommandLineOptions) -- | Call the compilerMain function of the given backend. callBackend :: String -> IsMain -> CheckResult -> TCM () -- | Look for a backend of the given name. lookupBackend :: BackendName -> TCM (Maybe Backend) -- | Get the currently active backend (if any). activeBackend :: TCM (Maybe Backend) instance GHC.Generics.Generic (Agda.Compiler.Backend.Backend' opts env menv mod def) instance Control.DeepSeq.NFData Agda.Compiler.Backend.Backend instance Control.DeepSeq.NFData opts => Control.DeepSeq.NFData (Agda.Compiler.Backend.Backend' opts env menv mod def) module Agda.Interaction.InteractionTop data GiveRefine Give :: GiveRefine Refine :: GiveRefine Intro :: GiveRefine ElaborateGive :: Rewrite -> GiveRefine -- | Put a response by the callback function given by -- stInteractionOutputCallback. putResponse :: Response -> CommandM () -- | Restore both TCState and CommandState. localStateCommandM :: CommandM a -> CommandM a -- | Explain why something is in scope. whyInScope :: String -> CommandM () -- | Computes some status information. -- -- Does not change the state. status :: CommandM Status -- | Creates a command queue, and forks a thread that writes commands to -- the queue. The queue is returned. initialiseCommandQueue :: IO Command -> IO CommandQueue -- | 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)) atTopLevel :: CommandM a -> CommandM a -- | Set envCurrentPath to theCurrentFile, if any. withCurrentFile :: 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 -- | 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 -- | 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 -- | A Lens for theInteractionPoints. modifyTheInteractionPoints :: ([InteractionId] -> [InteractionId]) -> CommandM () -- | A Lens for oldInteractionScopes. modifyOldInteractionScopes :: (OldInteractionScopes -> OldInteractionScopes) -> CommandM () insertOldInteractionScope :: InteractionId -> ScopeInfo -> CommandM () removeOldInteractionScope :: InteractionId -> CommandM () getOldInteractionScope :: InteractionId -> CommandM ScopeInfo -- | Do setup and error handling for a command. handleCommand_ :: CommandM () -> CommandM () handleCommand :: (forall a. CommandM a -> CommandM a) -> CommandM () -> CommandM () -> CommandM () -- | Tells the Emacs mode to go to the first error position (if any). tellEmacsToJumpToError :: Range -> [Response] -- | 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 () -- | Can the command run even if the relevant file has not been loaded into -- the state? independent :: Interaction -> Bool -- | 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 -- | Interpret an interaction interpret :: Interaction -> CommandM () -- | Should Resp_InteractionPoints be issued after the command has -- run? updateInteractionPointsAfter :: Interaction -> Bool -- | Displays or updates status information. -- -- Does not change the state. displayStatus :: CommandM () -- | display_info does what display_info' False -- does, but additionally displays some status information (see -- status and displayStatus). display_info :: DisplayInfo -> CommandM () -- | Shows all the top-level names in the given module, along with their -- types. showModuleContents :: Rewrite -> Range -> String -> CommandM () -- | Shows all the top-level names in scope which mention all the given -- identifiers in their type. searchAbout :: Rewrite -> Range -> String -> CommandM () -- | Solved goals already instantiated internally The second argument -- potentially limits it to one specific goal. solveInstantiatedGoals :: Rewrite -> Maybe 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) -- | Sets the command line options and updates the status information. setCommandLineOpts :: CommandLineOptions -> CommandM () -- | Tell to highlight the code using the given highlighting info (unless -- it is Nothing). tellToUpdateHighlighting :: Maybe (HighlightingInfo, HighlightingMethod, ModuleToSource) -> IO [Response] highlightExpr :: Expr -> TCM () -- | 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 () maybeTimed :: CommandM a -> CommandM (Maybe CPUTime, 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 () -- | Sorts interaction points based on their ranges. sortInteractionPoints :: (MonadInteractionPoints m, MonadError TCErr m, MonadFail m) => [InteractionId] -> m [InteractionId] instance GHC.Show.Show Agda.Interaction.InteractionTop.GiveRefine instance GHC.Classes.Eq 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 -- | Print open metas nicely. showGoals :: Goals -> TCM String -- | Serializing Info_Error showInfoError :: Info_Error -> TCM String explainWhyInScope :: forall m. MonadPretty m => WhyInScopeData -> m Doc -- | Pretty-prints the type of the meta-variable. prettyTypeOfMeta :: Rewrite -> InteractionId -> 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.Concrete.Name.NameInScope instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Concrete.Name.NameInScope instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Status instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Response.Status instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.CommandState instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.CommandState instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.CurrentFile instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.CurrentFile instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.ResponseContextEntry instance Agda.Interaction.JSON.EncodeTCM (Agda.Syntax.Position.Position' ()) instance Data.Aeson.Types.ToJSON.ToJSON (Agda.Syntax.Position.Position' ()) instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Position.Range instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Position.Range instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.ProblemId instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.MetaId instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.ProblemId instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.ModuleNameHash instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.MetaId instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Common.InteractionId instance Data.Aeson.Types.ToJSON.ToJSON Agda.Syntax.Common.InteractionId instance Agda.Interaction.JSON.EncodeTCM Agda.TypeChecking.Monad.Base.NamedMeta instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.GiveResult instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Response.GiveResult instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.MakeCaseVariant instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Response.MakeCaseVariant instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.Rewrite instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.Rewrite instance Agda.Interaction.JSON.EncodeTCM Agda.Utils.Time.CPUTime instance Data.Aeson.Types.ToJSON.ToJSON Agda.Utils.Time.CPUTime instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Base.ComputeMode instance Data.Aeson.Types.ToJSON.ToJSON Agda.Interaction.Base.ComputeMode instance Agda.Interaction.JSON.EncodeTCM (Agda.Interaction.Base.OutputForm Agda.Syntax.Concrete.Expr Agda.Syntax.Concrete.Expr) instance Agda.Interaction.JSON.EncodeTCM Agda.Syntax.Internal.Blockers.Blocker instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.DisplayInfo instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.GoalTypeAux instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Info_Error instance Agda.Interaction.JSON.EncodeTCM Agda.TypeChecking.Monad.Base.TCErr instance Agda.Interaction.JSON.EncodeTCM Agda.TypeChecking.Monad.Base.TCWarning instance Agda.Interaction.JSON.EncodeTCM Agda.Interaction.Response.Response module Agda.Interaction.Highlighting.Dot dotBackend :: Backend -- | Generating highlighted and aligned LaTeX from literate Agda source. module Agda.Interaction.Highlighting.LaTeX latexBackend :: Backend -- | Backend for generating highlighted, hyperlinked HTML from Agda -- sources. module Agda.Interaction.Highlighting.HTML htmlBackend :: Backend module Agda.Compiler.MAlonzo.Compiler ghcBackend :: Backend ghcBackend' :: Backend' GHCFlags GHCEnv GHCModuleEnv GHCModule GHCDefinition data GHCFlags GHCFlags :: Bool -> Bool -> Maybe FilePath -> [String] -> Bool -> Bool -> GHCFlags [flagGhcCompile] :: GHCFlags -> Bool [flagGhcCallGhc] :: GHCFlags -> Bool -- | Use the compiler at PATH instead of "ghc" [flagGhcBin] :: GHCFlags -> Maybe FilePath [flagGhcFlags] :: GHCFlags -> [String] -- | Make inductive constructors strict? [flagGhcStrictData] :: GHCFlags -> Bool -- | Make functions strict? [flagGhcStrict] :: GHCFlags -> Bool defaultGHCFlags :: GHCFlags ghcCommandLineFlags :: [OptDescr (Flag GHCFlags)] withCompilerFlag :: FilePath -> Flag GHCFlags -- | Monads that can read GHCOptions class Monad m => ReadGHCOpts m askGhcOpts :: ReadGHCOpts m => m GHCOptions data GHCModule GHCModule :: GHCModuleEnv -> [MainFunctionDef] -> GHCModule [ghcModModuleEnv] :: GHCModule -> GHCModuleEnv -- | The main function definition(s), if both the module is the -- IsMain module (root/focused) and a suitable main -- function was defined. [ghcModMainFuncs] :: GHCModule -> [MainFunctionDef] data GHCDefinition GHCDefinition :: UsesFloat -> [Decl] -> Definition -> Maybe MainFunctionDef -> Set TopLevelModuleName -> GHCDefinition [ghcDefUsesFloat] :: GHCDefinition -> UsesFloat [ghcDefDecls] :: GHCDefinition -> [Decl] [ghcDefDefinition] :: GHCDefinition -> Definition [ghcDefMainDef] :: GHCDefinition -> Maybe MainFunctionDef [ghcDefImports] :: GHCDefinition -> Set TopLevelModuleName ghcPreCompile :: GHCFlags -> TCM GHCEnv ghcPostCompile :: GHCEnv -> IsMain -> Map TopLevelModuleName GHCModule -> TCM () ghcPreModule :: GHCEnv -> IsMain -> TopLevelModuleName -> Maybe FilePath -> TCM (Recompile GHCModuleEnv GHCModule) ghcPostModule :: GHCEnv -> GHCModuleEnv -> IsMain -> TopLevelModuleName -> [GHCDefinition] -> TCM GHCModule ghcCompileDef :: GHCEnv -> GHCModuleEnv -> IsMain -> Definition -> TCM GHCDefinition -- | We do not erase types that have a HsData pragma. This is to -- ensure a stable interface to third-party code. ghcMayEraseType :: QName -> TCM Bool imports :: BuiltinThings PrimFun -> Set TopLevelModuleName -> [Definition] -> [ImportDecl] newtype UsesFloat UsesFloat :: Bool -> UsesFloat pattern YesFloat :: UsesFloat pattern NoFloat :: UsesFloat mazRTEFloatImport :: UsesFloat -> [ImportDecl] definition :: Definition -> HsCompileM (UsesFloat, [Decl], Maybe CheckedMainFunctionDef) constructorCoverageCode :: QName -> Int -> [QName] -> HaskellType -> [HaskellCode] -> HsCompileM [Decl] -- | Environment for naming of local variables. Invariant: reverse -- ccCxt ++ ccNameSupply data CCEnv CCEnv :: NameSupply -> CCContext -> CCEnv -- | Supply of fresh names [_ccNameSupply] :: CCEnv -> NameSupply -- | Names currently in scope [_ccContext] :: CCEnv -> CCContext type NameSupply = [Name] type CCContext = [Name] ccNameSupply :: Lens' NameSupply CCEnv ccContext :: Lens' CCContext CCEnv -- | Initial environment for expression generation. initCCEnv :: CCEnv -- | Term variables are de Bruijn indices. lookupIndex :: Int -> CCContext -> Name -- | Constructor coverage monad transformer type CCT m = ReaderT CCEnv (WriterT UsesFloat (HsCompileT m)) -- | Constructor coverage monad type CC = CCT TCM liftCC :: Monad m => HsCompileT m a -> CCT m a freshNames :: Monad m => Int -> ([Name] -> CCT m a) -> CCT m a -- | Introduce n variables into the context. intros :: Monad m => Int -> ([Name] -> CCT m a) -> CCT m a checkConstructorType :: QName -> HaskellCode -> HsCompileM [Decl] checkCover :: HasConstInfo m => QName -> HaskellType -> Nat -> [QName] -> [HaskellCode] -> m [Decl] closedTerm_ :: TTerm -> HsCompileM Exp closedTerm :: TTerm -> HsCompileM (Exp, UsesFloat) mkIf :: TTerm -> CC TTerm -- | Extract Agda term to Haskell expression. Erased arguments are -- extracted as (). Types are extracted as (). term :: TTerm -> CC Exp -- | Translate a non-application, non-coercion, non-constructor, -- non-definition term. noApplication :: TTerm -> CC Exp hsCoerce :: Exp -> Exp compilePrim :: TPrim -> Exp alt :: Int -> TAlt -> CC Alt literal :: forall m. Monad m => Literal -> CCT m Exp hslit :: Literal -> Literal litString :: Text -> Exp litqname :: QName -> Exp litqnamepat :: QName -> Pat litmetapat :: MetaId -> Pat condecl :: QName -> Induction -> HsCompileM ConDecl compiledcondecl :: Maybe Nat -> QName -> HsCompileM Decl compiledTypeSynonym :: QName -> String -> Nat -> Decl tvaldecl :: QName -> Induction -> Nat -> [ConDecl] -> Maybe Clause -> [Decl] infodecl :: QName -> [Decl] -> [Decl] type MonadGHCIO m = (MonadIO m, ReadGHCOpts m) copyRTEModules :: MonadGHCIO m => m () writeModule :: MonadGHCIO m => Module -> m () outFileAndDir :: MonadGHCIO m => ModuleName -> m (FilePath, FilePath) curOutFileAndDir :: (MonadGHCIO m, ReadGHCModuleEnv m) => m (FilePath, FilePath) curOutFile :: (MonadGHCIO m, ReadGHCModuleEnv m) => m FilePath callGHC :: ReaderT GHCModule TCM () instance GHC.Generics.Generic Agda.Compiler.MAlonzo.Compiler.GHCFlags instance GHC.Show.Show Agda.Compiler.MAlonzo.Compiler.UsesFloat instance GHC.Classes.Eq Agda.Compiler.MAlonzo.Compiler.UsesFloat instance GHC.Base.Semigroup Agda.Compiler.MAlonzo.Compiler.UsesFloat instance GHC.Base.Monoid Agda.Compiler.MAlonzo.Compiler.UsesFloat instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModule m) instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModule m) instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCOptions m) instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCEnv m) instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCModuleEnv m) instance Control.DeepSeq.NFData Agda.Compiler.MAlonzo.Compiler.GHCFlags -- | 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 -> 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 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 :: 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 compilePrim :: TPrim -> Exp compileAlt :: EnvWithOpts -> TAlt -> TCM ((QName, MemberId), Exp) eraseLocalVars :: [Bool] -> TTerm -> TTerm visitorName :: QName -> TCM MemberId flatName :: MemberId local :: Nat -> Exp qname :: QName -> TCM Exp literal :: Literal -> Exp litqname :: QName -> Exp litmeta :: MetaId -> Exp writeModule :: Bool -> Module -> TCM () outFile :: GlobalId -> TCM FilePath outFile_ :: TCM FilePath -- | Primitives implemented in the JS Agda RTS. -- -- TODO: Primitives that are not part of this set, and for which -- defJSDef does not return anything, are silently compiled to -- Undefined. A better approach might be to list exactly those -- primitives which should be compiled to Undefined. primitives :: Set String instance GHC.Generics.Generic Agda.Compiler.JS.Compiler.JSOptions 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 () -- | Main execution mode data MainMode MainModeRun :: Interactor () -> MainMode MainModePrintHelp :: Help -> MainMode MainModePrintVersion :: MainMode MainModePrintAgdaDir :: MainMode -- | Determine the main execution mode to run, based on the configured -- backends and command line options. | This is pure. getMainMode :: MonadError String m => [Backend] -> Maybe AbsolutePath -> CommandLineOptions -> m MainMode type Interactor a = TCM () -> (AbsolutePath -> TCM CheckResult) -> TCM a data FrontendType FrontEndEmacs :: FrontendType FrontEndJson :: FrontendType FrontEndRepl :: FrontendType emacsModeInteractor :: Interactor () jsonModeInteractor :: Interactor () replInteractor :: Maybe AbsolutePath -> Interactor () 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 () backendUsage :: Backend -> String -- | Print version information. printVersion :: [Backend] -> IO () printAgdaDir :: 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 ()