-- 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, Epigram -- 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.5.4.1.20181027 -- | Basic data types for library management. module Agda.Interaction.Library.Base -- | A symbolic library name. type LibName = String -- | The special name "." is used to indicated that the current -- directory should count as a project root. libNameForCurrentDir :: LibName -- | Content of a .agda-lib file. data AgdaLibFile AgdaLib :: LibName -> FilePath -> [FilePath] -> [LibName] -> 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] emptyLibFile :: AgdaLibFile instance GHC.Show.Show Agda.Interaction.Library.Base.AgdaLibFile -- | Some IORefs to access option values in pure code module Agda.Interaction.Options.IORefs -- | In Pretty and String we want to know whether we are -- allowed to insert unicode characters or not. data UnicodeOrAscii UnicodeOk :: UnicodeOrAscii AsciiOnly :: UnicodeOrAscii unicodeOrAscii :: IORef UnicodeOrAscii -- | 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 instance GHC.Classes.Ord Agda.Termination.CutOff.CutOff instance GHC.Classes.Eq Agda.Termination.CutOff.CutOff instance GHC.Show.Show 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.Integer.Type.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. OneHole :: (r -> a) -> 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) -- | Finite bijections (implemented as a pair of tree maps). module Agda.Utils.BiMap -- | Finite bijective map from a to b. There, and back -- again. data BiMap a b BiMap :: Map a b -> Map b a -> BiMap a b [biMapThere] :: BiMap a b -> Map a b [biMapBack] :: BiMap a b -> Map b a -- | Lookup. O(log n). lookup :: Ord a => a -> BiMap a b -> Maybe b -- | Inverse lookup. O(log n). invLookup :: Ord b => b -> BiMap a b -> Maybe a -- | Empty bimap. O(1). empty :: BiMap a b -- | Singleton bimap. O(1). singleton :: a -> b -> BiMap a b -- | Insert. Overwrites existing value if present. O(Map.insert). insert :: (Ord a, Ord b) => a -> b -> BiMap a b -> BiMap a b -- | Left-biased Union. O(Map.union). union :: (Ord a, Ord b) => BiMap a b -> BiMap a b -> BiMap a b -- | Construct from a list of pairs. -- -- Does not check for actual bijectivity of constructed finite map. O(n -- log n) fromList :: (Ord a, Ord b) => [(a, b)] -> BiMap a b -- | Turn into list, sorted ascendingly by first value. O(Map.toList) toList :: BiMap a b -> [(a, b)] instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Eq (Agda.Utils.BiMap.BiMap a b) instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Agda.Utils.BiMap.BiMap a b) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Utils.BiMap.BiMap a b) module Agda.Utils.Char -- | Convert a character in '0'..'9' into the corresponding digit -- 0..9. decDigit :: Char -> Int -- | Convert a character in '0'..'9','A'..'F','a'..'f' into the -- corresponding digit 0..15. hexDigit :: Char -> Int -- | Convert a character in '0'..'7' into the corresponding digit -- 0..7. octDigit :: Char -> Int -- | Unicode characters are divided into letters, numbers, marks, -- punctuation, symbols, separators (including spaces) and others -- (including control characters). -- -- These are the tests that Char offers: data UnicodeTest IsControl :: UnicodeTest IsSpace :: UnicodeTest IsLower :: UnicodeTest IsUpper :: UnicodeTest IsAlpha :: UnicodeTest IsAlphaNum :: UnicodeTest IsPrint :: UnicodeTest IsDigit :: UnicodeTest IsOctDigit :: UnicodeTest IsHexDigit :: UnicodeTest IsLetter :: UnicodeTest IsMark :: UnicodeTest IsNumber :: UnicodeTest IsPunctuation :: UnicodeTest IsSymbol :: UnicodeTest IsSeparator :: UnicodeTest -- | Test names paired with their implementation. unicodeTests :: [(UnicodeTest, Char -> Bool)] -- | Find out which tests a character satisfies. testChar :: Char -> [UnicodeTest] instance GHC.Show.Show Agda.Utils.Char.UnicodeTest instance GHC.Classes.Ord Agda.Utils.Char.UnicodeTest instance GHC.Classes.Eq Agda.Utils.Char.UnicodeTest -- | Create clusters of non-overlapping things. module Agda.Utils.Cluster -- | Characteristic identifiers. type C = Int -- | Given a function f :: a -> (C,[C]) which returns a -- non-empty list of characteristics C 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 :: (a -> (C, [C])) -> [a] -> [[a]] -- | Partition a list of as paired with a non-empty list of -- characteristics C into groups such that each element in a -- group shares at least one characteristic with at least one other -- element of the group. cluster' :: [(a, (C, [C]))] -> [[a]] -- | Utilities for the Either type. module Agda.Utils.Either -- | Loop while we have an exception. whileLeft :: Monad m => (a -> Either b c) -> (a -> b -> m a) -> (a -> c -> m d) -> a -> m d -- | Monadic version of either with a different argument ordering. caseEitherM :: Monad m => m (Either a b) -> (a -> m c) -> (b -> m c) -> m c -- | Either is a bifunctor. mapEither :: (a -> c) -> (b -> d) -> Either a b -> Either c d -- | 'Either _ b' is a functor. mapLeft :: (a -> c) -> Either a b -> Either c b -- | 'Either a' is a functor. mapRight :: (b -> d) -> Either a b -> Either a d -- | Either is bitraversable. traverseEither :: Functor f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) -- | Returns True iff the argument is Right x for -- some x. -- -- Note: from base >= 4.7.0.0 already present in -- Data.Either. isRight :: Either a b -> Bool -- | Returns True iff the argument is Left x for -- some x. -- -- Note: from base >= 4.7.0.0 already present in -- Data.Either. isLeft :: 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] -- | Convert Maybe to Either (). maybeToEither :: Maybe a -> Either () a -- | Expand environment variables in strings module Agda.Utils.Environment expandEnvironmentVariables :: String -> IO String instance GHC.Show.Show Agda.Utils.Environment.Token instance GHC.Classes.Eq Agda.Utils.Environment.Token -- | Wrapper for Control.Monad.Except from the mtl library (>= 2.2.1) module Agda.Utils.Except -- | Error class for backward compatibility (from Control.Monad.Trans.Error -- in transformers 0.3.0.0). class Error a noMsg :: Error a => a strMsg :: Error a => String -> a -- | A monad transformer that adds exceptions to other monads. -- -- ExceptT constructs a monad parameterized over two things: -- --
runExceptT (mapExceptT f m) = f -- (runExceptT m)
-- do { action1; action2; action3 } `catchError` handler ---- -- where the action functions can call throwError. Note -- that handler and the do-block must have the same return type. catchError :: MonadError e m => m a -> e -> m a -> m a -- | The inverse of ExceptT. runExceptT :: () => ExceptT e m a -> m Either e a instance Agda.Utils.Except.Error GHC.Base.String -- | Logically consistent comparison of floating point numbers. module Agda.Utils.Float floatEq :: Double -> Double -> Bool floatLt :: Double -> Double -> Bool module Agda.Utils.Function -- | Repeat a state transition f :: a -> (b, a) with output -- b while condition cond on the output is true. Return -- all intermediate results and the final result where cond is -- False. -- -- Postconditions (when it terminates): fst (last (iterWhile cond f -- a)) == False. all fst (init (interWhile cond f a)). iterWhile :: (b -> Bool) -> (a -> (b, a)) -> a -> [(b, a)] -- | Repeat something while a condition on some state is true. Return the -- last state (including the changes of the last transition, even if the -- condition became false then). repeatWhile :: (a -> (Bool, a)) -> a -> a -- | Monadic version of repeatWhile. repeatWhileM :: (Monad m) => (a -> m (Bool, a)) -> a -> m a -- | A version of the trampoline function. -- -- The usual function iterates f :: a -> Maybe a as long as -- Just{} is returned, and returns the last value of a -- upon Nothing. -- -- usualTrampoline f = trampolineWhile $ a -> maybe (False,a) -- (True,) (f a). -- -- trampolineWhile is very similar to repeatWhile, only -- that it discards the state on which the condition went False, -- and returns the last state on which the condition was True. trampolineWhile :: (a -> (Bool, a)) -> a -> a -- | Monadic version of trampolineWhile. trampolineWhileM :: (Monad m) => (a -> m (Bool, a)) -> a -> m a -- | More general trampoline, which allows some final computation from -- iteration state a into result type b. trampoline :: (a -> Either b a) -> a -> b -- | Monadic version of trampoline. trampolineM :: Monad m => (a -> m (Either b a)) -> a -> m b -- | Iteration to fixed-point. -- -- iterateUntil r f a0 iterates endofunction f, -- starting with a0, until r relates its result to its -- input, i.e., f a r a. -- -- This is the generic pattern behind saturation algorithms. -- -- If f is monotone with regard to r, meaning a -- r b implies f a r f b, and -- f-chains starting with a0 are finite then iteration -- is guaranteed to terminate. -- -- A typical instance will work on sets, and r could be set -- inclusion, and a0 the empty set, and f the step -- function of a saturation algorithm. iterateUntil :: (a -> a -> Bool) -> (a -> a) -> a -> a -- | Monadic version of iterateUntil. iterateUntilM :: Monad m => (a -> a -> Bool) -> (a -> m a) -> a -> m a -- | iterate' n f x applies f to x -- n times and returns the result. -- -- The applications are calculated strictly. iterate' :: Integral i => i -> (a -> a) -> a -> a -- | applyWhen b f a applies f to a when -- b. applyWhen :: Bool -> (a -> a) -> a -> a -- | applyUnless b f a applies f to a unless -- b. applyUnless :: Bool -> (a -> a) -> a -> a -- | Monadic version of applyWhen applyWhenM :: (Monad m) => m Bool -> (m a -> m a) -> m a -> m a -- | Monadic version of applyUnless applyUnlessM :: (Monad m) => m Bool -> (m a -> m a) -> m a -> m a module Agda.TypeChecking.SizedTypes.Utils debug :: IORef Bool setDebugging :: Bool -> IO () trace :: String -> a -> a traceM :: Applicative f => String -> f () class Eq a => Top a top :: Top a => a isTop :: Top a => a -> Bool class Plus a b c plus :: Plus a b c => a -> b -> c class MeetSemiLattice a meet :: MeetSemiLattice a => a -> a -> a -- | Semiring with idempotent + == dioid class (MeetSemiLattice a, Top a) => Dioid a compose :: Dioid a => a -> a -> a unitCompose :: Dioid a => a instance Agda.TypeChecking.SizedTypes.Utils.Plus GHC.Types.Int GHC.Types.Int GHC.Types.Int -- | Utilities for functors. module Agda.Utils.Functor -- | A decoration is a functor that is traversable into any functor. -- -- The Functor superclass is given because of the limitations of -- the Haskell class system. traverseF actually implies -- functoriality. -- -- Minimal complete definition: traverseF or -- distributeF. class Functor t => Decoration t -- | traverseF is the defining property. traverseF :: (Decoration t, Functor m) => (a -> m b) -> t a -> m (t b) -- | Decorations commute into any functor. distributeF :: (Decoration t, (Functor m)) => t (m a) -> m (t a) -- | Composition: pure function after functorial (monadic) function. (<.>) :: Functor m => (b -> c) -> (a -> m b) -> a -> m c infixr 9 <.> -- | The true pure for loop. for is a misnomer, it should -- be forA. for :: Functor m => m a -> (a -> b) -> m b -- | Any decoration is traversable with traverse = traverseF. Just -- like any Traversable is a functor, so is any decoration, given -- by just traverseF, a functor. dmap :: Decoration t => (a -> b) -> t a -> t b -- | Any decoration is a lens. set is a special case of -- dmap. dget :: Decoration t => t a -> a -- | An infix synonym for fmap. -- -- The name of this operator is an allusion to $. Note the -- similarities between their types: -- --
-- ($) :: (a -> b) -> a -> b -- (<$>) :: Functor f => (a -> b) -> f a -> f b ---- -- Whereas $ is function application, <$> is -- function application lifted over a Functor. -- --
-- >>> 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 $> -- | Flipped version of <$>. -- --
-- (<&>) = flip fmap ---- --
-- >>> Just 2 <&> (+1) -- Just 3 ---- --
-- >>> [1,2,3] <&> (+1) -- [2,3,4] ---- --
-- >>> Right 3 <&> (+1) -- Right 4 --(<&>) :: Functor f => f a -> a -> b -> f b infixl 1 <&> instance Agda.Utils.Functor.Decoration 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) module Agda.Utils.HashMap -- | 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 FunBind :: [Match] -> Decl PatSyn :: Pat -> Pat -> Decl FakeDecl :: 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 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 :: String -> 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.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 instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.ConDecl instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Pat instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Type instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.TyVarBind instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.QOp instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.QName instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Name 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.Literal instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.Strictness instance GHC.Classes.Eq Agda.Utils.Haskell.Syntax.DataOrNew -- | 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) -- | Binary IO. module Agda.Utils.IO.Binary -- | Returns a close function for the file together with the contents. readBinaryFile' :: FilePath -> IO (ByteString, IO ()) -- | Text IO using the UTF8 character encoding. module Agda.Utils.IO.UTF8 -- | Reads a UTF8-encoded text file and converts all Unicode line endings -- into '\n'. readTextFile :: FilePath -> IO String -- | Writes UTF8-encoded text to the handle, which should be opened for -- writing and in text mode. The native convention for line endings is -- used. -- -- The handle's text encoding is not necessarily preserved, it is changed -- to UTF8. hPutStr :: Handle -> String -> IO () -- | 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 () -- | 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 :: String -> Integer -> 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 :: String -> Integer -> Impossible -- | Abort by throwing an "impossible" error. You should not use this -- function directly. Instead use the macro in undefined.h. throwImpossible :: Impossible -> a -- | Catch an "impossible" error, if possible. catchImpossible :: IO a -> (Impossible -> IO a) -> IO a instance GHC.Show.Show Agda.Utils.Impossible.Impossible instance GHC.Exception.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 (throwImpossible (Impossible -- "srcfullAgdaUtilsEmpty.hs" 33)) 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 Data.Data.Data 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 -- | 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.ImpossibleTest impossibleTest :: a module Agda.Auto.NarrowingSearch newtype Prio Prio :: Int -> Prio [getPrio] :: Prio -> Int class Trav a blk | a -> blk trav :: (Trav a blk, Monad m) => (forall b. Trav b blk => MM b blk -> m ()) -> a -> m () 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.Classes.Ord Agda.Auto.NarrowingSearch.Cost instance GHC.Classes.Eq Agda.Auto.NarrowingSearch.Cost instance GHC.Num.Num Agda.Auto.NarrowingSearch.Cost 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 Agda.Auto.NarrowingSearch.Refinable Agda.Auto.NarrowingSearch.Choice blk instance Agda.Auto.NarrowingSearch.Trav a blk => Agda.Auto.NarrowingSearch.Trav (Agda.Auto.NarrowingSearch.MM a blk) 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 type LensMap i o = (i -> i) -> o -> o type LensSet i o = i -> o -> o type LensGet i o = o -> i -- | Van Laarhoven style homogeneous lenses. Mnemoic: "Lens inner outer". type Lens' i o = forall f. Functor f => (i -> f i) -> o -> f 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 ^. -- | Set inner part i of structure o as designated by -- Lens' i o. set :: Lens' i o -> LensSet i o -- | Modify inner part i of structure o using a function -- i -> i. over :: Lens' i o -> LensMap i o -- | 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 -- | Write a part of the state. (.=) :: MonadState o m => Lens' i o -> i -> m () infix 4 .= -- | 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 key :: Ord k => k -> Lens' (Maybe v) (Map k v) -- | Flipped version of <$>. -- --
-- (<&>) = flip fmap ---- --
-- >>> Just 2 <&> (+1) -- Just 3 ---- --
-- >>> [1,2,3] <&> (+1) -- [2,3,4] ---- --
-- >>> Right 3 <&> (+1) -- Right 4 --(<&>) :: Functor f => f a -> a -> b -> f b infixl 1 <&> module Agda.Utils.IndexedList -- | Existential wrapper for indexed types. data Some :: (k -> *) -> * [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 -> *) -> [x] -> * [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 -> * [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.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 errorWarnings :: Set WarningName defaultWarningMode :: WarningMode -- | 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 -> Maybe (WarningMode -> WarningMode) -- | 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 OverlappingTokensWarning_ :: WarningName UnknownNamesInFixityDecl_ :: WarningName UnknownFixityInMixfixDecl_ :: WarningName UnknownNamesInPolarityPragmas_ :: WarningName PolarityPragmasButNotPostulates_ :: WarningName UselessPrivate_ :: WarningName UselessAbstract_ :: WarningName UselessInstance_ :: WarningName EmptyMutual_ :: WarningName EmptyAbstract_ :: WarningName EmptyPrivate_ :: WarningName EmptyInstance_ :: WarningName EmptyMacro_ :: WarningName EmptyPostulate_ :: WarningName InvalidTerminationCheckPragma_ :: WarningName InvalidNoPositivityCheckPragma_ :: WarningName InvalidCatchallPragma_ :: WarningName OldBuiltin_ :: WarningName EmptyRewritePragma_ :: WarningName UselessPublic_ :: WarningName UnreachableClauses_ :: WarningName UselessInline_ :: WarningName GenericWarning_ :: WarningName DeprecationWarning_ :: WarningName InversionDepthReached_ :: WarningName TerminationIssue_ :: WarningName CoverageIssue_ :: WarningName CoverageNoExactSplit_ :: WarningName NotStrictlyPositive_ :: WarningName UnsolvedMetaVariables_ :: WarningName UnsolvedInteractionMetas_ :: WarningName UnsolvedConstraints_ :: WarningName GenericNonFatalError_ :: WarningName SafeFlagPostulate_ :: WarningName SafeFlagPragma_ :: WarningName SafeFlagNonTerminating_ :: WarningName SafeFlagTerminating_ :: WarningName SafeFlagPrimTrustMe_ :: WarningName SafeFlagNoPositivityCheck_ :: WarningName SafeFlagPolarity_ :: WarningName UserWarning_ :: 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.Show.Show Agda.Interaction.Options.Warnings.WarningMode instance GHC.Classes.Eq Agda.Interaction.Options.Warnings.WarningMode 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 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.Show.Show Agda.Interaction.Options.Help.Help instance GHC.Classes.Eq Agda.Interaction.Options.Help.Help instance GHC.Show.Show Agda.Interaction.Options.Help.HelpTopic instance GHC.Classes.Eq Agda.Interaction.Options.Help.HelpTopic 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 :: Int -> AutoToken S :: Int -> AutoToken H :: String -> AutoToken autoTokens :: [String] -> [AutoToken] 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) -- | 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 -- | 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) -- | Filtering a singleton list. -- --
-- filterMaybe p a = listToMaybe (filter p [a]) --filterMaybe :: (a -> Bool) -> a -> Maybe a -- | Version of mapMaybe with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] -- | 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 -- | Monadic version of fromMaybe. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m 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 -- | caseMaybeM with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b -- | A more telling name for forM_ for the Maybe collection -- type. Or: caseMaybe without the Nothing case. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () -- | caseMaybe without the Just case. whenNothing :: Monad m => Maybe a -> m () -> m () -- | caseMaybeM without the Nothing case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () -- | caseMaybeM without the Just case. whenNothingM :: Monad m => m (Maybe a) -> m () -> m () -- | 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]) -- | 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)) -- | 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 -- | 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) 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 -- | Nonempty lists. module Agda.Utils.NonemptyList data NonemptyList a (:!) :: a -> [a] -> NonemptyList a [headNe] :: NonemptyList a -> a [tailNe] :: NonemptyList a -> [a] -- | Returns the union of the argument lists seen as sets. The order of the -- elements in the result is not specified. Precondition: arguments -- contain no duplicates. unionNe :: Eq a => NonemptyList a -> NonemptyList a -> NonemptyList a -- | Zip two nonempty lists. zipWithNe :: (a -> b -> c) -> NonemptyList a -> NonemptyList b -> NonemptyList c -- | Zip two nonempty lists. zipNe :: NonemptyList a -> NonemptyList b -> NonemptyList (a, b) -- | Case on a list, getting a nonempty list in the cons case. caseListNe :: [a] -> b -> (NonemptyList a -> b) -> b -- | Case on a list, with list last. listCaseNe :: b -> (NonemptyList a -> b) -> [a] -> b -- | Check if an element is present in a list. elemNe :: Eq a => a -> NonemptyList a -> Bool -- | List of elements of a structure, from left to right. toList :: Foldable t => t a -> [a] instance Data.Data.Data a => Data.Data.Data (Agda.Utils.NonemptyList.NonemptyList a) instance Data.Traversable.Traversable Agda.Utils.NonemptyList.NonemptyList instance Data.Foldable.Foldable Agda.Utils.NonemptyList.NonemptyList instance GHC.Base.Functor Agda.Utils.NonemptyList.NonemptyList instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Utils.NonemptyList.NonemptyList a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.NonemptyList.NonemptyList a) instance GHC.Base.Semigroup (Agda.Utils.NonemptyList.NonemptyList a) instance GHC.Base.Applicative Agda.Utils.NonemptyList.NonemptyList instance GHC.Base.Monad Agda.Utils.NonemptyList.NonemptyList instance GHC.Show.Show a => GHC.Show.Show (Agda.Utils.NonemptyList.NonemptyList a) -- | 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 ifNullM :: (Monad m, Null a) => m a -> m b -> (a -> 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 Data.ByteString.Internal.ByteString 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.Base.HashMap k a) instance Agda.Utils.Null.Null (Data.HashSet.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.Base.Maybe a) instance Agda.Utils.Null.Null Text.PrettyPrint.HughesPJ.Doc -- | 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 fromJust :: () => Maybe a -> a fromMaybe :: () => a -> Maybe a -> a isJust :: () => Maybe a -> Bool isNothing :: () => Maybe a -> Bool maybe :: () => b -> a -> b -> Maybe a -> b data Maybe a Nothing :: Maybe a Just :: !a -> Maybe a toStrict :: Maybe a -> Maybe a toLazy :: Maybe a -> Maybe a -- | Analogous to listToMaybe in Data.Maybe. listToMaybe :: [a] -> Maybe a -- | Analogous to maybeToList in Data.Maybe. maybeToList :: Maybe a -> [a] -- | Analogous to catMaybes in Data.Maybe. catMaybes :: [Maybe a] -> [a] -- | Analogous to mapMaybe in Data.Maybe. mapMaybe :: (a -> Maybe b) -> [a] -> [b] -- | unionWith for collections of size <= 1. unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a -- | Unzipping a list of length <= 1. unzipMaybe :: Maybe (a, b) -> (Maybe a, Maybe b) -- | Filtering a singleton list. -- --
-- filterMaybe p a = listToMaybe (filter p [a]) --filterMaybe :: (a -> Bool) -> a -> Maybe a -- | Version of mapMaybe with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] -- | 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 -- | Monadic version of fromMaybe. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m 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 -- | caseMaybeM with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b -- | A more telling name for forM for the Maybe collection -- type. Or: caseMaybe without the Nothing case. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () -- | caseMaybeM without the Nothing case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () instance Data.Data.Data a => Data.Data.Data (Data.Strict.Maybe.Maybe a) instance GHC.Generics.Generic (Data.Strict.Maybe.Maybe a) instance Agda.Utils.Null.Null (Data.Strict.Maybe.Maybe a) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Data.Strict.Maybe.Maybe a) instance GHC.Base.Semigroup a => GHC.Base.Monoid (Data.Strict.Maybe.Maybe a) instance Data.Foldable.Foldable Data.Strict.Maybe.Maybe instance Data.Traversable.Traversable Data.Strict.Maybe.Maybe instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Strict.Maybe.Maybe a) instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Data.Strict.Maybe.Maybe a) module Agda.Utils.Parser.ReadP data ReadP t a -- | Consumes and returns the next character. Fails if there is no input -- left. get :: ReadP t t -- | Look-ahead: returns the part of the input that is left, without -- consuming it. look :: ReadP t [t] -- | Symmetric choice. (+++) :: ReadP t a -> ReadP t a -> ReadP t a infixr 5 +++ -- | Local, exclusive, left-biased choice: If left parser locally produces -- any result at all, then right parser is not used. (<++) :: ReadP t a -> ReadP t a -> ReadP t a infixr 5 <++ -- | Transforms a parser into one that does the same, but in addition -- returns the exact characters read. IMPORTANT NOTE: gather gives -- a runtime error if its first argument is built using any occurrences -- of readS_to_P. gather :: ReadP t a -> ReadP t ([t], a) -- | Run a parser on a list of tokens. Returns the list of complete -- matches. parse :: ReadP t a -> [t] -> [a] parse' :: ReadP t a -> [t] -> Either a [t] -- | Always fails. pfail :: ReadP t a -- | Consumes and returns the next character, if it satisfies the specified -- predicate. satisfy :: (t -> Bool) -> ReadP t t -- | Parses and returns the specified character. char :: Eq t => t -> ReadP t t -- | Parses and returns the specified string. string :: Eq t => [t] -> ReadP t [t] -- | Parses the first zero or more characters satisfying the predicate. munch :: (t -> Bool) -> ReadP t [t] -- | Parses the first one or more characters satisfying the predicate. munch1 :: (t -> Bool) -> ReadP t [t] -- | Skips all whitespace. skipSpaces :: ReadP Char () -- | Combines all parsers in the specified list. choice :: [ReadP t a] -> ReadP t a -- | count n p parses n occurrences of p in -- sequence. A list of results is returned. count :: Int -> ReadP t a -> ReadP t [a] -- | between open close p parses open, followed by -- p and finally close. Only the value of p is -- returned. between :: ReadP t open -> ReadP t close -> ReadP t a -> ReadP t a -- | option x p will either parse p or return x -- without consuming any input. option :: a -> ReadP t a -> ReadP t a -- | optional p optionally parses p and always returns -- (). optional :: ReadP t a -> ReadP t () -- | Parses zero or more occurrences of the given parser. many :: ReadP t a -> ReadP t [a] -- | Parses one or more occurrences of the given parser. many1 :: ReadP t a -> ReadP t [a] -- | Like many, but discards the result. skipMany :: ReadP t a -> ReadP t () -- | Like many1, but discards the result. skipMany1 :: ReadP t a -> ReadP t () -- | sepBy p sep parses zero or more occurrences of p, -- separated by sep. Returns a list of values returned by -- p. sepBy :: ReadP t a -> ReadP t sep -> ReadP t [a] -- | sepBy1 p sep parses one or more occurrences of p, -- separated by sep. Returns a list of values returned by -- p. sepBy1 :: ReadP t a -> ReadP t sep -> ReadP t [a] -- | endBy p sep parses zero or more occurrences of p, -- separated and ended by sep. endBy :: ReadP t a -> ReadP t sep -> ReadP t [a] -- | endBy p sep parses one or more occurrences of p, -- separated and ended by sep. endBy1 :: ReadP t a -> ReadP t sep -> ReadP t [a] -- | chainr p op x parses zero or more occurrences of p, -- separated by op. Returns a value produced by a right -- associative application of all functions returned by op. If -- there are no occurrences of p, x is returned. chainr :: ReadP t a -> ReadP t (a -> a -> a) -> a -> ReadP t a -- | chainl p op x parses zero or more occurrences of p, -- separated by op. Returns a value produced by a left -- associative application of all functions returned by op. If -- there are no occurrences of p, x is returned. chainl :: ReadP t a -> ReadP t (a -> a -> a) -> a -> ReadP t a -- | Like chainl, but parses one or more occurrences of p. chainl1 :: ReadP t a -> ReadP t (a -> a -> a) -> ReadP t a -- | Like chainr, but parses one or more occurrences of p. chainr1 :: ReadP t a -> ReadP t (a -> a -> a) -> ReadP t a -- | manyTill p end parses zero or more occurrences of p, -- until end succeeds. Returns a list of values returned by -- p. manyTill :: ReadP t a -> ReadP t end -> ReadP t [a] instance GHC.Base.Functor (Agda.Utils.Parser.ReadP.P t) instance GHC.Base.Functor (Agda.Utils.Parser.ReadP.ReadP t) instance GHC.Base.Applicative (Agda.Utils.Parser.ReadP.ReadP t) instance GHC.Base.Monad (Agda.Utils.Parser.ReadP.ReadP t) instance GHC.Base.Alternative (Agda.Utils.Parser.ReadP.ReadP t) instance GHC.Base.MonadPlus (Agda.Utils.Parser.ReadP.ReadP t) instance GHC.Base.Applicative (Agda.Utils.Parser.ReadP.P t) instance GHC.Base.Monad (Agda.Utils.Parser.ReadP.P t) instance GHC.Base.Alternative (Agda.Utils.Parser.ReadP.P t) instance GHC.Base.MonadPlus (Agda.Utils.Parser.ReadP.P t) 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.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.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.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.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.Integer.Type.Integer instance Agda.Utils.PartialOrd.PartialOrd () instance Agda.Utils.PartialOrd.PartialOrd a => Agda.Utils.PartialOrd.PartialOrd (GHC.Base.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, 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 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 Data.Data.Data a => Data.Data.Data (Agda.Utils.Pointer.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) instance Data.Typeable.Internal.Typeable a => Data.Data.Data (GHC.IORef.IORef a) -- | 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 -- | Use instead of show when printing to world. prettyShow :: Pretty a => a -> String pwords :: String -> [Doc] fwords :: String -> Doc -- | Comma separated list, without the brackets. prettyList_ :: Pretty a => [a] -> Doc -- | Apply parens to Doc if boolean is true. mparens :: Bool -> 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 -- |
-- a ? b = hang a 2 b --(>) :: Doc -> Doc -> Doc infixl 6 > -- |
-- pshow = text . pretty --pshow :: Show a => a -> Doc -- | 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 -- | Render the Doc to a String using the given Style. renderStyle :: Style -> Doc -> String -- | Render the Doc to a String using the default Style -- (see style). render :: Doc -> String -- | "Paragraph fill" version of sep. fsep :: [Doc] -> Doc -- | "Paragraph fill" version of cat. fcat :: [Doc] -> Doc -- | Either hcat or vcat. cat :: [Doc] -> Doc -- | Either hsep or vcat. sep :: [Doc] -> Doc -- | Beside, separated by space, unless one of the arguments is -- empty. <+> is associative, with identity -- empty. (<+>) :: Doc -> Doc -> Doc infixl 6 <+> -- | Beside. <> is associative, with identity empty. (<>) :: Doc -> Doc -> Doc infixl 6 <> -- | Above, with no overlapping. $+$ is associative, with identity -- empty. ($+$) :: Doc -> Doc -> Doc infixl 5 $+$ -- | 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 $$ -- |
-- punctuate p [d1, ... dn] = [d1 <> p, d2 <> p, ... dn-1 <> p, dn] --punctuate :: Doc -> [Doc] -> [Doc] -- |
-- hang d1 n d2 = sep [d1, nest n d2] --hang :: Doc -> Int -> 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
-- 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 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 /\ -- | Swap. (Only in Data.Tuple from base-4.3) swap :: (a, b) -> (b, a) fst3 :: (a, b, c) -> a snd3 :: (a, b, c) -> b thd3 :: (a, b, c) -> c 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) newtype List2 a List2 :: (a, a) -> List2 a [list2] :: List2 a -> (a, a) instance Data.Traversable.Traversable Agda.Utils.Tuple.List2 instance Data.Foldable.Foldable Agda.Utils.Tuple.List2 instance GHC.Base.Functor Agda.Utils.Tuple.List2 instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Utils.Tuple.List2 a) instance GHC.Base.Applicative Agda.Utils.Tuple.List2 module Agda.Utils.Map data EitherOrBoth a b L :: a -> EitherOrBoth a b B :: a -> b -> EitherOrBoth a b R :: b -> EitherOrBoth a b -- | Not very efficient (goes via a list), but it'll do. unionWithM :: (Ord k, Monad m) => (a -> a -> m a) -> Map k a -> Map k a -> m (Map k a) insertWithKeyM :: (Ord k, Monad m) => (k -> a -> a -> m a) -> k -> a -> Map k a -> m (Map k a) -- | Big conjunction over a map. allWithKey :: (k -> a -> Bool) -> Map k a -> Bool -- | Filter a map based on the keys. filterKeys :: (k -> Bool) -> Map k a -> Map k a -- | Unzip a map. unzip :: Map k (a, b) -> (Map k a, Map k b) unzip3 :: Map k (a, b, c) -> (Map k a, Map k b, Map k c) -- | Utility functions for lists. module Agda.Utils.List -- | Case distinction for lists, with list first. Cf. ifNull. caseList :: [a] -> b -> (a -> [a] -> b) -> b -- | Case distinction for lists, with list last. listCase :: b -> (a -> [a] -> b) -> [a] -> b -- | Head function (safe). headMaybe :: [a] -> Maybe a -- | Head function (safe). Returns a value on empty lists. -- --
-- headWithDefault 42 [] = 42 -- headWithDefault 42 [1,2,3] = 1 --headWithDefault :: a -> [a] -> a -- | Last element (safe). lastMaybe :: [a] -> Maybe a -- | Last two elements (safe). last2 :: [a] -> Maybe (a, a) -- | Opposite of cons (:), safe. uncons :: [a] -> Maybe (a, [a]) -- | Maybe cons. mcons ma as = maybeToList ma ++ as mcons :: Maybe a -> [a] -> [a] -- | init and last in one go, safe. initLast :: [a] -> Maybe ([a], a) -- | Lookup function (partially safe). (!!!) :: [a] -> Int -> Maybe a -- | downFrom n = [n-1,..1,0] downFrom :: Integral a => a -> [a] -- | Update the first element of a list, if it exists. updateHead :: (a -> a) -> [a] -> [a] -- | Update the last element of a list, if it exists. updateLast :: (a -> a) -> [a] -> [a] -- | Update nth element of a list, if it exists. Precondition: the index is -- >= 0. updateAt :: Int -> (a -> a) -> [a] -> [a] -- | A generalized version of partition. (Cf. mapMaybe -- vs. filter). mapEither :: (a -> Either b c) -> [a] -> ([b], [c]) deal :: (a -> Either b c) -> a -> ([b], [c]) -> ([b], [c]) -- | A generalized version of takeWhile. (Cf. mapMaybe -- vs. filter). takeWhileJust :: (a -> Maybe b) -> [a] -> [b] -- | A generalized version of span. spanJust :: (a -> Maybe b) -> [a] -> ([b], [a]) -- | Partition a list into Nothings and Justs. -- 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. filterAndRest :: (a -> Bool) -> [a] -> ([a], [a]) -- | Like mapMaybe, but additionally return the last partition of -- the list where the function always returns Nothing. mapMaybeAndRest :: (a -> Maybe b) -> [a] -> ([b], [a]) -- | Drops from both lists simultaneously until one list is empty. dropCommon :: [a] -> [b] -> ([a], [b]) -- | Sublist relation. isSublistOf :: Eq a => [a] -> [a] -> Bool type Prefix a = [a] type Suffix a = [a] -- | Check if a list has a given prefix. If so, return the list minus the -- prefix. stripPrefixBy :: (a -> a -> Bool) -> Prefix a -> [a] -> Maybe (Suffix a) -- | Result of preOrSuffix. data PreOrSuffix a -- | First list is prefix of second. IsPrefix :: a -> [a] -> PreOrSuffix a -- | First list is suffix of second. IsSuffix :: a -> [a] -> PreOrSuffix a -- | The lists are equal. IsBothfix :: PreOrSuffix a -- | The lists are incomparable. IsNofix :: PreOrSuffix a -- | Compare lists with respect to prefix partial order. preOrSuffix :: Eq a => [a] -> [a] -> PreOrSuffix a -- | Split a list into sublists. Generalisation of the prelude function -- words. -- --
-- words xs == wordsBy isSpace xs --wordsBy :: (a -> Bool) -> [a] -> [[a]] -- | Chop up a list in chunks of a given length. 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. > intercalate [x] (chopWhen (== x) xs) == xs chopWhen :: (a -> Bool) -> [a] -> [[a]] -- | All ways of removing one element from a list. holes :: [a] -> [(a, [a])] -- | Check whether a list is sorted. -- -- Assumes that the Ord instance implements a partial order. sorted :: Ord a => [a] -> Bool -- | Check whether all elements in a list are distinct from each other. -- Assumes that the Eq instance stands for an equivalence -- relation. distinct :: Eq a => [a] -> Bool -- | An optimised version of distinct. -- -- Precondition: The list's length must fit in an Int. fastDistinct :: Ord a => [a] -> Bool -- | Checks if all the elements in the list are equal. Assumes that the -- Eq instance stands for an equivalence relation. allEqual :: Eq a => [a] -> Bool -- | Returns an (arbitrary) representative for each list element that -- occurs more than once. duplicates :: Ord a => [a] -> [a] -- | A variant of groupBy which applies the predicate to consecutive -- pairs. groupBy' :: (a -> a -> Bool) -> [a] -> [[a]] -- | groupOn f = groupBy ((==) `on` f) . -- sortBy (compare `on` f). groupOn :: Ord b => (a -> b) -> [a] -> [[a]] -- | splitExactlyAt n xs = Just (ys, zs) iff xs = ys ++ -- zs and genericLength ys = n. splitExactlyAt :: Integral n => n -> [a] -> Maybe ([a], [a]) -- | A generalised variant of elemIndex. genericElemIndex :: (Eq a, Integral i) => a -> [a] -> Maybe i -- | Requires both lists to have the same length. -- -- 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). -- --
-- zipWithKeepRest f as bs == zipWith f as bs ++ drop (length as) bs --zipWithKeepRest :: (a -> b -> b) -> [a] -> [b] -> [b] -- | Efficient variant of nubBy for finite lists. -- -- Specification: -- --
-- nubOn f xs == 'nubBy' ((==) `'on'` f) xs. --nubOn :: Ord b => (a -> b) -> [a] -> [a] -- | Efficient variant of nubBy for finite lists. -- -- Specification: For each list xs there is a list ys -- which is a permutation of xs such that -- --
-- uniqOn f xs == 'nubBy' ((==) `'on'` f) ys. ---- -- Furthermore -- --
-- List.sortBy (compare `on` f) (uniqOn f xs) == uniqOn f xs. --uniqOn :: Ord b => (a -> b) -> [a] -> [a] -- | Compute the common suffix of two lists. commonSuffix :: Eq a => [a] -> [a] -> [a] -- | Compute the common prefix of two lists. commonPrefix :: Eq a => [a] -> [a] -> [a] editDistanceSpec :: Eq a => [a] -> [a] -> Int editDistance :: Eq a => [a] -> [a] -> Int 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 -- | Shows a non-negative integer using the characters ₀-₉ instead of 0-9 -- unless the user explicitly asked us to not use any unicode characters. showIndex :: (Show i, Integral i) => i -> 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 newtype Str Str :: String -> Str [unStr] :: Str -> String -- | Show a number using comma to separate powers of 1,000. showThousandSep :: Show a => a -> String -- | Remove leading whitespace. ltrim :: String -> String -- | Remove trailing whitespace. rtrim :: String -> String -- | Remove leading and trailing whitesapce. trim :: String -> String instance GHC.Classes.Eq Agda.Utils.String.Str instance GHC.Show.Show Agda.Utils.String.Str -- | Time-related utilities. module Agda.Utils.Time -- | Timestamps. type ClockTime = UTCTime -- | The current time. getClockTime :: IO ClockTime getCPUTime :: MonadIO m => m CPUTime -- | Measure the time of a computation. Of course, does not work with -- exceptions. measureTime :: MonadIO m => m a -> m (a, CPUTime) -- | CPU time in pico (10^-12) seconds. newtype CPUTime CPUTime :: Integer -> CPUTime fromMilliseconds :: Integer -> CPUTime instance GHC.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 for .agda-lib files. -- -- Example file: -- --
-- name: Main -- depend: -- standard-library -- include: . -- src more-src -- ---- -- Should parse as: -- --
-- AgdaLib -- { libName = Main -- , libFile = path_to_this_file -- , libIncludes = [ "." , "src" , "more-src" ] -- , libDepends = [ "standard-library" ] -- } -- --module Agda.Interaction.Library.Parse -- | Parse .agda-lib file. -- -- Sets libFile name and turn mentioned include directories into -- absolute pathes (provided the given FilePath is absolute). parseLibFile :: FilePath -> IO (P AgdaLibFile) -- | Break a comma-separated string. Result strings are trimmed. splitCommas :: String -> [String] -- | Remove leading whitespace and line comment. trimLineComment :: String -> String type LineNumber = Int instance GHC.Show.Show Agda.Interaction.Library.Parse.GenericLine -- | Code for instructing Emacs to do things module Agda.Interaction.EmacsCommand -- | Simple Emacs Lisp expressions. data Lisp a -- | Atom. A :: a -> Lisp a Cons :: (Lisp a) -> (Lisp a) -> Lisp a -- | List. L :: [Lisp a] -> Lisp a Q :: (Lisp a) -> Lisp a -- | Formats a response command. -- -- Replaces '\n' with spaces to ensure that each command is a -- single line. response :: Lisp String -> String -- | Writes a response command to standard output. putResponse :: Lisp String -> IO () display_info' :: Bool -> String -> String -> Lisp String display_warning :: String -> String -> Lisp String -- | Clear the running info buffer. clearRunningInfo :: Lisp String -- | Clear the warning buffer clearWarning :: Lisp String -- | Display running information about what the type-checker is up to. displayRunningInfo :: String -> Lisp String instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Interaction.EmacsCommand.Lisp a) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Interaction.EmacsCommand.Lisp a) instance GHC.Show.Show (Agda.Interaction.EmacsCommand.Lisp GHC.Base.String) module Agda.Utils.Monad -- | Binary bind. (==<<) :: Monad m => (a -> b -> m c) -> (m a, m b) -> m c whenM :: Monad m => m Bool -> m () -> m () unlessM :: Monad m => m Bool -> m () -> m () -- | Monadic guard. guardM :: (Monad m, MonadPlus m) => m Bool -> m () -- | Monadic if-then-else. ifM :: Monad m => m Bool -> m a -> m a -> m a -- |
-- ifNotM mc = ifM (not $ mc) --ifNotM :: Monad m => m Bool -> m a -> m a -> m a -- | Lazy monadic conjunction. and2M :: Monad m => m Bool -> m Bool -> m Bool andM :: (Foldable f, Monad m) => f (m Bool) -> m Bool allM :: (Functor f, Foldable f, Monad m) => f a -> (a -> m Bool) -> m Bool -- | Lazy monadic disjunction. or2M :: Monad m => m Bool -> m Bool -> m Bool orM :: (Foldable f, Monad m) => f (m Bool) -> m Bool anyM :: (Functor f, 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 mapM_ :: Monad 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, Monad m, Monoid b) => (a -> m b) -> t a -> m b -- | Generalized version of forM_ :: Monad m => [a] -> (a -> m -- ()) -> m () forM' :: (Foldable t, Monad m, Monoid b) => t a -> (a -> m b) -> m b -- | A monadic version of mapMaybe :: (a -> Maybe b) -> -- [a] -> [b]. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] -- | The for version of mapMaybeM. forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b] -- | A monadic version of dropWhile :: (a -> Bool) -> [a] -- -> [a]. dropWhileM :: 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 -- | Finally for the Error class. Errors in the finally part take -- precedence over prior errors. finally :: MonadError e m => m a -> m () -> m a -- | Try a computation, return Nothing if an Error occurs. tryMaybe :: (MonadError e m, Functor m) => m a -> m (Maybe a) -- | Bracket without failure. Typically used to preserve state. bracket_ :: Monad m => m a -> (a -> m ()) -> m b -> m b -- | Restore state after computation. localState :: MonadState s m => m a -> m a readM :: (Error e, MonadError e m, Read a) => String -> 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 :: * -> *) -- | 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. (<*>) :: 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 <$ -- | 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 -- | Tries to establish if the two file paths point to the same file (or -- directory). (===) :: AbsolutePath -> AbsolutePath -> Bool infix 4 === -- | 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 rootPath :: FilePath instance Data.Hashable.Class.Hashable Agda.Utils.FileName.AbsolutePath instance Data.Data.Data 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 hashFile :: AbsolutePath -> IO 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 a, Functor m, MonadIO m) => MonadBench a m | m -> a getBenchmark :: MonadBench a m => m (Benchmark a) getsBenchmark :: MonadBench a m => (Benchmark a -> c) -> m c putBenchmark :: MonadBench a m => Benchmark a -> m () modifyBenchmark :: MonadBench a m => (Benchmark a -> Benchmark a) -> m () -- | We need to be able to terminate benchmarking in case of an exception. finally :: MonadBench a m => m b -> m c -> m b -- | Turn benchmarking on/off. setBenchmarking :: MonadBench a m => BenchmarkOn a -> m () -- | Bill current account with time up to now. Switch to new account. -- Return old account (if any). switchBenchmarking :: MonadBench a m => Maybe (Account a) -> m (Maybe (Account a)) -- | Resets the account and the timing information. reset :: MonadBench a m => m () -- | Bill a computation to a specific account. Works even if the -- computation is aborted by an exception. billTo :: MonadBench a m => Account a -> m c -> m c -- | Bill a CPS function to an account. Can't handle exceptions. billToCPS :: MonadBench a m => Account a -> ((b -> m c) -> m c) -> (b -> m c) -> m c -- | Bill a pure computation to a specific account. billPureTo :: MonadBench a m => Account a -> c -> m c instance Agda.Utils.Benchmark.MonadBench a m => Agda.Utils.Benchmark.MonadBench a (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.Utils.Benchmark.MonadBench a m => Agda.Utils.Benchmark.MonadBench a (Control.Monad.Trans.State.Lazy.StateT r 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) -- | 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 AbsolutePath positionInvariant :: Position' a -> Bool -- | The first position in a file: position 1, line 1, column 1. startPos :: Maybe AbsolutePath -> 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 :: Position' a -> String -> 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 -- | Extracts the interval corresponding to the given string, assuming that -- the string starts at the beginning of the given interval. -- -- Precondition: The string must not be too long for the interval. takeI :: String -> Interval' a -> Interval' a -- | Removes the interval corresponding to the given string from the given -- interval, assuming that the string starts at the beginning of the -- interval. -- -- Precondition: The string must not be too long for the interval. dropI :: String -> Interval' a -> 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 -- | 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 t getRange :: HasRange t => t -> Range -- | If it is also possible to set the range, this is the class. -- -- Instances should satisfy getRange (setRange r x) == -- r. class HasRange t => SetRange t setRange :: SetRange t => Range -> t -> t -- | Killing the range of an object sets all range information to -- noRange. class KillRange a killRange :: KillRange 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 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 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Position.Range' a) 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Position.Interval' 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Position.Position' 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.Integer.Type.Integer instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange [a] instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.NonemptyList.NonemptyList a) instance Agda.Syntax.Position.KillRange GHC.Base.String instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Data.Map.Internal.Map k 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 (GHC.Base.Maybe a) 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.HasRange Agda.Syntax.Position.Interval instance Agda.Syntax.Position.HasRange Agda.Syntax.Position.Range 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.NonemptyList.NonemptyList 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 (GHC.Base.Maybe a) instance (Agda.Syntax.Position.HasRange a, Agda.Syntax.Position.HasRange b) => Agda.Syntax.Position.HasRange (Data.Either.Either a b) instance Agda.Utils.Null.Null (Agda.Syntax.Position.Range' a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Range' (Data.Strict.Maybe.Maybe a)) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Range' (GHC.Base.Maybe a)) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.Range' (Data.Strict.Maybe.Maybe a)) instance GHC.Show.Show Agda.Syntax.Position.IntervalWithoutFile instance Agda.Utils.Pretty.Pretty Agda.Syntax.Position.IntervalWithoutFile instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Interval' (Data.Strict.Maybe.Maybe a)) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.Interval' (Data.Strict.Maybe.Maybe a)) instance GHC.Show.Show Agda.Syntax.Position.PositionWithoutFile instance Agda.Utils.Pretty.Pretty Agda.Syntax.Position.PositionWithoutFile 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 GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Position.Position' (Data.Strict.Maybe.Maybe a)) instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Position.Position' (Data.Strict.Maybe.Maybe a)) 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 permute :: Permutation -> [a] -> [a] safePermute :: Permutation -> [a] -> [Maybe 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 -- | 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 Data.Traversable.Traversable Agda.Utils.Permutation.Drop instance Data.Foldable.Foldable Agda.Utils.Permutation.Drop instance GHC.Base.Functor Agda.Utils.Permutation.Drop instance Data.Data.Data a => Data.Data.Data (Agda.Utils.Permutation.Drop a) 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 Data.Data.Data Agda.Utils.Permutation.Permutation instance GHC.Classes.Eq Agda.Utils.Permutation.Permutation instance Agda.Utils.Permutation.DoDrop [a] instance Agda.Utils.Permutation.DoDrop Agda.Utils.Permutation.Permutation instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Utils.Permutation.Drop a) instance Agda.Utils.Permutation.InversePermute [GHC.Base.Maybe a] [(GHC.Types.Int, a)] instance Agda.Utils.Permutation.InversePermute [GHC.Base.Maybe a] (Data.IntMap.Internal.IntMap a) instance Agda.Utils.Permutation.InversePermute [GHC.Base.Maybe a] [GHC.Base.Maybe a] instance Agda.Utils.Permutation.InversePermute (GHC.Types.Int -> a) [GHC.Base.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 Agda.Syntax.Position.KillRange Agda.Utils.Permutation.Permutation module Agda.Syntax.Parser.Monad -- | The parse monad. Equivalent to StateT ParseState (Either -- ParseError) except for the definition of fail, -- which builds a suitable ParseError object. 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] -> [LexState] -> ParseFlags -> 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 contexts [parseLayout] :: ParseState -> [LayoutContext] -- | the state of the lexer (states can be nested so we need a stack) [parseLexState] :: ParseState -> [LexState] -- | currently there are no flags [parseFlags] :: ParseState -> ParseFlags -- | 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 :: !AbsolutePath -> [String] -> ParseError -- | The file which the error concerns. [errPath] :: ParseError -> !AbsolutePath [errValidExts] :: ParseError -> [String] ReadFileError :: !AbsolutePath -> IOError -> ParseError -- | The file which the error concerns. [errPath] :: ParseError -> !AbsolutePath [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) -- | To do 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 (if any) of a layout block. See -- Agda.Syntax.Parser.Layout for more informaton. data LayoutContext -- | no layout NoLayout :: LayoutContext -- | layout at specified column Layout :: Int32 -> LayoutContext -- | There aren't any parser flags at the moment. 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 AbsolutePath -> 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 most general way of parsing a file. The Agda.Syntax.Parser -- will define more specialised functions that supply the -- ParseFlags and the LexState. -- -- Note that Agda source files always use the UTF-8 character encoding. parseFile :: ParseFlags -> [LexState] -> Parser a -> AbsolutePath -> IO (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 context. topContext :: Parser LayoutContext popContext :: Parser () pushContext :: LayoutContext -> Parser () -- | Should only be used at the beginning of a file. When we start parsing -- we should be in layout mode. Instead of forcing zero indentation we -- use the indentation of the first token. pushCurrentContext :: Parser () parseWarningName :: ParseWarning -> WarningName -- |
-- parseError = fail --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 -- | 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 a => GHC.Show.Show (Agda.Syntax.Parser.Monad.ParseResult a) instance Data.Data.Data Agda.Syntax.Parser.Monad.ParseWarning instance GHC.Show.Show Agda.Syntax.Parser.Monad.ParseState instance GHC.Show.Show Agda.Syntax.Parser.Monad.ParseFlags instance GHC.Show.Show Agda.Syntax.Parser.Monad.LayoutContext instance GHC.Base.Monad Agda.Syntax.Parser.Monad.Parser instance GHC.Base.Functor Agda.Syntax.Parser.Monad.Parser instance GHC.Base.Applicative Agda.Syntax.Parser.Monad.Parser 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.Show.Show 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 GHC.Show.Show Agda.Syntax.Parser.Monad.ParseError instance Agda.Utils.Pretty.Pretty Agda.Syntax.Parser.Monad.ParseError instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Monad.ParseError -- | 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)] -- | Possible extensions for a literate Agda file literateExts :: [String] -- | 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] -- | 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 a role corresponds to Agda code isCode :: LayerRole -> Bool -- | Returns True a layer contains Agda code isCodeLayer :: Layer -> Bool instance GHC.Show.Show Agda.Syntax.Parser.Literate.Layer instance GHC.Classes.Eq Agda.Syntax.Parser.Literate.LayerRole instance GHC.Show.Show Agda.Syntax.Parser.Literate.LayerRole instance Agda.Syntax.Position.HasRange Agda.Syntax.Parser.Literate.Layer -- | Some common syntactic entities are defined in this module. module Agda.Syntax.Common -- | Used to specify whether something should be delayed. data Delayed Delayed :: Delayed NotDelayed :: Delayed data HasEta NoEta :: HasEta YesEta :: HasEta 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 one of -- setHiding or mapHiding. class LensHiding a getHiding :: LensHiding a => a -> Hiding setHiding :: LensHiding a => Hiding -> a -> a mapHiding :: LensHiding 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 -- | 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 -> 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. [modQuantity] :: Modality -> Quantity defaultModality :: Modality class LensModality a getModality :: LensModality a => a -> Modality setModality :: LensModality a => Modality -> a -> a mapModality :: LensModality 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 -- | Quantity for linearity. data Quantity -- | Zero uses, erased at runtime. TODO: | Quantity1 -- ^ Linear use (could -- be updated destructively). (needs postponable constraints between -- quantities to compute uses). Quantity0 :: Quantity -- | Unrestricted use. Quantityω :: Quantity defaultQuantity :: Quantity class LensQuantity a getQuantity :: LensQuantity a => a -> Quantity setQuantity :: LensQuantity a => Quantity -> a -> a mapQuantity :: LensQuantity a => (Quantity -> Quantity) -> a -> a -- | A function argument can be relevant or irrelevant. See -- Agda.TypeChecking.Irrelevance. data Relevance -- | The argument is (possibly) relevant at compile-time. Relevant :: 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] defaultRelevance :: Relevance -- | A lens to access the Relevance attribute in data structures. -- Minimal implementation: getRelevance and one of -- setRelevance or mapRelevance. class LensRelevance a getRelevance :: LensRelevance a => a -> Relevance setRelevance :: LensRelevance a => Relevance -> a -> a mapRelevance :: LensRelevance 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 -- | unusableRelevance rel == True iff we cannot use a variable of -- rel. unusableRelevance :: LensRelevance a => a -> Bool -- | Relevance composition. Irrelevant is dominant, -- Relevant is neutral. composeRelevance :: Relevance -> Relevance -> Relevance -- | inverseComposeRelevance r x returns the most irrelevant -- y such that forall x, y we have x -- `moreRelevant` (r `composeRelevance` y) iff (r -- `inverseComposeRelevance` x) `moreRelevant` y (Galois -- connection). inverseComposeRelevance :: Relevance -> Relevance -> Relevance -- | Irrelevant 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 -- | 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 -- | 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 one of -- setOrigin or mapOrigin. class LensOrigin a getOrigin :: LensOrigin a => a -> Origin setOrigin :: LensOrigin a => Origin -> a -> a mapOrigin :: LensOrigin 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 one -- of setFreeVariables or mapFreeVariables. class LensFreeVariables a getFreeVariables :: LensFreeVariables a => a -> FreeVariables setFreeVariables :: LensFreeVariables a => FreeVariables -> a -> a mapFreeVariables :: LensFreeVariables 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 -> ArgInfo [argInfoHiding] :: ArgInfo -> Hiding [argInfoModality] :: ArgInfo -> Modality [argInfoOrigin] :: ArgInfo -> Origin [argInfoFreeVariables] :: ArgInfo -> FreeVariables 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 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 -- | Similar to Arg, but we need to distinguish an irrelevance -- annotation in a function domain (the domain itself is not irrelevant!) -- from an irrelevant argument. -- -- Dom is used in Pi of internal syntax, in -- Context and Telescope. Arg is used for actual -- arguments (Var, Con, Def etc.) and in -- Abstract syntax and other situations. data Dom e Dom :: ArgInfo -> e -> Dom e [domInfo] :: Dom e -> ArgInfo [unDom] :: Dom e -> e argFromDom :: Dom a -> Arg a domFromArg :: Arg a -> Dom a defaultDom :: a -> Dom a -- | Something potentially carrying a name. data Named name a Named :: Maybe name -> a -> Named name a [nameOf] :: Named name a -> Maybe name [namedThing] :: Named name a -> a -- | Standard naming. type Named_ = Named RString unnamed :: a -> Named name a named :: name -> a -> Named name a -- | 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 -- | The functor instance for NamedArg would be ambiguous, so we -- give it another name here. updateNamedArg :: (a -> b) -> NamedArg a -> NamedArg b -- |
-- setNamedArg a b = updateNamedArg (const b) a --setNamedArg :: NamedArg a -> b -> NamedArg b -- | 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 data DataOrRecord IsData :: DataOrRecord IsRecord :: DataOrRecord -- | 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 -- | Visible from outside, but not exported when opening the module Used -- for qualified constructors. OnlyQualified :: Access -- | Abstract or concrete data IsAbstract AbstractDef :: IsAbstract ConcreteDef :: IsAbstract -- | Is this definition eligible for instance search? data IsInstance InstanceDef :: IsInstance NotInstanceDef :: IsInstance -- | Is this a macro definition? data IsMacro MacroDef :: IsMacro NotMacroDef :: IsMacro type Nat = Int type Arity = Nat -- | The unique identifier of a name. Second argument is the top-level -- module identifier. data NameId NameId :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> NameId -- | A meta variable identifier is just a natural number. newtype MetaId MetaId :: Nat -> MetaId [metaId] :: MetaId -> Nat newtype Constr a Constr :: a -> Constr a -- | 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 -- | The things you are allowed to say when you shuffle names between name -- spaces (i.e. in import, namespace, or open -- declarations). data ImportDirective' a b ImportDirective :: Range -> Using' a b -> [ImportedName' a b] -> [Renaming' a b] -> Bool -> ImportDirective' a b [importDirRange] :: ImportDirective' a b -> Range [using] :: ImportDirective' a b -> Using' a b [hiding] :: ImportDirective' a b -> [ImportedName' a b] [impRenaming] :: ImportDirective' a b -> [Renaming' a b] -- | Only for open. Exports the opened names from the current -- module. [publicOpen] :: ImportDirective' a b -> Bool data Using' a b UseEverything :: Using' a b Using :: [ImportedName' a b] -> Using' a b -- | Default is directive is private (use everything, but do not -- export). defaultImportDir :: ImportDirective' a b isDefaultImportDir :: ImportDirective' a b -> Bool -- | An imported name can be a module or a defined name data ImportedName' a b ImportedModule :: b -> ImportedName' a b ImportedName :: a -> ImportedName' a b setImportedName :: ImportedName' a a -> a -> ImportedName' a a data Renaming' a b Renaming :: ImportedName' a b -> ImportedName' a b -> Range -> Renaming' a b -- | Rename from this name. [renFrom] :: Renaming' a b -> ImportedName' a b -- | To this one. Must be same kind as renFrom. [renTo] :: Renaming' a b -> ImportedName' a b -- | The range of the "to" keyword. Retained for highlighting purposes. [renToRange] :: Renaming' a b -> 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). type PositivityCheck = Bool 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 Data.Data.Data m => Data.Data.Data (Agda.Syntax.Common.TerminationCheck m) instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Common.ImportDirective' a b) instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Agda.Syntax.Common.ImportDirective' a b) instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Common.Renaming' a b) instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Agda.Syntax.Common.Renaming' a b) instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Common.Using' a b) instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Agda.Syntax.Common.Using' a b) instance (GHC.Classes.Ord b, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Common.ImportedName' a b) instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Common.ImportedName' a b) instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Agda.Syntax.Common.ImportedName' a b) instance Data.Data.Data 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.Classes.Ord Agda.Syntax.Common.InteractionId instance GHC.Classes.Eq Agda.Syntax.Common.InteractionId 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 Data.Data.Data e => Data.Data.Data (Agda.Syntax.Common.MaybePlaceholder e) instance Data.Data.Data Agda.Syntax.Common.PositionInName 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 Data.Data.Data Agda.Syntax.Common.MetaId instance GHC.Real.Integral Agda.Syntax.Common.MetaId instance GHC.Enum.Enum Agda.Syntax.Common.MetaId instance GHC.Real.Real Agda.Syntax.Common.MetaId instance GHC.Num.Num Agda.Syntax.Common.MetaId instance GHC.Classes.Ord Agda.Syntax.Common.MetaId instance GHC.Classes.Eq Agda.Syntax.Common.MetaId instance GHC.Generics.Generic Agda.Syntax.Common.NameId instance Data.Data.Data Agda.Syntax.Common.NameId instance GHC.Classes.Ord Agda.Syntax.Common.NameId instance GHC.Classes.Eq Agda.Syntax.Common.NameId 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.Data.Data Agda.Syntax.Common.IsMacro 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 Data.Data.Data Agda.Syntax.Common.IsInstance 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 Data.Data.Data Agda.Syntax.Common.IsAbstract 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 Data.Data.Data Agda.Syntax.Common.Access 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 Data.Data.Data Agda.Syntax.Common.IsInfix instance GHC.Show.Show Agda.Syntax.Common.DataOrRecord instance GHC.Classes.Ord Agda.Syntax.Common.DataOrRecord instance GHC.Classes.Eq Agda.Syntax.Common.DataOrRecord instance Data.Data.Data Agda.Syntax.Common.DataOrRecord 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 Data.Data.Data Agda.Syntax.Common.ProjOrigin 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 Data.Data.Data Agda.Syntax.Common.ConOrigin 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Common.Ranged a) 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 (Data.Data.Data name, Data.Data.Data a) => Data.Data.Data (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.Dom instance Data.Foldable.Foldable Agda.Syntax.Common.Dom instance GHC.Base.Functor Agda.Syntax.Common.Dom instance GHC.Classes.Ord e => GHC.Classes.Ord (Agda.Syntax.Common.Dom e) instance Data.Data.Data e => Data.Data.Data (Agda.Syntax.Common.Dom e) 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.Classes.Ord e => GHC.Classes.Ord (Agda.Syntax.Common.Arg e) instance Data.Data.Data e => Data.Data.Data (Agda.Syntax.Common.Arg e) 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.Data.Data Agda.Syntax.Common.ArgInfo 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 Data.Data.Data Agda.Syntax.Common.FreeVariables 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Common.WithOrigin a) 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.Data.Data Agda.Syntax.Common.Origin 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 Data.Data.Data Agda.Syntax.Common.Modality 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 Data.Data.Data Agda.Syntax.Common.Relevance instance GHC.Enum.Bounded Agda.Syntax.Common.Quantity instance GHC.Enum.Enum 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 Data.Data.Data Agda.Syntax.Common.Quantity 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Common.WithHiding a) 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.Data.Data Agda.Syntax.Common.Hiding 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 Data.Data.Data Agda.Syntax.Common.Overlappable instance GHC.Classes.Ord Agda.Syntax.Common.Induction instance GHC.Classes.Eq Agda.Syntax.Common.Induction instance Data.Data.Data Agda.Syntax.Common.Induction instance GHC.Classes.Ord Agda.Syntax.Common.HasEta instance GHC.Classes.Eq Agda.Syntax.Common.HasEta instance GHC.Show.Show Agda.Syntax.Common.HasEta instance Data.Data.Data Agda.Syntax.Common.HasEta 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 Data.Data.Data Agda.Syntax.Common.Delayed 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.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' a b) instance GHC.Base.Monoid (Agda.Syntax.Common.Using' a b) 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 (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Syntax.Common.ImportedName' 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 GHC.Show.Show 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 Agda.Utils.Pretty.Pretty Agda.Syntax.Common.MetaId instance GHC.Show.Show Agda.Syntax.Common.MetaId instance Control.DeepSeq.NFData Agda.Syntax.Common.MetaId instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.NameId instance GHC.Show.Show 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.Syntax.Position.KillRange Agda.Syntax.Common.IsMacro instance Agda.Syntax.Position.HasRange 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.Position.KillRange 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 Agda.Syntax.Position.KillRange Agda.Syntax.Common.ProjOrigin instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ConOrigin instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.Named_ a) instance GHC.Show.Show a => GHC.Show.Show (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.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.Utils.Functor.Decoration Agda.Syntax.Common.Dom instance Agda.Syntax.Position.HasRange a => Agda.Syntax.Position.HasRange (Agda.Syntax.Common.Dom a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Common.Dom a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.Dom a) instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Common.Dom a) instance Agda.Syntax.Common.LensArgInfo (Agda.Syntax.Common.Dom e) instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.Dom e) instance Agda.Syntax.Common.LensModality (Agda.Syntax.Common.Dom e) instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Common.Dom e) instance Agda.Syntax.Common.LensFreeVariables (Agda.Syntax.Common.Dom e) instance Agda.Syntax.Common.LensRelevance (Agda.Syntax.Common.Dom e) instance Agda.Syntax.Common.LensQuantity (Agda.Syntax.Common.Dom e) 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.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 GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Syntax.Common.Arg a) instance GHC.Show.Show a => GHC.Show.Show (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.LensArgInfo Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.ArgInfo instance Control.DeepSeq.NFData Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensHiding Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensModality Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensOrigin Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensFreeVariables Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensQuantity Agda.Syntax.Common.ArgInfo instance Agda.Syntax.Common.LensFreeVariables Agda.Syntax.Common.FreeVariables instance GHC.Base.Semigroup Agda.Syntax.Common.FreeVariables instance GHC.Base.Monoid Agda.Syntax.Common.FreeVariables instance Control.DeepSeq.NFData Agda.Syntax.Common.FreeVariables instance Agda.Syntax.Common.LensOrigin Agda.Syntax.Common.Origin instance Agda.Syntax.Common.LensOrigin (Agda.Syntax.Common.WithOrigin a) instance Agda.Utils.Functor.Decoration Agda.Syntax.Common.WithOrigin 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.KillRange Agda.Syntax.Common.Origin instance Control.DeepSeq.NFData Agda.Syntax.Common.Origin instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Common.Relevance instance Agda.Syntax.Common.LensModality Agda.Syntax.Common.Modality instance GHC.Base.Semigroup Agda.Syntax.Common.Modality instance GHC.Base.Monoid Agda.Syntax.Common.Modality instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Modality instance Agda.Utils.POMonoid.POSemigroup Agda.Syntax.Common.Modality instance Agda.Utils.POMonoid.POMonoid Agda.Syntax.Common.Modality instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Modality instance Control.DeepSeq.NFData Agda.Syntax.Common.Modality instance Agda.Syntax.Common.LensQuantity Agda.Syntax.Common.Modality 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.Relevance instance GHC.Base.Monoid Agda.Syntax.Common.Relevance instance Agda.Utils.POMonoid.POSemigroup Agda.Syntax.Common.Relevance instance Agda.Utils.POMonoid.POMonoid Agda.Syntax.Common.Relevance instance Agda.Utils.POMonoid.LeftClosedPOMonoid Agda.Syntax.Common.Relevance instance Agda.Syntax.Common.LensQuantity Agda.Syntax.Common.Quantity instance GHC.Base.Semigroup Agda.Syntax.Common.Quantity instance GHC.Base.Monoid Agda.Syntax.Common.Quantity instance GHC.Classes.Ord Agda.Syntax.Common.Quantity instance Agda.Utils.PartialOrd.PartialOrd Agda.Syntax.Common.Quantity instance Agda.Utils.POMonoid.POSemigroup Agda.Syntax.Common.Quantity instance Agda.Utils.POMonoid.POMonoid Agda.Syntax.Common.Quantity instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Quantity instance Control.DeepSeq.NFData Agda.Syntax.Common.Quantity instance Agda.Syntax.Common.LensHiding Agda.Syntax.Common.Hiding instance Agda.Syntax.Common.LensHiding (Agda.Syntax.Common.WithHiding a) 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 GHC.Base.Semigroup Agda.Syntax.Common.Hiding instance GHC.Base.Monoid 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 GHC.Show.Show 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.Position.HasRange Agda.Syntax.Common.HasEta instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.HasEta instance Control.DeepSeq.NFData Agda.Syntax.Common.HasEta instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Delayed -- | The parser monad used by the operator parser module Agda.Syntax.Concrete.Operators.Parser.Monad -- | Memoisation keys. data MemoKey NodeK :: (Either Integer Integer) -> MemoKey PostLeftsK :: (Either Integer Integer) -> MemoKey PreRightsK :: (Either Integer Integer) -> MemoKey TopK :: MemoKey AppK :: MemoKey NonfixK :: MemoKey -- | 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 -- | 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 -> [NamePart] -> Name -- | _. NoName :: Range -> NameId -> Name -- | 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 -- | Top-level module names. Used in connection with the file system. -- -- Invariant: The list must not be empty. data TopLevelModuleName TopLevelModuleName :: Range -> [String] -> TopLevelModuleName [moduleNameRange] :: TopLevelModuleName -> Range [moduleNameParts] :: TopLevelModuleName -> [String] nameToRawName :: Name -> RawName nameParts :: Name -> [NamePart] nameStringParts :: Name -> [RawName] -- | Parse a string to parts of a concrete name. -- -- Note: stringNameParts "_" == [Id "_"] == nameParts NoName{} stringNameParts :: String -> [NamePart] -- | 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? isOperator :: Name -> Bool isHole :: NamePart -> Bool isPrefix :: Name -> Bool isPostfix :: Name -> Bool isInfix :: Name -> Bool isNonfix :: Name -> Bool -- |
-- 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 -> [Name] -- | Is the name qualified? isQualified :: QName -> Bool -- | Turns a qualified name into a TopLevelModuleName. The qualified -- name is assumed to represent a top-level module name. toTopLevelModuleName :: QName -> TopLevelModuleName -- | 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 -- |
-- noName_ = noName noRange --noName_ :: Name noName :: Range -> Name -- | Check whether a name is the empty name "_". class IsNoName a isNoName :: IsNoName a => a -> Bool instance Data.Data.Data Agda.Syntax.Concrete.Name.TopLevelModuleName instance GHC.Show.Show Agda.Syntax.Concrete.Name.TopLevelModuleName instance GHC.Classes.Ord Agda.Syntax.Concrete.Name.QName instance GHC.Classes.Eq Agda.Syntax.Concrete.Name.QName instance Data.Data.Data Agda.Syntax.Concrete.Name.QName instance Data.Data.Data Agda.Syntax.Concrete.Name.Name instance GHC.Generics.Generic Agda.Syntax.Concrete.Name.NamePart instance Data.Data.Data Agda.Syntax.Concrete.Name.NamePart 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.NumHoles [Agda.Syntax.Concrete.Name.NamePart] instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Name.NumHoles Agda.Syntax.Concrete.Name.QName instance GHC.Classes.Eq Agda.Syntax.Concrete.Name.TopLevelModuleName instance GHC.Classes.Ord Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.Utils.Size.Sized Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.Syntax.Common.Underscore Agda.Syntax.Concrete.Name.QName instance GHC.Show.Show 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 GHC.Show.Show 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 GHC.Classes.Eq Agda.Syntax.Concrete.Name.NamePart instance GHC.Classes.Ord Agda.Syntax.Concrete.Name.NamePart instance GHC.Show.Show Agda.Syntax.Concrete.Name.NamePart instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Name.NamePart instance Control.DeepSeq.NFData Agda.Syntax.Concrete.Name.NamePart module Agda.Compiler.JS.Syntax data Exp Self :: Exp Local :: LocalId -> Exp Global :: GlobalId -> Exp Undefined :: Exp String :: String -> Exp Char :: Char -> Exp Integer :: Integer -> Exp Double :: Double -> Exp Lambda :: Nat -> Exp -> Exp Object :: (Map MemberId 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 newtype MemberId MemberId :: String -> MemberId data Export Export :: [MemberId] -> Exp -> Export [expName] :: Export -> [MemberId] [defn] :: Export -> Exp data Module Module :: GlobalId -> [Export] -> Maybe Exp -> Module [modName] :: Module -> GlobalId [exports] :: Module -> [Export] [postscript] :: Module -> Maybe Exp class Uses a uses :: Uses a => a -> Set [MemberId] class Globals a globals :: Globals a => a -> Set GlobalId instance GHC.Show.Show Agda.Compiler.JS.Syntax.Module instance GHC.Show.Show Agda.Compiler.JS.Syntax.Export instance GHC.Show.Show Agda.Compiler.JS.Syntax.Exp 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.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.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 Agda.Compiler.JS.Syntax.Globals a => Agda.Compiler.JS.Syntax.Globals [a] instance Agda.Compiler.JS.Syntax.Globals a => Agda.Compiler.JS.Syntax.Globals (Data.Map.Internal.Map k a) instance Agda.Compiler.JS.Syntax.Globals 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 Agda.Compiler.JS.Syntax.Exp instance Agda.Compiler.JS.Syntax.Uses Agda.Compiler.JS.Syntax.Export 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 br :: Int -> String unescape :: Char -> String unescapes :: String -> String class Pretty a pretty :: Pretty a => Nat -> Int -> a -> String class Pretties a pretties :: Pretties a => Nat -> Int -> a -> [String] block :: Nat -> Int -> Exp -> String block' :: Nat -> Int -> Exp -> String modname :: GlobalId -> String exports :: Nat -> Int -> Set [MemberId] -> [Export] -> String 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.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 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.Module 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 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.Classes.Eq (Agda.Auto.Syntax.Elr o) instance GHC.Show.Show Agda.Auto.Syntax.EqReasoningState instance GHC.Classes.Eq Agda.Auto.Syntax.EqReasoningState 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 blk => Agda.Auto.NarrowingSearch.Trav [a] blk instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.MId, Agda.Auto.Syntax.CExp o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.TrBr a o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.Exp o) (Agda.Auto.Syntax.RefInfo o) instance Agda.Auto.NarrowingSearch.Trav (Agda.Auto.Syntax.ArgList o) (Agda.Auto.Syntax.RefInfo o) 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 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 o t u | t u -> o replace' :: Replace o t u => Nat -> MExp o -> t -> Reader (Nat, Nat) u replace :: Replace o t u => Nat -> Nat -> MExp o -> 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 o t | t -> o unify' :: Unify o t => t -> t -> StateT (Assignments o) Maybe () notequal' :: Unify o t => t -> t -> ReaderT (Nat, Nat) (StateT (Assignments o) IO) Bool unify :: Unify o t => t -> t -> Maybe (Assignments o) notequal :: Unify o 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 o t => Agda.Auto.CaseSplit.Unify o (Agda.Auto.NarrowingSearch.MM t (Agda.Auto.Syntax.RefInfo o)) instance Agda.Auto.CaseSplit.Unify o t => Agda.Auto.CaseSplit.Unify o (Agda.Auto.Syntax.Abs t) instance Agda.Auto.CaseSplit.Unify o (Agda.Auto.Syntax.Exp o) instance Agda.Auto.CaseSplit.Unify o (Agda.Auto.Syntax.ArgList o) instance Agda.Auto.CaseSplit.Replace o t u => Agda.Auto.CaseSplit.Replace o (Agda.Auto.Syntax.Abs t) (Agda.Auto.Syntax.Abs u) instance Agda.Auto.CaseSplit.Replace o (Agda.Auto.Syntax.Exp o) (Agda.Auto.Syntax.MExp o) instance Agda.Auto.CaseSplit.Replace o t u => Agda.Auto.CaseSplit.Replace o (Agda.Auto.NarrowingSearch.MM t (Agda.Auto.Syntax.RefInfo o)) u instance Agda.Auto.CaseSplit.Replace o (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) -- | 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 GenPart -- before it leaves the Happy code. data HoleName -- | x -> y; 1st argument is the bound name (unused for now). LambdaHole :: RawName -> RawName -> HoleName [_bindHoleName] :: HoleName -> RawName [holeName] :: HoleName -> RawName -- | Simple named hole with hiding. ExprHole :: RawName -> HoleName [holeName] :: HoleName -> RawName -- | Is the hole a binder? isLambdaHole :: HoleName -> Bool -- | Notation as provided by the syntax declaration. type Notation = [GenPart] -- | Part of a Notation data GenPart -- | Argument is the position of the hole (with binding) where the binding -- should occur. BindHole :: !Int -> GenPart -- | Argument is where the expression should go. NormalHole :: (NamedArg Int) -> GenPart -- | An underscore in binding position. WildHole :: !Int -> GenPart IdPart :: RawName -> GenPart -- | Get a flat list of identifier parts of a notation. stringParts :: Notation -> [RawName] -- | Target argument position of a part (Nothing if it is not a hole). holeTarget :: GenPart -> Maybe Int -- | Is the part a hole? WildHoles don't count since they don't correspond -- to anything the user writes. isAHole :: GenPart -> Bool -- | Is the part a normal hole? isNormalHole :: GenPart -> Bool -- | Is the part a binder? isBindingHole :: GenPart -> 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. -- -- Example: ids = ["for", "x", "∈", "xs", "return", "e"] holes = [ -- LambdaHole "x" "e", ExprHole "xs" ] creates the notation [ -- IdPart "for" , BindHole 0 , IdPart "∈" , NormalHole 1 , IdPart -- "return" , NormalHole 0 ] mkNotation :: [NamedArg HoleName] -> [RawName] -> Either String Notation noNotation :: Notation instance GHC.Show.Show Agda.Syntax.Notation.NotationKind instance GHC.Classes.Eq Agda.Syntax.Notation.NotationKind instance GHC.Classes.Ord Agda.Syntax.Notation.GenPart instance GHC.Classes.Eq Agda.Syntax.Notation.GenPart instance GHC.Show.Show Agda.Syntax.Notation.GenPart instance Data.Data.Data Agda.Syntax.Notation.GenPart instance Agda.Syntax.Position.KillRange Agda.Syntax.Notation.GenPart instance Control.DeepSeq.NFData Agda.Syntax.Notation.GenPart -- | Abstract names carry unique identifiers and stuff. module Agda.Syntax.Abstract.Name -- | 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 -- | Check whether we are a projection pattern. class IsProjP a isProjP :: IsProjP a => a -> Maybe (ProjOrigin, AmbiguousQName) -- | 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 :: NonemptyList QName -> AmbiguousQName [unAmbQ] :: AmbiguousQName -> NonemptyList QName -- | 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] -- | Something preceeded by a qualified name. data QNamed a QNamed :: QName -> a -> QNamed a [qname] :: QNamed a -> QName [qnamed] :: QNamed a -> a -- | 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 -- | 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 -> Range -> Fixity' -> Name [nameId] :: Name -> !NameId [nameConcrete] :: Name -> Name [nameBindingSite] :: Name -> Range [nameFixity] :: Name -> Fixity' -- | A singleton "ambiguous" name. unambiguous :: QName -> AmbiguousQName -- | 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: -- --
-- 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.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.Classes.Eq n, GHC.Classes.Eq e) => GHC.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.Graph n e) 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.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 String (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 String [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 String (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 String ([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, Show r, Show f) => Polarities f -> HypGraph r f -> ConGraph r f -> Either String (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, Show r, Show f) => Polarities f -> HypGraph r f -> ConGraphs r f -> Either String (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 String () -- | 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, Show r, Show f) => Polarities f -> HypGraph r f -> [Constraint' r f] -> Solution r f -> Either String (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.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.Show.Show Agda.TypeChecking.SizedTypes.WarshallSolver.Label instance GHC.Show.Show Agda.TypeChecking.SizedTypes.WarshallSolver.Weight instance GHC.Classes.Eq Agda.TypeChecking.SizedTypes.WarshallSolver.Weight 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) -- | 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 -- | an unknown position (treated as negative) Unknown :: OccursWhere -- | The elements of the sequence, from left to right, explain how to get -- to the occurrence. Known :: Range -> (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 -- | 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.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 Data.Data.Data Agda.TypeChecking.Positivity.Occurrence.Occurrence instance Data.Data.Data 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 Data.Data.Data 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 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 Agda.Utils.Pretty.Pretty Agda.TypeChecking.Positivity.Occurrence.OccursWhere 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 :: Literal -> Expr -- | ex: ? or {! ... !} QuestionMark :: Range -> (Maybe Nat) -> Expr -- | ex: _ or _A_5 Underscore :: Range -> (Maybe String) -> Expr -- | before parsing operators RawApp :: Range -> [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) -> [NamedArg (MaybePlaceholder (OpApp Expr))] -> 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 -> [LamBinding] -> Expr -> Expr -- | ex: \ () AbsurdLam :: Range -> Hiding -> Expr -- | ex: \ { p11 .. p1a -> e1 ; .. ; pn1 .. pnz -> en } ExtendedLam :: Range -> [LamClause] -> Expr -- | ex: e -> e or .e -> e (NYI: {e} -> -- e) Fun :: Range -> Expr -> Expr -> Expr -- | ex: (xs:e) -> e or {xs:e} -> e Pi :: Telescope -> Expr -> Expr -- | ex: Set Set :: Range -> Expr -- | ex: Prop Prop :: Range -> Expr -- | ex: Set0, Set1, .. SetN :: Range -> Integer -> 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 -> [Declaration] -> (Maybe Expr) -> Expr -- | ex: (e) Paren :: Range -> Expr -> Expr -- | ex: (| e |) IdiomBrackets :: Range -> Expr -> Expr -- | ex: do x <- m1; m2 DoBlock :: Range -> [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 -- | only used for printing telescopes ETel :: Telescope -> Expr -- | ex: quoteGoal x in e QuoteGoal :: Range -> Name -> Expr -> Expr -- | ex: quoteContext QuoteContext :: Range -> Expr -- | ex: quote, should be applied to a name Quote :: Range -> Expr -- | ex: quoteTerm, should be applied to a term QuoteTerm :: Range -> Expr -- |
-- tactic solve | subgoal1 | .. | subgoalN --Tactic :: Range -> Expr -> [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 data OpApp e -- | An abstraction inside a special syntax declaration (see Issue 358 why -- we introduce this). SyntaxBindingLambda :: Range -> [LamBinding] -> e -> OpApp e Ordinary :: e -> OpApp e fromOrdinary :: e -> OpApp e -> e appView :: Expr -> AppView -- | The Expr is not an application. data AppView AppView :: Expr -> [NamedArg Expr] -> AppView -- | A lambda binding is either domain free or typed. type LamBinding = LamBinding' TypedBindings data LamBinding' a -- | . x or {x} or .x or .{x} or -- {.x} DomainFree :: ArgInfo -> BoundName -> LamBinding' a -- | . (xs : e) or {xs : e} DomainFull :: a -> LamBinding' a -- | A sequence of typed bindings with hiding information. Appears in -- dependent function spaces, typed lambdas, and telescopes. -- -- If the individual binding contains hiding information as well, the -- Hiding in TypedBindings must be the unit -- NotHidden. type TypedBindings = TypedBindings' TypedBinding data TypedBindings' a -- | . (xs : e) or {xs : e} or something like (x {y} -- _ : e). TypedBindings :: Range -> (Arg a) -> TypedBindings' a -- | A typed binding. type TypedBinding = TypedBinding' Expr data TypedBinding' e -- | Binding (x1 ... xn : A). TBind :: Range -> [WithHiding BoundName] -> e -> TypedBinding' e -- | Let binding (let Ds) or (open M args). TLet :: Range -> [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 -> Name -> Fixity' -> BoundName [boundName] :: BoundName -> Name -- | for implicit function types the label matters and can't be -- alpha-renamed [boundLabel] :: BoundName -> Name [bnameFixity] :: BoundName -> Fixity' mkBoundName_ :: Name -> BoundName mkBoundName :: Name -> Fixity' -> BoundName -- | A telescope is a sequence of typed bindings. Bound variables are in -- scope in later types. type Telescope = [TypedBindings] countTelVars :: Telescope -> Nat -- | 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 -> Name -> Expr -> Declaration -- | Record field, can be hidden and/or irrelevant. Field :: IsInstance -> Name -> (Arg Expr) -> Declaration FunClause :: LHS -> RHS -> WhereClause -> Bool -> Declaration -- | lone data signature in mutual block DataSig :: Range -> Induction -> Name -> [LamBinding] -> Expr -> Declaration Data :: Range -> Induction -> Name -> [LamBinding] -> (Maybe Expr) -> [TypeSignatureOrInstanceBlock] -> Declaration -- | lone record signature in mutual block RecordSig :: Range -> Name -> [LamBinding] -> Expr -> Declaration -- | The optional name is a name for the record constructor. Record :: Range -> Name -> (Maybe (Ranged Induction)) -> (Maybe HasEta) -> (Maybe (Name, IsInstance)) -> [LamBinding] -> (Maybe Expr) -> [Declaration] -> Declaration Infix :: Fixity -> [Name] -> Declaration -- | notation declaration for a name Syntax :: Name -> Notation -> Declaration PatternSyn :: Range -> Name -> [Arg Name] -> Pattern -> Declaration Mutual :: 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 InstanceB :: 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 -> [TypedBindings] -> [Declaration] -> Declaration UnquoteDecl :: Range -> [Name] -> Expr -> Declaration UnquoteDef :: Range -> [Name] -> Expr -> Declaration Pragma :: Pragma -> Declaration data ModuleApplication -- |
-- tel. M args --SectionApp :: Range -> [TypedBindings] -> Expr -> ModuleApplication -- |
-- M {{...}} --RecordModuleIFS :: 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 data AsName AsName :: Name -> Range -> AsName -- | The "as" name. [asName] :: AsName -> Name -- | The range of the "as" keyword. Retained for highlighting purposes. [asRange] :: AsName -> Range data OpenShortHand DoOpen :: OpenShortHand DontOpen :: OpenShortHand type RewriteEqn = Expr type WithExpr = 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 (many) [lhsRewriteEqn] :: LHS -> [RewriteEqn] -- | with e (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 -> [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 :: Literal -> Pattern -- |
-- record {x = p; y = q} --RecP :: Range -> [FieldAssignment' Pattern] -> Pattern -- | ..., only as left-most pattern. EllipsisP :: Range -> 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] data LamClause LamClause :: LHS -> RHS -> WhereClause -> Bool -> LamClause [lamLHS] :: LamClause -> LHS [lamRHS] :: LamClause -> RHS -- | always NoWhere (see parser) [lamWhere] :: LamClause -> WhereClause [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 type WhereClause = WhereClause' [Declaration] data WhereClause' decls -- | No where clauses. NoWhere :: WhereClause' decls -- | Ordinary where. AnyWhere :: decls -> WhereClause' decls -- | Named where: module M where. The Access flag applies -- to the Name (not the module contents!) and is propagated from -- the parent function. SomeWhere :: 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 -> [Declaration] -> DoStmt data Pragma OptionsPragma :: Range -> [String] -> Pragma BuiltinPragma :: Range -> String -> QName -> Pragma RewritePragma :: Range -> [QName] -> Pragma CompiledDataPragma :: Range -> QName -> String -> [String] -> Pragma CompiledTypePragma :: Range -> QName -> String -> Pragma CompiledPragma :: Range -> QName -> String -> Pragma CompiledExportPragma :: Range -> QName -> String -> Pragma CompiledJSPragma :: Range -> QName -> String -> Pragma CompiledUHCPragma :: Range -> QName -> String -> Pragma CompiledDataUHCPragma :: Range -> QName -> String -> [String] -> Pragma HaskellCodePragma :: Range -> String -> Pragma -- | first string is backend name ForeignPragma :: Range -> String -> String -> Pragma -- | first string is backend name CompilePragma :: Range -> String -> QName -> String -> Pragma StaticPragma :: Range -> QName -> Pragma InjectivePragma :: Range -> QName -> Pragma -- | INLINE or NOINLINE InlinePragma :: Range -> Bool -> QName -> Pragma -- | Invariant: The string must be a valid Haskell module name. ImportPragma :: Range -> String -> Pragma -- | same as above, but for the UHC backend ImportUHCPragma :: Range -> String -> Pragma -- | Throws an internal error in the scope checker. ImpossiblePragma :: Range -> 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 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 named function WarningOnUsage :: Range -> QName -> String -> Pragma -- | Applies to the following function clause. CatchallPragma :: Range -> Pragma DisplayPragma :: Range -> Pattern -> Expr -> Pragma -- | Applies to the following data/record type or mutual block. NoPositivityCheckPragma :: Range -> Pragma PolarityPragma :: Range -> Name -> [Occurrence] -> Pragma -- | Modules: Top-level pragmas plus other top-level declarations. type Module = ([Pragma], [Declaration]) -- | Decorating something with Fixity'. data ThingWithFixity x ThingWithFixity :: x -> Fixity' -> ThingWithFixity x type HoleContent = HoleContent' Expr -- | Extended content of an interaction hole. data HoleContent' e -- |
-- e --HoleContentExpr :: e -> HoleContent' e -- |
-- rewrite e0 | ... | en --HoleContentRewrite :: [e] -> HoleContent' e -- | Computes the top-level module name. -- -- Precondition: The Module has to be well-formed. This means that -- there are only allowed declarations before the first module -- declaration, typically import declarations. See -- spanAllowedBeforeModule. topLevelModuleName :: Module -> TopLevelModuleName -- | 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 Data.Traversable.Traversable Agda.Syntax.Concrete.HoleContent' instance Data.Foldable.Foldable Agda.Syntax.Concrete.HoleContent' instance GHC.Base.Functor Agda.Syntax.Concrete.HoleContent' 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 Data.Data.Data e => Data.Data.Data (Agda.Syntax.Concrete.OpApp e) instance Data.Data.Data Agda.Syntax.Concrete.ModuleAssignment instance Data.Data.Data Agda.Syntax.Concrete.DoStmt instance Data.Data.Data Agda.Syntax.Concrete.LamClause instance Data.Data.Data Agda.Syntax.Concrete.LHS 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 Data.Data.Data e => Data.Data.Data (Agda.Syntax.Concrete.TypedBinding' e) instance Data.Data.Data Agda.Syntax.Concrete.ModuleApplication instance Data.Data.Data Agda.Syntax.Concrete.Declaration instance Data.Data.Data Agda.Syntax.Concrete.Expr instance Data.Data.Data Agda.Syntax.Concrete.Pattern instance Data.Data.Data Agda.Syntax.Concrete.Pragma instance GHC.Show.Show Agda.Syntax.Concrete.OpenShortHand instance GHC.Classes.Eq Agda.Syntax.Concrete.OpenShortHand instance Data.Data.Data Agda.Syntax.Concrete.OpenShortHand instance GHC.Show.Show Agda.Syntax.Concrete.AsName instance Data.Data.Data Agda.Syntax.Concrete.AsName 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 Data.Data.Data decls => Data.Data.Data (Agda.Syntax.Concrete.WhereClause' decls) 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.Data.Data e => Data.Data.Data (Agda.Syntax.Concrete.RHS' e) 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Concrete.LamBinding' a) instance GHC.Show.Show Agda.Syntax.Concrete.BoundName instance GHC.Classes.Eq Agda.Syntax.Concrete.BoundName instance Data.Data.Data Agda.Syntax.Concrete.BoundName instance Data.Traversable.Traversable Agda.Syntax.Concrete.TypedBindings' instance Data.Foldable.Foldable Agda.Syntax.Concrete.TypedBindings' instance GHC.Base.Functor Agda.Syntax.Concrete.TypedBindings' instance Data.Data.Data a => Data.Data.Data (Agda.Syntax.Concrete.TypedBindings' a) 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.LHSCore instance Agda.Syntax.Common.LensRelevance Agda.Syntax.Concrete.TypedBindings instance Agda.Syntax.Common.LensHiding Agda.Syntax.Concrete.TypedBindings instance Agda.Syntax.Common.LensHiding Agda.Syntax.Concrete.LamBinding 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.TypedBindings 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.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.Pattern instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.TypedBindings instance Agda.Syntax.Position.SetRange Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.ModuleAssignment 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.TypedBindings 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 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 Agda.Syntax.Concrete.DoStmt instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.AsName instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.AsName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.AsName 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 Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.LamBinding' a) instance Agda.Syntax.Position.HasRange Agda.Syntax.Concrete.BoundName instance Agda.Syntax.Position.KillRange Agda.Syntax.Concrete.BoundName instance Control.DeepSeq.NFData Agda.Syntax.Concrete.BoundName instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Concrete.TypedBindings' 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) -- | Pretty printer for the concrete syntax. module Agda.Syntax.Concrete.Pretty -- | 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 -> SpecialCharacters [_dbraces] :: SpecialCharacters -> Doc -> Doc [_lambda] :: SpecialCharacters -> Doc [_arrow] :: SpecialCharacters -> Doc [_forallQ] :: SpecialCharacters -> Doc specialCharacters :: SpecialCharacters braces' :: Doc -> Doc dbraces :: Doc -> Doc forallQ :: Doc bracesAndSemicolons :: [Doc] -> Doc arrow :: Doc lambda :: Doc -- | prettyHiding info visible doc puts the correct braces around -- doc according to info info and returns visible -- doc if the we deal with a visible thing. prettyHiding :: LensHiding a => a -> (Doc -> Doc) -> Doc -> Doc prettyRelevance :: LensRelevance a => a -> Doc -> Doc newtype Tel Tel :: Telescope -> Tel smashTel :: Telescope -> Telescope prettyOpApp :: forall a. Pretty a => QName -> [NamedArg (MaybePlaceholder a)] -> [Doc] instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Expr instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.Pretty.Tel instance GHC.Show.Show Agda.Syntax.Concrete.Expr instance GHC.Show.Show Agda.Syntax.Concrete.Declaration instance GHC.Show.Show Agda.Syntax.Concrete.Pattern instance GHC.Show.Show Agda.Syntax.Concrete.TypedBinding instance GHC.Show.Show Agda.Syntax.Concrete.TypedBindings instance GHC.Show.Show Agda.Syntax.Concrete.LamBinding instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => GHC.Show.Show (Agda.Syntax.Common.ImportDirective' 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.WhereClause instance GHC.Show.Show Agda.Syntax.Concrete.ModuleApplication 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.Induction 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 Agda.Syntax.Concrete.LamBinding instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.TypedBindings instance Agda.Utils.Pretty.Pretty Agda.Syntax.Concrete.TypedBinding 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.Fixity.Fixity instance Agda.Utils.Pretty.Pretty Agda.Syntax.Notation.GenPart instance Agda.Utils.Pretty.Pretty Agda.Syntax.Fixity.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.ImportedName' a b) -- | Agda-specific benchmarking structure. module Agda.Benchmarking -- | Phases to allocate CPU time to. data Phase -- | Happy parsing and operator parsing. Parsing :: Phase -- | Import chasing. Import :: Phase -- | Reading interface files. Deserialization :: Phase -- | Scope checking and translation to abstract syntax. Scoping :: Phase -- | Type checking and translation to internal syntax. Typing :: Phase -- | Termination checking. Termination :: Phase -- | Positivity checking and polarity computation. Positivity :: Phase -- | Injectivity checking. Injectivity :: Phase -- | Checking for projection likeness. ProjectionLikeness :: Phase -- | Coverage checking and compilation to case trees. Coverage :: Phase -- | Generating highlighting info. Highlighting :: Phase -- | Writing interface files. Serialization :: Phase -- | Deac code elimination. DeadCode :: Phase -- | Subphase for Termination. Graph :: Phase -- | Subphase for Termination. RecCheck :: Phase -- | Subphase for Termination. Reduce :: Phase -- | Subphase for Termination. Level :: Phase -- | Subphase for Termination. Compare :: Phase -- | Subphase for Termination. With :: Phase -- | Subphase for Import. ModuleName :: Phase -- | Subphase for Serialization. BuildInterface :: Phase -- | Subphase for Serialization. Sort :: Phase -- | Subphase for Serialization. BinaryEncode :: Phase -- | Subphase for Serialization. Compress :: Phase -- | Subphase for Parsing. OperatorsExpr :: Phase -- | Subphase for Parsing. OperatorsPattern :: Phase -- | Subphase for Typing: free variable computation. Free :: Phase -- | Subphase for Typing: occurs check for solving metas. OccursCheck :: Phase -- | Subphase for Typing: checking the LHS CheckLHS :: Phase -- | Subphase for Typing: checking the RHS CheckRHS :: Phase -- | Subphase for Typing: checking a type signature TypeSig :: Phase -- | Subphase for CheckLHS: unification of the indices UnifyIndices :: Phase -- | Pretty printing names. InverseScopeLookup :: Phase TopModule :: TopLevelModuleName -> Phase Definition :: QName -> Phase type Benchmark = Benchmark Phase type Account = Account Phase isModuleAccount :: Account -> Bool isDefAccount :: Account -> Bool isInternalAccount :: Account -> Bool -- | Global variable to store benchmark statistics. benchmarks :: IORef Benchmark -- | Benchmark an IO computation and bill it to the given account. billToIO :: Account -> IO a -> IO a -- | Benchmark a pure computation and bill it to the given account. billToPure :: Account -> a -> a instance GHC.Show.Show Agda.Benchmarking.Phase instance GHC.Classes.Ord Agda.Benchmarking.Phase instance GHC.Classes.Eq Agda.Benchmarking.Phase instance Agda.Utils.Pretty.Pretty Agda.Benchmarking.Phase instance Agda.Utils.Benchmark.MonadBench Agda.Benchmarking.Phase GHC.Types.IO -- | Tools for patterns in concrete syntax. module Agda.Syntax.Concrete.Pattern -- | Check for ellipsis .... class IsEllipsis a isEllipsis :: IsEllipsis a => a -> Bool -- | Has the lhs an occurrence of the ellipsis ...? class HasEllipsis a hasEllipsis :: HasEllipsis a => a -> Bool -- | Check for with-pattern | p. class IsWithP p isWithP :: IsWithP p => p -> Maybe p isWithP :: (IsWithP p, IsWithP q, Decoration f, f q ~ p) => p -> Maybe p -- | The next patterns are ... -- -- (This view discards PatInfo.) data LHSPatternView -- | Application patterns (non-empty list). LHSAppP :: [NamedArg Pattern] -> LHSPatternView -- | With patterns (non-empty list). These patterns are not prefixed with -- WithP. LHSWithP :: [Pattern] -> LHSPatternView -- | Construct the LHSPatternView of the given list (if not empty). -- -- Return the view and the remaining patterns. lhsPatternView :: [NamedArg Pattern] -> Maybe (LHSPatternView, [NamedArg Pattern]) -- | Add applicative patterns (non-projection / non-with patterns) to the -- right. lhsCoreApp :: LHSCore -> [NamedArg Pattern] -> LHSCore -- | Add with-patterns to the right. lhsCoreWith :: LHSCore -> [Pattern] -> LHSCore -- | Append patterns to LHSCore, separating with patterns from the -- rest. lhsCoreAddSpine :: LHSCore -> [NamedArg Pattern] -> LHSCore -- | Modify the Pattern component in LHS. mapLhsOriginalPattern :: (Pattern -> Pattern) -> LHS -> LHS -- | Effectfully modify the Pattern component in LHS. mapLhsOriginalPatternM :: (Functor m, Applicative m) => (Pattern -> m Pattern) -> LHS -> m LHS -- | Does the LHS contain projection patterns? hasCopatterns :: LHSCore -> Bool -- | Generic pattern traversal. -- -- See APatternLike. class CPatternLike p -- | Fold pattern. foldrCPattern :: (CPatternLike p, Monoid m) => (Pattern -> m -> m) -> p -> m -- | Fold pattern. foldrCPattern :: (CPatternLike p, Monoid m, Foldable f, CPatternLike q, f q ~ p) => (Pattern -> m -> m) -> p -> m -- | Traverse pattern with option of post-traversal modification. traverseCPatternA :: (CPatternLike p, Applicative m, Functor m) => (Pattern -> m Pattern -> m Pattern) -> p -> m p -- | Traverse pattern with option of post-traversal modification. traverseCPatternA :: (CPatternLike p, Traversable f, CPatternLike q, f q ~ p, Applicative m, Functor m) => (Pattern -> m Pattern -> m Pattern) -> p -> m p -- | Traverse pattern. traverseCPatternM :: (CPatternLike p, Monad m) => (Pattern -> m Pattern) -> (Pattern -> m Pattern) -> p -> m p -- | Traverse pattern. traverseCPatternM :: (CPatternLike p, Traversable f, CPatternLike q, f q ~ p, Monad m) => (Pattern -> m Pattern) -> (Pattern -> m Pattern) -> p -> m p -- | Compute a value from each subpattern and collect all values in a -- monoid. foldCPattern :: (CPatternLike p, Monoid m) => (Pattern -> m) -> p -> m -- | Traverse pattern(s) with a modification before the recursive descent. preTraverseCPatternM :: (CPatternLike p, Monad m) => (Pattern -> m Pattern) -> p -> m p -- | Traverse pattern(s) with a modification after the recursive descent. postTraverseCPatternM :: (CPatternLike p, Monad m) => (Pattern -> m Pattern) -> p -> m p -- | Map pattern(s) with a modification after the recursive descent. mapCPattern :: CPatternLike p => (Pattern -> Pattern) -> p -> p -- | Get all the identifiers in a pattern in left-to-right order. -- -- Implemented using difference lists. patternQNames :: CPatternLike p => p -> [QName] -- | Get all the identifiers in a pattern in left-to-right order. patternNames :: Pattern -> [Name] -- | Does the pattern contain a with-pattern? (Shortcutting.) hasWithPatterns :: CPatternLike p => p -> Bool -- | Is WithP? isWithPattern :: Pattern -> Bool -- | Count the number of with-subpatterns in a pattern? numberOfWithPatterns :: CPatternLike p => p -> Int -- | Compute the context in which the ellipsis occurs, if at all. If there -- are several occurrences, this is an error. hasEllipsis' :: CPatternLike p => p -> AffineHole Pattern p instance Agda.Syntax.Concrete.Pattern.CPatternLike Agda.Syntax.Concrete.Pattern instance (Agda.Syntax.Concrete.Pattern.CPatternLike a, Agda.Syntax.Concrete.Pattern.CPatternLike b) => Agda.Syntax.Concrete.Pattern.CPatternLike (a, b) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Syntax.Common.Arg p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Syntax.Common.Named n p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike [p] instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (GHC.Base.Maybe p) instance Agda.Syntax.Concrete.Pattern.CPatternLike p => Agda.Syntax.Concrete.Pattern.CPatternLike (Agda.Syntax.Concrete.FieldAssignment' p) instance Agda.Syntax.Concrete.Pattern.IsWithP Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Concrete.Pattern.IsWithP p => Agda.Syntax.Concrete.Pattern.IsWithP (Agda.Syntax.Common.Arg p) instance Agda.Syntax.Concrete.Pattern.IsWithP p => Agda.Syntax.Concrete.Pattern.IsWithP (Agda.Syntax.Common.Named n p) instance Agda.Syntax.Concrete.Pattern.HasEllipsis Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Concrete.Pattern.HasEllipsis Agda.Syntax.Concrete.LHS instance Agda.Syntax.Concrete.Pattern.IsEllipsis Agda.Syntax.Concrete.Pattern module Agda.Syntax.Concrete.Operators.Parser placeholder :: PositionInName -> Parser e (MaybePlaceholder e) maybePlaceholder :: Maybe PositionInName -> Parser e e -> Parser e (MaybePlaceholder e) satNoPlaceholder :: (e -> Maybe a) -> Parser e a data ExprView e LocalV :: QName -> ExprView e WildV :: e -> ExprView e OtherV :: e -> ExprView e AppV :: e -> (NamedArg e) -> ExprView e -- | The QName is possibly ambiguous, but it must correspond to one -- of the names in the set. OpAppV :: QName -> (Set Name) -> [NamedArg (MaybePlaceholder (OpApp e))] -> ExprView e HiddenArgV :: (Named_ e) -> ExprView e InstanceArgV :: (Named_ e) -> ExprView e LamV :: [LamBinding] -> e -> ExprView e ParenV :: e -> ExprView e class HasRange e => IsExpr e exprView :: IsExpr e => e -> ExprView e unExprView :: IsExpr e => ExprView e -> e -- | Should sections be parsed? data ParseSections ParseSections :: ParseSections DoNotParseSections :: ParseSections -- | Runs a parser. If sections should be parsed, then identifiers with at -- least two name parts are split up into multiple tokens, using -- PositionInName to record the tokens' original positions within -- their respective identifiers. parse :: IsExpr e => (ParseSections, Parser e a) -> [e] -> [a] -- | Parse a specific identifier as a NamePart partP :: IsExpr e => [Name] -> RawName -> Parser e Range -- | Parses a split-up, unqualified name consisting of at least two name -- parts. -- -- The parser does not check that underscores and other name parts -- alternate. The range of the resulting name is the range of the first -- name part that is not an underscore. atLeastTwoParts :: IsExpr e => Parser e Name -- | Either a wildcard (_), or an unqualified name (possibly -- containing multiple name parts). wildOrUnqualifiedName :: IsExpr e => Parser e (Maybe Name) -- | Used to define the return type of opP. -- | A singleton type for NotationKind (except for the constructor -- NoNotation). data NK (k :: NotationKind) :: * [In] :: NK 'InfixNotation [Pre] :: NK 'PrefixNotation [Post] :: NK 'PostfixNotation [Non] :: NK 'NonfixNotation -- | Parse the "operator part" of the given notation. -- -- Normal holes (but not binders) at the beginning and end are ignored. -- -- If the notation does not contain any binders, then a section notation -- is allowed. opP :: forall e k. IsExpr e => ParseSections -> Parser e e -> NewNotation -> NK k -> Parser e (OperatorType k e) argsP :: IsExpr e => Parser e e -> Parser e [NamedArg e] appP :: IsExpr e => Parser e e -> Parser e [NamedArg e] -> Parser e e atomP :: IsExpr e => (QName -> Bool) -> Parser e e instance GHC.Show.Show Agda.Syntax.Concrete.Operators.Parser.ParseSections instance GHC.Classes.Eq Agda.Syntax.Concrete.Operators.Parser.ParseSections instance Agda.Syntax.Concrete.Operators.Parser.IsExpr e => Agda.Syntax.Position.HasRange (Agda.Syntax.Concrete.Operators.Parser.ExprView e) instance Agda.Syntax.Concrete.Operators.Parser.IsExpr Agda.Syntax.Concrete.Expr instance Agda.Syntax.Concrete.Operators.Parser.IsExpr Agda.Syntax.Concrete.Pattern -- | Generic traversal and reduce for concrete syntax, in the style of -- Agda.Syntax.Internal.Generic. -- -- However, here we use the terminology of Traversable. module Agda.Syntax.Concrete.Generic -- | Generic traversals for concrete expressions. -- -- Note: does not go into patterns! class ExprLike a -- | This corresponds to map. mapExpr :: ExprLike a => (Expr -> Expr) -> a -> a -- | This corresponds to mapM. traverseExpr :: (ExprLike a, Monad m) => (Expr -> m Expr) -> a -> m a -- | This is a reduce. foldExpr :: (ExprLike a, Monoid m) => (Expr -> m) -> a -> m instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Concrete.Generic.ExprLike GHC.Types.Bool instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike [a] instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (GHC.Base.Maybe a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Common.MaybePlaceholder a) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b) => Agda.Syntax.Concrete.Generic.ExprLike (Data.Either.Either a b) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.TypedBinding' a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.RHS' a) instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.WhereClause' a) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b) => Agda.Syntax.Concrete.Generic.ExprLike (a, b) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b, Agda.Syntax.Concrete.Generic.ExprLike c) => Agda.Syntax.Concrete.Generic.ExprLike (a, b, c) instance (Agda.Syntax.Concrete.Generic.ExprLike a, Agda.Syntax.Concrete.Generic.ExprLike b, Agda.Syntax.Concrete.Generic.ExprLike c, Agda.Syntax.Concrete.Generic.ExprLike d) => Agda.Syntax.Concrete.Generic.ExprLike (a, b, c, d) instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Expr instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.FieldAssignment instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.ModuleAssignment instance Agda.Syntax.Concrete.Generic.ExprLike a => Agda.Syntax.Concrete.Generic.ExprLike (Agda.Syntax.Concrete.OpApp a) instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.LamBinding instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.TypedBindings instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.LHS instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.LamClause instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.DoStmt instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Concrete.Generic.ExprLike Agda.Syntax.Concrete.Declaration -- | Types used for precise syntax highlighting. module Agda.Interaction.Highlighting.Precise -- | Syntactic aspects of the code. (These cannot overlap.) They can be -- obtained from the lexed tokens already, except for the -- NameKind. data Aspect Comment :: Aspect Option :: Aspect Keyword :: Aspect String :: Aspect Number :: Aspect -- | Symbols like forall, =, ->, etc. Symbol :: Aspect -- | Things like Set and Prop. PrimitiveType :: Aspect -- | Is the name an operator part? Name :: (Maybe NameKind) -> Bool -> Aspect -- | NameKinds are figured out during scope checking. data NameKind -- | Bound variable. Bound :: NameKind -- | Inductive or coinductive constructor. Constructor :: Induction -> NameKind Datatype :: NameKind -- | Record field. Field :: NameKind Function :: NameKind -- | Module name. Module :: NameKind Postulate :: NameKind -- | Primitive. Primitive :: NameKind -- | Record type. Record :: NameKind -- | Named argument, like x in {x = v} Argument :: NameKind -- | Macro. Macro :: NameKind -- | Other aspects, generated by type checking. (These can overlap with -- each other and with Aspects.) data OtherAspect Error :: OtherAspect DottedPattern :: OtherAspect UnsolvedMeta :: OtherAspect -- | Unsolved constraint not connected to meta-variable. This could for -- instance be an emptyness constraint. UnsolvedConstraint :: OtherAspect TerminationProblem :: OtherAspect PositivityProblem :: OtherAspect ReachabilityProblem :: OtherAspect CoverageProblem :: OtherAspect -- | When this constructor is used it is probably a good idea to include a -- note explaining why the pattern is incomplete. IncompletePattern :: OtherAspect CatchallClause :: OtherAspect -- | Code which is being type-checked. TypeChecks :: OtherAspect -- | Meta information which can be associated with a character/character -- range. data Aspects Aspects :: Maybe Aspect -> [OtherAspect] -> Maybe String -> Maybe DefinitionSite -> !TokenBased -> Aspects [aspect] :: Aspects -> Maybe Aspect [otherAspects] :: Aspects -> [OtherAspect] -- | This note, if present, can be displayed as a tool-tip or something -- like that. It should contain useful information about the range (like -- the module containing a certain identifier, or the fixity of an -- operator). [note] :: Aspects -> Maybe String -- | The definition site of the annotated thing, if applicable and known. -- File positions are counted from 1. [definitionSite] :: Aspects -> Maybe DefinitionSite -- | Is this entry token-based? [tokenBased] :: Aspects -> !TokenBased data DefinitionSite DefinitionSite :: TopLevelModuleName -> Int -> Bool -> Maybe String -> DefinitionSite -- | The defining module. [defSiteModule] :: DefinitionSite -> TopLevelModuleName -- | The file position in that module. [defSitePos] :: DefinitionSite -> Int -- | Has this DefinitionSite been created at the defining site of -- the name? [defSiteHere] :: DefinitionSite -> Bool -- | A pretty name for the HTML linking. [defSiteAnchor] :: DefinitionSite -> Maybe String -- | Is the highlighting "token-based", i.e. based only on information from -- the lexer? data TokenBased TokenBased :: TokenBased NotOnlyTokenBased :: TokenBased -- | A File is a mapping from file positions to meta information. -- -- The first position in the file has number 1. newtype File File :: IntMap Aspects -> File [mapping] :: File -> IntMap Aspects -- | Syntax highlighting information. type HighlightingInfo = CompressedFile -- | A variant of mempty with tokenBased set to -- NotOnlyTokenBased. parserBased :: Aspects -- | singleton rs m is a file whose positions are those in -- rs, and in which every position is associated with -- m. singleton :: Ranges -> Aspects -> File -- | Like singleton, but with several Ranges instead of only -- one. several :: [Ranges] -> Aspects -> File -- | Merges files. merge :: File -> File -> File -- | Returns the smallest position, if any, in the File. smallestPos :: File -> Maybe Int -- | Convert the File to a map from file positions (counting from 1) -- to meta information. toMap :: File -> IntMap Aspects -- | A compressed File, in which consecutive positions with the same -- Aspects are stored together. newtype CompressedFile CompressedFile :: [(Range, Aspects)] -> CompressedFile [ranges] :: CompressedFile -> [(Range, Aspects)] -- | Invariant for compressed files. -- -- Note that these files are not required to be maximally -- compressed, because ranges are allowed to be empty, and the -- Aspectss in adjacent ranges are allowed to be equal. compressedFileInvariant :: CompressedFile -> Bool -- | Compresses a file by merging consecutive positions with equal meta -- information into longer ranges. compress :: File -> CompressedFile -- | Decompresses a compressed file. decompress :: CompressedFile -> File -- | Clear any highlighting info for the given ranges. Used to make sure -- unsolved meta highlighting overrides error highlighting. noHighlightingInRange :: Ranges -> CompressedFile -> CompressedFile -- | singletonC rs m is a file whose positions are those in -- rs, and in which every position is associated with -- m. singletonC :: Ranges -> Aspects -> CompressedFile -- | Like singletonR, but with a list of Ranges instead of -- a single one. severalC :: [Ranges] -> Aspects -> CompressedFile -- | splitAtC p f splits the compressed file f into -- (f1, f2), where all the positions in f1 are < -- p, and all the positions in f2 are >= p. splitAtC :: Int -> CompressedFile -> (CompressedFile, CompressedFile) selectC :: Range -> CompressedFile -> CompressedFile -- | Returns the smallest position, if any, in the CompressedFile. smallestPosC :: CompressedFile -> Maybe Int -- | Merges compressed files. mergeC :: CompressedFile -> CompressedFile -> CompressedFile instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.CompressedFile instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.CompressedFile instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.File instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.File instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.Aspects instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.TokenBased instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.TokenBased instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.DefinitionSite instance GHC.Enum.Bounded Agda.Interaction.Highlighting.Precise.OtherAspect instance GHC.Enum.Enum Agda.Interaction.Highlighting.Precise.OtherAspect instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.OtherAspect instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.OtherAspect instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.Aspect instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.Aspect instance GHC.Show.Show Agda.Interaction.Highlighting.Precise.NameKind instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.NameKind instance GHC.Base.Semigroup Agda.Interaction.Highlighting.Precise.CompressedFile instance GHC.Base.Monoid Agda.Interaction.Highlighting.Precise.CompressedFile instance GHC.Base.Semigroup Agda.Interaction.Highlighting.Precise.File instance GHC.Base.Monoid Agda.Interaction.Highlighting.Precise.File instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.Aspects instance GHC.Base.Semigroup Agda.Interaction.Highlighting.Precise.Aspects instance GHC.Base.Monoid Agda.Interaction.Highlighting.Precise.Aspects instance GHC.Base.Semigroup Agda.Interaction.Highlighting.Precise.TokenBased instance GHC.Base.Monoid Agda.Interaction.Highlighting.Precise.TokenBased instance GHC.Classes.Eq Agda.Interaction.Highlighting.Precise.DefinitionSite -- | Data type for all interactive responses module Agda.Interaction.Response -- | Responses for any interactive interface -- -- Note that the response is given in pieces and incrementally, so the -- user can have timely response even during long computations. data Response Resp_HighlightingInfo :: HighlightingInfo -> RemoveTokenBasedHighlighting -> HighlightingMethod -> ModuleToSource -> Response Resp_Status :: Status -> Response Resp_JumpToError :: FilePath -> Int32 -> Response Resp_InteractionPoints :: [InteractionId] -> Response Resp_GiveAction :: InteractionId -> GiveResult -> Response Resp_MakeCase :: MakeCaseVariant -> [String] -> Response -- | Solution for one or more meta-variables. Resp_SolveAll :: [(InteractionId, Expr)] -> Response Resp_DisplayInfo :: DisplayInfo -> Response -- | The integer is the message's debug level. Resp_RunningInfo :: Int -> String -> Response Resp_ClearRunningInfo :: Response -- | Clear highlighting of the given kind. Resp_ClearHighlighting :: TokenBased -> Response -- | A command sent when an abort command has completed successfully. Resp_DoneAborting :: Response -- | Should token-based highlighting be removed in conjunction with the -- application of new highlighting (in order to reduce the risk of -- flicker)? data RemoveTokenBasedHighlighting -- | Yes, remove all token-based highlighting from the file. RemoveHighlighting :: RemoveTokenBasedHighlighting -- | No. KeepHighlighting :: RemoveTokenBasedHighlighting -- | There are two kinds of "make case" commands. data MakeCaseVariant Function :: MakeCaseVariant ExtendedLambda :: MakeCaseVariant -- | Info to display at the end of an interactive command data DisplayInfo -- | Strings are the warnings and the (non-fatal) errors Info_CompilationOk :: String -> String -> DisplayInfo Info_Constraints :: String -> DisplayInfo -- | Strings are the goals, the warnings and the (non-fatal) errors Info_AllGoalsWarnings :: String -> String -> String -> DisplayInfo Info_Time :: Doc -> DisplayInfo -- | When an error message is displayed this constructor should be used, if -- appropriate. | Info_Warning String --FNF: currently unused Info_Error :: String -> DisplayInfo -- | Info_Intro denotes two different types of errors TODO: split -- these into separate constructors Info_Intro :: Doc -> DisplayInfo -- | Info_Auto denotes either an error or a success (when -- Resp_GiveAction is present) TODO: split these into separate -- constructors Info_Auto :: String -> DisplayInfo Info_ModuleContents :: Doc -> DisplayInfo Info_SearchAbout :: Doc -> DisplayInfo Info_WhyInScope :: Doc -> DisplayInfo Info_NormalForm :: Doc -> DisplayInfo Info_GoalType :: Doc -> DisplayInfo Info_CurrentGoal :: Doc -> DisplayInfo Info_InferredType :: Doc -> DisplayInfo Info_Context :: Doc -> DisplayInfo Info_HelperFunction :: Doc -> DisplayInfo Info_Version :: DisplayInfo -- | Status information. data Status Status :: Bool -> Bool -> Status -- | Are implicit arguments displayed? [sShowImplicitArguments] :: Status -> Bool -- | Has the module been successfully type checked? [sChecked] :: Status -> Bool -- | Give action result -- -- Comment derived from agda2-mode.el -- -- If GiveResult is 'Give_String s', then the goal is replaced by -- s, and otherwise the text inside the goal is retained -- (parenthesised if GiveResult is Give_Paren). data GiveResult Give_String :: String -> GiveResult Give_Paren :: GiveResult Give_NoParen :: GiveResult -- | Callback fuction to call when there is a response to give to the -- interactive frontend. -- -- Note that the response is given in pieces and incrementally, so the -- user can have timely response even during long computations. -- -- Typical InteractionOutputCallback functions: -- --
-- 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)] -- | O(n). Reexport lookup. lookup :: Eq k => k -> AssocList k v -> Maybe v -- | O(n). Get the domain (list of keys) of the finite map. keys :: AssocList k v -> [k] -- | O(1). Add a new binding. Assumes the binding is not yet in the list. insert :: k -> v -> AssocList k v -> AssocList k v -- | O(n). Update the value at a key. The key must be in the domain of the -- finite map. Otherwise, an internal error is raised. update :: Eq k => k -> v -> AssocList k v -> AssocList k v -- | O(n). Delete a binding. The key must be in the domain of the finite -- map. Otherwise, an internal error is raised. delete :: Eq k => k -> AssocList k v -> AssocList k v -- | O(n). Update the value at a key with a certain function. The key must -- be in the domain of the finite map. Otherwise, an internal error is -- raised. updateAt :: Eq k => k -> (v -> v) -> AssocList k v -> AssocList k v -- | O(n). Map over an association list, preserving the order. mapWithKey :: (k -> v -> v) -> AssocList k v -> AssocList k v -- | O(n). If called with a effect-producing function, violation of the -- invariant could matter here (duplicating effects). mapWithKeyM :: Applicative m => (k -> v -> m v) -> AssocList k v -> m (AssocList k v) -- | O(n). Named in analogy to mapKeysMonotonic. To preserve the -- invariant, it is sufficient that the key transformation is injective -- (rather than monotonic). mapKeysMonotonic :: (k -> k') -> AssocList k v -> AssocList k' v -- | 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 DataOrRecord -> Scope [scopeName] :: Scope -> ModuleName [scopeParents] :: Scope -> [ModuleName] [scopeNameSpaces] :: Scope -> ScopeNameSpaces [scopeImports] :: Scope -> Map QName ModuleName [scopeDatatypeModule] :: Scope -> Maybe DataOrRecord -- | 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 -- | Visible (as qualified) from outside, but not exported when opening the -- module. Used for qualified constructors. OnlyQualifiedNS :: 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 -> Map QName [QName] -> Map ModuleName [QName] -> InScopeSet -> ScopeInfo [scopeCurrent] :: ScopeInfo -> ModuleName [scopeModules] :: ScopeInfo -> Map ModuleName Scope [scopeVarsToBind] :: ScopeInfo -> LocalVars [scopeLocals] :: ScopeInfo -> LocalVars [scopePrecedence] :: ScopeInfo -> PrecedenceStack [scopeInverseName] :: ScopeInfo -> Map QName [QName] [scopeInverseModule] :: ScopeInfo -> Map ModuleName [QName] [scopeInScope] :: ScopeInfo -> InScopeSet -- | 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 Binder -- | λ (currently also used for Π and module parameters) LambdaBound :: Binder -- |
-- f ... = --PatternBound :: Binder -- |
-- let ... in --LetBound :: Binder -- | 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 -> Binder -> [AbstractName] -> LocalVar -- | Unique ID of local variable. [localVar] :: LocalVar -> Name -- | Kind of binder used to introduce the variable (λ, -- let, ...). [localBinder] :: LocalVar -> Binder -- | 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 -- | Project name of unshadowed local variable. notShadowedLocal :: LocalVar -> Maybe Name -- | Get all locals that are not shadowed by imports. notShadowedLocals :: LocalVars -> AssocList Name Name -- | Lens for scopeVarsToBind. updateVarsToBind :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo setVarsToBind :: LocalVars -> ScopeInfo -> ScopeInfo -- | Lens for scopeLocals. updateScopeLocals :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo setScopeLocals :: LocalVars -> ScopeInfo -> ScopeInfo mapScopeInfo :: (Scope -> Scope) -> 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 [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 Eq 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 -- | For the sake of parsing left-hand sides, we distinguish constructor -- and record field names from defined names. data KindOfName -- | Constructor name. ConName :: KindOfName -- | Record field name. FldName :: KindOfName -- | Ordinary defined name. DefName :: KindOfName -- | Name of a pattern synonym. PatternSynName :: KindOfName -- | Name of a macro MacroName :: KindOfName -- | A name that can only be quoted. QuotableName :: KindOfName -- | A list containing all name kinds. allKindsOfNames :: [KindOfName] -- | 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 -> 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 -- | 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 :: Functor m => (QName -> m QName) -> AbstractName -> m AbstractName -- | Van Laarhoven lens on amodName. lensAmodName :: Functor m => (ModuleName -> m ModuleName) -> AbstractModule -> m AbstractModule data ResolvedName -- | Local variable bound by λ, Π, module telescope, pattern, let. VarName :: Name -> Binder -> ResolvedName [resolvedVar] :: ResolvedName -> Name -- | What kind of binder? [resolvedBinder] :: ResolvedName -> Binder -- | Function, data/record type, postulate. DefinedName :: Access -> AbstractName -> ResolvedName -- | Record field name. Needs to be distinguished to parse copatterns. FieldName :: (NonemptyList AbstractName) -> ResolvedName -- | Data or record constructor name. ConstructorName :: (NonemptyList AbstractName) -> ResolvedName -- | Name of pattern synonym. PatternSynResName :: (NonemptyList AbstractName) -> ResolvedName -- | Unbound name. UnknownName :: ResolvedName mergeNames :: Eq a => ThingsInScope 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. mapScope' :: 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) -- | 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 names to a scope. addNamesToScope :: NameSpaceId -> Name -> [AbstractName] -> 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 type UsingOrHiding = Either Using [ImportedName] usingOrHiding :: ImportDirective -> UsingOrHiding -- | Apply an ImportDirective to a scope. applyImportDirective :: ImportDirective -> Scope -> Scope -- | Rename the abstract names in a scope. renameCanonicalNames :: Map QName QName -> Map ModuleName ModuleName -> Scope -> Scope -- | Remove private name space of a scope. -- -- Should be a right identity for exportedNamesInScope. -- exportedNamesInScope . restrictPrivate == -- exportedNamesInScope. restrictPrivate :: Scope -> Scope -- | Remove private things from the given module from a scope. restrictLocalPrivate :: ModuleName -> Scope -> Scope -- | Remove names that can only be used qualified (when opening a scope) removeOnlyQualified :: Scope -> Scope -- | Add an explanation to why things are in scope. inScopeBecause :: (WhyInScope -> WhyInScope) -> Scope -> Scope -- | Get the public parts of the public modules of a scope publicModules :: ScopeInfo -> Map ModuleName Scope publicNames :: ScopeInfo -> Set AbstractName everythingInScope :: ScopeInfo -> NameSpace -- | Compute a flattened scope. Only include unqualified names or names -- qualified by modules in the first argument. flattenScope :: [[Name]] -> ScopeInfo -> Map QName [AbstractName] -- | Get all concrete names in scope. Includes bound variables. concreteNamesInScope :: ScopeInfo -> Set QName -- | Look up a name in the scope scopeLookup :: InScope a => QName -> ScopeInfo -> [a] scopeLookup' :: forall a. InScope a => QName -> ScopeInfo -> [(a, Access)] data AllowAmbiguousNames -- | Used for instance arguments to check whether a name is in scope, but -- we do not care whether is is ambiguous AmbiguousAnything :: AllowAmbiguousNames -- | Ambiguous constructors, projections, or pattern synonyms. AmbiguousConProjs :: AllowAmbiguousNames AmbiguousNothing :: AllowAmbiguousNames isNameInScope :: QName -> ScopeInfo -> Bool -- | Find the concrete names that map (uniquely) to a given abstract name. -- Sort by length, shortest first. inverseScopeLookup :: Either ModuleName QName -> ScopeInfo -> [QName] inverseScopeLookup' :: AllowAmbiguousNames -> Either ModuleName QName -> ScopeInfo -> [QName] recomputeInverseScopeMaps :: ScopeInfo -> ScopeInfo -- | Find the concrete names that map (uniquely) to a given abstract -- qualified name. Sort by length, shortest first. inverseScopeLookupName :: QName -> ScopeInfo -> [QName] inverseScopeLookupName' :: AllowAmbiguousNames -> QName -> ScopeInfo -> [QName] -- | Find the concrete names that map (uniquely) to a given abstract module -- name. Sort by length, shortest first. inverseScopeLookupModule :: ModuleName -> ScopeInfo -> [QName] prettyNameSpace :: NameSpace -> [Doc] -- | Add first string only if list is non-empty. blockOfLines :: Doc -> [Doc] -> [Doc] instance GHC.Classes.Eq Agda.Syntax.Scope.Base.AllowAmbiguousNames instance GHC.Classes.Eq Agda.Syntax.Scope.Base.ResolvedName instance GHC.Show.Show Agda.Syntax.Scope.Base.ResolvedName instance Data.Data.Data Agda.Syntax.Scope.Base.ResolvedName instance GHC.Show.Show Agda.Syntax.Scope.Base.ScopeInfo instance Data.Data.Data Agda.Syntax.Scope.Base.ScopeInfo instance GHC.Show.Show Agda.Syntax.Scope.Base.Scope instance GHC.Classes.Eq Agda.Syntax.Scope.Base.Scope instance Data.Data.Data Agda.Syntax.Scope.Base.Scope instance GHC.Show.Show Agda.Syntax.Scope.Base.NameSpace instance GHC.Classes.Eq Agda.Syntax.Scope.Base.NameSpace instance Data.Data.Data Agda.Syntax.Scope.Base.NameSpace instance GHC.Show.Show Agda.Syntax.Scope.Base.AbstractModule instance Data.Data.Data Agda.Syntax.Scope.Base.AbstractModule instance GHC.Show.Show Agda.Syntax.Scope.Base.LocalVar instance Data.Data.Data Agda.Syntax.Scope.Base.LocalVar instance GHC.Show.Show Agda.Syntax.Scope.Base.AbstractName instance Data.Data.Data Agda.Syntax.Scope.Base.AbstractName instance GHC.Show.Show Agda.Syntax.Scope.Base.WhyInScope instance Data.Data.Data Agda.Syntax.Scope.Base.WhyInScope instance GHC.Enum.Bounded Agda.Syntax.Scope.Base.KindOfName instance GHC.Enum.Enum Agda.Syntax.Scope.Base.KindOfName instance Data.Data.Data Agda.Syntax.Scope.Base.KindOfName instance GHC.Show.Show Agda.Syntax.Scope.Base.KindOfName instance GHC.Classes.Eq Agda.Syntax.Scope.Base.KindOfName instance GHC.Classes.Eq Agda.Syntax.Scope.Base.Binder instance GHC.Show.Show Agda.Syntax.Scope.Base.Binder instance Data.Data.Data Agda.Syntax.Scope.Base.Binder instance GHC.Show.Show Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Enum.Enum Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Enum.Bounded Agda.Syntax.Scope.Base.NameSpaceId instance GHC.Classes.Eq Agda.Syntax.Scope.Base.NameSpaceId instance Data.Data.Data Agda.Syntax.Scope.Base.NameSpaceId instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.ResolvedName instance GHC.Classes.Eq Agda.Syntax.Scope.Base.ScopeInfo instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.ScopeInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Scope.Base.ScopeInfo instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.Scope instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.NameSpace instance Agda.Syntax.Scope.Base.InScope Agda.Syntax.Scope.Base.AbstractName instance Agda.Syntax.Scope.Base.InScope Agda.Syntax.Scope.Base.AbstractModule instance GHC.Classes.Eq Agda.Syntax.Scope.Base.AbstractModule instance GHC.Classes.Ord Agda.Syntax.Scope.Base.AbstractModule instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.AbstractModule instance GHC.Classes.Eq Agda.Syntax.Scope.Base.LocalVar instance GHC.Classes.Ord Agda.Syntax.Scope.Base.LocalVar instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.LocalVar instance GHC.Classes.Eq Agda.Syntax.Scope.Base.AbstractName instance GHC.Classes.Ord Agda.Syntax.Scope.Base.AbstractName instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.AbstractName instance Agda.Syntax.Position.HasRange Agda.Syntax.Scope.Base.AbstractName instance Agda.Syntax.Position.SetRange Agda.Syntax.Scope.Base.AbstractName instance Agda.Utils.Pretty.Pretty Agda.Syntax.Scope.Base.NameSpaceId -- | Utilities related to Geniplate. module Agda.Utils.Geniplate -- | A localised instance of instanceUniverseBiT. The generated -- universeBi functions neither descend into the types in -- dontDescendInto, nor into the types in the list argument. instanceUniverseBiT' :: [TypeQ] -> TypeQ -> Q [Dec] -- | A localised instance of instanceTransformBiMT. The generated -- transformBiM functions neither descend into the types in -- dontDescendInto, nor into the types in the list argument. instanceTransformBiMT' :: [TypeQ] -> TypeQ -> TypeQ -> Q [Dec] -- | Types which Geniplate should not descend into. dontDescendInto :: [TypeQ] -- | An info object contains additional information about a piece of -- abstract syntax that isn't part of the actual syntax. For instance, it -- might contain the source code position of an expression or the -- concrete syntax that an internal expression originates from. module Agda.Syntax.Info data MetaInfo MetaInfo :: Range -> ScopeInfo -> Maybe MetaId -> String -> MetaInfo [metaRange] :: MetaInfo -> Range [metaScope] :: MetaInfo -> ScopeInfo [metaNumber] :: MetaInfo -> Maybe MetaId [metaNameSuggestion] :: MetaInfo -> String emptyMetaInfo :: MetaInfo newtype ExprInfo ExprRange :: Range -> ExprInfo exprNoRange :: ExprInfo -- | Information about application data AppInfo AppInfo :: Range -> Origin -> ParenPreference -> AppInfo [appRange] :: AppInfo -> Range [appOrigin] :: AppInfo -> Origin -- | Do we prefer a appbda argument with or without parens? [appParens] :: AppInfo -> ParenPreference -- | Default is system inserted and prefer parens. defaultAppInfo :: Range -> AppInfo -- | AppInfo with no range information. defaultAppInfo_ :: AppInfo data ModuleInfo ModuleInfo :: Range -> Range -> Maybe Name -> Maybe OpenShortHand -> Maybe ImportDirective -> ModuleInfo [minfoRange] :: ModuleInfo -> Range -- | The range of the "as" and "to" keywords, if any. Retained for -- highlighting purposes. [minfoAsTo] :: ModuleInfo -> Range -- | The "as" module name, if any. Retained for highlighting purposes. [minfoAsName] :: ModuleInfo -> Maybe Name [minfoOpenShort] :: ModuleInfo -> Maybe OpenShortHand -- | Retained for abstractToConcrete of ModuleMacro. [minfoDirective] :: ModuleInfo -> Maybe ImportDirective newtype LetInfo LetRange :: Range -> LetInfo data DefInfo DefInfo :: Fixity' -> Access -> IsAbstract -> IsInstance -> IsMacro -> DeclInfo -> DefInfo [defFixity] :: DefInfo -> Fixity' [defAccess] :: DefInfo -> Access [defAbstract] :: DefInfo -> IsAbstract [defInstance] :: DefInfo -> IsInstance [defMacro] :: DefInfo -> IsMacro [defInfo] :: DefInfo -> DeclInfo mkDefInfo :: Name -> Fixity' -> Access -> IsAbstract -> Range -> DefInfo -- | Same as mkDefInfo but where we can also give the -- IsInstance mkDefInfoInstance :: Name -> Fixity' -> Access -> IsAbstract -> IsInstance -> IsMacro -> Range -> DefInfo data DeclInfo DeclInfo :: Name -> Range -> DeclInfo [declName] :: DeclInfo -> Name [declRange] :: DeclInfo -> Range data MutualInfo MutualInfo :: TerminationCheck Name -> PositivityCheck -> Range -> MutualInfo [mutualTermCheck] :: MutualInfo -> TerminationCheck Name [mutualPositivityCheck] :: MutualInfo -> PositivityCheck [mutualRange] :: MutualInfo -> Range newtype LHSInfo LHSRange :: Range -> LHSInfo -- | For a general pattern we remember the source code position. newtype PatInfo PatRange :: Range -> PatInfo -- | Empty range for patterns. patNoRange :: PatInfo -- | Constructor pattern info. data ConPatInfo ConPatInfo :: ConOrigin -> PatInfo -> Bool -> ConPatInfo -- | Does this pattern come form the eta-expansion of an implicit pattern? [patOrigin] :: ConPatInfo -> ConOrigin [patInfo] :: ConPatInfo -> PatInfo [patLazy] :: ConPatInfo -> Bool instance GHC.Classes.Eq Agda.Syntax.Info.ConPatInfo instance Data.Data.Data Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.PatInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.PatInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.PatInfo instance GHC.Show.Show Agda.Syntax.Info.PatInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.PatInfo instance GHC.Classes.Eq Agda.Syntax.Info.PatInfo instance Data.Data.Data Agda.Syntax.Info.PatInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.LHSInfo instance GHC.Classes.Eq Agda.Syntax.Info.LHSInfo instance GHC.Show.Show Agda.Syntax.Info.LHSInfo instance Data.Data.Data Agda.Syntax.Info.LHSInfo instance GHC.Classes.Eq Agda.Syntax.Info.MutualInfo instance GHC.Show.Show Agda.Syntax.Info.MutualInfo instance Data.Data.Data Agda.Syntax.Info.MutualInfo instance GHC.Classes.Eq Agda.Syntax.Info.DefInfo instance GHC.Show.Show Agda.Syntax.Info.DefInfo instance Data.Data.Data Agda.Syntax.Info.DefInfo instance GHC.Classes.Eq Agda.Syntax.Info.DeclInfo instance GHC.Show.Show Agda.Syntax.Info.DeclInfo instance Data.Data.Data Agda.Syntax.Info.DeclInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.LetInfo instance GHC.Classes.Eq Agda.Syntax.Info.LetInfo instance GHC.Show.Show Agda.Syntax.Info.LetInfo instance Data.Data.Data Agda.Syntax.Info.LetInfo instance GHC.Classes.Eq Agda.Syntax.Info.ModuleInfo instance Data.Data.Data Agda.Syntax.Info.ModuleInfo instance GHC.Classes.Ord Agda.Syntax.Info.AppInfo instance GHC.Classes.Eq Agda.Syntax.Info.AppInfo instance GHC.Show.Show Agda.Syntax.Info.AppInfo instance Data.Data.Data Agda.Syntax.Info.AppInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.ExprInfo instance GHC.Classes.Eq Agda.Syntax.Info.ExprInfo instance GHC.Show.Show Agda.Syntax.Info.ExprInfo instance Data.Data.Data Agda.Syntax.Info.ExprInfo instance GHC.Classes.Eq Agda.Syntax.Info.MetaInfo instance GHC.Show.Show Agda.Syntax.Info.MetaInfo instance Data.Data.Data Agda.Syntax.Info.MetaInfo instance GHC.Show.Show Agda.Syntax.Info.ModuleInfo instance GHC.Show.Show Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.ConPatInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.LHSInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.LHSInfo instance Agda.Utils.Null.Null Agda.Syntax.Info.MutualInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.MutualInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.MutualInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.DefInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.DefInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.DefInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.DeclInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.DeclInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.DeclInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.LetInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.LetInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.ModuleInfo instance Agda.Syntax.Position.SetRange Agda.Syntax.Info.ModuleInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.ModuleInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.AppInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.AppInfo instance Agda.Syntax.Common.LensOrigin Agda.Syntax.Info.AppInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.ExprInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.ExprInfo instance Agda.Syntax.Position.HasRange Agda.Syntax.Info.MetaInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Info.MetaInfo -- | Sparse matrices. -- -- We assume the matrices to be very sparse, so we just implement them as -- sorted association lists. -- -- Most operations are linear in the number of non-zero elements. -- -- An exception is transposition, which needs to sort the association -- list again; it has the complexity of sorting: n log n where -- n is the number of non-zero elements. -- -- Another exception is matrix multiplication, of course. module Agda.Termination.SparseMatrix -- | Type of matrices, parameterised on the type of values. -- -- Sparse matrices are implemented as an ordered association list, -- mapping coordinates to values. data Matrix i b Matrix :: Size i -> [(MIx i, b)] -> Matrix i b -- | Association of indices to values. unM :: Matrix i b -> [(MIx i, b)] -- | Size of a matrix. data Size i Size :: i -> i -> Size i -- | Number of rows, >= 0. [rows] :: Size i -> i -- | Number of columns, >= 0. [cols] :: Size i -> i -- | Type of matrix indices (row, column). data MIx i MIx :: i -> i -> MIx i -- | Row index, 1 <= row <= rows. [row] :: MIx i -> i -- | Column index 1 <= col <= cols. [col] :: MIx i -> i -- | fromLists sz rs constructs a matrix from a list of -- lists of values (a list of rows). O(size) where size = -- rows × cols. -- -- Precondition: length rs == rows sz and -- all ((cols sz ==) . length) rs. fromLists :: (Ord i, Num i, Enum i, HasZero b) => Size i -> [[b]] -> Matrix i b -- | Constructs a matrix from a list of (index, value)-pairs. -- O(n) where n is size of the list. -- -- Precondition: indices are unique. fromIndexList :: (Ord i, HasZero b) => Size i -> [(MIx i, b)] -> Matrix i b -- | Converts a matrix to a list of row lists. O(size) where -- size = rows × cols. toLists :: (Integral i, HasZero b) => Matrix i b -> [[b]] -- | Dimensions of the matrix. size :: Matrix i b -> Size i -- | True iff the matrix is square. square :: Ix i => Matrix i b -> Bool -- | Returns True iff the matrix is empty. isEmpty :: (Num i, Ix i) => Matrix i b -> Bool -- | Returns 'Just b' iff it is a 1x1 matrix with just one entry -- b. O(1). isSingleton :: (Eq i, Num i, HasZero b) => Matrix i b -> Maybe b -- | General pointwise combination function for sparse matrices. O(n1 + -- n2). zipMatrices :: forall a b c i. (Ord i) => (a -> c) -> (b -> c) -> (a -> b -> c) -> (c -> Bool) -> Matrix i a -> Matrix i b -> Matrix i c -- | add (+) m1 m2 adds m1 and m2, using -- (+) to add values. O(n1 + n2). -- -- Returns a matrix of size supSize m1 m2. add :: (Ord i, HasZero a) => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a -- | intersectWith f m1 m2 build the pointwise conjunction -- m1 and m2. Uses f to combine non-zero -- values. O(n1 + n2). -- -- Returns a matrix of size infSize m1 m2. intersectWith :: (Ord i) => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a -- | Association list intersection. O(n1 + n2). -- --
-- interAssocWith f l l' = { (i, f a b) | (i,a) ∈ l and (i,b) ∈ l' } ---- -- Used to combine sparse matrices, it might introduce zero elements if -- f can return zero for non-zero arguments. interAssocWith :: (Ord i) => (a -> a -> a) -> [(i, a)] -> [(i, a)] -> [(i, a)] -- | 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 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 GHC.Arr.Ix i => GHC.Arr.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 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 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 either when seeing an open brace -- (openBrace) or at the next token (newLayoutContext). -- -- Update: we don't use braces for layout anymore. layout :: LexState -- | We enter this state from newLayoutContext 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 newLayoutContext. 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.Show.Show Agda.Syntax.Parser.Parser.RHSOrTypeSigs instance GHC.Show.Show Agda.Syntax.Parser.Parser.RecordDirective instance GHC.Classes.Eq Agda.Syntax.Parser.Parser.RecordDirective -- | 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 :: LexAction r -> LexAction r -- | 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 -- | Parse a literal. literal :: Read a => (Range -> a -> Literal) -> LexAction Token -- | 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' = case x of { True -> False; False -> ... ---- -- At the ... the layout context would be -- --
-- [NoLayout, Layout 4, Layout 0] ---- -- The closest layout block is the one containing the case -- branches. This block starts with an open brace ('{') and so -- doesn't use layout. The second closest block is the where -- clause. Here, there is no open brace so the block is started by the -- x' token which has indentation 4. Finally there is a -- top-level layout block with indentation 0. module Agda.Syntax.Parser.Layout -- | Executed upon lexing an open brace ('{'). Enters the -- NoLayout context. openBrace :: LexAction Token -- | Executed upon lexing a close brace ('}'). Exits the current -- layout context. This might look a bit funny--the lexer will happily -- use a close brace to close a context open by a virtual brace. This is -- not a problem since the parser will make sure the braces are -- appropriately matched. closeBrace :: LexAction Token -- | Executed for layout keywords. Enters the layout state and -- performs the given action. withLayout :: LexAction r -> LexAction r -- | Executed for the first token in each line (see bol). Checks the -- position of the token relative to the current layout context. If the -- token is -- --
-- x --VarP :: PatOrigin -> x -> Pattern' x -- |
-- .t --DotP :: PatOrigin -> 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 :: Literal -> Pattern' x -- | Projection copattern. Can only appear by itself. ProjP :: ProjOrigin -> QName -> Pattern' x -- | 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 -- | Pattern variables. type PatVarName = ArgName -- | A clause is a list of patterns and the clause body. -- -- The telescope contains the types of the pattern variables and the de -- Bruijn indices say how to get from the order the variables occur in -- the patterns to the order they occur in the telescope. The body binds -- the variables in the order they appear in the telescope. -- --
-- clauseTel ~ permute clausePerm (patternVars namedClausePats) ---- -- Terms in dot patterns are valid in the clause telescope. -- -- For the purpose of the permutation and the body dot patterns count as -- variables. TODO: Change this! data Clause Clause :: Range -> Range -> Telescope -> [NamedArg DeBruijnPattern] -> Maybe Term -> Maybe (Arg Type) -> Bool -> Maybe Bool -> 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 -> [NamedArg DeBruijnPattern] -- | 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 -- | 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 -- | Blocked t without the t. type Blocked_ = Blocked () -- | Something where a meta variable may block reduction. data Blocked t Blocked :: MetaId -> t -> Blocked t [theBlockingMeta] :: Blocked t -> MetaId [ignoreBlocking] :: Blocked t -> t NotBlocked :: NotBlocked -> t -> Blocked t [blockingStatus] :: Blocked t -> NotBlocked [ignoreBlocking] :: Blocked t -> t -- | Even if we are not stuck on a meta during reduction we can fail to -- reduce a definition by pattern matching for another reason. data NotBlocked -- | The Elim is neutral and blocks a pattern match. StuckOn :: Elim -> NotBlocked -- | Not enough arguments were supplied to complete the matching. Underapplied :: NotBlocked -- | We matched an absurd clause, results in a neutral Def. AbsurdMatch :: NotBlocked -- | We ran out of clauses, all considered clauses produced an actual -- mismatch. This can happen when try to reduce a function application -- but we are still missing some function clauses. See -- Agda.TypeChecking.Patterns.Match. MissingClauses :: NotBlocked -- | Reduction was not blocked, we reached a whnf which can be anything but -- a stuck Def. ReallyNotBlocked :: NotBlocked -- | An atomic term of type Level. data LevelAtom -- | A meta variable targeting Level under some eliminations. MetaLevel :: MetaId -> Elims -> LevelAtom -- | A term of type Level whose reduction is blocked by a meta. BlockedLevel :: MetaId -> Term -> LevelAtom -- | A neutral term of type Level. NeutralLevel :: NotBlocked -> Term -> LevelAtom -- | Introduced by instantiate, removed by reduce. UnreducedLevel :: Term -> LevelAtom data PlusLevel -- | n, to represent Setₙ. ClosedLevel :: Integer -> PlusLevel -- | n + ℓ. Plus :: Integer -> LevelAtom -> PlusLevel -- | A level is a maximum expression of 0..n PlusLevel expressions -- each of which is a number or an atom plus a number. -- -- The empty maximum is the canonical representation for level 0. newtype Level Max :: [PlusLevel] -> Level -- | Sorts. data Sort -- | Set ℓ. Type :: Level -> Sort -- | Dummy sort. Prop :: Sort -- | Setω. Inf :: Sort -- | SizeUniv, a sort inhabited by type Size. SizeUniv :: Sort -- | Sort of the pi type. PiSort :: Sort -> (Abs Sort) -> Sort -- | Sort of another sort. UnivSort :: Sort -> Sort MetaS :: {-# UNPACK #-} !MetaId -> Elims -> Sort type Telescope = Tele (Dom Type) -- | 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 class LensSort a lensSort :: LensSort a => Lens' Sort a getSort :: LensSort a => a -> Sort type Type = Type' Term -- | Types are terms with a sort annotation. data Type' a El :: Sort -> a -> Type' a [_getSort] :: Type' a -> Sort [unEl] :: Type' a -> a -- | Binder. Abs: The bound variable might appear in the body. -- NoAbs is pseudo-binder, it does not introduce a fresh variable, -- similar to the const of Haskell. data Abs a -- | The body has (at least) one free variable. Danger: unAbs -- doesn't shift variables properly Abs :: ArgName -> a -> Abs a [absName] :: Abs a -> ArgName [unAbs] :: Abs a -> a NoAbs :: ArgName -> a -> Abs a [absName] :: Abs a -> ArgName [unAbs] :: Abs a -> a -- | Names in binders and arguments. type ArgName = String type Elims = [Elim] eliminations ordered left-to-right. type Elim = Elim' Term -- | Eliminations, subsuming applications and projections. data Elim' a -- | Application. Apply :: (Arg a) -> Elim' a -- | Projection. QName is name of a record projection. Proj :: ProjOrigin -> QName -> Elim' a type ConInfo = ConOrigin -- | Raw values. -- -- Def is used for both defined and undefined constants. Assume -- there is a type declaration and a definition for every constant, even -- if the definition is an empty list of clauses. data Term -- | x es neutral Var :: {-# UNPACK #-} !Int -> Elims -> Term -- | Terms are beta normal. Relevance is ignored Lam :: ArgInfo -> (Abs Term) -> Term Lit :: Literal -> Term -- | f es, possibly a delta/iota-redex Def :: QName -> Elims -> Term -- | c es or record { fs = es } es allows only -- Apply and IApply eliminations, and IApply only for data constructors. Con :: ConHead -> ConInfo -> Elims -> Term -- | dependent or non-dependent function space Pi :: (Dom Type) -> (Abs Type) -> Term Sort :: Sort -> Term Level :: Level -> Term MetaV :: {-# UNPACK #-} !MetaId -> Elims -> Term -- | Irrelevant stuff in relevant position, but created in an irrelevant -- context. Basically, an internal version of the irrelevance axiom -- .irrAx : .A -> A. DontCare :: Term -> Term class LensConName a getConName :: LensConName a => a -> QName setConName :: LensConName a => QName -> a -> a mapConName :: LensConName a => (QName -> QName) -> a -> a -- | 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 -> Induction -> [QName] -> ConHead -- | The name of the constructor. [conName] :: ConHead -> QName -- | Record constructors can be coinductive. [conInductive] :: ConHead -> Induction -- | The name of the record fields. Empty list for data constructors. -- Arg is not needed here since it is stored in the constructor -- args. [conFields] :: ConHead -> [QName] type NamedArgs = [NamedArg Term] -- | Type of argument lists. type Args = [Arg Term] argNameToString :: ArgName -> String stringToArgName :: String -> ArgName appendArgNames :: ArgName -> ArgName -> ArgName nameToArgName :: Name -> ArgName -- | When trying to reduce f es, on match failed on one -- elimination e ∈ es that came with info r :: -- NotBlocked. stuckOn e r produces the new -- NotBlocked info. -- -- MissingClauses must be propagated, as this is blockage that can -- be lifted in the future (as more clauses are added). -- -- StuckOn e0 is also propagated, since it provides more -- precise information as StuckOn e (as e0 is the -- original reason why reduction got stuck and usually a subterm of -- e). An information like StuckOn (Apply (Arg info (Var i -- []))) (stuck on a variable) could be used by the lhs/coverage -- checker to trigger a split on that (pattern) variable. -- -- In the remaining cases for r, we are terminally stuck due to -- StuckOn e. Propagating AbsurdMatch does not -- seem useful. -- -- Underapplied must not be propagated, as this would mean that -- f es is underapplied, which is not the case (it is stuck). -- Note that Underapplied can only arise when projection patterns -- were missing to complete the original match (in e). (Missing -- ordinary pattern would mean the e is of function type, but we -- cannot match against something of function type.) stuckOn :: Elim -> NotBlocked -> NotBlocked clausePats :: Clause -> [Arg DeBruijnPattern] patVarNameToString :: PatVarName -> String nameToPatVarName :: Name -> PatVarName varP :: a -> Pattern' a dotP :: Term -> Pattern' a namedVarP :: PatVarName -> Named_ Pattern namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern noConPatternInfo :: ConPatternInfo -- | Build partial ConPatternInfo from ConInfo toConPatternInfo :: ConInfo -> ConPatternInfo -- | Build ConInfo from ConPatternInfo. fromConPatternInfo :: ConPatternInfo -> ConInfo -- | Retrieve the origin of a pattern patternOrigin :: Pattern' x -> Maybe PatOrigin -- | Does the pattern perform a match that could fail? properlyMatching :: DeBruijnPattern -> Bool isEqualityType :: EqualityView -> Bool -- | Absurd lambdas are internally represented as identity with variable -- name "()". absurdBody :: Abs Term isAbsurdBody :: Abs Term -> Bool absurdPatternName :: PatVarName isAbsurdPatternName :: PatVarName -> Bool -- | An unapplied variable. var :: Nat -> Term -- | Add DontCare is it is not already a DontCare. dontCare :: Term -> Term -- | A dummy type. typeDontCare :: Type -- | Top sort (Setomega). topSort :: Type sort :: Sort -> Type varSort :: Int -> Sort levelSuc :: Level -> Level mkType :: Integer -> Sort isSort :: Term -> Maybe Sort impossibleTerm :: String -> Int -> Term hackReifyToMeta :: Term isHackReifyToMeta :: Term -> Bool -- | 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 -- | Convert a telescope to its list form. telToList :: Telescope -> ListTel blockingMeta :: Blocked t -> Maybe MetaId blocked :: MetaId -> a -> Blocked a notBlocked :: a -> Blocked a -- | Removing a topmost DontCare constructor. stripDontCare :: Term -> Term -- | Doesn't do any reduction. arity :: Type -> Nat -- | Make a name that is not in scope. notInScopeName :: ArgName -> ArgName -- | Remove the dot from a notInScopeName. This is used when printing -- function types that have abstracted over not-in-scope names. unNotInScopeName :: ArgName -> ArgName -- | 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) -- | Drop Apply constructor. (Unsafe!) argFromElim :: Elim' a -> Arg a -- | Drop Apply constructor. (Safe) isApplyElim :: Elim' a -> Maybe (Arg a) isApplyElim' :: Empty -> Elim' a -> Arg a -- | Drop Apply constructors. (Safe) allApplyElims :: [Elim' a] -> Maybe [Arg a] -- | Split at first non-Apply splitApplyElims :: [Elim' a] -> ([Arg a], [Elim' a]) -- | Discard Proj f entries. dropProjElims :: IsProjElim e => [e] -> [e] -- | Discards Proj f entries. argsFromElims :: Elims -> Args -- | Drop Proj constructors. (Safe) allProjElims :: Elims -> Maybe [(ProjOrigin, QName)] pDom :: LensHiding a => a -> Doc -> Doc -- | A meta variable identifier is just a natural number. newtype MetaId MetaId :: Nat -> MetaId [metaId] :: MetaId -> Nat instance Data.Generics.Geniplate.UniverseBi [Agda.Syntax.Internal.Term] Agda.Syntax.Internal.Term instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Substitution' a) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Term instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Clause instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Tele (Agda.Syntax.Common.Dom a)) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Level instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.PlusLevel instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.LevelAtom instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Sort instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.Type instance Agda.Utils.Pretty.Pretty tm => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Elim' tm) instance Agda.Utils.Pretty.Pretty Agda.Syntax.Internal.DBPatVar instance Agda.Utils.Pretty.Pretty a => Agda.Utils.Pretty.Pretty (Agda.Syntax.Internal.Pattern' a) 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 Agda.Syntax.Internal.PlusLevel instance Control.DeepSeq.NFData Agda.Syntax.Internal.LevelAtom instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Agda.Syntax.Internal.Elim' a) instance Data.Generics.Geniplate.UniverseBi Agda.Syntax.Internal.Elims Agda.Syntax.Internal.Term instance Data.Generics.Geniplate.UniverseBi Agda.Syntax.Internal.Args Agda.Syntax.Internal.Term instance Data.Generics.Geniplate.UniverseBi ([Agda.Syntax.Internal.Type], [Agda.Syntax.Internal.Clause]) Agda.Syntax.Internal.Term instance Data.Generics.Geniplate.UniverseBi Agda.Syntax.Internal.Elims Agda.Syntax.Internal.Pattern instance Data.Generics.Geniplate.UniverseBi Agda.Syntax.Internal.Args Agda.Syntax.Internal.Pattern instance Data.Generics.Geniplate.UniverseBi ([Agda.Syntax.Internal.Type], [Agda.Syntax.Internal.Clause]) Agda.Syntax.Internal.Pattern instance Data.Data.Data a => Data.Data.Data (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.Clause instance Data.Data.Data Agda.Syntax.Internal.Clause 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 Data.Data.Data x => Data.Data.Data (Agda.Syntax.Internal.Pattern' x) instance GHC.Show.Show Agda.Syntax.Internal.ConPatternInfo instance Data.Data.Data Agda.Syntax.Internal.ConPatternInfo instance GHC.Classes.Eq Agda.Syntax.Internal.DBPatVar instance GHC.Show.Show Agda.Syntax.Internal.DBPatVar instance Data.Data.Data Agda.Syntax.Internal.DBPatVar instance GHC.Classes.Eq Agda.Syntax.Internal.PatOrigin instance GHC.Show.Show Agda.Syntax.Internal.PatOrigin instance Data.Data.Data Agda.Syntax.Internal.PatOrigin instance Data.Traversable.Traversable Agda.Syntax.Internal.Blocked instance Data.Foldable.Foldable Agda.Syntax.Internal.Blocked instance GHC.Base.Functor Agda.Syntax.Internal.Blocked instance GHC.Show.Show t => GHC.Show.Show (Agda.Syntax.Internal.Blocked t) instance Data.Traversable.Traversable Agda.Syntax.Internal.Type' instance Data.Foldable.Foldable Agda.Syntax.Internal.Type' instance GHC.Base.Functor Agda.Syntax.Internal.Type' instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Internal.Type' a) instance Data.Data.Data a => Data.Data.Data (Agda.Syntax.Internal.Type' a) instance GHC.Show.Show Agda.Syntax.Internal.Sort instance Data.Data.Data Agda.Syntax.Internal.Sort instance Data.Data.Data Agda.Syntax.Internal.LevelAtom instance GHC.Show.Show Agda.Syntax.Internal.LevelAtom instance Data.Data.Data Agda.Syntax.Internal.PlusLevel instance GHC.Show.Show Agda.Syntax.Internal.PlusLevel instance Data.Data.Data Agda.Syntax.Internal.Level instance GHC.Show.Show Agda.Syntax.Internal.Level instance GHC.Show.Show Agda.Syntax.Internal.Term instance Data.Data.Data Agda.Syntax.Internal.Term instance Data.Data.Data Agda.Syntax.Internal.NotBlocked instance GHC.Show.Show Agda.Syntax.Internal.NotBlocked 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Internal.Tele 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 Data.Data.Data a => Data.Data.Data (Agda.Syntax.Internal.Abs a) instance Data.Traversable.Traversable Agda.Syntax.Internal.Elim' instance Data.Foldable.Foldable Agda.Syntax.Internal.Elim' instance GHC.Base.Functor Agda.Syntax.Internal.Elim' instance GHC.Show.Show a => GHC.Show.Show (Agda.Syntax.Internal.Elim' a) instance Data.Data.Data a => Data.Data.Data (Agda.Syntax.Internal.Elim' a) instance GHC.Show.Show Agda.Syntax.Internal.ConHead instance Data.Data.Data Agda.Syntax.Internal.ConHead 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 Agda.Syntax.Internal.LevelAtom instance Agda.Syntax.Internal.TermSize a => Agda.Syntax.Internal.TermSize (Agda.Syntax.Internal.Substitution' a) instance Agda.Syntax.Internal.IsProjElim Agda.Syntax.Internal.Elim instance Agda.Syntax.Internal.Suggest GHC.Base.String GHC.Base.String instance Agda.Syntax.Internal.Suggest (Agda.Syntax.Internal.Abs a) (Agda.Syntax.Internal.Abs b) instance Agda.Syntax.Internal.Suggest GHC.Base.String (Agda.Syntax.Internal.Abs b) instance Agda.Syntax.Internal.Suggest Agda.Syntax.Abstract.Name.Name (Agda.Syntax.Internal.Abs b) instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Internal.ArgName, Agda.Syntax.Common.Dom Agda.Syntax.Internal.Type) instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Common.Dom (Agda.Syntax.Internal.ArgName, Agda.Syntax.Internal.Type)) instance Agda.Syntax.Internal.SgTel (Agda.Syntax.Common.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.Syntax.Internal.PatternVars a (Agda.Syntax.Common.Arg (Agda.Syntax.Internal.Pattern' a)) instance Agda.Syntax.Internal.PatternVars a (Agda.Syntax.Common.NamedArg (Agda.Syntax.Internal.Pattern' a)) instance Agda.Syntax.Internal.PatternVars a b => Agda.Syntax.Internal.PatternVars a [b] 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.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.Syntax.Position.KillRange Agda.Syntax.Internal.ConPatternInfo instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.DBPatVar instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PatOrigin instance GHC.Base.Semigroup Agda.Syntax.Internal.Blocked_ instance GHC.Base.Monoid Agda.Syntax.Internal.Blocked_ instance GHC.Base.Applicative Agda.Syntax.Internal.Blocked instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Blocked a) instance Agda.Syntax.Internal.LensSort (Agda.Syntax.Internal.Type' a) instance Agda.Syntax.Internal.LensSort a => Agda.Syntax.Internal.LensSort (Agda.Syntax.Common.Dom a) instance Agda.Syntax.Internal.LensSort a => Agda.Syntax.Internal.LensSort (Agda.Syntax.Internal.Abs a) instance Agda.Utils.Functor.Decoration Agda.Syntax.Internal.Type' instance GHC.Base.Semigroup Agda.Syntax.Internal.NotBlocked instance GHC.Base.Monoid Agda.Syntax.Internal.NotBlocked instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Term instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.Level instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Position.KillRange Agda.Syntax.Internal.LevelAtom 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.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 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.Syntax.Common.LensOrigin (Agda.Syntax.Internal.Elim' a) instance Agda.Syntax.Position.KillRange a => Agda.Syntax.Position.KillRange (Agda.Syntax.Internal.Elim' 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 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.LevelAtom instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.Level -- | 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.Common.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.LevelAtom 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' 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.Base.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 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 :: Subst a 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 => Empty -> [Maybe a] -> Substitution' a -> Substitution' a parallelS :: DeBruijn a => [a] -> Substitution' a compactS :: DeBruijn a => Empty -> [Maybe a] -> Substitution' a -- | Γ ⊢ (strengthenS ⊥ |Δ|) : Γ,Δ strengthenS :: Empty -> Int -> Substitution' a lookupS :: Subst a a => Substitution' a -> Nat -> a -- | Instantiate an abstraction. Strict in the term. absApp :: Subst t a => Abs a -> t -> a -- | Instantiate an abstraction. Lazy in the term, which allow it to be -- (throwImpossible (Impossible -- "srcfullAgdaTypeCheckingSubstitute/Class.hs" 233)) in -- the case where the variable shouldn't be used but we cannot use -- noabsApp. Used in Apply. lazyAbsApp :: Subst t a => Abs a -> t -> a -- | Instantiate an abstraction that doesn't use its argument. noabsApp :: Subst t a => Empty -> Abs a -> a absBody :: Subst t a => Abs a -> a mkAbs :: (Subst t a, Free a) => ArgName -> a -> Abs a reAbs :: (Subst t 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 t 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 :: Subst Term a => Int -> (a -> Term -> Term) -> a -> Term -> Term instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Abstract.Name.QName -- | 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.Integer.Type.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' 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.Common.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.Base.Maybe 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.Blocked 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.LevelAtom instance Agda.Syntax.Internal.Generic.TermLike Agda.Syntax.Internal.Type 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 -> 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 -- | 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. Fail :: CompiledClauses' a type CompiledClauses = CompiledClauses' Term litCase :: Literal -> c -> Case c conCase :: QName -> 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.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 Data.Data.Data a => Data.Data.Data (Agda.TypeChecking.CompiledClause.CompiledClauses' a) 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 Data.Data.Data c => Data.Data.Data (Agda.TypeChecking.CompiledClause.Case 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 Data.Data.Data c => Data.Data.Data (Agda.TypeChecking.CompiledClause.WithArity c) 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 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 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) -- | 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 Agda.Syntax.Internal.LevelAtom instance Agda.Syntax.Internal.Defs.GetDefs a => Agda.Syntax.Internal.Defs.GetDefs (GHC.Base.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' 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.Common.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) -- | 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 type HoleContent = HoleContent' Expr class MaybePostfixProjP a maybePostfixProjP :: MaybePostfixProjP a => a -> Maybe (ProjOrigin, AmbiguousQName) type Patterns = [NamedArg Pattern] type Pattern = Pattern' Expr type NAPs e = [NamedArg (Pattern' e)] -- | 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 :: Literal -> Pattern' e PatternSynP :: PatInfo -> AmbiguousQName -> (NAPs e) -> Pattern' e RecP :: PatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e -- | | p, for with-patterns. WithP :: PatInfo -> (Pattern' e) -> Pattern' e type LHSCore = LHSCore' Expr -- | The lhs in projection-application and with-pattern view. Parameterised -- over the type e of dot patterns. data LHSCore' e -- | The head applied to ordinary patterns. LHSHead :: QName -> [NamedArg (Pattern' e)] -> LHSCore' e -- | Head f. [lhsDefName] :: LHSCore' e -> QName -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] -- | Projection. LHSProj :: AmbiguousQName -> NamedArg (LHSCore' e) -> [NamedArg (Pattern' e)] -> LHSCore' e -- | Record projection identifier. [lhsDestructor] :: LHSCore' e -> AmbiguousQName -- | Main argument of projection. [lhsFocus] :: LHSCore' e -> NamedArg (LHSCore' e) -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] -- | With patterns. LHSWith :: LHSCore' e -> [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 -> [Pattern' e] -- | Applied to patterns ps. [lhsPats] :: LHSCore' e -> [NamedArg (Pattern' e)] -- | 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 -- | 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] 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 -> [Expr] -> [Clause] -> RHS RewriteRHS :: [(QName, Expr)] -> [ProblemEq] -> RHS -> WhereDeclarations -> RHS -- | The QNames are the names of the generated with functions, one -- for each Expr. [rewriteExprs] :: RHS -> [(QName, Expr)] -- | 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 SpineClause = Clause' SpineLHS type Clause = Clause' LHS data WhereDeclarations WhereDecls :: Maybe ModuleName -> [Declaration] -> WhereDeclarations [whereModule] :: WhereDeclarations -> Maybe ModuleName [whereDecls] :: WhereDeclarations -> [Declaration] -- | 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 -- | 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. data ProblemEq ProblemEq :: Pattern -> Term -> Dom Type -> ProblemEq [problemInPat] :: ProblemEq -> Pattern [problemInst] :: ProblemEq -> Term [problemType] :: ProblemEq -> Dom Type type Telescope = [TypedBindings] -- | 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: -- --
-- LetBind info rel name type defn --LetBind :: LetInfo -> ArgInfo -> BindName -> Expr -> 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 data Pragma OptionsPragma :: [String] -> Pragma -- | ResolvedName is not UnknownName. Name can be ambiguous -- e.g. for built-in constructors. BuiltinPragma :: String -> ResolvedName -> Pragma -- | Builtins that do not come with a definition, but declare a name for an -- Agda concept. BuiltinNoDefPragma :: String -> QName -> Pragma RewritePragma :: QName -> Pragma CompilePragma :: String -> QName -> String -> Pragma CompiledPragma :: QName -> String -> Pragma CompiledExportPragma :: QName -> String -> Pragma CompiledTypePragma :: QName -> String -> Pragma CompiledDataPragma :: QName -> String -> [String] -> Pragma CompiledJSPragma :: QName -> String -> Pragma CompiledUHCPragma :: QName -> String -> Pragma CompiledDataUHCPragma :: QName -> String -> [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 DisplayPragma :: QName -> [NamedArg Pattern] -> Expr -> Pragma data ModuleApplication -- | tel. M args: applies M to args and -- abstracts tel. SectionApp :: Telescope -> ModuleName -> [NamedArg Expr] -> ModuleApplication -- |
-- M {{...}} --RecordModuleIFS :: ModuleName -> ModuleApplication type ImportedName = ImportedName' QName ModuleName type Renaming = Renaming' QName ModuleName type ImportDirective = ImportDirective' QName ModuleName class GetDefInfo a getDefInfo :: GetDefInfo a => a -> Maybe DefInfo data Declaration -- | Type signature (can be irrelevant, but not hidden). -- -- The fourth argument contains an optional assignment of polarities to -- arguments. Axiom :: Axiom -> DefInfo -> ArgInfo -> (Maybe [Occurrence]) -> QName -> Expr -> Declaration -- | record field Field :: DefInfo -> QName -> (Arg Expr) -> Declaration -- | primitive function Primitive :: DefInfo -> QName -> Expr -> Declaration -- | a bunch of mutually recursive definitions Mutual :: MutualInfo -> [Declaration] -> Declaration Section :: ModuleInfo -> ModuleName -> [TypedBindings] -> [Declaration] -> Declaration -- | The ImportDirective is for highlighting purposes. Apply :: ModuleInfo -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> ImportDirective -> Declaration -- | The ImportDirective is for highlighting purposes. Import :: ModuleInfo -> ModuleName -> ImportDirective -> Declaration Pragma :: Range -> Pragma -> Declaration -- | only retained for highlighting purposes Open :: ModuleInfo -> ModuleName -> ImportDirective -> Declaration -- | sequence of function clauses FunDef :: DefInfo -> QName -> Delayed -> [Clause] -> Declaration -- | lone data signature DataSig :: DefInfo -> QName -> Telescope -> Expr -> Declaration -- | the LamBindings are DomainFree and bind the parameters -- of the datatype. DataDef :: DefInfo -> QName -> [LamBinding] -> [Constructor] -> Declaration -- | lone record signature RecSig :: DefInfo -> QName -> Telescope -> Expr -> Declaration -- | The LamBindings are DomainFree and bind the parameters -- of the datatype. The Expr gives the constructor type telescope, -- (x1 : A1)..(xn : An) -> Prop, and the optional name is the -- constructor's name. RecDef :: DefInfo -> QName -> (Maybe (Ranged Induction)) -> (Maybe HasEta) -> (Maybe QName) -> [LamBinding] -> Expr -> [Declaration] -> Declaration -- | Only for highlighting purposes PatternSynDef :: QName -> [Arg Name] -> (Pattern' Void) -> Declaration UnquoteDecl :: MutualInfo -> [DefInfo] -> [QName] -> Expr -> Declaration UnquoteDef :: [DefInfo] -> [QName] -> Expr -> Declaration -- | scope annotation ScopedDecl :: ScopeInfo -> [Declaration] -> Declaration data ScopeCopyInfo ScopeCopyInfo :: Ren ModuleName -> Ren QName -> ScopeCopyInfo [renModules] :: ScopeCopyInfo -> Ren ModuleName [renNames] :: ScopeCopyInfo -> Ren QName -- | Renaming (generic). type Ren a = [(a, a)] -- | Is a type signature a postulate or a function signature? data Axiom -- | A function signature. FunSig :: Axiom -- | Not a function signature, i.e., a postulate (in user input) or another -- (e.g. data/record) type signature (internally). NoFunSig :: Axiom type RecordAssigns = [RecordAssign] type RecordAssign = Either Assign ModuleName type Assigns = [Assign] -- | 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. Def :: QName -> Expr -- | Projection (overloaded). Proj :: ProjOrigin -> AmbiguousQName -> Expr -- | Constructor (overloaded). Con :: AmbiguousQName -> Expr -- | Pattern synonym. PatternSyn :: AmbiguousQName -> Expr -- | Macro. Macro :: QName -> Expr -- | Literal. Lit :: 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 -> QName -> [Clause] -> Expr -- | Dependent function space Γ → A. Pi :: ExprInfo -> Telescope -> Expr -> Expr -- | Non-dependent function space. Fun :: ExprInfo -> (Arg Expr) -> Expr -> Expr -- | Set, Set1, Set2, ... Set :: ExprInfo -> Integer -> Expr -- | Prop (no longer supported, used as dummy type). Prop :: ExprInfo -> Expr -- | let bs in e. Let :: ExprInfo -> [LetBinding] -> Expr -> Expr -- | Only used when printing telescopes. ETel :: Telescope -> Expr -- | Record construction. Rec :: ExprInfo -> RecordAssigns -> Expr -- | Record update. RecUpdate :: ExprInfo -> Expr -> Assigns -> Expr -- | Scope annotation. ScopedExpr :: ScopeInfo -> Expr -> Expr -- | Binds Name to current type in Expr. QuoteGoal :: ExprInfo -> Name -> Expr -> Expr -- | Returns the current context. QuoteContext :: ExprInfo -> Expr -- | Quote an identifier QName. Quote :: ExprInfo -> Expr -- | Quote a term. QuoteTerm :: ExprInfo -> Expr -- | The splicing construct: unquote ... Unquote :: ExprInfo -> Expr -- |
-- tactic e x1 .. xn | y1 | .. | yn --Tactic :: ExprInfo -> Expr -> [NamedArg Expr] -> [NamedArg Expr] -> Expr -- | For printing DontCare from Syntax.Internal. DontCare :: Expr -> Expr type Args = [NamedArg Expr] newtype BindName BindName :: Name -> BindName [unBind] :: BindName -> Name initCopyInfo :: ScopeCopyInfo noWhereDecls :: WhereDeclarations class SubstExpr a substExpr :: SubstExpr a => [(Name, Expr)] -> a -> a type PatternSynDefns = Map QName PatternSynDefn type PatternSynDefn = ([Arg Name], Pattern' Void) class NameToExpr a nameExpr :: NameToExpr a => a -> Expr -- | Are we in an abstract block? -- -- In that case some definition is abstract. class AnyAbstract a anyAbstract :: AnyAbstract a => a -> Bool -- | Extracts all the names which are declared in a Declaration. -- This does not include open public or let expressions, but it does -- include local modules, where clauses and the names of extended -- lambdas. class AllNames a allNames :: AllNames a => a -> Seq QName -- | The name defined by the given axiom. -- -- Precondition: The declaration has to be a (scoped) Axiom. axiomName :: Declaration -> QName app :: Expr -> [NamedArg Expr] -> Expr mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr patternToExpr :: Pattern -> Expr lambdaLiftExpr :: [Name] -> Expr -> Expr insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name]) -- | Check whether a name is the empty name "_". class IsNoName a isNoName :: IsNoName a => a -> Bool -- | 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 -- | Check whether we are a projection pattern. class IsProjP a isProjP :: IsProjP a => a -> Maybe (ProjOrigin, AmbiguousQName) -- | 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 :: NonemptyList QName -> AmbiguousQName [unAmbQ] :: AmbiguousQName -> NonemptyList QName -- | 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] -- | Something preceeded by a qualified name. data QNamed a QNamed :: QName -> a -> QNamed a [qname] :: QNamed a -> QName [qnamed] :: QNamed a -> a -- | 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 -- | 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 -> Range -> Fixity' -> Name [nameId] :: Name -> !NameId [nameConcrete] :: Name -> Name [nameBindingSite] :: Name -> Range [nameFixity] :: Name -> Fixity' -- | A singleton "ambiguous" name. unambiguous :: QName -> AmbiguousQName -- | 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: -- --
-- -- 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 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] -- | Get all include pathes for a list of libraries to use. libraryIncludePaths :: Maybe FilePath -> [AgdaLibFile] -> [LibName] -> LibM [FilePath] -- | A symbolic library name. type LibName = String -- | Throws Doc exceptions. type LibM = ExceptT Doc IO -- | 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.LibError instance GHC.Show.Show Agda.Interaction.Library.VersionView instance GHC.Classes.Eq Agda.Interaction.Library.VersionView instance GHC.Show.Show Agda.Interaction.Library.LibrariesFile 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 () module Agda.Interaction.Options data CommandLineOptions Options :: String -> Maybe FilePath -> [FilePath] -> [AbsolutePath] -> [LibName] -> Maybe FilePath -> Bool -> Bool -> Bool -> Maybe Help -> Bool -> Bool -> Bool -> Maybe FilePath -> Bool -> Bool -> Bool -> Maybe FilePath -> FilePath -> FilePath -> Maybe FilePath -> Bool -> Bool -> PragmaOptions -> Bool -> CommandLineOptions [optProgramName] :: CommandLineOptions -> String [optInputFile] :: CommandLineOptions -> Maybe FilePath [optIncludePaths] :: CommandLineOptions -> [FilePath] [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 [optShowVersion] :: CommandLineOptions -> Bool [optShowHelp] :: CommandLineOptions -> Maybe Help [optInteractive] :: CommandLineOptions -> Bool [optGHCiInteraction] :: CommandLineOptions -> Bool [optOptimSmashing] :: CommandLineOptions -> Bool -- | In the absence of a path the project root is used. [optCompileDir] :: CommandLineOptions -> Maybe FilePath [optGenerateVimFile] :: CommandLineOptions -> Bool [optGenerateLaTeX] :: CommandLineOptions -> Bool [optGenerateHTML] :: CommandLineOptions -> Bool [optDependencyGraph] :: CommandLineOptions -> Maybe FilePath [optLaTeXDir] :: CommandLineOptions -> FilePath [optHTMLDir] :: CommandLineOptions -> FilePath [optCSSFile] :: CommandLineOptions -> Maybe FilePath [optIgnoreInterfaces] :: CommandLineOptions -> Bool [optForcing] :: CommandLineOptions -> Bool [optPragmaOptions] :: CommandLineOptions -> PragmaOptions -- | Should the top-level module only be scope-checked, and not -- type-checked? [optOnlyScopeChecking] :: CommandLineOptions -> Bool -- | Options which can be set in a pragma. data PragmaOptions PragmaOptions :: Bool -> Bool -> Bool -> Verbosity -> Bool -> Bool -> Bool -> Bool -> CutOff -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> Int -> Bool -> WarningMode -> Bool -> Bool -> Bool -> Bool -> Bool -> PragmaOptions [optShowImplicit] :: PragmaOptions -> Bool [optShowIrrelevant] :: PragmaOptions -> Bool [optUseUnicode] :: PragmaOptions -> Bool [optVerbose] :: PragmaOptions -> Verbosity [optProofIrrelevance] :: PragmaOptions -> Bool [optAllowUnsolved] :: PragmaOptions -> Bool [optDisablePositivity] :: PragmaOptions -> Bool [optTerminationCheck] :: PragmaOptions -> Bool -- | Cut off structural order comparison at some depth in termination -- checker? [optTerminationDepth] :: PragmaOptions -> CutOff [optCompletenessCheck] :: PragmaOptions -> Bool [optUniverseCheck] :: PragmaOptions -> Bool [optSizedTypes] :: PragmaOptions -> Bool [optInjectiveTypeConstructors] :: PragmaOptions -> Bool [optGuardingTypeConstructors] :: PragmaOptions -> Bool [optUniversePolymorphism] :: PragmaOptions -> Bool [optIrrelevantProjections] :: PragmaOptions -> Bool -- | irrelevant levels, irrelevant data matching [optExperimentalIrrelevance] :: PragmaOptions -> Bool [optWithoutK] :: PragmaOptions -> Bool -- | 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 -- | Can rewrite rules be added and used? [optRewriting] :: PragmaOptions -> Bool -- | Should system generated projections ProjSystem be printed -- postfix (True) or prefix (False). [optPostfixProjections] :: PragmaOptions -> Bool [optInstanceSearchDepth] :: PragmaOptions -> Int [optInversionMaxDepth] :: PragmaOptions -> Int [optSafe] :: PragmaOptions -> Bool [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 -- | 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] -- | 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 type OptM = ExceptT String IO runOptM :: OptM a -> IO (Either String a) -- | Each OptDescr describes a single option. -- -- The arguments to Option are: -- --
-- (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 telVars :: Int -> Telescope -> [Arg DeBruijnPattern] namedTelVars :: Int -> Telescope -> [NamedArg DeBruijnPattern] abstractArgs :: Abstract a => Args -> a -> a -- | If permute π : [a]Γ -> [a]Δ, then applySubst (renaming -- _ π) : Term Γ -> Term Δ renaming :: forall a. DeBruijn a => Empty -> Permutation -> Substitution' a -- | If permute π : [a]Γ -> [a]Δ, then applySubst -- (renamingR π) : Term Δ -> Term Γ renamingR :: DeBruijn a => Permutation -> Substitution' a -- | The permutation should permute the corresponding context. -- (right-to-left list) renameP :: Subst t a => Empty -> Permutation -> a -> a applyNLPatSubst :: (Subst Term a) => Substitution' NLPat -> a -> a fromPatternSubstitution :: PatternSubstitution -> Substitution applyPatSubst :: (Subst Term a) => PatternSubstitution -> a -> a usePatOrigin :: PatOrigin -> 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 -> 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 -- | Turn a typed binding (x1 .. xn : A) into a telescope. bindsToTel' :: (Name -> a) -> [Name] -> Dom Type -> ListTel' a bindsToTel :: [Name] -> Dom Type -> ListTel -- | Turn a typed binding (x1 .. xn : A) into a telescope. bindsWithHidingToTel' :: (Name -> a) -> [WithHiding Name] -> Dom Type -> ListTel' a bindsWithHidingToTel :: [WithHiding Name] -> Dom Type -> ListTel -- |
-- mkPi dom t = telePi (telFromList [dom]) t --mkPi :: Dom (ArgName, Type) -> Type -> Type mkLam :: Arg ArgName -> Term -> Term telePi' :: (Abs Type -> Abs Type) -> Telescope -> Type -> Type -- | Uses free variable analysis to introduce NoAbs bindings. telePi :: Telescope -> Type -> Type -- | Everything will be an Abs. telePi_ :: Telescope -> Type -> Type -- | 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 -- | 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 -- | Get the next higher sort. univSort' :: Sort -> Maybe Sort univSort :: Sort -> Sort -- | Compute the sort of a function type from the sorts of its domain and -- codomain. funSort' :: Sort -> Sort -> Maybe Sort funSort :: Sort -> Sort -> Sort -- | Compute the sort of a pi type from the sorts of its domain and -- codomain. piSort' :: Sort -> Abs Sort -> Maybe Sort piSort :: Sort -> Abs Sort -> Sort levelMax :: [PlusLevel] -> Level levelTm :: Level -> Term unLevelAtom :: LevelAtom -> Term levelSucView :: Level -> Maybe Level -- | Substitutions. data Substitution' a -- | Identity substitution. Γ ⊢ IdS : Γ IdS :: Substitution' a -- | Empty substitution, lifts from the empty context. First argument is -- (throwImpossible (Impossible -- "srcfullAgdaSyntaxInternal.hs" 572)). Apply this to -- closed terms you want to use in a non-empty context. Γ ⊢ EmptyS : -- () EmptyS :: Empty -> Substitution' a -- | Substitution extension, `cons'. Γ ⊢ u : Aρ Γ ⊢ ρ : Δ -- ---------------------- Γ ⊢ u :# ρ : Δ, A (:#) :: a -> Substitution' a -> Substitution' a -- | Strengthening substitution. First argument is (throwImpossible -- (Impossible "srcfullAgdaSyntaxInternal.hs" 585)). -- Apply this to a term which does not contain variable 0 to lower all de -- Bruijn indices by one. Γ ⊢ ρ : Δ --------------------------- Γ ⊢ -- Strengthen ρ : Δ, A Strengthen :: Empty -> (Substitution' a) -> Substitution' a -- | Weakning 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 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.Subst t a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.TypeChecking.Substitute.TelV a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.TypeChecking.Substitute.TelV a) instance GHC.Classes.Eq (Agda.Syntax.Internal.Substitution' Agda.Syntax.Internal.Term) instance GHC.Classes.Ord (Agda.Syntax.Internal.Substitution' Agda.Syntax.Internal.Term) 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.Candidate instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Internal.Tele a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Internal.Tele a) instance GHC.Classes.Eq Agda.TypeChecking.Monad.Base.Constraint instance GHC.Classes.Eq Agda.TypeChecking.Monad.Base.Section 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.Sort instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term 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.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 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.Base.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.Base.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.Projection instance Agda.TypeChecking.Substitute.Class.Abstract Agda.TypeChecking.Monad.Base.ProjLams 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.Base.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.Base.HashMap k v) instance Agda.TypeChecking.Substitute.Class.Subst a a => Agda.TypeChecking.Substitute.Class.Subst a (Agda.Syntax.Internal.Substitution' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.Term instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term a => Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term (Agda.Syntax.Internal.Type' a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.Level instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.LevelAtom instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term GHC.Base.String instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.Pattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Abstract.ProblemEq instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.NLPat Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.NLPat Agda.TypeChecking.Monad.Base.NLPType instance Agda.TypeChecking.Substitute.Class.Subst Agda.TypeChecking.Monad.Base.NLPat Agda.TypeChecking.Monad.Base.RewriteRule instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Internal.Blocked a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Internal.Elim' a) instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Common.Named name a) instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (Agda.Syntax.Common.Dom a) instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t (GHC.Base.Maybe a) instance Agda.TypeChecking.Substitute.Class.Subst t a => Agda.TypeChecking.Substitute.Class.Subst t [a] instance (GHC.Classes.Ord k, Agda.TypeChecking.Substitute.Class.Subst t a) => Agda.TypeChecking.Substitute.Class.Subst t (Data.Map.Internal.Map k a) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term () instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.Substitute.Class.Subst t b) => Agda.TypeChecking.Substitute.Class.Subst t (a, b) instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.Substitute.Class.Subst t b, Agda.TypeChecking.Substitute.Class.Subst t c) => Agda.TypeChecking.Substitute.Class.Subst t (a, b, c) instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.Substitute.Class.Subst t b, Agda.TypeChecking.Substitute.Class.Subst t c, Agda.TypeChecking.Substitute.Class.Subst t d) => Agda.TypeChecking.Substitute.Class.Subst t (a, b, c, d) instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn Agda.Syntax.Internal.DeBruijnPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.DeBruijnPattern Agda.Syntax.Internal.DeBruijnPattern instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term Agda.Syntax.Position.Range instance GHC.Classes.Ord Agda.Syntax.Internal.PlusLevel instance GHC.Classes.Eq Agda.Syntax.Internal.LevelAtom instance GHC.Classes.Ord Agda.Syntax.Internal.LevelAtom 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.Ord Agda.Syntax.Internal.Term instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Internal.Abs a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Internal.Abs a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Eq a) => GHC.Classes.Eq (Agda.Syntax.Internal.Elim' a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, GHC.Classes.Ord a) => GHC.Classes.Ord (Agda.Syntax.Internal.Elim' a) 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 t a) => Int -> a -> Maybe a 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 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.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 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 Agda.Syntax.Treeless.TTerm instance Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Treeless.TTerm Agda.Syntax.Treeless.TAlt module Agda.Compiler.Treeless.Pretty instance Agda.Utils.Pretty.Pretty Agda.Syntax.Treeless.TTerm -- | Translates guard alternatives to if-then-else cascades. -- -- The builtin translation must be run before this transformation. module Agda.Compiler.Treeless.GuardsToPrims convertGuards :: TTerm -> TTerm module Agda.Compiler.Treeless.Compare equalTerms :: TTerm -> TTerm -> Bool module Agda.Compiler.Treeless.Uncase caseToSeq :: Monad m => TTerm -> m 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.TypeChecking.Serialise.Base -- | Constructor tag (maybe omitted) and argument indices. type Node = [Int32] -- | The type of hashtables used in this module. -- -- A very limited amount of testing indicates that CuckooHashTable -- is somewhat slower than BasicHashTable, and that -- LinearHashTable and the hashtables from Data.Hashtable -- are much slower. type HashTable k v = BasicHashTable k v -- | Structure providing fresh identifiers for hash map and counting hash -- map hits (i.e. when no fresh identifier required). data FreshAndReuse FreshAndReuse :: !Int32 -> !Int32 -> FreshAndReuse -- | Number of hash map misses. [farFresh] :: FreshAndReuse -> !Int32 -- | Number of hash map hits. [farReuse] :: FreshAndReuse -> !Int32 farEmpty :: FreshAndReuse lensFresh :: Lens' Int32 FreshAndReuse lensReuse :: Lens' Int32 FreshAndReuse -- | Two QNames are equal if their QNameId is equal. type QNameId = [NameId] -- | Computing a qualified names composed ID. qnameId :: QName -> QNameId -- | State of the the encoder. data Dict Dict :: !(HashTable Node Int32) -> !(HashTable String Int32) -> !(HashTable ByteString Int32) -> !(HashTable Integer Int32) -> !(HashTable Double Int32) -> !(HashTable (Ptr Term) Int32) -> !(HashTable NameId Int32) -> !(HashTable QNameId Int32) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(IORef FreshAndReuse) -> !(HashTable String Int) -> Bool -> !(HashTable AbsolutePath Int32) -> Dict -- | Written to interface file. [nodeD] :: Dict -> !(HashTable Node Int32) -- | Written to interface file. [stringD] :: Dict -> !(HashTable String Int32) -- | Written to interface file. [bstringD] :: Dict -> !(HashTable ByteString Int32) -- | Written to interface file. [integerD] :: Dict -> !(HashTable Integer Int32) -- | Written to interface file. Dicitionaries which are not serialized, but -- provide short cuts to speed up serialization: [doubleD] :: Dict -> !(HashTable Double Int32) -- | Not written to interface file. Andreas, Makoto, AIM XXI Memoizing -- A.Name does not buy us much if we already memoize A.QName. [termD] :: Dict -> !(HashTable (Ptr Term) Int32) -- | Not written to interface file. [nameD] :: Dict -> !(HashTable NameId Int32) -- | Not written to interface file. Fresh UIDs and reuse statistics: [qnameD] :: Dict -> !(HashTable QNameId Int32) [nodeC] :: Dict -> !(IORef FreshAndReuse) [stringC] :: Dict -> !(IORef FreshAndReuse) [bstringC] :: Dict -> !(IORef FreshAndReuse) [integerC] :: Dict -> !(IORef FreshAndReuse) [doubleC] :: Dict -> !(IORef FreshAndReuse) [termC] :: Dict -> !(IORef FreshAndReuse) [nameC] :: Dict -> !(IORef FreshAndReuse) [qnameC] :: Dict -> !(IORef FreshAndReuse) [stats] :: Dict -> !(HashTable String Int) -- | If True collect in stats the quantities of calls to -- icode for each Typeable a. [collectStats] :: Dict -> Bool -- | Not written to interface file. [absPathD] :: Dict -> !(HashTable AbsolutePath Int32) -- | Creates an empty dictionary. emptyDict :: Bool -> IO Dict -- | Universal type, wraps everything. data U U :: !a -> U -- | Univeral memo structure, to introduce sharing during decoding type Memo = HashTable (Int32, TypeRep) U -- | State of the decoder. data St St :: !(Array Int32 Node) -> !(Array Int32 String) -> !(Array Int32 ByteString) -> !(Array Int32 Integer) -> !(Array Int32 Double) -> !Memo -> !ModuleToSource -> [AbsolutePath] -> St -- | Obtained from interface file. [nodeE] :: St -> !(Array Int32 Node) -- | Obtained from interface file. [stringE] :: St -> !(Array Int32 String) -- | Obtained from interface file. [bstringE] :: St -> !(Array Int32 ByteString) -- | Obtained from interface file. [integerE] :: St -> !(Array Int32 Integer) -- | Obtained from interface file. [doubleE] :: St -> !(Array Int32 Double) -- | Created and modified by decoder. Used to introduce sharing while -- deserializing objects. [nodeMemo] :: St -> !Memo -- | Maps module names to file names. Constructed by the decoder. [modFile] :: St -> !ModuleToSource -- | The include directories. [includes] :: St -> [AbsolutePath] -- | Monad used by the encoder. type S a = ReaderT Dict IO a -- | Monad used by the decoder. -- -- TCM is not used because the associated overheads would make -- decoding slower. type R a = ExceptT TypeError (StateT St IO) a -- | Throws an error which is suitable when the data stream is malformed. malformed :: R a class Typeable a => EmbPrj a icode :: EmbPrj a => a -> S Int32 icod_ :: EmbPrj a => a -> S Int32 value :: EmbPrj a => Int32 -> R a -- | Increase entry for a in stats. tickICode :: forall a. Typeable a => a -> S () -- | Data.Binary.runGetState is deprecated in favour of runGetIncremental. -- Reimplementing it in terms of the new function. The new Decoder type -- contains strict byte strings so we need to be careful not to feed the -- entire lazy byte string to the decoder at once. runGetState :: Get a -> ByteString -> ByteOffset -> (a, ByteString, ByteOffset) icodeX :: (Eq k, Hashable k) => (Dict -> HashTable k Int32) -> (Dict -> IORef FreshAndReuse) -> k -> S Int32 icodeInteger :: Integer -> S Int32 icodeDouble :: Double -> S Int32 icodeString :: String -> S Int32 icodeNode :: Node -> S Int32 -- | icode only if thing has not seen before. icodeMemo :: (Ord a, Hashable a) => (Dict -> HashTable a Int32) -> (Dict -> IORef FreshAndReuse) -> a -> S Int32 -> S Int32 -- | vcase value ix decodes thing represented by ix :: -- Int32 via the valu function and stores it in -- nodeMemo. If ix is present in nodeMemo, -- valu is not used, but the thing is read from nodeMemo -- instead. vcase :: forall a. EmbPrj a => (Node -> R a) -> Int32 -> R a -- | icodeArgs proxy (a1, ..., an) maps icode over -- a1, ..., an and returns the corresponding list of -- Int32. class ICODE t b icodeArgs :: (ICODE t b, IsBase t ~ b) => All EmbPrj (Domains t) => Proxy t -> Products (Domains t) -> S [Int32] -- | icodeN tag t a1 ... an serialises the arguments a1, -- ..., an of the constructor t together with a tag -- tag picked to disambiguate between different constructors. It -- corresponds to icodeNode . (tag :) =<< mapM icode [a1, ..., -- an] icodeN :: forall t. ICODE t (IsBase t) => Currying (Domains t) (S Int32) => All EmbPrj (Domains t) => Int32 -> t -> Arrows (Domains t) (S Int32) -- | icodeN' is the same as icodeN except that there is -- no tag icodeN' :: forall t. ICODE t (IsBase t) => Currying (Domains t) (S Int32) => All EmbPrj (Domains t) => t -> Arrows (Domains t) (S Int32) class VALU t b valuN' :: (VALU t b, b ~ IsBase t) => All EmbPrj (Domains t) => t -> Products (Constant Int32 (Domains t)) -> R (CoDomain t) valueArgs :: (VALU t b, b ~ IsBase t) => All EmbPrj (CoDomain t : Domains t) => Proxy t -> Node -> Maybe (Products (Constant Int32 (Domains t))) valuN :: forall t. VALU t (IsBase t) => Currying (Constant Int32 (Domains t)) (R (CoDomain t)) => All EmbPrj (Domains t) => t -> Arrows (Constant Int32 (Domains t)) (R (CoDomain t)) valueN :: forall t. VALU t (IsBase t) => All EmbPrj (CoDomain t : Domains t) => t -> Int32 -> R (CoDomain t) instance Agda.TypeChecking.Serialise.Base.VALU t 'GHC.Types.True instance Agda.TypeChecking.Serialise.Base.VALU t (Agda.Utils.TypeLevel.IsBase t) => Agda.TypeChecking.Serialise.Base.VALU (a -> t) 'GHC.Types.False instance (Agda.Utils.TypeLevel.IsBase t ~ 'GHC.Types.True) => Agda.TypeChecking.Serialise.Base.ICODE t 'GHC.Types.True instance Agda.TypeChecking.Serialise.Base.ICODE t (Agda.Utils.TypeLevel.IsBase t) => Agda.TypeChecking.Serialise.Base.ICODE (a -> t) 'GHC.Types.False module Agda.TypeChecking.Monad.Imports addImport :: ModuleName -> TCM () addImportCycleCheck :: TopLevelModuleName -> TCM a -> TCM a getImports :: TCM (Set ModuleName) isImported :: ModuleName -> TCM Bool getImportPath :: TCM [TopLevelModuleName] visitModule :: ModuleInfo -> TCM () setVisitedModules :: VisitedModules -> TCM () getVisitedModules :: TCM VisitedModules isVisited :: TopLevelModuleName -> TCM Bool getVisitedModule :: TopLevelModuleName -> TCM (Maybe ModuleInfo) getDecodedModules :: TCM DecodedModules setDecodedModules :: DecodedModules -> TCM () getDecodedModule :: TopLevelModuleName -> TCM (Maybe Interface) storeDecodedModule :: Interface -> TCM () dropDecodedModule :: TopLevelModuleName -> TCM () withImportPath :: [TopLevelModuleName] -> TCM a -> TCM a -- | Assumes that the first module in the import path is the module we are -- worried about. checkForImportCycle :: TCM () module Agda.TypeChecking.Monad.Env -- | Get the name of the current module, if any. currentModule :: MonadReader TCEnv m => m ModuleName -- | Set the name of the current module. withCurrentModule :: ModuleName -> TCM a -> TCM a -- | Get the number of variables bound by anonymous modules. getAnonymousVariables :: MonadReader TCEnv m => ModuleName -> m Nat -- | Add variables bound by an anonymous module. withAnonymousModule :: ModuleName -> Nat -> TCM a -> TCM a -- | Set the current environment to the given withEnv :: TCEnv -> TCM a -> TCM a -- | Get the current environment getEnv :: TCM TCEnv -- | Increases the module nesting level by one in the given computation. withIncreasedModuleNestingLevel :: TCM a -> TCM a -- | Set highlighting level withHighlightingLevel :: HighlightingLevel -> TCM a -> TCM a -- | Restore setting for ExpandLast to default. doExpandLast :: TCM a -> TCM a dontExpandLast :: TCM a -> TCM a -- | If the reduced did a proper match (constructor or literal pattern), -- then record this as simplification step. performedSimplification :: MonadReader TCEnv m => m a -> m a performedSimplification' :: MonadReader TCEnv m => Simplification -> m a -> m a getSimplification :: MonadReader TCEnv m => m Simplification -- | Lens for AllowedReductions. updateAllowedReductions :: (AllowedReductions -> AllowedReductions) -> TCEnv -> TCEnv modifyAllowedReductions :: (AllowedReductions -> AllowedReductions) -> TCM a -> TCM a putAllowedReductions :: AllowedReductions -> TCM a -> TCM a -- | Reduce Def f vs only if f is a projection. onlyReduceProjections :: TCM a -> TCM a -- | Allow all reductions except for non-terminating functions (default). allowAllReductions :: TCM a -> TCM a -- | Allow all reductions including non-terminating functions. allowNonTerminatingReductions :: TCM a -> TCM a insideDotPattern :: TCM a -> TCM a isInsideDotPattern :: TCM Bool -- | Don't use call-by-need evaluation for the given computation. callByName :: TCM a -> TCM a module Agda.TypeChecking.Monad.Open -- | Create an open term in the current context. makeOpen :: a -> TCM (Open a) -- | Extract the value from an open term. The checkpoint at which it was -- created must be in scope. getOpen :: (Subst Term a, MonadReader TCEnv m) => Open a -> m a -- | Extract the value from an open term. Returns Nothing if the -- checkpoint at which it was created is not in scope. tryGetOpen :: (Subst Term a, MonadReader TCEnv m) => Open a -> m (Maybe a) -- | An Open is closed if it has checkpoint 0. isClosed :: Open a -> Bool module Agda.TypeChecking.Monad.Builtin class (Functor m, Applicative m, Monad m) => HasBuiltins m getBuiltinThing :: HasBuiltins m => String -> m (Maybe (Builtin PrimFun)) litType :: Literal -> TCM Type setBuiltinThings :: BuiltinThings PrimFun -> TCM () bindBuiltinName :: String -> Term -> TCM () bindPrimitive :: String -> PrimFun -> TCM () getBuiltin :: String -> TCM Term getBuiltin' :: HasBuiltins m => String -> m (Maybe Term) getPrimitive' :: HasBuiltins m => String -> m (Maybe PrimFun) getPrimitive :: String -> TCM PrimFun -- | Rewrite a literal to constructor form if possible. constructorForm :: Term -> TCM Term constructorForm' :: Applicative m => m Term -> m Term -> Term -> m Term primInteger :: TCM Term primIntegerPos :: TCM Term primIntegerNegSuc :: TCM Term primFloat :: TCM Term primChar :: TCM Term primString :: TCM Term primUnit :: TCM Term primUnitUnit :: TCM Term primBool :: TCM Term primTrue :: TCM Term primFalse :: TCM Term primList :: TCM Term primNil :: TCM Term primCons :: TCM Term primIO :: TCM Term primNat :: TCM Term primSuc :: TCM Term primZero :: TCM Term primNatPlus :: TCM Term primNatMinus :: TCM Term primNatTimes :: TCM Term primNatDivSucAux :: TCM Term primNatModSucAux :: TCM Term primNatEquality :: TCM Term primNatLess :: TCM Term primWord64 :: TCM Term primSizeUniv :: TCM Term primSize :: TCM Term primSizeLt :: TCM Term primSizeSuc :: TCM Term primSizeInf :: TCM Term primSizeMax :: TCM Term primInf :: TCM Term primSharp :: TCM Term primFlat :: TCM Term primEquality :: TCM Term primRefl :: TCM Term primRewrite :: TCM Term primLevel :: TCM Term primLevelZero :: TCM Term primLevelSuc :: TCM Term primLevelMax :: TCM Term primFromNat :: TCM Term primFromNeg :: TCM Term primFromString :: TCM Term primQName :: TCM Term primArgInfo :: TCM Term primArgArgInfo :: TCM Term primArg :: TCM Term primArgArg :: TCM Term primAbs :: TCM Term primAbsAbs :: TCM Term primAgdaTerm :: TCM Term primAgdaTermVar :: TCM Term primAgdaTermLam :: TCM Term primAgdaTermExtLam :: TCM Term primAgdaTermDef :: TCM Term primAgdaTermCon :: TCM Term primAgdaTermPi :: TCM Term primAgdaTermSort :: TCM Term primAgdaTermLit :: TCM Term primAgdaTermUnsupported :: TCM Term primAgdaTermMeta :: TCM Term primAgdaErrorPart :: TCM Term primAgdaErrorPartString :: TCM Term primAgdaErrorPartTerm :: TCM Term primAgdaErrorPartName :: TCM Term primHiding :: TCM Term primHidden :: TCM Term primInstance :: TCM Term primVisible :: TCM Term primRelevance :: TCM Term primRelevant :: TCM Term primIrrelevant :: TCM Term primAssoc :: TCM Term primAssocLeft :: TCM Term primAssocRight :: TCM Term primAssocNon :: TCM Term primPrecedence :: TCM Term primPrecRelated :: TCM Term primPrecUnrelated :: TCM Term primFixity :: TCM Term primFixityFixity :: TCM Term primAgdaLiteral :: TCM Term primAgdaLitNat :: TCM Term primAgdaLitWord64 :: TCM Term primAgdaLitFloat :: TCM Term primAgdaLitString :: TCM Term primAgdaLitChar :: TCM Term primAgdaLitQName :: TCM Term primAgdaLitMeta :: TCM Term primAgdaSort :: TCM Term primAgdaSortSet :: TCM Term primAgdaSortLit :: TCM Term primAgdaSortUnsupported :: TCM Term primAgdaDefinition :: TCM Term primAgdaDefinitionFunDef :: TCM Term primAgdaDefinitionDataDef :: TCM Term primAgdaDefinitionRecordDef :: TCM Term primAgdaDefinitionPostulate :: TCM Term primAgdaDefinitionPrimitive :: TCM Term primAgdaDefinitionDataConstructor :: TCM Term primAgdaClause :: TCM Term primAgdaClauseClause :: TCM Term primAgdaClauseAbsurd :: TCM Term primAgdaPattern :: TCM Term primAgdaPatCon :: TCM Term primAgdaPatVar :: TCM Term primAgdaPatDot :: TCM Term primAgdaPatLit :: TCM Term primAgdaPatProj :: TCM Term primAgdaPatAbsurd :: TCM Term primAgdaMeta :: TCM Term primAgdaTCM :: TCM Term primAgdaTCMReturn :: TCM Term primAgdaTCMBind :: TCM Term primAgdaTCMUnify :: TCM Term primAgdaTCMTypeError :: TCM Term primAgdaTCMInferType :: TCM Term primAgdaTCMCheckType :: TCM Term primAgdaTCMNormalise :: TCM Term primAgdaTCMReduce :: TCM Term primAgdaTCMCatchError :: TCM Term primAgdaTCMGetContext :: TCM Term primAgdaTCMExtendContext :: TCM Term primAgdaTCMInContext :: TCM Term primAgdaTCMFreshName :: TCM Term primAgdaTCMDeclareDef :: TCM Term primAgdaTCMDeclarePostulate :: TCM Term primAgdaTCMDefineFun :: TCM Term primAgdaTCMGetType :: TCM Term primAgdaTCMGetDefinition :: TCM Term primAgdaTCMQuoteTerm :: TCM Term primAgdaTCMUnquoteTerm :: TCM Term primAgdaTCMBlockOnMeta :: TCM Term primAgdaTCMCommit :: TCM Term primAgdaTCMIsMacro :: TCM Term primAgdaTCMWithNormalisation :: TCM Term primAgdaTCMDebugPrint :: TCM Term 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 builtinBool :: String builtinTrue :: String builtinFalse :: String builtinList :: String builtinNil :: String builtinCons :: String builtinIO :: 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 builtinFromNat :: String builtinFromNeg :: String builtinFromString :: String builtinQName :: String builtinAgdaSort :: String builtinAgdaSortSet :: String builtinAgdaSortLit :: String builtinAgdaSortUnsupported :: String builtinHiding :: String builtinHidden :: String builtinInstance :: String builtinVisible :: String builtinRelevance :: String builtinRelevant :: String builtinIrrelevant :: String builtinArg :: String builtinAssoc :: String builtinAssocLeft :: String builtinAssocRight :: String builtinAssocNon :: String builtinPrecedence :: String builtinPrecRelated :: String builtinPrecUnrelated :: String builtinFixity :: String builtinFixityFixity :: String builtinArgInfo :: String builtinArgArgInfo :: 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 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 builtinAgdaTCMDefineFun :: String builtinAgdaTCMGetType :: String builtinAgdaTCMGetDefinition :: String builtinAgdaTCMQuoteTerm :: String builtinAgdaTCMUnquoteTerm :: String builtinAgdaTCMBlockOnMeta :: String builtinAgdaTCMCommit :: String builtinAgdaTCMIsMacro :: String builtinAgdaTCMWithNormalisation :: String builtinAgdaTCMDebugPrint :: 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. -- -- {--} -- -- The type of Type would be Type : Level → Setω which -- is not valid Agda. builtinsNoDef :: [String] -- | The coinductive primitives. data CoinductionKit CoinductionKit :: QName -> QName -> QName -> CoinductionKit [nameOfInf] :: CoinductionKit -> QName [nameOfSharp] :: CoinductionKit -> QName [nameOfFlat] :: CoinductionKit -> QName -- | Tries to build a CoinductionKit. coinductionKit' :: TCM CoinductionKit coinductionKit :: TCM (Maybe CoinductionKit) -- | Get the name of the equality type. primEqualityName :: TCM QName -- | 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 -- | Revert the EqualityView. -- -- Postcondition: type is reduced. equalityUnview :: EqualityView -> Type instance Agda.TypeChecking.Monad.Builtin.HasBuiltins m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Control.Monad.Trans.Maybe.MaybeT m) instance Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Builtin.HasBuiltins (Agda.TypeChecking.Monad.Base.TCMT m) module Agda.TypeChecking.LevelConstraints -- | simplifyLevelConstraint c cs turns an c into an -- equality constraint if it is an inequality constraint and the reverse -- inequality is contained in cs. -- -- The constraints doesn't necessarily have to live in the same context, -- but they do need to be universally quanitfied over the context. This -- function takes care of renaming variables when checking for matches. simplifyLevelConstraint :: Constraint -> [Constraint] -> [Constraint] instance GHC.Classes.Eq Agda.TypeChecking.LevelConstraints.Leq instance GHC.Show.Show Agda.TypeChecking.LevelConstraints.Leq module Agda.TypeChecking.Monad.Debug class (Functor m, Applicative m, Monad m) => MonadDebug m displayDebugMessage :: MonadDebug m => Int -> String -> m () traceDebugMessage :: MonadDebug m => Int -> String -> m a -> m a formatDebugMessage :: MonadDebug m => VerboseKey -> Int -> TCM Doc -> m String -- | Conditionally print debug string. reportS :: (HasOptions m, MonadDebug m, MonadReader TCEnv m) => VerboseKey -> Int -> String -> m () -- | Conditionally println debug string. reportSLn :: (HasOptions m, MonadDebug m, MonadReader TCEnv m) => VerboseKey -> Int -> String -> m () -- | Conditionally render debug Doc and print it. reportSDoc :: (HasOptions m, MonadDebug m, MonadReader TCEnv m) => VerboseKey -> Int -> TCM Doc -> m () unlessDebugPrinting :: MonadTCM m => m () -> m () traceSLn :: (HasOptions m, MonadDebug m) => VerboseKey -> Int -> String -> m a -> m a -- | Conditionally render debug Doc, print it, and then continue. traceSDoc :: (HasOptions m, MonadDebug m) => VerboseKey -> Int -> TCM Doc -> m a -> m a -- | Print brackets around debug messages issued by a computation. verboseBracket :: (HasOptions m, MonadDebug m, MonadError err m) => VerboseKey -> Int -> String -> m a -> m a instance Control.Monad.IO.Class.MonadIO m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.TypeChecking.Monad.Base.TCMT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Except.ExceptT e m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Agda.Utils.ListT.ListT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Reader.ReaderT r m) instance Agda.TypeChecking.Monad.Debug.MonadDebug m => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.State.Lazy.StateT s m) instance (Agda.TypeChecking.Monad.Debug.MonadDebug m, GHC.Base.Monoid w) => Agda.TypeChecking.Monad.Debug.MonadDebug (Control.Monad.Trans.Writer.Lazy.WriterT w m) module Agda.TypeChecking.Monad.Caching -- | Writes a TypeCheckAction to the current log, using the current -- PostScopeState writeToCurrentLog :: TypeCheckAction -> TCM () -- | Reads the next entry in the cached type check log, if present. readFromCachedLog :: TCM (Maybe (TypeCheckAction, PostScopeState)) -- | Empties the "to read" CachedState. To be used when it gets invalid. cleanCachedLog :: TCM () -- | Caches the current type check log. Discardes the old cache. Does -- nothing if caching is inactive. cacheCurrentLog :: TCM () -- | Makes sure that the stLoadedFileCache is Just, with a -- clean current log. Crashes is stLoadedFileCache is already -- active with a dirty log. Should be called when we start typechecking -- the current file. activateLoadedFileCache :: TCM () -- | To be called before any write or restore calls. cachingStarts :: TCM () areWeCaching :: TCM Bool -- | The cache should not be used for an imported module, and it should be -- restored after the module has been type-checked. This combinator takes -- care of that. noCacheForImportedModule :: TCM a -> TCM a restorePostScopeState :: PostScopeState -> TCM () module Agda.TypeChecking.Warnings genericWarning :: MonadTCM tcm => Doc -> tcm () genericNonFatalError :: MonadTCM tcm => Doc -> tcm () warning_ :: MonadTCM tcm => Warning -> tcm TCWarning -- | applyWarningMode filters out the warnings the user has not -- requested Users are not allowed to ignore non-fatal errors. applyWarningMode :: WarningMode -> Warning -> Maybe Warning warnings :: MonadTCM tcm => [Warning] -> tcm () warning :: MonadTCM tcm => Warning -> tcm () -- | Classifying warnings: some are benign, others are (non-fatal) errors data WhichWarnings -- | warnings that will be turned into errors ErrorWarnings :: WhichWarnings -- | all warnings, including errors and benign ones Note: order of -- constructors is important for the derived Ord instance AllWarnings :: WhichWarnings isUnsolvedWarning :: Warning -> Bool classifyWarning :: Warning -> WhichWarnings -- | Should we only emit a single warning with this constructor. onlyOnce :: Warning -> Bool onlyShowIfUnsolved :: Warning -> Bool classifyWarnings :: [TCWarning] -> ([TCWarning], [TCWarning]) -- | running the Parse monad runPM :: PM a -> TCM a instance GHC.Classes.Ord Agda.TypeChecking.Warnings.WhichWarnings instance GHC.Classes.Eq Agda.TypeChecking.Warnings.WhichWarnings -- | Lenses for TCState and more. module Agda.TypeChecking.Monad.State -- | Resets the non-persistent part of the type checking state. resetState :: TCM () -- | Resets all of the type checking state. -- -- Keep only Benchmark and backend information. resetAllState :: TCM () -- | Restore TCState after performing subcomputation. -- -- In contrast to localState, the Benchmark info from the -- subcomputation is saved. localTCState :: TCM a -> TCM a -- | Same as localTCState but also returns the state in which we -- were just before reverting it. localTCStateSaving :: TCM a -> TCM (a, TCState) -- | A fresh TCM instance. -- -- The computation is run in a fresh state, with the exception that the -- persistent state is preserved. If the computation changes the state, -- then these changes are ignored, except for changes to the persistent -- state. (Changes to the persistent state are also ignored if errors -- other than type errors or IO exceptions are encountered.) freshTCM :: TCM a -> TCM (Either TCErr a) lensPersistentState :: Lens' PersistentTCState TCState updatePersistentState :: (PersistentTCState -> PersistentTCState) -> (TCState -> TCState) modifyPersistentState :: (PersistentTCState -> PersistentTCState) -> TCM () -- | Lens for stAccumStatistics. lensAccumStatisticsP :: Lens' Statistics PersistentTCState lensAccumStatistics :: Lens' Statistics TCState -- | Get the current scope. getScope :: TCM ScopeInfo -- | Set the current scope. setScope :: ScopeInfo -> TCM () -- | Modify the current scope without updating the inverse maps. modifyScope_ :: (ScopeInfo -> ScopeInfo) -> TCM () -- | Modify the current scope. modifyScope :: (ScopeInfo -> ScopeInfo) -> TCM () -- | Run a computation in a local scope. withScope :: ScopeInfo -> TCM a -> TCM (a, ScopeInfo) -- | Same as withScope, but discard the scope from the computation. withScope_ :: ScopeInfo -> TCM a -> TCM a -- | Discard any changes to the scope by a computation. localScope :: TCM a -> TCM a -- | Scope error. notInScope :: QName -> TCM a -- | Debug print the scope. printScope :: String -> Int -> String -> TCM () modifySignature :: (Signature -> Signature) -> TCM () modifyImportedSignature :: (Signature -> Signature) -> TCM () getSignature :: TCM Signature -- | Update a possibly imported definition. Warning: changes made to -- imported definitions (during type checking) will not persist outside -- the current module. This function is currently used to update the -- compiled representation of a function during compilation. modifyGlobalDefinition :: QName -> (Definition -> Definition) -> TCM () setSignature :: Signature -> TCM () -- | Run some computation in a different signature, restore original -- signature. withSignature :: Signature -> TCM a -> TCM a addRewriteRulesFor :: QName -> RewriteRules -> [QName] -> Signature -> Signature lookupDefinition :: QName -> Signature -> Maybe Definition updateDefinitions :: (Definitions -> Definitions) -> Signature -> Signature updateDefinition :: QName -> (Definition -> Definition) -> Signature -> Signature updateTheDef :: (Defn -> Defn) -> (Definition -> Definition) updateDefType :: (Type -> Type) -> (Definition -> Definition) updateDefArgOccurrences :: ([Occurrence] -> [Occurrence]) -> (Definition -> Definition) updateDefPolarity :: ([Polarity] -> [Polarity]) -> (Definition -> Definition) updateDefCompiledRep :: (CompiledRepresentation -> CompiledRepresentation) -> (Definition -> Definition) addCompilerPragma :: BackendName -> CompilerPragma -> Definition -> Definition updateFunClauses :: ([Clause] -> [Clause]) -> (Defn -> Defn) updateCompiledClauses :: (Maybe CompiledClauses -> Maybe CompiledClauses) -> (Defn -> Defn) updateFunCopatternLHS :: (Bool -> Bool) -> Defn -> Defn -- | Set the top-level module. This affects the global module id of freshly -- generated names. setTopLevelModule :: QName -> TCM () -- | Use a different top-level module for a computation. Used when -- generating names for imported modules. withTopLevelModule :: QName -> TCM a -> TCM a addForeignCode :: BackendName -> String -> TCM () addDeprecatedForeignCode :: String -> BackendName -> String -> TCM () -- | Tell the compiler to import the given Haskell module. addHaskellImport :: String -> TCM () -- | Tell the compiler to import the given Haskell module. addHaskellImportUHC :: String -> TCM () addInlineHaskell :: String -> TCM () getInteractionOutputCallback :: TCM InteractionOutputCallback appInteractionOutputCallback :: Response -> TCM () setInteractionOutputCallback :: InteractionOutputCallback -> TCM () getPatternSyns :: TCM PatternSynDefns setPatternSyns :: PatternSynDefns -> TCM () -- | Lens for stPatternSyns. modifyPatternSyns :: (PatternSynDefns -> PatternSynDefns) -> TCM () getPatternSynImports :: TCM PatternSynDefns -- | Get both local and imported pattern synonyms getAllPatternSyns :: TCM PatternSynDefns lookupPatternSyn :: AmbiguousQName -> TCM PatternSynDefn lookupSinglePatternSyn :: QName -> TCM PatternSynDefn -- | Lens getter for Benchmark from TCState. theBenchmark :: TCState -> Benchmark -- | Lens map for Benchmark. updateBenchmark :: (Benchmark -> Benchmark) -> TCState -> TCState -- | Lens getter for Benchmark from TCM. getBenchmark :: TCM Benchmark -- | Lens modify for Benchmark. modifyBenchmark :: (Benchmark -> Benchmark) -> TCM () -- | Look through the signature and reconstruct the instance table. addImportedInstances :: Signature -> TCM () -- | Lens for stInstanceDefs. updateInstanceDefs :: (TempInstanceTable -> TempInstanceTable) -> (TCState -> TCState) modifyInstanceDefs :: (TempInstanceTable -> TempInstanceTable) -> TCM () getAllInstanceDefs :: TCM TempInstanceTable getAnonInstanceDefs :: TCM (Set QName) -- | Remove all instances whose type is still unresolved. clearAnonInstanceDefs :: TCM () -- | Add an instance whose type is still unresolved. addUnknownInstance :: QName -> TCM () -- | Add instance to some `class'. addNamedInstance :: QName -> QName -> TCM () module Agda.TypeChecking.Monad.Mutual noMutualBlock :: TCM a -> TCM a -- | Pass the current mutual block id or create a new mutual block if we -- are not already inside on. inMutualBlock :: (MutualId -> TCM a) -> TCM a -- | Set the mutual block info for a block, possibly overwriting the -- existing one. setMutualBlockInfo :: MutualId -> MutualInfo -> TCM () -- | Set the mutual block info for a block if non-existing. insertMutualBlockInfo :: MutualId -> MutualInfo -> TCM () -- | Set the mutual block for a definition. setMutualBlock :: MutualId -> QName -> TCM () -- | Get the current mutual block, if any, otherwise a fresh mutual block -- is returned. currentOrFreshMutualBlock :: TCM MutualId lookupMutualBlock :: MutualId -> TCM MutualBlock -- | Reverse lookup of a mutual block id for a names. mutualBlockOf :: QName -> TCM MutualId -- | Measure CPU time for individual phases of the Agda pipeline. module Agda.TypeChecking.Monad.Benchmark -- | Monad with access to benchmarking data. class (Ord a, Functor m, MonadIO m) => MonadBench a m | m -> a getBenchmark :: MonadBench a m => m (Benchmark a) -- | When verbosity is set or changes, we need to turn benchmarking on or -- off. updateBenchmarkingStatus :: TCM () -- | Bill a computation to a specific account. Works even if the -- computation is aborted by an exception. billTo :: MonadBench a m => Account a -> m c -> m c -- | Bill a pure computation to a specific account. billPureTo :: MonadBench a m => Account a -> c -> m c -- | Bill a CPS function to an account. Can't handle exceptions. billToCPS :: MonadBench a m => Account a -> ((b -> m c) -> m c) -> (b -> m c) -> m c -- | Resets the account and the timing information. reset :: MonadBench a m => m () -- | Prints the accumulated benchmark results. Does nothing if profiling is -- not activated at level 7. print :: MonadTCM tcm => tcm () 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.Base.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 -- | Extract all names from things. module Agda.Syntax.Internal.Names class NamesIn a namesIn :: NamesIn a => a -> Set QName namesIn :: (NamesIn a, Foldable f, NamesIn b, f b ~ a) => a -> Set QName newtype PSyn PSyn :: PatternSynDefn -> PSyn instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Names.PSyn instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (GHC.Base.Maybe a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn [a] instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Utils.NonemptyList.NonemptyList a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Common.Dom a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Abs a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.CompiledClause.WithArity a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Tele a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Concrete.FieldAssignment' a) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b) => Agda.Syntax.Internal.Names.NamesIn (a, b) instance (Agda.Syntax.Internal.Names.NamesIn a, Agda.Syntax.Internal.Names.NamesIn b, Agda.Syntax.Internal.Names.NamesIn c) => Agda.Syntax.Internal.Names.NamesIn (a, b, c) instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.Definition instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.Defn instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Clause instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.CompiledClause.CompiledClauses instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.CompiledClause.Case a) instance Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Pattern' a) instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Type' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Sort instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Term instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.Level instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.PlusLevel instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.LevelAtom instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Literal.Literal instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Internal.Elim' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Internal.ConHead instance Agda.Syntax.Internal.Names.NamesIn a => Agda.Syntax.Internal.Names.NamesIn (Agda.TypeChecking.Monad.Base.Open a) instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.DisplayForm instance Agda.Syntax.Internal.Names.NamesIn Agda.TypeChecking.Monad.Base.DisplayTerm instance Agda.Syntax.Internal.Names.NamesIn (Agda.Syntax.Abstract.Pattern' a) instance Agda.Syntax.Internal.Names.NamesIn Agda.Syntax.Abstract.Name.AmbiguousQName -- | Logic for deciding which functions should be automatically inlined. module Agda.TypeChecking.Inlining -- | Mark a definition to be inlined if it satisfies the inlining -- criterion. autoInline :: Defn -> TCM Defn -- | Lenses for CommandLineOptions and PragmaOptions. -- -- Add as needed. -- -- Nothing smart happening here. module Agda.Interaction.Options.Lenses class LensPragmaOptions a getPragmaOptions :: LensPragmaOptions a => a -> PragmaOptions setPragmaOptions :: LensPragmaOptions a => PragmaOptions -> a -> a mapPragmaOptions :: LensPragmaOptions a => (PragmaOptions -> PragmaOptions) -> a -> a modifyPragmaOptions :: (PragmaOptions -> PragmaOptions) -> TCM () class LensVerbosity a getVerbosity :: LensVerbosity a => a -> Verbosity setVerbosity :: LensVerbosity a => Verbosity -> a -> a mapVerbosity :: LensVerbosity a => (Verbosity -> Verbosity) -> a -> a modifyVerbosity :: (Verbosity -> Verbosity) -> TCM () putVerbosity :: Verbosity -> TCM () class LensCommandLineOptions a getCommandLineOptions :: LensCommandLineOptions a => a -> CommandLineOptions setCommandLineOptions :: LensCommandLineOptions a => CommandLineOptions -> a -> a mapCommandLineOptions :: LensCommandLineOptions a => (CommandLineOptions -> CommandLineOptions) -> a -> a modifyCommandLineOptions :: (CommandLineOptions -> CommandLineOptions) -> TCM () type SafeMode = Bool class LensSafeMode a getSafeMode :: LensSafeMode a => a -> SafeMode setSafeMode :: LensSafeMode a => SafeMode -> a -> a mapSafeMode :: LensSafeMode a => (SafeMode -> SafeMode) -> a -> a modifySafeMode :: (SafeMode -> SafeMode) -> TCM () putSafeMode :: SafeMode -> TCM () class LensIncludePaths a getIncludePaths :: LensIncludePaths a => a -> [FilePath] setIncludePaths :: LensIncludePaths a => [FilePath] -> a -> a mapIncludePaths :: LensIncludePaths a => ([FilePath] -> [FilePath]) -> a -> a getAbsoluteIncludePaths :: LensIncludePaths a => a -> [AbsolutePath] setAbsoluteIncludePaths :: LensIncludePaths a => [AbsolutePath] -> a -> a mapAbsoluteIncludePaths :: LensIncludePaths a => ([AbsolutePath] -> [AbsolutePath]) -> a -> a modifyIncludePaths :: ([FilePath] -> [FilePath]) -> TCM () putIncludePaths :: [FilePath] -> TCM () modifyAbsoluteIncludePaths :: ([AbsolutePath] -> [AbsolutePath]) -> TCM () putAbsoluteIncludePaths :: [AbsolutePath] -> TCM () type PersistentVerbosity = Verbosity class LensPersistentVerbosity a getPersistentVerbosity :: LensPersistentVerbosity a => a -> PersistentVerbosity setPersistentVerbosity :: LensPersistentVerbosity a => PersistentVerbosity -> a -> a mapPersistentVerbosity :: LensPersistentVerbosity a => (PersistentVerbosity -> PersistentVerbosity) -> a -> a modifyPersistentVerbosity :: (PersistentVerbosity -> PersistentVerbosity) -> TCM () putPersistentVerbosity :: PersistentVerbosity -> TCM () instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.Interaction.Options.PragmaOptions instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.Interaction.Options.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensPersistentVerbosity Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensIncludePaths Agda.Interaction.Options.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensIncludePaths Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensIncludePaths Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.Interaction.Options.PragmaOptions instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.Interaction.Options.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensSafeMode Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensCommandLineOptions Agda.TypeChecking.Monad.Base.PersistentTCState instance Agda.Interaction.Options.Lenses.LensCommandLineOptions Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensVerbosity Agda.Interaction.Options.PragmaOptions instance Agda.Interaction.Options.Lenses.LensVerbosity Agda.TypeChecking.Monad.Base.TCState instance Agda.Interaction.Options.Lenses.LensPragmaOptions Agda.Interaction.Options.CommandLineOptions instance Agda.Interaction.Options.Lenses.LensPragmaOptions Agda.TypeChecking.Monad.Base.TCState module Agda.TypeChecking.Monad.Options -- | Sets the pragma options. setPragmaOptions :: PragmaOptions -> TCM () -- | Sets the command line options (both persistent and pragma options are -- updated). -- -- Relative include directories are made absolute with respect to the -- current working directory. If the include directories have changed -- (thus, they are Left now, and were previously Right -- something), then the state is reset (completely, see -- setIncludeDirs) . -- -- An empty list of relative include directories (Left -- []) is interpreted as ["."]. setCommandLineOptions :: CommandLineOptions -> TCM () setCommandLineOptions' :: RelativeTo -> CommandLineOptions -> TCM () libToTCM :: LibM a -> TCM a setLibraryPaths :: RelativeTo -> CommandLineOptions -> TCM CommandLineOptions setLibraryIncludes :: CommandLineOptions -> TCM CommandLineOptions addDefaultLibraries :: RelativeTo -> CommandLineOptions -> TCM CommandLineOptions setOptionsFromPragma :: OptionsPragma -> TCM () -- | Disable display forms. enableDisplayForms :: TCM a -> TCM a -- | Disable display forms. disableDisplayForms :: TCM a -> TCM a -- | Check if display forms are enabled. displayFormsEnabled :: TCM Bool -- | Gets the include directories. -- -- Precondition: optAbsoluteIncludePaths must be nonempty (i.e. -- setCommandLineOptions must have run). getIncludeDirs :: TCM [AbsolutePath] -- | Which directory should form the base of relative include paths? data RelativeTo -- | The root directory of the "project" containing the given file. The -- file needs to be syntactically correct, with a module name matching -- the file name. ProjectRoot :: AbsolutePath -> RelativeTo -- | The current working directory. CurrentDir :: RelativeTo getProjectRoot :: RelativeTo -> TCM AbsolutePath -- | Makes the given directories absolute and stores them as include -- directories. -- -- If the include directories change, then the state is reset -- (completely, except for the include directories and -- stInteractionOutputCallback). -- -- An empty list is interpreted as ["."]. setIncludeDirs :: [FilePath] -> RelativeTo -> TCM () setInputFile :: FilePath -> TCM () -- | Should only be run if hasInputFile. getInputFile :: TCM AbsolutePath -- | Return the optInputFile as AbsolutePath, if any. getInputFile' :: TCM (Maybe AbsolutePath) hasInputFile :: TCM Bool proofIrrelevance :: TCM Bool hasUniversePolymorphism :: HasOptions m => m Bool enableCaching :: TCM Bool showImplicitArguments :: TCM Bool showIrrelevantArguments :: TCM Bool -- | Switch on printing of implicit and irrelevant arguments. E.g. for -- reification in with-function generation. -- -- Restores all PragmaOptions after completion. Thus, do not -- attempt to make persistent PragmaOptions changes in a -- withShowAllArguments bracket. withShowAllArguments :: TCM a -> TCM a withShowAllArguments' :: Bool -> TCM a -> TCM a -- | Change PragmaOptions for a computation and restore afterwards. withPragmaOptions :: (PragmaOptions -> PragmaOptions) -> TCM a -> TCM a ignoreInterfaces :: TCM Bool positivityCheckEnabled :: TCM Bool typeInType :: HasOptions m => m Bool etaEnabled :: TCM Bool maxInstanceSearchDepth :: TCM Int maxInversionDepth :: TCM Int -- | Retrieve the current verbosity level. getVerbosity :: HasOptions m => m (Trie String Int) type VerboseKey = String parseVerboseKey :: VerboseKey -> [String] -- | Check whether a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. hasVerbosity :: HasOptions m => VerboseKey -> Int -> m Bool -- | Check whether a certain verbosity level is activated (exact match). hasExactVerbosity :: HasOptions m => VerboseKey -> Int -> m Bool -- | Run a computation if a certain verbosity level is activated (exact -- match). whenExactVerbosity :: MonadTCM tcm => VerboseKey -> Int -> tcm () -> tcm () -- | Run a computation if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. verboseS :: (MonadReader TCEnv m, HasOptions m) => VerboseKey -> Int -> m () -> m () -- | Verbosity lens. verbosity :: VerboseKey -> Lens' Int TCState module Agda.TypeChecking.Monad.Trace interestingCall :: Closure Call -> Bool traceCallM :: (MonadTCM tcm, MonadDebug tcm) => tcm Call -> tcm a -> tcm a -- | Record a function call in the trace. traceCall :: (MonadTCM tcm, MonadDebug tcm) => Call -> tcm a -> tcm a getCurrentRange :: (MonadTCM tcm, MonadDebug tcm) => tcm Range -- | Sets the current range (for error messages etc.) to the range of the -- given object, if it has a range (i.e., its range is not -- noRange). setCurrentRange :: (MonadTCM tcm, MonadDebug tcm, HasRange x) => x -> tcm a -> tcm a -- | Functions which map between module names and file names. -- -- Note that file name lookups are cached in the TCState. The code -- assumes that no Agda source files are added or removed from the -- include directories while the code is being type checked. module Agda.Interaction.FindFile -- | Converts an Agda file name to the corresponding interface file name. toIFile :: AbsolutePath -> AbsolutePath -- | Errors which can arise when trying to find a source file. -- -- Invariant: All paths are absolute. data FindError -- | The file was not found. It should have had one of the given file -- names. NotFound :: [AbsolutePath] -> FindError -- | Several matching files were found. -- -- Invariant: The list of matching files has at least two elements. Ambiguous :: [AbsolutePath] -> FindError -- | Given the module name which the error applies to this function -- converts a FindError to a TypeError. findErrorToTypeError :: TopLevelModuleName -> FindError -> TypeError -- | Finds the source file corresponding to a given top-level module name. -- The returned paths are absolute. -- -- Raises an error if the file cannot be found. findFile :: TopLevelModuleName -> TCM AbsolutePath -- | Tries to find the source file corresponding to a given top-level -- module name. The returned paths are absolute. -- -- SIDE EFFECT: Updates stModuleToSource. findFile' :: TopLevelModuleName -> TCM (Either FindError AbsolutePath) -- | A variant of findFile' which does not require TCM. findFile'' :: [AbsolutePath] -> TopLevelModuleName -> ModuleToSource -> IO (Either FindError AbsolutePath, ModuleToSource) -- | Finds the interface file corresponding to a given top-level module -- name. The returned paths are absolute. -- -- Raises an error if the source file cannot be found, and returns -- Nothing if the source file can be found but not the interface -- file. findInterfaceFile :: TopLevelModuleName -> TCM (Maybe AbsolutePath) -- | Ensures that the module name matches the file name. The file -- corresponding to the module name (according to the include path) has -- to be the same as the given file name. checkModuleName :: TopLevelModuleName -> AbsolutePath -> Maybe TopLevelModuleName -> TCM () -- | Computes the module name of the top-level module in the given file. -- -- Warning! Parses the whole file to get the module name out. Use wisely! -- -- No side effects! Only in TCM to raise errors. moduleName' :: AbsolutePath -> TCM TopLevelModuleName -- | A variant of moduleName' which raises an error if the file name -- does not match the module name. -- -- The file name is interpreted relative to the current working directory -- (unless it is absolute). moduleName :: AbsolutePath -> TCM TopLevelModuleName rootNameModule :: AbsolutePath -> String replaceModuleExtension :: String -> AbsolutePath -> AbsolutePath module Agda.TypeChecking.Serialise.Instances.Common -- | Ranges that should be serialised properly. newtype SerialisedRange SerialisedRange :: Range -> SerialisedRange [underlyingRange] :: SerialisedRange -> Range instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Serialise.Instances.Common.SerialisedRange instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Base.String instance Agda.TypeChecking.Serialise.Base.EmbPrj Data.ByteString.Lazy.Internal.ByteString instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Integer.Type.Integer instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Word.Word64 instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Int.Int32 instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Types.Int instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Types.Char instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Types.Double instance Agda.TypeChecking.Serialise.Base.EmbPrj Data.Void.Void instance Agda.TypeChecking.Serialise.Base.EmbPrj () instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (a, b) instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b, Agda.TypeChecking.Serialise.Base.EmbPrj c) => Agda.TypeChecking.Serialise.Base.EmbPrj (a, b, c) instance (Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Either.Either a b) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (GHC.Base.Maybe a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Strict.Maybe.Maybe a) instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Types.Bool instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.DataOrRecord instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.FileName.AbsolutePath instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Position.Position' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.TopLevelModuleName instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj [a] instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.NonemptyList.NonemptyList a) instance (GHC.Classes.Ord a, GHC.Classes.Ord b, Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.BiMap.BiMap a b) instance (GHC.Classes.Ord a, Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Map.Internal.Map a b) instance (GHC.Classes.Ord a, Agda.TypeChecking.Serialise.Base.EmbPrj a) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Set.Internal.Set a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Data.IntSet.Internal.IntSet instance (GHC.Classes.Ord a, Agda.TypeChecking.Serialise.Base.EmbPrj a, Agda.TypeChecking.Serialise.Base.EmbPrj b) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Utils.Trie.Trie a b) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.Sequence.Internal.Seq a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Position.Interval' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Position.Range instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.Name instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.NamePart instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Concrete.Name.QName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.Associativity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.PrecedenceLevel instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.Fixity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.Fixity' instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Notation.GenPart instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.AmbiguousQName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Concrete.FieldAssignment' a) instance (Agda.TypeChecking.Serialise.Base.EmbPrj s, Agda.TypeChecking.Serialise.Base.EmbPrj t) => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Named s t) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Ranged a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.NameId instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k, Agda.TypeChecking.Serialise.Base.EmbPrj k, Agda.TypeChecking.Serialise.Base.EmbPrj v) => Agda.TypeChecking.Serialise.Base.EmbPrj (Data.HashMap.Base.HashMap k v) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.WithHiding a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Common.Dom a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.HasEta instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Induction instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Hiding instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Quantity instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Modality instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Relevance instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Origin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.FreeVariables instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ConOrigin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.ProjOrigin instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Literal.Literal instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.IsAbstract instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Delayed instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.Impossible.Impossible instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Utils.Empty.Empty module Agda.TypeChecking.Serialise.Instances.Highlighting instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Range.Range instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.NameKind instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.Aspect instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.OtherAspect instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.Aspects instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.DefinitionSite instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.CompressedFile instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Interaction.Highlighting.Precise.TokenBased -- | Collect statistics. module Agda.TypeChecking.Monad.Statistics -- | Increase specified counter by 1. tick :: String -> TCM () -- | Increase specified counter by n. tickN :: String -> Integer -> TCM () -- | Set the specified counter to the maximum of its current value and -- n. tickMax :: String -> Integer -> TCM () -- | Get the statistics. getStatistics :: TCM Statistics -- | Modify the statistics via given function. modifyStatistics :: (Statistics -> Statistics) -> TCM () -- | Print the given statistics if verbosity "profile.ticks" is given. printStatistics :: Int -> Maybe TopLevelModuleName -> Statistics -> TCM () -- | 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 => a -> TCM (Maybe BoundedSize) isSizeTypeTest :: TCM (Term -> Maybe BoundedSize) getBuiltinDefName :: String -> TCM (Maybe QName) getBuiltinSize :: TCM (Maybe QName, Maybe QName) isSizeNameTest :: TCM (QName -> Bool) isSizeNameTestRaw :: TCM (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 :: TCM Type -- | The name of SIZESUC. sizeSucName :: TCM (Maybe QName) sizeSuc :: Nat -> Term -> TCM Term sizeSuc_ :: QName -> Term -> Term -- | Transform list of terms into a term build from binary maximum. sizeMax :: [Term] -> TCM Term -- | A useful view on sizes. data SizeView SizeInf :: SizeView SizeSuc :: Term -> SizeView OtherSize :: Term -> SizeView -- | Expects argument to be reduced. sizeView :: Term -> TCM SizeView type Offset = Nat -- | A deep view on sizes. data DeepSizeView DSizeInf :: DeepSizeView DSizeVar :: Nat -> 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 :: DeepSizeView -> TCM Term 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 :: SizeMaxView -> TCM Term instance GHC.Base.Functor Agda.TypeChecking.Monad.SizedTypes.SizeViewComparable instance GHC.Show.Show Agda.TypeChecking.Monad.SizedTypes.DeepSizeView instance GHC.Show.Show Agda.TypeChecking.Monad.SizedTypes.BoundedSize instance GHC.Classes.Eq Agda.TypeChecking.Monad.SizedTypes.BoundedSize instance Agda.TypeChecking.Monad.SizedTypes.IsSizeType a => Agda.TypeChecking.Monad.SizedTypes.IsSizeType (Agda.Syntax.Common.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 -- | 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 c | a -> c toConcrete :: ToConcrete a c => a -> AbsToCon c bindToConcrete :: ToConcrete a c => a -> (c -> AbsToCon b) -> AbsToCon b -- | Translate something in a context of the given precedence. toConcreteCtx :: ToConcrete a c => Precedence -> a -> AbsToCon c abstractToConcrete_ :: ToConcrete a c => a -> TCM c abstractToConcreteScope :: ToConcrete a c => ScopeInfo -> a -> TCM c abstractToConcreteHiding :: (LensHiding i, ToConcrete a c) => i -> a -> TCM c runAbsToCon :: AbsToCon c -> TCM c data RangeAndPragma RangeAndPragma :: Range -> Pragma -> RangeAndPragma abstractToConcreteCtx :: ToConcrete a c => Precedence -> a -> TCM c withScope :: ScopeInfo -> AbsToCon a -> AbsToCon a preserveInteractionIds :: AbsToCon a -> AbsToCon a -- | We put the translation into TCM in order to print debug messages. type AbsToCon = ReaderT Env TCM data DontTouchMe a data Env noTakenNames :: AbsToCon a -> AbsToCon a instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.FreshName Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.BindingPattern Agda.Syntax.Abstract.Pattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.SplitPattern Agda.Syntax.Abstract.Pattern) Agda.Syntax.Abstract.Pattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.SplitPattern (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Pattern)) (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Pattern) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Pattern Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.UserPattern Agda.Syntax.Abstract.Pattern) Agda.Syntax.Abstract.Pattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.UserPattern (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Pattern)) (Agda.Syntax.Common.NamedArg Agda.Syntax.Abstract.Pattern) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Declaration [Agda.Syntax.Concrete.Declaration] instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Translation.AbstractToConcrete.RangeAndPragma Agda.Syntax.Concrete.Pragma instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Translation.AbstractToConcrete.DontTouchMe a) a instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete [a] [c] instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1 c1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2 c2) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Data.Either.Either a1 a2) (Data.Either.Either c1 c2) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1 c1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2 c2) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (a1, a2) (c1, c2) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a1 c1, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a2 c2, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a3 c3) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (a1, a2, a3) (c1, c2, c3) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg c) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.WithHiding a) (Agda.Syntax.Common.WithHiding c) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Named name a) (Agda.Syntax.Common.Named name c) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.Name Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.BindName Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.QName Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Name.ModuleName Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Scope.Base.AbstractName Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Scope.Base.ResolvedName Agda.Syntax.Concrete.Name.QName instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.Expr Agda.Syntax.Concrete.Expr instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Concrete.FieldAssignment' a) (Agda.Syntax.Concrete.FieldAssignment' c) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LamBinding [Agda.Syntax.Concrete.LamBinding] instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.TypedBindings [Agda.Syntax.Concrete.TypedBindings] instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.TypedBinding Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LetBinding [Agda.Syntax.Concrete.Declaration] instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.WhereDeclarations Agda.Syntax.Concrete.WhereClause instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.RHS (Agda.Syntax.Concrete.RHS, [Agda.Syntax.Concrete.Expr], [Agda.Syntax.Concrete.Expr], [Agda.Syntax.Concrete.Declaration]) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (GHC.Base.Maybe Agda.Syntax.Abstract.Name.QName) (GHC.Base.Maybe Agda.Syntax.Concrete.Name.Name) instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Common.Constr Agda.Syntax.Abstract.Constructor) Agda.Syntax.Concrete.Declaration instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a Agda.Syntax.Concrete.LHS => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Syntax.Abstract.Clause' a) [Agda.Syntax.Concrete.Declaration] instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.ModuleApplication Agda.Syntax.Concrete.ModuleApplication instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.SpineLHS Agda.Syntax.Concrete.LHS instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LHS Agda.Syntax.Concrete.LHS instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Abstract.LHSCore Agda.Syntax.Concrete.Pattern instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.Syntax.Common.InteractionId Agda.Syntax.Concrete.Expr instance Agda.Syntax.Translation.AbstractToConcrete.ToConcrete Agda.TypeChecking.Monad.Base.NamedMeta Agda.Syntax.Concrete.Expr -- | 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 isDatatypeModule :: ModuleName -> ScopeM (Maybe DataOrRecord) printLocals :: Int -> String -> ScopeM () getCurrentModule :: ScopeM ModuleName setCurrentModule :: ModuleName -> ScopeM () withCurrentModule :: ModuleName -> ScopeM a -> ScopeM 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. (Just if it is a -- datatype or record module.) createModule :: Maybe DataOrRecord -> 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 () pushContextPrecedence :: Precedence -> ScopeM PrecedenceStack setContextPrecedence :: PrecedenceStack -> ScopeM () withContextPrecedence :: Precedence -> ScopeM a -> ScopeM a getLocalVars :: ScopeM LocalVars modifyLocalVars :: (LocalVars -> LocalVars) -> ScopeM () setLocalVars :: LocalVars -> ScopeM () -- | Run a computation without changing the local variables. withLocalVars :: ScopeM a -> ScopeM a getVarsToBind :: ScopeM LocalVars addVarToBind :: Name -> LocalVar -> ScopeM () -- | After collecting some variable names in the scopeVarsToBind, bind them -- all simultaneously. bindVarsToBind :: ScopeM () -- | 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 -- | 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' :: [KindOfName] -> Maybe (Set Name) -> QName -> ScopeM ResolvedName -- | Look up a module in the scope. resolveModule :: QName -> ScopeM AbstractModule -- | Get the notation of a name. The name is assumed to be in scope. getNotation :: QName -> Set Name -> ScopeM NewNotation -- | Bind a variable. bindVariable :: Binder -> 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 () -- | 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 -> [(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 -> [(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) -- | Apply an import directive and check that all the names mentioned -- actually exist. applyImportDirectiveM :: QName -> ImportDirective -> Scope -> ScopeM (ImportDirective, Scope) -- | A finite map for ImportedNames. lookupImportedName :: (Eq a, Eq b) => ImportedName' a b -> [ImportedName' (a, c) (b, d)] -> ImportedName' c d -- | Translation of ImportDirective. mapImportDir :: (Eq a, Eq b) => [ImportedName' (a, c) (b, d)] -> [ImportedName' (a, c) (b, d)] -> ImportDirective' a b -> ImportDirective' c d -- | Translation of Using or Hiding. mapUsing :: (Eq a, Eq b) => [ImportedName' (a, c) (b, d)] -> Using' a b -> Using' c d -- | Translation of Renaming. mapRenaming :: (Eq a, Eq b) => [ImportedName' (a, c) (b, d)] -> [ImportedName' (a, c) (b, d)] -> Renaming' a b -> Renaming' c d -- | Open a module. openModule_ :: QName -> ImportDirective -> ScopeM ImportDirective module Agda.TypeChecking.Monad.Context -- | Modify a Context in a computation. modifyContext :: MonadTCM tcm => (Context -> Context) -> tcm a -> tcm a -- | Change to top (=empty) context. Resets the checkpoints. safeInTopContext :: MonadTCM tcm => tcm a -> tcm a -- | Change to top (=empty) context, but don't update the checkpoints. -- Totally not safe! inTopContext :: MonadTCM tcm => tcm a -> tcm a -- | Delete the last n bindings from the context. -- -- Doesn't update checkpoints!! Use `updateContext rho (drop n)` instead, -- for an appropriate substitution rho. escapeContext :: MonadTCM tcm => Int -> tcm a -> tcm a -- | Add a new checkpoint. Do not use directly! checkpoint :: (MonadDebug tcm, MonadTCM tcm) => Substitution -> tcm a -> tcm a -- | Update the context. Requires a substitution from the old context to -- the new. updateContext :: (MonadDebug tcm, MonadTCM tcm) => Substitution -> (Context -> Context) -> tcm a -> tcm a -- | Get the substitution from the context at a given checkpoint to the -- current context. checkpointSubstitution :: MonadReader TCEnv tcm => CheckpointId -> tcm Substitution -- | Get substitution Γ ⊢ ρ : Γm where Γ is the current -- context and Γm is the module parameter telescope of module -- m. -- -- In case the we don't have a checkpoint for m we return the -- identity substitution. This is ok for instance if we are outside -- module m (in which case we have to supply all module -- parameters to any symbol defined within m we want to refer). getModuleParameterSub :: (MonadReader TCEnv m, ReadTCState m) => ModuleName -> m Substitution -- | addCtx x arg cont add a variable to the context. -- -- Chooses an unused Name. -- -- Warning: Does not update module parameter substitution! addCtx :: (MonadDebug tcm, MonadTCM tcm) => Name -> Dom Type -> tcm a -> tcm a -- | Pick a concrete name that doesn't shadow anything in the given list. unshadowedName :: [Name] -> Name -> Name -- | Pick a concrete name that doesn't shadow anything in the context. unshadowName :: MonadTCM tcm => Name -> tcm Name -- | Various specializations of addCtx. class AddContext b addContext :: (AddContext b, MonadTCM tcm, MonadDebug tcm) => b -> tcm a -> tcm a contextSize :: AddContext b => b -> Nat -- | Wrapper to tell 'addContext not to unshadowNames. Used when -- adding a user-provided, but already type checked, telescope to the -- context. newtype KeepNames a KeepNames :: a -> KeepNames a -- | Context entries without a type have this dummy type. dummyDom :: Dom Type -- | Go under an abstraction. underAbstraction :: (Subst t a, MonadTCM tcm, MonadDebug tcm) => Dom Type -> Abs a -> (a -> tcm b) -> tcm b underAbstraction' :: (Subst t a, MonadTCM tcm, MonadDebug tcm, AddContext (name, Dom Type)) => (String -> name) -> Dom Type -> Abs a -> (a -> tcm b) -> tcm b -- | Go under an abstract without worrying about the type to add to the -- context. underAbstraction_ :: (Subst t a, MonadTCM tcm, MonadDebug tcm) => Abs a -> (a -> tcm b) -> tcm b -- | Add a let bound variable. addLetBinding :: MonadTCM tcm => ArgInfo -> Name -> Term -> Type -> tcm a -> tcm a -- | Get the current context. getContext :: MonadReader TCEnv m => m [Dom (Name, Type)] -- | Get the size of the current context. getContextSize :: (Applicative m, MonadReader TCEnv m) => m Nat -- | Generate [var (n - 1), ..., var 0] for all declarations in -- the context. getContextArgs :: (Applicative m, MonadReader TCEnv m) => m Args -- | Generate [var (n - 1), ..., var 0] for all declarations in -- the context. getContextTerms :: (Applicative m, MonadReader TCEnv m) => m [Term] -- | Get the current context as a Telescope. getContextTelescope :: (Applicative m, MonadReader TCEnv m) => m Telescope -- | Get the names of all declarations in the context. getContextNames :: (Applicative m, MonadReader TCEnv m) => m [Name] -- | get type of bound variable (i.e. deBruijn index) lookupBV :: MonadReader TCEnv m => Nat -> m (Dom (Name, Type)) typeOfBV' :: (Applicative m, MonadReader TCEnv m) => Nat -> m (Dom Type) typeOfBV :: (Applicative m, MonadReader TCEnv m) => Nat -> m Type nameOfBV :: (Applicative m, MonadReader TCEnv 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 :: MonadReader TCEnv m => Name -> m (Term, Dom Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.TypeChecking.Monad.Context.KeepNames GHC.Base.String, Agda.Syntax.Common.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.Common.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Common.Dom (Agda.Syntax.Abstract.Name.Name, Agda.Syntax.Internal.Type)) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Common.Dom (GHC.Base.String, Agda.Syntax.Internal.Type)) instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Common.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext ([Agda.Syntax.Common.WithHiding Agda.Syntax.Abstract.Name.Name], Agda.Syntax.Common.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (GHC.Base.String, Agda.Syntax.Common.Dom Agda.Syntax.Internal.Type) instance Agda.TypeChecking.Monad.Context.AddContext (Agda.Syntax.Common.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 module Agda.TypeChecking.Monad.Signature -- | Add a constant to the signature. Lifts the definition to top level. addConstant :: QName -> Definition -> TCM () -- | Set termination info of a defined function symbol. setTerminates :: QName -> Bool -> 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 :: QName -> [Clause] -> TCM () mkPragma :: String -> TCM CompilerPragma -- | Add a compiler pragma `{--}` addPragma :: BackendName -> QName -> String -> TCM () type HaskellCode = String type HaskellType = String type JSCode = String type CoreCode = String addDeprecatedPragma :: String -> BackendName -> QName -> String -> TCM () dataFormat :: String -> [String] -> String addHaskellCode :: QName -> HaskellCode -> TCM () addHaskellExport :: QName -> String -> TCM () addHaskellType :: QName -> HaskellType -> TCM () addHaskellData :: QName -> HaskellType -> [HaskellCode] -> TCM () addJSCode :: QName -> JSCode -> TCM () addCoreCode :: QName -> CoreCode -> TCM () addCoreType :: QName -> CoreCode -> [CoreCode] -> 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 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 :: QName -> TCM Bool getDisplayForms :: QName -> TCM [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 :: QName -> TCM QName sameDef :: QName -> QName -> TCM (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, Monad m, HasOptions m, MonadDebug m, MonadReader TCEnv 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 defaultGetRewriteRulesFor :: (Monad m) => m TCState -> 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, MonadReader TCEnv m) => TCState -> TCEnv -> QName -> m (Either SigError Definition) getConInfo :: MonadTCM tcm => ConHead -> tcm Definition -- | Look up the polarity of a definition. getPolarity :: QName -> TCM [Polarity] -- | Look up polarity of a definition and compose with polarity represented -- by Comparison. getPolarity' :: Comparison -> QName -> TCM [Polarity] -- | Set the polarity of a definition. setPolarity :: QName -> [Polarity] -> TCM () -- | Look up the forced arguments of a definition. getForcedArgs :: QName -> TCM [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 :: QName -> [Occurrence] -> TCM () modifyArgOccurrences :: QName -> ([Occurrence] -> [Occurrence]) -> TCM () setTreeless :: QName -> TTerm -> TCM () setCompiledArgUse :: QName -> [Bool] -> TCM () getCompiled :: QName -> TCM (Maybe Compiled) getErasedConArgs :: QName -> TCM [Bool] setErasedConArgs :: QName -> [Bool] -> TCM () getTreeless :: QName -> TCM (Maybe TTerm) getCompiledArgUse :: QName -> TCM [Bool] -- | 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 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, MonadReader TCEnv m) => QName -> m Nat freeVarsToApply :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadReader TCEnv m, MonadDebug m) => QName -> m Args getModuleFreeVars :: (Functor m, Applicative m, MonadReader TCEnv 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, MonadReader TCEnv 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 :: Definition -> TCM Definition instantiateRewriteRule :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadReader TCEnv m, MonadDebug m) => RewriteRule -> m RewriteRule instantiateRewriteRules :: (Functor m, HasConstInfo m, HasOptions m, ReadTCState m, MonadReader TCEnv 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 :: MonadReader TCEnv m => m a -> m a -- | Not in abstract mode. All abstract definitions are opaque. inConcreteMode :: MonadReader TCEnv m => m a -> m a -- | Ignore abstract mode. All abstract definitions are transparent. ignoreAbstractMode :: MonadReader TCEnv m => m a -> m a -- | Enter concrete or abstract mode depending on whether the given -- identifier is concrete or abstract. inConcreteOrAbstractMode :: (MonadReader TCEnv 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 :: MonadReader TCEnv 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 :: QName -> TCM Type -- | Get relevance of a constant. relOfConst :: QName -> TCM Relevance -- | 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 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 :: Defn -> Int -- | Check whether a definition uses copatterns. usesCopatterns :: QName -> TCM Bool -- | Apply a function f to its first argument, producing the -- proper postfix projection if f is a projection. applyDef :: ProjOrigin -> QName -> Arg Term -> TCM 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 (Control.Monad.Trans.Maybe.MaybeT m) instance Agda.TypeChecking.Monad.Signature.HasConstInfo m => Agda.TypeChecking.Monad.Signature.HasConstInfo (Control.Monad.Trans.Except.ExceptT err 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) module Agda.TypeChecking.Monad.Closure enterClosure :: Closure a -> (a -> TCM b) -> TCM b withClosure :: Closure a -> (a -> TCM b) -> TCM (Closure b) mapClosure :: (a -> TCM b) -> Closure a -> TCM (Closure b) module Agda.TypeChecking.Monad.MetaVars -- | Switch off assignment of metas. dontAssignMetas :: TCM a -> TCM a -- | Get the meta store. getMetaStore :: TCM MetaStore modifyMetaStore :: (MetaStore -> MetaStore) -> TCM () -- | Run a computation and record which new metas it created. metasCreatedBy :: TCM a -> TCM (a, Set MetaId) -- | Lookup a meta variable lookupMeta :: MetaId -> TCM MetaVariable updateMetaVar :: MetaId -> (MetaVariable -> MetaVariable) -> TCM () getMetaPriority :: MetaId -> TCM MetaPriority isSortMeta :: MetaId -> TCM Bool isSortMeta_ :: MetaVariable -> Bool getMetaType :: MetaId -> TCM Type -- | Given a meta, return the type applied to the current context. getMetaTypeInContext :: MetaId -> TCM Type -- | 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 => a -> TCM Bool isInstantiatedMeta' :: MetaId -> TCM (Maybe Term) -- | Returns every meta-variable occurrence in the given type, except for -- those in Sorts. allMetas :: TermLike a => a -> [MetaId] -- | Create MetaInfo in the current environment. createMetaInfo :: TCM MetaInfo createMetaInfo' :: RunMetaOccursCheck -> TCM MetaInfo setValueMetaName :: Term -> MetaNameSuggestion -> TCM () getMetaNameSuggestion :: MetaId -> TCM MetaNameSuggestion setMetaNameSuggestion :: MetaId -> MetaNameSuggestion -> TCM () updateMetaVarRange :: MetaId -> Range -> TCM () setMetaOccursCheck :: MetaId -> RunMetaOccursCheck -> TCM () modifyInteractionPoints :: (InteractionPoints -> InteractionPoints) -> TCM () -- | Register an interaction point during scope checking. If there is no -- interaction id yet, create one. registerInteractionPoint :: Bool -> Range -> Maybe Nat -> TCM InteractionId -- | Find an interaction point by Range by searching the whole map. -- -- O(n): linear in the number of registered interaction points. findInteractionPoint_ :: Range -> InteractionPoints -> Maybe InteractionId -- | Hook up meta variable to interaction point. connectInteractionPoint :: InteractionId -> MetaId -> TCM () -- | Mark an interaction point as solved. removeInteractionPoint :: InteractionId -> TCM () -- | Get a list of interaction ids. getInteractionPoints :: TCM [InteractionId] -- | Get all metas that correspond to unsolved interaction ids. getInteractionMetas :: TCM [MetaId] -- | Get all metas that correspond to unsolved interaction ids. getInteractionIdsAndMetas :: TCM [(InteractionId, MetaId)] -- | Does the meta variable correspond to an interaction point? -- -- Time: O(n) where n is the number of interaction -- metas. isInteractionMeta :: MetaId -> TCM (Maybe InteractionId) -- | Get the information associated to an interaction point. lookupInteractionPoint :: InteractionId -> TCM InteractionPoint -- | Get MetaId for an interaction point. Precondition: interaction -- point is connected. lookupInteractionId :: InteractionId -> TCM MetaId -- | Check whether an interaction id is already associated with a meta -- variable. lookupInteractionMeta :: InteractionId -> TCM (Maybe MetaId) lookupInteractionMeta_ :: InteractionId -> InteractionPoints -> Maybe MetaId -- | Generate new meta variable. newMeta :: MetaInfo -> MetaPriority -> Permutation -> Judgement a -> TCM MetaId -- | Generate a new meta variable with some instantiation given. For -- instance, the instantiation could be a -- PostponedTypeCheckingProblem. newMeta' :: MetaInstantiation -> MetaInfo -> MetaPriority -> Permutation -> Judgement a -> TCM MetaId -- | Get the Range for an interaction point. getInteractionRange :: InteractionId -> TCM Range -- | Get the Range for a meta variable. getMetaRange :: MetaId -> TCM Range getInteractionScope :: InteractionId -> TCM ScopeInfo withMetaInfo' :: MetaVariable -> TCM a -> TCM a withMetaInfo :: Closure Range -> TCM a -> TCM a getInstantiatedMetas :: TCM [MetaId] getOpenMetas :: TCM [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 :: Listener -> MetaId -> TCM () -- | Unregister a listener. unlistenToMeta :: Listener -> MetaId -> TCM () -- | Get the listeners to a meta. getMetaListeners :: MetaId -> TCM [Listener] clearMetaListeners :: MetaId -> TCM () -- | Freeze all so far unfrozen metas for the duration of the given -- computation. withFreezeMetas :: TCM a -> TCM a -- | Freeze all meta variables and return the list of metas that got -- frozen. freezeMetas :: TCM [MetaId] -- | Freeze some meta variables and return the list of metas that got -- frozen. freezeMetas' :: (MetaId -> Bool) -> TCM [MetaId] -- | Thaw all meta variables. unfreezeMetas :: TCM () -- | Thaw some metas, as indicated by the passed condition. unfreezeMetas' :: (MetaId -> Bool) -> TCM () isFrozen :: MetaId -> TCM Bool -- | Unfreeze meta and its type if this is a meta again. Does not unfreeze -- deep occurrences of metas. class UnFreezeMeta a unfreezeMeta :: UnFreezeMeta a => a -> TCM () 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 Agda.Syntax.Internal.LevelAtom 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.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 Agda.Syntax.Internal.LevelAtom 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.Base.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) module Agda.TypeChecking.Monad.Constraints -- | Add all constraints belonging to the given problem to the current -- problem(s). stealConstraints :: ProblemId -> TCM () solvingProblem :: ProblemId -> TCM a -> TCM a solvingProblems :: Set ProblemId -> TCM a -> TCM a isProblemSolved :: ProblemId -> TCM Bool getConstraintsForProblem :: ProblemId -> TCM Constraints -- | Get the awake constraints getAwakeConstraints :: TCM Constraints wakeConstraints :: (ProblemConstraint -> TCM Bool) -> TCM () dropConstraints :: (ProblemConstraint -> Bool) -> TCM () putConstraintsToSleep :: (ProblemConstraint -> Bool) -> TCM () putAllConstraintsToSleep :: TCM () data ConstraintStatus AwakeConstraint :: ConstraintStatus SleepingConstraint :: ConstraintStatus -- | Suspend constraints matching the predicate during the execution of the -- second argument. Caution: held sleeping constraints will not be woken -- up by events that would normally trigger a wakeup call. holdConstraints :: (ConstraintStatus -> ProblemConstraint -> Bool) -> TCM a -> TCM a takeAwakeConstraint :: TCM (Maybe ProblemConstraint) getAllConstraints :: TCM Constraints withConstraint :: (Constraint -> TCM a) -> ProblemConstraint -> TCM a buildProblemConstraint :: Set ProblemId -> Constraint -> TCM ProblemConstraint buildProblemConstraint_ :: Constraint -> TCM ProblemConstraint buildConstraint :: Constraint -> TCM ProblemConstraint -- | Add new a constraint addConstraint' :: Constraint -> TCM () addAwakeConstraint' :: Constraint -> TCM () addConstraintTo :: Lens' Constraints TCState -> Constraint -> TCM () -- | Add already awake constraints addAwakeConstraints :: Constraints -> TCM () -- | Start solving constraints nowSolvingConstraints :: TCM a -> TCM a isSolvingConstraints :: TCM Bool mapAwakeConstraints :: (Constraints -> Constraints) -> TCState -> TCState mapSleepingConstraints :: (Constraints -> Constraints) -> TCState -> TCState modifyAwakeConstraints :: (Constraints -> Constraints) -> TCM () modifySleepingConstraints :: (Constraints -> Constraints) -> TCM () instance GHC.Show.Show Agda.TypeChecking.Monad.Constraints.ConstraintStatus instance GHC.Classes.Eq Agda.TypeChecking.Monad.Constraints.ConstraintStatus 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 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' a) 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.LevelAtom 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.Definition 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.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.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.Positivity.Occurrence.Occurrence instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.EtaEquality instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.TypeChecking.Monad.Base.Defn 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.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) module Agda.TypeChecking.Serialise.Instances.Abstract instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Abstract.BindName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.Scope instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.NameSpaceId instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Access instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.NameSpace instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.WhyInScope instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.AbstractName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.AbstractModule instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.KindOfName instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.Binder instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.LocalVar instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Info.ConPatInfo instance Agda.TypeChecking.Serialise.Base.EmbPrj a => Agda.TypeChecking.Serialise.Base.EmbPrj (Agda.Syntax.Abstract.Pattern' a) instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.ParenPreference instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Fixity.Precedence instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Scope.Base.ScopeInfo 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.Syntax.Concrete.Definitions.DeclarationWarning instance Agda.TypeChecking.Serialise.Base.EmbPrj Text.PrettyPrint.HughesPJ.Doc 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 ByteString -- | Encodes something. To ensure relocatability file paths in positions -- are replaced with module names. encodeFile :: FilePath -> Interface -> TCM () encodeInterface :: Interface -> TCM ByteString -- | Decodes something. The result depends on the include path. -- -- Returns Nothing if the input does not start with the right -- magic number or some other decoding error is encountered. decode :: EmbPrj a => ByteString -> TCM (Maybe a) decodeFile :: FilePath -> TCM (Maybe Interface) -- | Decodes something. 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 module Agda.TypeChecking.Reduce.Monad constructorForm :: Term -> ReduceM Term enterClosure :: Closure a -> (a -> ReduceM b) -> ReduceM b underAbstraction_ :: Subst t a => Abs a -> (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 isInstantiatedMeta :: MetaId -> ReduceM Bool lookupMeta :: MetaId -> ReduceM MetaVariable askR :: ReduceM ReduceEnv -- | Apply a function if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. applyWhenVerboseS :: HasOptions m => VerboseKey -> Int -> (m a -> m a) -> m a -> m a instance Agda.TypeChecking.Monad.Base.HasOptions Agda.TypeChecking.Monad.Base.ReduceM instance Agda.TypeChecking.Monad.Builtin.HasBuiltins 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 -- | 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 :: Pattern -> TCM 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.Base.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 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.LevelAtom 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.Common.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.Base.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 -- | 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 :: (MonadReader TCEnv m, HasConstInfo m, HasOptions m, TermLike a) => a -> m a etaOnce :: (MonadReader TCEnv m, HasConstInfo m, HasOptions m) => Term -> m Term -- | If record constructor, call eta-contraction function. etaCon :: (MonadReader TCEnv m, HasConstInfo m, HasOptions m) => ConHead -> ConInfo -> Args -> (QName -> ConHead -> ConInfo -> Args -> m Term) -> m Term -- | Try to contract a lambda-abstraction Lam i (Abs x b). etaLam :: (MonadReader TCEnv m, HasConstInfo m, HasOptions m) => ArgInfo -> ArgName -> Term -> m Term module Agda.TypeChecking.Reduce instantiate :: Instantiate a => a -> TCM a instantiateFull :: InstantiateFull a => a -> TCM a reduce :: Reduce a => a -> TCM a reduceB :: Reduce a => a -> TCM (Blocked a) normalise :: Normalise a => a -> TCM a simplify :: Simplify a => a -> TCM a -- | Meaning no metas left in the instantiation. isFullyInstantiatedMeta :: MetaId -> TCM Bool -- | 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 -- | 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 :: MonadTCM tcm => Term -> (MetaId -> Term -> tcm a) -> (NotBlocked -> Term -> tcm a) -> tcm a isBlocked :: MonadTCM tcm => Term -> tcm (Maybe MetaId) -- | Case on whether a type is blocked on a meta (or is a meta). ifBlockedType :: MonadTCM tcm => Type -> (MetaId -> Type -> tcm a) -> (NotBlocked -> Type -> tcm a) -> tcm a isBlockedType :: MonadTCM tcm => Type -> tcm (Maybe MetaId) class Reduce t reduce' :: Reduce t => t -> ReduceM t reduceB' :: Reduce t => t -> ReduceM (Blocked t) shouldTryFastReduce :: ReduceM Bool maybeFastReduceTerm :: Term -> ReduceM (Blocked Term) slowReduceTerm :: Term -> ReduceM (Blocked Term) unfoldCorecursionE :: Elim -> ReduceM (Blocked Elim) unfoldCorecursion :: Term -> ReduceM (Blocked Term) -- | If the first argument is True, then a single delayed clause may -- be unfolded. unfoldDefinition :: Bool -> (Term -> ReduceM (Blocked Term)) -> Term -> QName -> Args -> ReduceM (Blocked Term) unfoldDefinitionE :: Bool -> (Term -> ReduceM (Blocked Term)) -> Term -> QName -> Elims -> ReduceM (Blocked Term) unfoldDefinition' :: Bool -> (Simplification -> Term -> ReduceM (Simplification, Blocked Term)) -> Term -> QName -> Elims -> ReduceM (Simplification, Blocked Term) unfoldDefinitionStep :: Bool -> Term -> QName -> Elims -> ReduceM (Reduced (Blocked Term) Term) -- | Reduce a non-primitive definition if it is a copy linking to another -- def. reduceDefCopy :: QName -> Elims -> TCM (Reduced () Term) -- | Reduce simple (single clause) definitions. reduceHead :: Term -> TCM (Blocked Term) reduceHead' :: Term -> ReduceM (Blocked Term) -- | Unfold a single inlined function. unfoldInlined :: Term -> TCM Term unfoldInlined' :: Term -> ReduceM Term -- | Apply a definition using the compiled clauses, or fall back to -- ordinary clauses if no compiled clauses exist. appDef_ :: QName -> Term -> [Clause] -> Maybe CompiledClauses -> RewriteRules -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDefE_ :: QName -> Term -> [Clause] -> Maybe CompiledClauses -> RewriteRules -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) -- | Apply a defined function to it's arguments, using the compiled -- clauses. The original term is the first argument applied to the third. appDef :: Term -> CompiledClauses -> RewriteRules -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDefE :: Term -> CompiledClauses -> RewriteRules -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) -- | Apply a defined function to it's arguments, using the original -- clauses. appDef' :: Term -> [Clause] -> RewriteRules -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDefE' :: Term -> [Clause] -> RewriteRules -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) -- | Only unfold definitions if this leads to simplification which means -- that a constructor/literal pattern is matched. class Simplify t simplify' :: Simplify t => t -> ReduceM t simplifyBlocked' :: Simplify t => Blocked t -> ReduceM t class Normalise t normalise' :: Normalise t => t -> ReduceM t slowNormaliseArgs :: Term -> ReduceM Term -- | instantiateFull' instantiates metas everywhere (and -- recursively) but does not reduce. class InstantiateFull t instantiateFull' :: InstantiateFull t => t -> ReduceM t instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.Name instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Type' a) 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.LevelAtom instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.Substitution instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Types.Bool instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Types.Int instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.DBPatVar instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Pattern' a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.Reduce.InstantiateFull a) => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Common.Dom t) instance Agda.TypeChecking.Reduce.InstantiateFull t => Agda.TypeChecking.Reduce.InstantiateFull [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 (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 a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Elim' a) instance Agda.TypeChecking.Reduce.InstantiateFull e => Agda.TypeChecking.Reduce.InstantiateFull (Data.Map.Internal.Map k e) instance Agda.TypeChecking.Reduce.InstantiateFull e => Agda.TypeChecking.Reduce.InstantiateFull (Data.HashMap.Base.HashMap k e) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.ModuleName instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Scope.Base.Scope 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 t a, Agda.TypeChecking.Reduce.InstantiateFull a) => Agda.TypeChecking.Reduce.InstantiateFull (Agda.Syntax.Internal.Tele a) instance Agda.TypeChecking.Reduce.InstantiateFull GHC.Types.Char 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.RewriteRule instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Open a) 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.FunctionInverse instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.CompiledClause.WithArity a) 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.Interface instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (Agda.TypeChecking.Monad.Base.Builtin a) instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Reduce.InstantiateFull Agda.Syntax.Internal.ConHead instance Agda.TypeChecking.Reduce.InstantiateFull a => Agda.TypeChecking.Reduce.InstantiateFull (GHC.Base.Maybe 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 Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Type instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Elim instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.LevelAtom instance (Agda.TypeChecking.Substitute.Class.Subst t 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.Common.Named name t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise (Agda.Syntax.Common.Dom t) instance Agda.TypeChecking.Reduce.Normalise t => Agda.TypeChecking.Reduce.Normalise [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 a => Agda.TypeChecking.Reduce.Normalise (Agda.TypeChecking.Monad.Base.Closure a) instance (Agda.TypeChecking.Substitute.Class.Subst t 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 GHC.Types.Bool instance Agda.TypeChecking.Reduce.Normalise GHC.Types.Int instance Agda.TypeChecking.Reduce.Normalise GHC.Types.Char instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.ConPatternInfo instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.DBPatVar 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 e => Agda.TypeChecking.Reduce.Normalise (Data.Map.Internal.Map k e) instance Agda.TypeChecking.Reduce.Normalise a => Agda.TypeChecking.Reduce.Normalise (GHC.Base.Maybe a) instance Agda.TypeChecking.Reduce.Normalise Agda.TypeChecking.Monad.Base.Candidate instance Agda.TypeChecking.Reduce.Normalise Agda.Syntax.Internal.EqualityView instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Type instance Agda.TypeChecking.Reduce.Simplify Agda.Syntax.Internal.Elim 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.Reduce.Simplify Agda.Syntax.Internal.LevelAtom instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.Reduce.Simplify a) => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Common.Named name t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify (Agda.Syntax.Common.Dom t) instance Agda.TypeChecking.Reduce.Simplify t => Agda.TypeChecking.Reduce.Simplify [t] instance Agda.TypeChecking.Reduce.Simplify e => Agda.TypeChecking.Reduce.Simplify (Data.Map.Internal.Map k e) instance Agda.TypeChecking.Reduce.Simplify a => Agda.TypeChecking.Reduce.Simplify (GHC.Base.Maybe a) 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 a => Agda.TypeChecking.Reduce.Simplify (Agda.TypeChecking.Monad.Base.Closure a) instance (Agda.TypeChecking.Substitute.Class.Subst t 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 GHC.Types.Bool 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.Elim instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.Reduce Agda.Syntax.Internal.LevelAtom instance (Agda.TypeChecking.Substitute.Class.Subst t 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 (Agda.Syntax.Common.Arg t) instance Agda.TypeChecking.Reduce.Reduce t => Agda.TypeChecking.Reduce.Reduce (Agda.Syntax.Common.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.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 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.Instantiate Agda.Syntax.Internal.Term instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Level instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.LevelAtom instance Agda.TypeChecking.Reduce.Instantiate a => Agda.TypeChecking.Reduce.Instantiate (Agda.Syntax.Internal.Blocked a) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Type instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Sort instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Elim 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.Common.Dom t) instance Agda.TypeChecking.Reduce.Instantiate t => Agda.TypeChecking.Reduce.Instantiate [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 a => Agda.TypeChecking.Reduce.Instantiate (Agda.TypeChecking.Monad.Base.Closure a) instance Agda.TypeChecking.Reduce.Instantiate Agda.Syntax.Internal.Telescope instance Agda.TypeChecking.Reduce.Instantiate Agda.TypeChecking.Monad.Base.Constraint instance Agda.TypeChecking.Reduce.Instantiate e => Agda.TypeChecking.Reduce.Instantiate (Data.Map.Internal.Map k e) 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 :: Telescope -> [Dom Type] -- | 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 -- | Get the suggested names from a telescope teleNames :: Telescope -> [ArgName] teleArgNames :: Telescope -> [Arg ArgName] teleArgs :: (DeBruijn a) => Telescope -> [Arg a] withNamedArgsFromTel :: [a] -> Telescope -> [NamedArg a] teleNamedArgs :: (DeBruijn a) => Telescope -> [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 -- | 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 -> Term -> 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 :: Type -> TCM TelView -- | telViewUpTo n t takes off the first n function types -- of t. Takes off all if n < 0. telViewUpTo :: Int -> Type -> TCM 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' :: Int -> (Dom Type -> Bool) -> Type -> TCM TelView -- | Decomposing a function type. mustBePi :: MonadTCM tcm => Type -> tcm (Dom Type, Abs Type) -- | If the given type is a Pi, pass its parts to the first -- continuation. If not (or blocked), pass the reduced type to the second -- continuation. ifPi :: MonadTCM tcm => Term -> (Dom Type -> Abs Type -> tcm a) -> (Term -> tcm a) -> tcm a -- | If the given type is a Pi, pass its parts to the first -- continuation. If not (or blocked), pass the reduced type to the second -- continuation. ifPiType :: MonadTCM tcm => Type -> (Dom Type -> Abs Type -> tcm a) -> (Type -> tcm a) -> tcm a -- | If the given type is blocked or not a Pi, pass it reduced to -- the first continuation. If it is a Pi, pass its parts to the -- second continuation. ifNotPi :: MonadTCM tcm => Term -> (Term -> tcm a) -> (Dom Type -> Abs Type -> tcm a) -> tcm a -- | If the given type is blocked or not a Pi, pass it reduced to -- the first continuation. If it is a Pi, pass its parts to the -- second continuation. ifNotPiType :: MonadTCM tcm => Type -> (Type -> tcm a) -> (Dom Type -> Abs Type -> tcm a) -> tcm a -- | A safe variant of piApply. piApplyM :: Type -> Args -> TCM Type piApply1 :: MonadTCM tcm => Type -> Term -> tcm Type -- | Compute type arity typeArity :: Type -> TCM Nat data OutputTypeName OutputTypeName :: QName -> OutputTypeName OutputTypeVar :: OutputTypeName OutputTypeNameNotYetKnown :: OutputTypeName NoOutputTypeName :: OutputTypeName -- | Strips all Pi's and return the head definition name, if possible. getOutputTypeName :: Type -> TCM OutputTypeName addTypedInstance :: QName -> Type -> TCM () resolveUnknownInstanceDefs :: TCM () -- | Try to solve the instance definitions whose type is not yet known, -- report an error if it doesn't work and return the instance table -- otherwise. getInstanceDefs :: TCM InstanceTable -- | A syntactic equality check that takes meta instantiations into -- account, but does not reduce. It replaces (v, v') <- -- instantiateFull (v, v') v == v' by a more efficient routine -- which only traverses and instantiates the terms as long as they are -- equal. module Agda.TypeChecking.SyntacticEquality -- | Instantiate full as long as things are equal class SynEq a -- | Syntactic equality check for terms. checkSyntacticEquality v v' = -- do (v,v') <- instantiateFull (v,v') return ((v,v'), v==v') -- only that v,v' are only fully instantiated to the depth where -- they are equal. checkSyntacticEquality :: (SynEq a) => a -> a -> ReduceM ((a, a), Bool) instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Term instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Level instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.LevelAtom instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Sort instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Internal.Type instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq [a] instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Internal.Elim' a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.SyntacticEquality.SynEq a) => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.SyntacticEquality.SynEq a => Agda.TypeChecking.SyntacticEquality.SynEq (Agda.Syntax.Common.Dom a) instance Agda.TypeChecking.SyntacticEquality.SynEq Agda.Syntax.Common.ArgInfo -- | Tools to manipulate patterns in internal syntax in the TCM (type -- checking monad). module Agda.TypeChecking.Patterns.Internal -- | Convert a term (from a dot pattern) to a DeBruijn pattern. class TermToPattern a b termToPattern :: TermToPattern a b => a -> TCM b termToPattern :: (TermToPattern a b, TermToPattern a' b', Traversable f, a ~ f a', b ~ f b') => a -> TCM b dotPatternsToPatterns :: forall a. (DeBruijn (Pattern' a)) => Pattern' a -> TCM (Pattern' a) instance Agda.TypeChecking.Patterns.Internal.TermToPattern a b => Agda.TypeChecking.Patterns.Internal.TermToPattern [a] [b] instance Agda.TypeChecking.Patterns.Internal.TermToPattern a b => Agda.TypeChecking.Patterns.Internal.TermToPattern (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.TypeChecking.Patterns.Internal.TermToPattern a b => Agda.TypeChecking.Patterns.Internal.TermToPattern (Agda.Syntax.Common.Named c a) (Agda.Syntax.Common.Named c b) instance Agda.TypeChecking.Substitute.DeBruijn.DeBruijn (Agda.Syntax.Internal.Pattern' a) => Agda.TypeChecking.Patterns.Internal.TermToPattern Agda.Syntax.Internal.Term (Agda.Syntax.Internal.Pattern' a) module Agda.TypeChecking.Level data LevelKit LevelKit :: Term -> Term -> Term -> Term -> Term -> Term -> Term -> QName -> QName -> QName -> QName -> LevelKit [lvlType] :: LevelKit -> Term [lvlSuc] :: LevelKit -> Term -> Term [lvlMax] :: LevelKit -> Term -> Term -> Term [lvlZero] :: LevelKit -> Term [typeName] :: LevelKit -> QName [sucName] :: LevelKit -> QName [maxName] :: LevelKit -> QName [zeroName] :: LevelKit -> QName -- | Get the primLevel as a Type. levelType :: TCM Type levelSucFunction :: TCM (Term -> Term) builtinLevelKit :: (HasBuiltins m) => m LevelKit -- | Raises an error if no level kit is available. requireLevels :: TCM LevelKit -- | Checks whether level kit is fully available. haveLevels :: TCM Bool unLevel :: (HasBuiltins m) => Term -> m Term reallyUnLevelView :: (HasBuiltins m) => Level -> m Term unlevelWithKit :: LevelKit -> Level -> Term unPlusV :: Term -> (Term -> Term) -> PlusLevel -> Term maybePrimCon :: TCM Term -> TCM (Maybe ConHead) maybePrimDef :: TCM Term -> TCM (Maybe QName) levelView :: Term -> TCM Level levelView' :: Term -> ReduceM Level levelLub :: Level -> Level -> Level subLevel :: Integer -> Level -> Maybe Level -- | Free variable check that reduces the subject to make certain variables -- not free. Used when pruning metavariables in -- Agda.TypeChecking.MetaVars.Occurs. module Agda.TypeChecking.Free.Reduce -- | Try to enforce a set of variables not occurring in a given type. -- Returns a possibly reduced version of the type and the subset of -- variables that does indeed not occur in the reduced type. forceNotFree :: IntSet -> Type -> TCM (IntSet, Type) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Common.Arg a) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Common.Dom a) instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Free.Reduce.ForceNotFree a => Agda.TypeChecking.Free.Reduce.ForceNotFree [a] instance (Agda.TypeChecking.Reduce.Reduce a, Agda.TypeChecking.Free.Reduce.ForceNotFree a) => Agda.TypeChecking.Free.Reduce.ForceNotFree (Agda.Syntax.Internal.Elim' a) instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Type instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Term instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Level instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.LevelAtom instance Agda.TypeChecking.Free.Reduce.ForceNotFree Agda.Syntax.Internal.Sort -- | Tools for DisplayTerm and DisplayForm. module Agda.TypeChecking.DisplayForm -- | Convert a DisplayTerm into a Term. dtermToTerm :: DisplayTerm -> Term -- | Get the arities of all display forms for a name. displayFormArities :: QName -> TCM [Int] -- | 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 :: QName -> Elims -> TCM (Maybe DisplayTerm) -- | Match a DisplayForm q ps = v against q es. -- Return the DisplayTerm v[us] if the match was -- successful, i.e., es / ps = Just us. matchDisplayForm :: DisplayForm -> Elims -> MaybeT TCM (DisplayForm, DisplayTerm) -- | Class Match for matching a term p in the role of a -- pattern against a term v. -- -- The 0th variable in p plays the role of a place holder -- (pattern variable). Each occurrence of var 0 in p -- stands for a different pattern variable. -- -- The result of matching, if successful, is a list of solutions for the -- pattern variables, in left-to-right order. -- -- The 0th variable is in scope in the input v, but should not -- actually occur! In the output solution, the 0th variable is -- no longer in scope. (It has been substituted by (throwImpossible -- (Impossible "srcfullAgdaTypeCheckingDisplayForm.hs" -- 126)) which corresponds to a raise by -1). class Match a match :: Match a => a -> a -> MaybeT TCM [WithOrigin Term] -- | Substitute terms with origin into display terms, replacing variables -- along with their origins. -- -- The purpose is to replace the pattern variables in a with-display -- form, and only on the top level of the lhs. Thus, we are happy to fall -- back to ordinary substitution where it does not matter. This fixes -- issue #2590. class SubstWithOrigin a substWithOrigin :: SubstWithOrigin a => Substitution -> [WithOrigin Term] -> a -> a instance Agda.TypeChecking.DisplayForm.SubstWithOrigin a => Agda.TypeChecking.DisplayForm.SubstWithOrigin [a] instance Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Common.Arg a) => Agda.TypeChecking.DisplayForm.SubstWithOrigin (Agda.Syntax.Internal.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' 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.Termination.RecCheck recursive :: [QName] -> TCM Bool -- | anysDef names a returns all definitions from names -- that are used in a. anyDefs :: GetDefs a => [QName] -> a -> TCM [QName] -- | 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.Abstract.Pretty showA :: (Show c, ToConcrete a c) => a -> TCM String prettyA :: (Pretty c, ToConcrete a c) => a -> TCM Doc prettyAs :: (Pretty c, ToConcrete a [c]) => a -> TCM Doc -- | Variant of showA which does not insert outermost parentheses. showATop :: (Show c, ToConcrete a c) => a -> TCM String -- | Variant of prettyA which does not insert outermost parentheses. prettyATop :: (Pretty c, ToConcrete a c) => a -> TCM Doc -- | Translating from internal syntax to abstract syntax. Enables nice -- pretty printing of internal syntax. -- -- TODO -- --
-- 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 :: Int -> Telescope -> TCM (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 :: QName -> Args -> Term -> TCM (Telescope, Args) -- | Eta expand a record regardless of whether it's an eta-record or not. forceEtaExpandRecord :: QName -> Args -> Term -> TCM (Telescope, Args) etaExpandRecord' :: Bool -> QName -> Args -> Term -> TCM (Telescope, Args) etaExpandRecord_ :: QName -> Args -> Defn -> Term -> TCM (Telescope, ConHead, ConInfo, Args) etaExpandRecord'_ :: Bool -> QName -> Args -> Defn -> Term -> TCM (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. 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 :: QName -> Args -> TCM (Either MetaId Bool) isSingletonRecordModuloRelevance :: QName -> Args -> TCM (Either MetaId Bool) -- | Return the unique (closed) inhabitant if exists. In case of counting -- irrelevance in, the returned inhabitant contains garbage. isSingletonRecord' :: Bool -> QName -> Args -> TCM (Either MetaId (Maybe Term)) -- | Check whether a type has a unique inhabitant and return it. Can be -- blocked by a metavar. isSingletonType :: Type -> TCM (Either MetaId (Maybe Term)) -- | Check whether a type has a unique inhabitant (irrelevant parts -- ignored). Can be blocked by a metavar. isSingletonTypeModuloRelevance :: (MonadTCM tcm) => Type -> tcm (Either MetaId Bool) isSingletonType' :: Bool -> Type -> TCM (Either MetaId (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 :: Term -> Type -> TCM (Maybe Int) -- | Auxiliary function. emap :: (a -> b) -> Either c (Maybe a) -> Either c (Maybe b) -- | 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 -- | Non-linear matching of the lhs of a rewrite rule against a neutral -- term. -- -- Given a lhs -- -- Δ ⊢ lhs : B -- -- and a candidate term -- -- Γ ⊢ t : A -- -- we seek a substitution Γ ⊢ σ : Δ such that -- -- Γ ⊢ B[σ] = A and Γ ⊢ lhs[σ] = t : A module Agda.TypeChecking.Rewriting.NonLinMatch -- | Turn a term into a non-linear pattern, treating the free variables as -- pattern variables. The first argument indicates the relevance we are -- working under: if this is Irrelevant, then we construct a pattern that -- never fails to match. The second argument is the number of bound -- variables (from pattern lambdas). class PatternFrom a b patternFrom :: PatternFrom a b => Relevance -> Int -> a -> TCM b -- | Monad for non-linear matching. type NLM = ExceptT Blocked_ (StateT NLMState ReduceM) data NLMState NLMState :: Sub -> PostponedEquations -> NLMState [_nlmSub] :: NLMState -> Sub [_nlmEqs] :: NLMState -> PostponedEquations nlmSub :: Lens' Sub NLMState nlmEqs :: Lens' PostponedEquations NLMState liftRed :: ReduceM a -> NLM a runNLM :: NLM () -> ReduceM (Either Blocked_ NLMState) matchingBlocked :: Blocked_ -> NLM () -- | Add substitution i |-> v to result of matching. tellSub :: Relevance -> Int -> Term -> NLM () tellEq :: Telescope -> Telescope -> Term -> Term -> NLM () type Sub = IntMap (Relevance, Term) -- | Matching against a term produces a constraint which we have to verify -- after applying the substitution computed by matching. data PostponedEquation PostponedEquation :: Telescope -> Term -> Term -> PostponedEquation -- | Telescope of free variables in the equation [eqFreeVars] :: PostponedEquation -> Telescope -- | Term from pattern, living in pattern context. [eqLhs] :: PostponedEquation -> Term -- | Term from scrutinee, living in context where matching was invoked. [eqRhs] :: PostponedEquation -> Term type PostponedEquations = [PostponedEquation] -- | Match a non-linear pattern against a neutral term, returning a -- substitution. class Match a b match :: Match a b => Relevance -> Telescope -> Telescope -> a -> b -> NLM () reallyFree :: (Reduce a, Normalise a, Free a) => (Int -> Bool) -> a -> ReduceM (Either Blocked_ (Maybe a)) makeSubstitution :: Telescope -> Sub -> Substitution checkPostponedEquations :: Substitution -> PostponedEquations -> ReduceM (Maybe Blocked_) nonLinMatch :: (Match a b) => Telescope -> a -> b -> ReduceM (Either Blocked_ Substitution) -- | Untyped βη-equality, does not handle things like empty record types. -- Returns Nothing if the terms are equal, or `Just b` if the -- terms are not (where b contains information about possible metas -- blocking the comparison) equal :: Term -> Term -> ReduceM (Maybe Blocked_) -- | Normalise the given term but also preserve blocking tags TODO: -- implement a more efficient version of this. normaliseB' :: (Reduce t, Normalise t) => t -> ReduceM (Blocked t) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match a b => Agda.TypeChecking.Rewriting.NonLinMatch.Match [a] [b] instance Agda.TypeChecking.Rewriting.NonLinMatch.Match a b => Agda.TypeChecking.Rewriting.NonLinMatch.Match (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match a b => Agda.TypeChecking.Rewriting.NonLinMatch.Match (Agda.Syntax.Internal.Elim' a) (Agda.Syntax.Internal.Elim' b) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match a b => Agda.TypeChecking.Rewriting.NonLinMatch.Match (Agda.Syntax.Common.Dom a) (Agda.Syntax.Common.Dom b) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.TypeChecking.Monad.Base.NLPType Agda.Syntax.Internal.Type instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.TypeChecking.Monad.Base.NLPat Agda.Syntax.Internal.Sort instance (Agda.TypeChecking.Rewriting.NonLinMatch.Match a b, Agda.TypeChecking.Substitute.Class.Subst t1 a, Agda.TypeChecking.Substitute.Class.Subst t2 b) => Agda.TypeChecking.Rewriting.NonLinMatch.Match (Agda.Syntax.Internal.Abs a) (Agda.Syntax.Internal.Abs b) instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.TypeChecking.Monad.Base.NLPat Agda.Syntax.Internal.Level instance Agda.TypeChecking.Rewriting.NonLinMatch.Match Agda.TypeChecking.Monad.Base.NLPat Agda.Syntax.Internal.Term instance Agda.Utils.Null.Null Agda.TypeChecking.Rewriting.NonLinMatch.NLMState instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom a b => Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom [a] [b] instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom a b => Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Arg b) instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom a Agda.TypeChecking.Monad.Base.NLPat => Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom (Agda.Syntax.Internal.Elim' a) (Agda.Syntax.Internal.Elim' Agda.TypeChecking.Monad.Base.NLPat) instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom a b => Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom (Agda.Syntax.Common.Dom a) (Agda.Syntax.Common.Dom b) instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom Agda.Syntax.Internal.Type Agda.TypeChecking.Monad.Base.NLPType instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom Agda.Syntax.Internal.Sort Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom Agda.Syntax.Internal.Term Agda.TypeChecking.Monad.Base.NLPat instance Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom a b => Agda.TypeChecking.Rewriting.NonLinMatch.PatternFrom (Agda.Syntax.Internal.Abs a) (Agda.Syntax.Internal.Abs b) module Agda.TypeChecking.Quote data QuotingKit QuotingKit :: Term -> ReduceM Term -> Type -> ReduceM Term -> Clause -> ReduceM Term -> Dom Type -> ReduceM Term -> Definition -> ReduceM Term -> forall a. (a -> ReduceM Term) -> [a] -> ReduceM Term -> QuotingKit [quoteTermWithKit] :: QuotingKit -> Term -> ReduceM Term [quoteTypeWithKit] :: QuotingKit -> Type -> ReduceM Term [quoteClauseWithKit] :: QuotingKit -> Clause -> ReduceM Term [quoteDomWithKit] :: QuotingKit -> Dom Type -> ReduceM Term [quoteDefnWithKit] :: QuotingKit -> Definition -> ReduceM Term [quoteListWithKit] :: QuotingKit -> forall a. (a -> ReduceM Term) -> [a] -> ReduceM Term quotingKit :: TCM QuotingKit quoteString :: String -> Term quoteName :: QName -> Term quoteNat :: Integer -> Term quoteConName :: ConHead -> Term quoteMeta :: AbsolutePath -> MetaId -> Term quoteTerm :: Term -> TCM Term quoteType :: Type -> TCM Term quoteDom :: Dom Type -> TCM Term quoteDefn :: Definition -> TCM Term quoteList :: [Term] -> TCM Term module Agda.TypeChecking.Polarity -- | Infimum on the information lattice. Invariant is bottom -- (dominant for inf), Nonvariant is top (neutral for inf). (/\) :: Polarity -> Polarity -> Polarity -- | Polarity negation, swapping monotone and antitone. neg :: Polarity -> Polarity -- | What is the polarity of a function composition? composePol :: Polarity -> Polarity -> Polarity polFromOcc :: Occurrence -> Polarity -- | Get the next polarity from a list, Invariant if empty. nextPolarity :: [Polarity] -> (Polarity, [Polarity]) -- | Replace Nonvariant by Covariant. (Arbitrary bias, but -- better than Invariant, see issue 1596). purgeNonvariant :: [Polarity] -> [Polarity] -- | A quick transliterations of occurrences to polarities. polarityFromPositivity :: QName -> TCM () -- | Main function of this module. computePolarity :: [QName] -> TCM () -- | Data and record parameters are used as phantom arguments all over the -- test suite (and possibly in user developments). -- enablePhantomTypes turns Nonvariant parameters to -- Covariant to enable phantoms. enablePhantomTypes :: Defn -> [Polarity] -> [Polarity] -- | Make arguments Invariant if the type of a not-Nonvariant -- later argument depends on it. Also, enable phantom types by turning -- Nonvariant into something else if it is a data/record parameter -- but not a size argument. [See issue 1596] -- -- Precondition: the "phantom" polarity list has the same length as the -- polarity list. dependentPolarity :: Type -> [Polarity] -> [Polarity] -> TCM [Polarity] -- | Check whether a variable is relevant in a type expression, ignoring -- domains of non-variant arguments. relevantInIgnoringNonvariant :: Nat -> Type -> [Polarity] -> TCM Bool -- | Hack for polarity of size indices. As a side effect, this sets the -- positivity of the size index. See -- testsucceedPolaritySizeSucData.agda for a case where this is -- needed. sizePolarity :: QName -> [Polarity] -> TCM [Polarity] -- | checkSizeIndex d np i a checks that constructor target type -- a has form d ps (↑ⁿ i) idxs where |ps| = -- np. -- -- Precondition: a is reduced and of form d ps idxs0. checkSizeIndex :: QName -> Nat -> Nat -> Type -> TCM Bool -- | polarities i a computes the list of polarities of de Bruijn -- index i in syntactic entity a. class HasPolarity a polarities :: HasPolarity a => Nat -> a -> TCM [Polarity] -- | polarity i a computes the polarity of de Bruijn index -- i in syntactic entity a by taking the infimum of all -- polarities. polarity :: HasPolarity a => Nat -> a -> TCM Polarity instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Common.Arg a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Common.Dom a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Abs a) instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity [a] instance (Agda.TypeChecking.Polarity.HasPolarity a, Agda.TypeChecking.Polarity.HasPolarity b) => Agda.TypeChecking.Polarity.HasPolarity (a, b) instance Agda.TypeChecking.Polarity.HasPolarity Agda.Syntax.Internal.Type instance Agda.TypeChecking.Polarity.HasPolarity a => Agda.TypeChecking.Polarity.HasPolarity (Agda.Syntax.Internal.Elim' a) instance Agda.TypeChecking.Polarity.HasPolarity Agda.Syntax.Internal.Term instance Agda.TypeChecking.Polarity.HasPolarity Agda.Syntax.Internal.Level instance Agda.TypeChecking.Polarity.HasPolarity Agda.Syntax.Internal.PlusLevel instance Agda.TypeChecking.Polarity.HasPolarity Agda.Syntax.Internal.LevelAtom -- | Irrelevant function types. module Agda.TypeChecking.Irrelevance -- | Prepare parts of a parameter telescope for abstraction in constructors -- and projections. hideAndRelParams :: Dom a -> Dom a -- | Used to modify context when going into a rel argument. inverseApplyRelevance :: Relevance -> Dom a -> Dom a -- | Compose two relevance flags. This function is used to update the -- relevance information on pattern variables a after a match -- against something rel. applyRelevance :: Relevance -> Dom a -> Dom 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 :: TCM a -> TCM a -- | Internal workhorse, expects value of --experimental-irrelevance flag -- as argument. workOnTypes' :: Bool -> 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. applyRelevanceToContext :: (MonadTCM tcm) => Relevance -> 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). wakeIrrelevantVars :: TCM a -> TCM a -- | Check whether something can be used in a position of the given -- relevance. class UsableRelevance a usableRel :: UsableRelevance a => Relevance -> a -> TCM Bool 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 Agda.Syntax.Internal.LevelAtom 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 (Agda.Syntax.Internal.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.Common.Dom a) instance (Agda.TypeChecking.Substitute.Class.Subst t a, Agda.TypeChecking.Irrelevance.UsableRelevance a) => Agda.TypeChecking.Irrelevance.UsableRelevance (Agda.Syntax.Internal.Abs a) -- | This module contains the rules for Agda's sort system viewed as a pure -- type system (pts). The specification of a pts consists of a set of -- axioms of the form s1 : s2 specifying when a sort fits in -- another sort, and a set of rules of the form (s1,s2,s3) -- specifying that a pi type with domain in s1 and codomain in -- s2 itself fits into sort s3. -- -- To ensure unique principal types, the axioms and rules of Agda's pts -- are given by two partial functions univSort' and -- piSort' (see Agda.TypeChecking.Substitute). If these -- functions return Nothing, a constraint is added to ensure -- that the sort will be computed eventually. -- -- One upgrade over the standard definition of a pts is that in -- a rule (s1,s2,s3), in Agda the sort s2 can depend on -- a variable of some type in s1. This is needed to support -- Agda's universe polymorphism where we can have e.g. a function of type -- ∀ {ℓ} → Set ℓ. module Agda.TypeChecking.Sort -- | Infer the sort of another sort. If we can compute the bigger sort -- straight away, return that. Otherwise, return UnivSort s and -- add a constraint to ensure we can compute the sort eventually. inferUnivSort :: Sort -> TCM Sort sortFitsIn :: Sort -> Sort -> TCM () hasBiggerSort :: Sort -> TCM () -- | Infer the sort of a pi type. If we can compute the sort straight away, -- return that. Otherwise, return PiSort s1 s2 and add a -- constraint to ensure we can compute the sort eventually. inferPiSort :: Sort -> Abs Sort -> TCM Sort -- | As inferPiSort, but for a nondependent function type. inferFunSort :: Sort -> Sort -> TCM Sort ptsRule :: Sort -> Abs Sort -> Sort -> TCM () -- | Non-dependent version of ptsRule ptsRule' :: Sort -> Sort -> Sort -> TCM () hasPTSRule :: Sort -> Abs Sort -> TCM () -- | Recursively check that an iterated function type constructed by -- telePi is well-sorted. checkTelePiSort :: Type -> TCM () -- | Functions for inserting implicit arguments at the right places. module Agda.TypeChecking.Implicit -- | implicitArgs n expand eti t generates up to n -- implicit arguments metas (unbounded if n<0), as long as -- t is a function type and expand holds on the hiding -- info of its domain. -- -- If explicit arguments are to be inserted as well, they are inserted as -- instance arguments (used for recursive instance search). implicitArgs :: Int -> (Hiding -> Bool) -> Type -> TCM (Args, Type) -- | implicitNamedArgs n expand eti 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. -- -- If explicit arguments are to be inserted as well, they are inserted as -- instance arguments (used for recursive instance search). implicitNamedArgs :: Int -> (Hiding -> ArgName -> Bool) -> Type -> TCM (NamedArgs, Type) -- | Create a metavariable according to the Hiding info. newMetaArg :: ArgInfo -> ArgName -> Type -> TCM (MetaId, Term) -- | Create a questionmark according to the Hiding info. newInteractionMetaArg :: ArgInfo -> ArgName -> Type -> TCM (MetaId, Term) data ImplicitInsertion -- | this many implicits have to be inserted ImpInsert :: [Hiding] -> ImplicitInsertion -- | hidden argument where there should have been a non-hidden arg BadImplicits :: ImplicitInsertion -- | bad named argument NoSuchName :: ArgName -> ImplicitInsertion NoInsertNeeded :: ImplicitInsertion impInsert :: [Hiding] -> ImplicitInsertion -- | The list should be non-empty. insertImplicit :: NamedArg e -> [Arg 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 :: ExpandHidden -> [NamedArg Pattern] -> Telescope -> TCM [NamedArg Pattern] -- | Insert trailing SizeLt patterns, if any. insertImplicitSizeLtPatterns :: Type -> TCM [NamedArg Pattern] -- | Insert implicit patterns in a list of patterns. Even if -- DontExpandLast, trailing SIZELT patterns are inserted. insertImplicitPatternsT :: ExpandHidden -> [NamedArg Pattern] -> Type -> TCM [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 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 ["_", "just a"] [] [] [] 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 :: LHSState a -> TCM (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) -- | A constructor argument is forced if it appears as pattern variable in -- an index of the target. -- -- For instance x is forced in sing and n is -- forced in zero and suc: -- --
-- data Sing {a}{A : Set a} : A -> Set where -- sing : (x : A) -> Sing x -- -- data Fin : Nat -> Set where -- zero : (n : Nat) -> Fin (suc n) -- suc : (n : Nat) (i : Fin n) -> Fin (suc n) ---- -- At runtime, forced constructor arguments may be erased as they can be -- recovered from dot patterns. For instance, unsing : {A : Set} (x -- : A) -> Sing x -> A unsing .x (sing x) = x can become -- unsing x sing = x and proj : (n : Nat) (i : Fin n) -> -- Nat proj .(suc n) (zero n) = n proj .(suc n) (suc n i) = n -- becomes proj (suc n) zero = n proj (suc n) (suc i) = n -- -- 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 :: Type -> TCM [IsForced] -- | Compute the pattern variables of a term or term-like thing. class ForcedVariables a forcedVariables :: ForcedVariables a => a -> [(Modality, Nat)] forcedVariables :: (ForcedVariables a, ForcedVariables b, Foldable t, a ~ t b) => a -> [(Modality, Nat)] isForced :: IsForced -> Bool nextIsForced :: [IsForced] -> (IsForced, [IsForced]) -- | Move bindings for forced variables to unforced positions. forcingTranslation :: [NamedArg DeBruijnPattern] -> TCM [NamedArg DeBruijnPattern] -- | Applies the forcing translation in order to update modalities of -- forced arguments in the telescope. This is used before checking a -- right-hand side in order to make sure all uses of forced arguments -- agree with the relevance of the position where the variable will -- ultimately be bound. Precondition: the telescope types the bound -- variables of the patterns. forceTranslateTelescope :: Telescope -> [NamedArg DeBruijnPattern] -> TCM Telescope -- | Rebind a forced pattern in a non-forced position. The forced pattern -- has already been dotted by dotForcedPatterns, so the remaining -- task is to find a dot pattern in an unforced position that can be -- turned into a proper match of the forced pattern. -- -- For instance (with patterns prettified to ease readability): -- -- rebindForcedPattern [.(suc n), cons .n x xs] n = [suc n, cons .n x xs] rebindForcedPattern :: [NamedArg DeBruijnPattern] -> DeBruijnPattern -> TCM [NamedArg DeBruijnPattern] -- | Dot all forced patterns and return a list of patterns that need to be -- undotted elsewhere. Patterns that need to be undotted are those that -- bind variables or does some actual (non-eta) matching. dotForcedPatterns :: [NamedArg DeBruijnPattern] -> TCM ([NamedArg DeBruijnPattern], [DeBruijnPattern]) 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' 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 module Agda.TypeChecking.Datatypes -- | Get true constructor with record fields. getConHead :: QName -> TCM (Either SigError ConHead) -- | 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 -- | 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 :: ConHead -> Type -> TCM (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 :: ConHead -> Type -> TCM (Maybe ((QName, Type, Args), Type)) data ConstructorInfo -- | Arity. DataCon :: Nat -> ConstructorInfo -- | List of field names. RecordCon :: HasEta -> [Arg 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 :: QName -> TCM 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 :: QName -> TCM (Maybe Nat) -- | 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] -- | Precondition: Name is a data or record type. getConHeads :: QName -> TCM [ConHead] -- | Nothing if not data or record type name. getConHeads' :: QName -> TCM (Maybe [ConHead]) -- | Nothing if not data or record definition. getConHeads_ :: Defn -> Maybe [ConHead] -- | 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 (>*<) :: OccursWhere -> OccursWhere -> OccursWhere 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 -> OccursWhere -> OccurrencesBuilder' emptyOB :: OccurrencesBuilder (>+<) :: OccurrencesBuilder -> OccurrencesBuilder -> OccurrencesBuilder -- | Removes OnlyVarsUpTo entries and adds OccursWhere -- entries. -- -- 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.) preprocess :: OccurrencesBuilder -> OccurrencesBuilder' -- | A type used locally in flatten. data OccursWheres (:++) :: OccursWheres -> OccursWheres -> OccursWheres Occurs :: OccursWhere -> OccursWheres -- | 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 -> Occurrences -- | 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 -- | Computes the occurrences 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 Occurrences -- | 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 Edge :: !Occurrence -> OccursWhere -> Edge -- | 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) -- | 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: -- --
-- trustMe : {a : Level} {A : Set a} {x y : A} -> x ≡ y --primTrustMe :: TCM PrimitiveImpl -- | Get the ArgInfo of the principal argument of BUILTIN REFL. -- -- Returns Nothing for e.g. data Eq {a} {A : Set a} (x : A) -- : A → Set a where refl : Eq x x -- -- Returns Just ... for e.g. data Eq {a} {A : Set a} : (x y -- : A) → Set a where refl : ∀ x → Eq x x getReflArgInfo :: ConHead -> TCM (Maybe ArgInfo) -- | Used for both primForce and primForceLemma. genPrimForce :: TCM Type -> (Term -> Arg Term -> Term) -> TCM PrimitiveImpl primForce :: TCM PrimitiveImpl primForceLemma :: TCM PrimitiveImpl mkPrimLevelZero :: TCM PrimitiveImpl mkPrimLevelSuc :: TCM PrimitiveImpl mkPrimLevelMax :: TCM PrimitiveImpl mkPrimFun1TCM :: (FromTerm a, ToTerm b, TermLike 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 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 (-->) :: TCM Type -> TCM Type -> TCM Type infixr 4 --> (.-->) :: TCM Type -> TCM Type -> TCM Type infixr 4 .--> (..-->) :: TCM Type -> TCM Type -> TCM Type infixr 4 ..--> garr :: (Relevance -> Relevance) -> TCM Type -> TCM Type -> TCM Type gpi :: ArgInfo -> String -> TCM Type -> TCM Type -> TCM Type hPi :: String -> TCM Type -> TCM Type -> TCM Type nPi :: String -> TCM Type -> TCM Type -> TCM Type varM :: Int -> TCM Term gApply :: Hiding -> TCM Term -> TCM Term -> TCM Term (<@>) :: TCM Term -> TCM Term -> TCM Term infixl 9 <@> (<#>) :: TCM Term -> TCM Term -> TCM Term infixl 9 <#> list :: TCM Term -> TCM Term io :: TCM Term -> TCM Term el :: TCM Term -> TCM Type tset :: TCM Type sSizeUniv :: Sort tSizeUniv :: TCM Type -- | Abbreviation: argN = Arg defaultArgInfo. argN :: e -> Arg e domN :: e -> Dom e -- | Abbreviation: argH = hide Arg -- defaultArgInfo. argH :: e -> Arg e domH :: e -> Dom e type Op a = a -> a -> a type Fun a = a -> a type Rel a = a -> a -> Bool type Pred a = a -> Bool primitiveFunctions :: Map String (TCM PrimitiveImpl) lookupPrimitiveFunction :: String -> TCM PrimitiveImpl lookupPrimitiveFunctionQ :: QName -> TCM (String, PrimitiveImpl) getBuiltinName :: String -> TCM (Maybe QName) isBuiltin :: QName -> String -> TCM Bool instance GHC.Classes.Ord Agda.TypeChecking.Primitive.Lvl instance GHC.Classes.Eq Agda.TypeChecking.Primitive.Lvl 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 Agda.TypeChecking.Primitive.FromTerm GHC.Integer.Type.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 Agda.Utils.String.Str 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.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 Agda.Utils.String.Str 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.Integer.Type.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.Type instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Common.ArgInfo instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Fixity.Fixity' instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Fixity.Fixity instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Fixity.Associativity instance Agda.TypeChecking.Primitive.ToTerm Agda.Syntax.Fixity.PrecedenceLevel instance Agda.TypeChecking.Primitive.ToTerm a => Agda.TypeChecking.Primitive.ToTerm [a] instance (Agda.TypeChecking.Primitive.PrimType a, Agda.TypeChecking.Primitive.PrimType b) => Agda.TypeChecking.Primitive.PrimTerm (a -> b) instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimType a instance Agda.TypeChecking.Primitive.PrimTerm GHC.Integer.Type.Integer instance Agda.TypeChecking.Primitive.PrimTerm GHC.Word.Word64 instance Agda.TypeChecking.Primitive.PrimTerm GHC.Types.Bool instance Agda.TypeChecking.Primitive.PrimTerm GHC.Types.Char instance Agda.TypeChecking.Primitive.PrimTerm GHC.Types.Double instance Agda.TypeChecking.Primitive.PrimTerm Agda.Utils.String.Str instance Agda.TypeChecking.Primitive.PrimTerm Agda.TypeChecking.Primitive.Nat instance Agda.TypeChecking.Primitive.PrimTerm Agda.TypeChecking.Primitive.Lvl instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Abstract.Name.QName instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Common.MetaId instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Internal.Type instance Agda.TypeChecking.Primitive.PrimTerm Agda.Syntax.Fixity.Fixity' instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm [a] instance Agda.TypeChecking.Primitive.PrimTerm a => Agda.TypeChecking.Primitive.PrimTerm (GHC.Types.IO a) instance GHC.Show.Show Agda.TypeChecking.Primitive.Lvl instance GHC.Real.Integral Agda.TypeChecking.Primitive.Nat instance Agda.Syntax.Internal.Generic.TermLike Agda.TypeChecking.Primitive.Nat instance GHC.Show.Show Agda.TypeChecking.Primitive.Nat module Agda.Compiler.Treeless.Simplify simplifyTTerm :: TTerm -> TCM TTerm instance GHC.Classes.Ord Agda.Compiler.Treeless.Simplify.Atom instance GHC.Classes.Eq Agda.Compiler.Treeless.Simplify.Atom instance GHC.Show.Show Agda.Compiler.Treeless.Simplify.Atom -- | Converts case matches on literals to if cascades with equality -- comparisons. module Agda.Compiler.Treeless.EliminateLiteralPatterns eliminateLiteralPatterns :: TTerm -> TCM TTerm data BuiltinKit BuiltinKit :: Maybe QName -> Maybe QName -> BuiltinKit [nat] :: BuiltinKit -> Maybe QName [int] :: BuiltinKit -> Maybe QName transform :: BuiltinKit -> TTerm -> TTerm -- | Eliminates case defaults by adding an alternative for all possible -- constructors. Literal cases are preserved as-is. module Agda.Compiler.Treeless.EliminateDefaults eliminateCaseDefaults :: TTerm -> TCM TTerm module Agda.TypeChecking.InstanceArguments -- | Compute a list of instance candidates. Nothing if type is a -- meta, error if type is not eligible for instance search. initialIFSCandidates :: Type -> TCM (Maybe [Candidate]) -- | findInScope m (v,a)s tries to instantiate on of the types -- as of the candidate terms vs to the type t -- of the metavariable m. If successful, meta m is -- solved with the instantiation of v. If unsuccessful, the -- constraint is regenerated, with possibly reduced candidate set. The -- list of candidates is equal to Nothing when the type of the -- meta wasn't known when the constraint was generated. In that case, try -- to find its type again. findInScope :: MetaId -> Maybe [Candidate] -> TCM () -- | Result says whether we need to add constraint, and if so, the set of -- remaining candidates and an eventual blocking metavariable. findInScope' :: MetaId -> [Candidate] -> TCM (Maybe ([Candidate], Maybe MetaId)) -- | Precondition: type is spine reduced and ends in a Def or a Var. insidePi :: Type -> (Type -> TCM a) -> TCM a -- | A meta _M is rigidly constrained if there is a constraint _M us == D -- vs, for inert D. Such metas can safely be instantiated by recursive -- instance search, since the constraint limits the solution space. rigidlyConstrainedMetas :: TCM [MetaId] isRigid :: MetaId -> TCM Bool -- | Returns True if one of the arguments of t is a meta which -- isn’t rigidly constrained. Note that level metas are never considered -- rigidly constrained (#1865). areThereNonRigidMetaArguments :: Term -> TCM (Maybe MetaId) -- | Apply the computation to every argument in turn by reseting the state -- every time. Return the list of the arguments giving the result True. -- -- If the resulting list contains exactly one element, then the state is -- the same as the one obtained after running the corresponding -- computation. In all the other cases, the state is reseted. filterResetingState :: MetaId -> [Candidate] -> (Candidate -> TCM YesNoMaybe) -> TCM [Candidate] dropSameCandidates :: MetaId -> [(Candidate, Term, Type, a)] -> TCM [(Candidate, Term, Type, a)] data YesNoMaybe Yes :: YesNoMaybe No :: YesNoMaybe Maybe :: YesNoMaybe HellNo :: TCErr -> YesNoMaybe isNo :: YesNoMaybe -> Bool -- | Given a meta m of type t and a list of candidates -- cands, checkCandidates m t cands returns a refined -- list of valid candidates. checkCandidates :: MetaId -> Type -> [Candidate] -> TCM (Maybe [Candidate]) isIFSConstraint :: Constraint -> Bool -- | To preserve the invariant that a constructor is not applied to its -- parameter arguments, we explicitly check whether function term we are -- applying to arguments is a unapplied constructor. In this case we drop -- the first conPars arguments. See Issue670a. Andreas, 2013-11-07 -- Also do this for projections, see Issue670b. applyDroppingParameters :: Term -> Args -> TCM Term instance GHC.Show.Show Agda.TypeChecking.InstanceArguments.YesNoMaybe -- | 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] -- | Builds a proper substitution from an IntMap produced by -- match(Co)patterns buildSubstitution :: (DeBruijn a) => Empty -> Int -> IntMap (Arg a) -> Substitution' a -- | Instead of zipWithM, we need to use this lazy version of -- combining pattern matching computations. foldMatch :: forall p v. IsProjP p => (p -> v -> ReduceM (Match Term, v)) -> [p] -> [v] -> ReduceM (Match Term, [v]) -- | 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 :: [NamedArg DeBruijnPattern] -> [Elim] -> ReduceM (Match Term, [Elim]) -- | Match a single copattern. matchCopattern :: DeBruijnPattern -> Elim -> ReduceM (Match Term, Elim) matchPatterns :: [NamedArg DeBruijnPattern] -> [Arg Term] -> ReduceM (Match Term, [Arg Term]) -- | Match a single pattern. matchPattern :: DeBruijnPattern -> Arg Term -> ReduceM (Match Term, Arg Term) yesSimplification :: (Match a, b) -> (Match a, b) instance GHC.Base.Functor Agda.TypeChecking.Patterns.Match.Match instance Agda.Utils.Null.Null (Agda.TypeChecking.Patterns.Match.Match a) -- | The occurs check for unification. Does pruning on the fly. -- -- When hitting a meta variable: -- --
-- splitResult f sc = return res ---- -- If the target type of sc is a record type, a covering set of -- split clauses is returned (sc extended by all valid -- projection patterns), otherwise res == Nothing. Note that the -- empty set of split clauses is returned if the record has no fields. splitResult :: QName -> SplitClause -> TCM (Either CosplitError Covering) normaliseProjP :: (NormaliseProjP a, HasConstInfo m) => a -> m a instance GHC.Show.Show Agda.TypeChecking.Coverage.AllowPartialCover instance GHC.Classes.Eq Agda.TypeChecking.Coverage.AllowPartialCover instance GHC.Show.Show Agda.TypeChecking.Coverage.FixTarget instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Coverage.CosplitError instance Agda.TypeChecking.Pretty.PrettyTCM Agda.TypeChecking.Coverage.SplitClause module Agda.TypeChecking.Empty -- | Check whether a type is empty. This check may be postponed as -- emptiness constraint. isEmptyType :: Range -> Type -> TCM () instance GHC.Base.Semigroup Agda.TypeChecking.Empty.ErrorNonEmpty instance GHC.Base.Monoid Agda.TypeChecking.Empty.ErrorNonEmpty module Agda.TypeChecking.CompiledClause.Compile data RunRecordPatternTranslation RunRecordPatternTranslation :: RunRecordPatternTranslation DontRunRecordPatternTranslation :: RunRecordPatternTranslation compileClauses' :: RunRecordPatternTranslation -> [Clause] -> TCM CompiledClauses -- | Process function clauses into case tree. This involves: 1. Coverage -- checking, generating a split tree. 2. Translation of lhs record -- patterns into rhs uses of projection. Update the split tree. 3. -- Generating a case tree from the split tree. Phases 1. and 2. are -- skipped if Nothing. compileClauses :: Maybe (QName, Type) -> [Clause] -> TCM CompiledClauses -- | Stripped-down version of Clause used in clause compiler. data Cl Cl :: [Arg Pattern] -> Maybe Term -> Cl -- | Pattern variables are considered in left-to-right order. [clPats] :: Cl -> [Arg Pattern] [clBody] :: Cl -> Maybe Term type Cls = [Cl] -- | Strip down a clause. Don't forget to apply the substitution to the dot -- patterns! unBruijn :: Clause -> Cl compileWithSplitTree :: SplitTree -> Cls -> CompiledClauses compile :: Cls -> CompiledClauses -- | Get the index of the next argument we need to split on. This the -- number of the first pattern that does a (non-lazy) match in the first -- clause. Or the first lazy match where all clauses agree on the -- constructor, if there are no non-lazy matches. nextSplit :: Cls -> Maybe (Bool, Arg Int) -- | Is is not a variable pattern? And if yes, is it a record pattern? properSplit :: Pattern' a -> Maybe Bool -- | Is this a variable pattern? -- -- Maintain invariant: isVar = isNothing . properSplit! isVar :: Pattern' a -> Bool -- | splitOn single n cs will force expansion of catch-alls if -- single. splitOn :: Bool -> Int -> Cls -> Case Cls splitC :: Int -> Cl -> Case Cl -- | Expand catch-alls that appear before actual matches. -- -- Example: -- --
-- true y -- x false -- false y ---- -- will expand the catch-all x to false. -- -- Catch-alls need also to be expanded if they come before/after a record -- pattern, otherwise we get into trouble when we want to eliminate -- splits on records later. -- -- Another example (see Issue 1650): f (x, (y, z)) true = a f _ -- false = b Split tree: 0 (first argument of f) - 1 (second -- component of the pair) - 3 (last argument of f) -- true -> a - -- false -> b We would like to get the following case tree: -- case 0 of _,_ -> case 1 of _,_ -> case 3 of true -> a; false -- -> b _ -> case 3 of true -> a; false -> b _ -> case 3 -- of true -> a; false -> b -- -- Example from issue #2168: f x false = a f false = _ -> b f x -- true = c case tree: f x y = case y of true -> case x of -- true -> c false -> b false -> a 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 t a) => Int -> Int -> t -> a -> a instance GHC.Show.Show Agda.TypeChecking.CompiledClause.Compile.Cl instance GHC.Classes.Eq Agda.TypeChecking.CompiledClause.Compile.RunRecordPatternTranslation 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 ---- --
-- piAbstractTerm v a b[v] = (w : a) -> b[w] --piAbstractTerm :: Term -> Type -> Type -> TCM Type -- |
-- piAbstract (v, a) b[v] = (w : a) -> 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 :: (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 :: (Subst Term a) => a -> 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 Agda.Syntax.Internal.LevelAtom instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (Agda.Syntax.Internal.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.Common.Dom a) instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm [a] instance Agda.TypeChecking.Abstract.AbsTerm a => Agda.TypeChecking.Abstract.AbsTerm (GHC.Base.Maybe a) instance (Agda.TypeChecking.Substitute.Class.Subst Agda.Syntax.Internal.Term 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) instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Elims instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Args instance Agda.TypeChecking.Abstract.IsPrefixOf Agda.Syntax.Internal.Term module Agda.TypeChecking.With -- | Split pattern variables according to with-expressions. splitTelForWith :: Telescope -> Type -> [EqualityView] -> [Term] -> (Telescope, Telescope, Permutation, Type, [EqualityView], [Term]) -- | Abstract with-expressions vs to generate type for with-helper -- function. -- -- Each EqualityType, coming from a rewrite, will turn -- into 2 abstractions. withFunctionType :: Telescope -> [Term] -> [EqualityView] -> Telescope -> Type -> 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 :: [Term] -> [EqualityView] -> [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.TypeChecking.Rules.Def checkFunDef :: Delayed -> DefInfo -> QName -> [Clause] -> TCM () checkMacroType :: Type -> TCM () -- | A single clause without arguments and without type signature is an -- alias. isAlias :: [Clause] -> Type -> Maybe (Expr, Maybe Expr, MetaId) -- | Check a trivial definition of the form f = e checkAlias :: Type -> ArgInfo -> Delayed -> DefInfo -> QName -> Expr -> Maybe Expr -> TCM () -- | Type check a definition by pattern matching. checkFunDef' :: Type -> ArgInfo -> Delayed -> Maybe ExtLamInfo -> Maybe QName -> DefInfo -> QName -> [Clause] -> TCM () -- | Type check a definition by pattern matching. checkFunDefS :: Type -> ArgInfo -> Delayed -> Maybe ExtLamInfo -> Maybe QName -> DefInfo -> QName -> Maybe Substitution -> [Clause] -> TCM () -- | Set funTerminates according to termination info in -- TCEnv, which comes from a possible termination pragma. useTerPragma :: Definition -> TCM Definition -- | Insert some with-patterns into the with-clauses LHS of the given RHS. -- (Used for rewrite.) insertPatterns :: [Pattern] -> RHS -> RHS -- | Insert with-patterns before the trailing with patterns. If there are -- none, append the with-patterns. insertPatternsLHSCore :: [Pattern] -> LHSCore -> LHSCore -- | Parameters for creating a with-function. data WithFunctionProblem NoWithFunction :: WithFunctionProblem WithFunction :: QName -> QName -> Type -> Telescope -> Telescope -> Telescope -> [Term] -> [EqualityView] -> Type -> [NamedArg DeBruijnPattern] -> Nat -> Permutation -> Permutation -> Permutation -> [Clause] -> WithFunctionProblem -- | Parent function name. [wfParentName] :: WithFunctionProblem -> QName -- | With function name. [wfName] :: WithFunctionProblem -> QName -- | Type of the parent function. [wfParentType] :: WithFunctionProblem -> Type -- | Context of the parent patterns. [wfParentTel] :: WithFunctionProblem -> Telescope -- | Types of arguments to the with function before the with expressions -- (needed vars). [wfBeforeTel] :: WithFunctionProblem -> Telescope -- | Types of arguments to the with function after the with expressions -- (unneeded vars). [wfAfterTel] :: WithFunctionProblem -> Telescope -- | With and rewrite expressions. [wfExprs] :: WithFunctionProblem -> [Term] -- | Types of the with and rewrite expressions. [wfExprTypes] :: WithFunctionProblem -> [EqualityView] -- | Type of the right hand side. [wfRHSType] :: WithFunctionProblem -> Type -- | Parent patterns. [wfParentPats] :: WithFunctionProblem -> [NamedArg DeBruijnPattern] -- | Number of module parameters in parent patterns [wfParentParams] :: WithFunctionProblem -> Nat -- | Permutation resulting from splitting the telescope into needed and -- unneeded vars. [wfPermSplit] :: WithFunctionProblem -> Permutation -- | Permutation reordering the variables in the parent pattern. [wfPermParent] :: WithFunctionProblem -> Permutation -- | Final permutation (including permutation for the parent clause). [wfPermFinal] :: WithFunctionProblem -> Permutation -- | The given clauses for the with function [wfClauses] :: WithFunctionProblem -> [Clause] -- | Type check a function clause. checkClause :: Type -> Maybe Substitution -> SpineClause -> TCM Clause -- | Type check the with and rewrite lhss and/or the rhs. checkRHS :: LHSInfo -> QName -> [NamedArg Pattern] -> Type -> LHSResult -> RHS -> TCM (Maybe Term, WithFunctionProblem) checkWithRHS :: QName -> QName -> Type -> LHSResult -> [Term] -> [EqualityView] -> [Clause] -> TCM (Maybe Term, WithFunctionProblem) -- | Invoked in empty context. checkWithFunction :: [Name] -> WithFunctionProblem -> TCM () -- | Type check a where clause. checkWhere :: WhereDeclarations -> TCM a -> TCM a -- | Enter a new section during type-checking. newSection :: ModuleName -> Telescope -> TCM a -> TCM a -- | Set the current clause number. atClause :: QName -> Int -> RHS -> TCM a -> TCM a module Agda.TypeChecking.Rules.Application -- | checkArguments exph r args t0 t k tries checkArgumentsE -- exph args t0 t. If it succeeds, it continues k with the -- returned results. If it fails, it registers a postponed typechecking -- problem and returns the resulting new meta variable. -- -- Checks e := ((_ : t0) args) : t. checkArguments :: ExpandHidden -> Range -> [NamedArg Expr] -> Type -> Type -> (Elims -> Type -> CheckedTarget -> TCM Term) -> TCM Term -- | Check that a list of arguments fits a telescope. Inserts hidden -- arguments as necessary. Returns the type-checked arguments and the -- remaining telescope. checkArguments_ :: ExpandHidden -> Range -> [NamedArg Expr] -> Telescope -> TCM (Elims, Telescope) -- | checkApplication hd args e t checks an application. -- Precondition: Application hs args = appView e -- -- checkApplication disambiguates constructors (and continues to -- checkConstructorApplication) and resolves pattern synonyms. checkApplication :: Expr -> Args -> Expr -> Type -> TCM Term -- | Precondition: Application hd args = appView e. inferApplication :: ExpandHidden -> Expr -> Args -> Expr -> TCM (Term, Type) -- | The monad for the termination checker. -- -- The termination monad TerM is an extension of the type -- checking monad TCM by an environment with information needed by -- the termination checker. module Agda.Termination.Monad -- | The mutual block we are checking. -- -- The functions are numbered according to their order of appearance in -- this list. type MutualNames = [QName] -- | The target of the function we are checking. type Target = QName -- | The current guardedness level. type Guarded = Order -- | The termination environment. data TerEnv TerEnv :: Bool -> Bool -> Bool -> Maybe QName -> Maybe QName -> CutOff -> QName -> MutualNames -> [QName] -> Bool -> Maybe Target -> Delayed -> [Bool] -> Bool -> Int -> MaskedDeBruijnPatterns -> !Int -> !Guarded -> Bool -> VarSet -> TerEnv -- | Are we mining dot patterns to find evindence of structal descent? [terUseDotPatterns] :: TerEnv -> Bool -- | Do we assume that record and data type constructors preserve -- guardedness? [terGuardingTypeConstructors] :: TerEnv -> Bool -- | Do we inline with functions to enhance termination checking of with? [terInlineWithFunctions] :: TerEnv -> Bool -- | The name of size successor, if any. [terSizeSuc] :: TerEnv -> Maybe QName -- | The name of the delay constructor (sharp), if any. [terSharp] :: TerEnv -> Maybe QName -- | Depth at which to cut off the structural order. [terCutOff] :: TerEnv -> CutOff -- | The name of the function we are currently checking. [terCurrent] :: TerEnv -> QName -- | The names of the functions in the mutual block we are checking. This -- includes the internally generated functions (with, extendedlambda, -- coinduction). [terMutual] :: TerEnv -> MutualNames -- | The list of name actually appearing in the file (abstract syntax). -- Excludes the internally generated functions. [terUserNames] :: TerEnv -> [QName] -- | Does the actual clause result from with-inlining? (If yes, it may be -- ill-typed.) [terHaveInlinedWith] :: TerEnv -> Bool -- | Target type of the function we are currently termination checking. -- Only the constructors of Target are considered guarding. [terTarget] :: TerEnv -> Maybe Target -- | Are we checking a delayed definition? [terDelayed] :: TerEnv -> Delayed -- | Only consider the notMasked False arguments for -- establishing termination. See issue #1023. [terMaskArgs] :: TerEnv -> [Bool] -- | Only consider guardedness if False (not masked). [terMaskResult] :: TerEnv -> Bool -- | How many SIZELT relations do we have in the context (= clause -- telescope). Used to approximate termination for metas in call args. [_terSizeDepth] :: TerEnv -> Int -- | The patterns of the clause we are checking. [terPatterns] :: TerEnv -> MaskedDeBruijnPatterns -- | Number of additional binders we have gone under (and consequently need -- to raise the patterns to compare to terms). Updated during call graph -- extraction, hence strict. [terPatternsRaise] :: TerEnv -> !Int -- | The current guardedness status. Changes as we go deeper into the term. -- Updated during call graph extraction, hence strict. [terGuarded] :: TerEnv -> !Guarded -- | When extracting usable size variables during construction of the call -- matrix, can we take the variable for use with SIZELT constraints from -- the context? Yes, if we are under an inductive constructor. No, if we -- are under a record constructor. (See issue #1015). [terUseSizeLt] :: TerEnv -> Bool -- | Pattern variables that can be compared to argument variables using -- SIZELT. [terUsableVars] :: TerEnv -> VarSet -- | An empty termination environment. -- -- Values are set to a safe default meaning that with these initial -- values the termination checker will not miss termination errors it -- would have seen with better settings of these values. -- -- Values that do not have a safe default are set to IMPOSSIBLE. defaultTerEnv :: TerEnv -- | Termination monad service class. class (Functor m, Monad m) => MonadTer m terAsk :: MonadTer m => m TerEnv terLocal :: MonadTer m => (TerEnv -> TerEnv) -> m a -> m a terAsks :: MonadTer m => (TerEnv -> a) -> m a -- | Termination monad. newtype TerM a TerM :: ReaderT TerEnv TCM a -> TerM a [terM] :: TerM a -> ReaderT TerEnv TCM a -- | Generic run method for termination monad. runTer :: TerEnv -> TerM a -> TCM a -- | Run TerM computation in default environment (created from options). runTerDefault :: TerM a -> TCM a terGetGuardingTypeConstructors :: TerM Bool terGetInlineWithFunctions :: TerM Bool terGetUseDotPatterns :: TerM Bool terSetUseDotPatterns :: Bool -> TerM a -> TerM a terGetSizeSuc :: TerM (Maybe QName) terGetCurrent :: TerM QName terSetCurrent :: QName -> TerM a -> TerM a terGetSharp :: TerM (Maybe QName) terGetCutOff :: TerM CutOff terGetMutual :: TerM MutualNames terGetUserNames :: TerM [QName] terGetTarget :: TerM (Maybe Target) terSetTarget :: Maybe Target -> TerM a -> TerM a terGetHaveInlinedWith :: TerM Bool terSetHaveInlinedWith :: TerM a -> TerM a terGetDelayed :: TerM Delayed terSetDelayed :: Delayed -> TerM a -> TerM a terGetMaskArgs :: TerM [Bool] terSetMaskArgs :: [Bool] -> TerM a -> TerM a terGetMaskResult :: TerM Bool terSetMaskResult :: Bool -> TerM a -> TerM a terGetPatterns :: TerM (MaskedDeBruijnPatterns) terSetPatterns :: MaskedDeBruijnPatterns -> TerM a -> TerM a terRaise :: TerM a -> TerM a terGetGuarded :: TerM Guarded terModifyGuarded :: (Order -> Order) -> TerM a -> TerM a terSetGuarded :: Order -> TerM a -> TerM a terUnguarded :: TerM a -> TerM a -- | Should the codomain part of a function type preserve guardedness? terPiGuarded :: TerM a -> TerM a -- | Lens for _terSizeDepth. terSizeDepth :: Lens' Int TerEnv -- | Lens for terUsableVars. terGetUsableVars :: TerM VarSet terModifyUsableVars :: (VarSet -> VarSet) -> TerM a -> TerM a terSetUsableVars :: VarSet -> TerM a -> TerM a -- | Lens for terUseSizeLt. terGetUseSizeLt :: TerM Bool terModifyUseSizeLt :: (Bool -> Bool) -> TerM a -> TerM a terSetUseSizeLt :: Bool -> TerM a -> TerM a -- | Compute usable vars from patterns and run subcomputation. withUsableVars :: UsableSizeVars a => a -> TerM b -> TerM b -- | Set terUseSizeLt when going under constructor c. conUseSizeLt :: QName -> TerM a -> TerM a -- | Set terUseSizeLt for arguments following projection q. -- We disregard j<i after a non-coinductive projection. However, the -- projection need not be recursive (Issue 1470). projUseSizeLt :: QName -> TerM a -> TerM a -- | For termination checking purposes flat should not be considered a -- projection. That is, it flat doesn't preserve either structural order -- or guardedness like other projections do. Andreas, 2012-06-09: the -- same applies to projections of recursive records. isProjectionButNotCoinductive :: MonadTCM tcm => QName -> tcm Bool -- | Check whether a projection belongs to a coinductive record and is -- actually recursive. E.g. @ isCoinductiveProjection (Stream.head) = -- return False -- -- isCoinductiveProjection (Stream.tail) = return True @ isCoinductiveProjection :: MonadTCM tcm => Bool -> QName -> tcm Bool -- | How long is the path to the deepest atomic pattern? patternDepth :: forall a. Pattern' a -> Int -- | A dummy pattern used to mask a pattern that cannot be used for -- structural descent. unusedVar :: DeBruijnPattern -- | Extract variables from DeBruijnPatterns that could witness a -- decrease via a SIZELT constraint. -- -- These variables must be under an inductive constructor (with no record -- constructor in the way), or after a coinductive projection (with no -- inductive one in the way). class UsableSizeVars a usableSizeVars :: UsableSizeVars a => a -> TerM VarSet type MaskedDeBruijnPatterns = [Masked DeBruijnPattern] data Masked a Masked :: Bool -> a -> Masked a -- | True if thing not eligible for structural descent. [getMask] :: Masked a -> Bool -- | Thing. [getMasked] :: Masked a -> a masked :: a -> Masked a notMasked :: a -> Masked a -- | The call information is stored as free monoid over CallInfo. As -- long as we never look at it, only accumulate it, it does not matter -- whether we use Set, (nub) list, or Tree. Internally, -- due to lazyness, it is anyway a binary tree of mappend nodes -- and singleton leafs. Since we define no order on CallInfo -- (expensive), we cannot use a Set or nub list. -- Performance-wise, I could not see a difference between Set and list. newtype CallPath CallPath :: [CallInfo] -> CallPath [callInfos] :: CallPath -> [CallInfo] -- | A very crude way of estimating the SIZELT chains i > j -- > k in context. Returns 3 in this case. Overapproximates. terSetSizeDepth :: Telescope -> TerM a -> TerM a instance Agda.Syntax.Abstract.AllNames Agda.Termination.Monad.CallPath instance GHC.Base.Monoid Agda.Termination.Monad.CallPath instance GHC.Base.Semigroup Agda.Termination.Monad.CallPath instance GHC.Show.Show Agda.Termination.Monad.CallPath instance Agda.TypeChecking.Monad.Debug.MonadDebug Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.HasOptions Agda.Termination.Monad.TerM instance Agda.Utils.Benchmark.MonadBench Agda.Benchmarking.Phase Agda.Termination.Monad.TerM instance GHC.Base.Monad Agda.Termination.Monad.TerM instance GHC.Base.Applicative Agda.Termination.Monad.TerM instance GHC.Base.Functor Agda.Termination.Monad.TerM instance Data.Traversable.Traversable Agda.Termination.Monad.Masked instance Data.Foldable.Foldable Agda.Termination.Monad.Masked instance GHC.Base.Functor Agda.Termination.Monad.Masked instance GHC.Show.Show a => GHC.Show.Show (Agda.Termination.Monad.Masked a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Agda.Termination.Monad.Masked a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Agda.Termination.Monad.Masked a) instance Agda.Utils.Pretty.Pretty Agda.Termination.Monad.CallPath instance Agda.Termination.Monad.MonadTer Agda.Termination.Monad.TerM instance Agda.Termination.Monad.UsableSizeVars Agda.Syntax.Internal.DeBruijnPattern instance Agda.Termination.Monad.UsableSizeVars [Agda.Syntax.Internal.DeBruijnPattern] instance Agda.Termination.Monad.UsableSizeVars (Agda.Termination.Monad.Masked Agda.Syntax.Internal.DeBruijnPattern) instance Agda.Termination.Monad.UsableSizeVars Agda.Termination.Monad.MaskedDeBruijnPatterns instance Control.Monad.Reader.Class.MonadReader Agda.TypeChecking.Monad.Base.TCEnv Agda.Termination.Monad.TerM instance Control.Monad.State.Class.MonadState Agda.TypeChecking.Monad.Base.TCState Agda.Termination.Monad.TerM instance Control.Monad.IO.Class.MonadIO Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Base.MonadTCM Agda.Termination.Monad.TerM instance Control.Monad.Error.Class.MonadError Agda.TypeChecking.Monad.Base.TCErr Agda.Termination.Monad.TerM instance Agda.TypeChecking.Monad.Signature.HasConstInfo Agda.Termination.Monad.TerM instance GHC.Base.Semigroup m => GHC.Base.Semigroup (Agda.Termination.Monad.TerM m) instance (GHC.Base.Semigroup m, GHC.Base.Monoid m) => GHC.Base.Monoid (Agda.Termination.Monad.TerM m) instance Agda.Utils.Functor.Decoration Agda.Termination.Monad.Masked instance Agda.TypeChecking.Pretty.PrettyTCM a => Agda.TypeChecking.Pretty.PrettyTCM (Agda.Termination.Monad.Masked a) -- | This module defines an inlining transformation on clauses that's run -- before termination checking. The purpose is to improve termination -- checking of with clauses (issue 59). The transformation inlines -- generated with-functions expanding the clauses of the parent function -- in such a way that termination checking the expanded clauses -- guarantees termination of the original function, while allowing more -- terminating functions to be accepted. It does in no way pretend to -- preserve the semantics of the original function. -- -- Roughly, the source program -- --
-- f ps with as -- {f ps₁i qsi = bi} ---- -- is represented internally as -- --
-- f ps = f-aux xs as where xs = vars(ps) -- {f-aux ps₂i qsi = bi} where ps₁i = ps[ps₂i/xs] ---- -- The inlining transformation turns this into -- --
-- {f ps = aj} for aj ∈ as -- {f ps₁i qsi = bi} ---- -- The first set of clauses, called withExprClauses, ensure that -- we don't forget any recursive calls in as. The second set of -- clauses, henceforth called inlinedClauses, are the -- surface-level clauses the user sees (and probably reasons about). -- -- The reason this works is that there is a single call site for each -- with-function. -- -- Note that the lhss of the inlined clauses are not type-correct, -- neither with the type of f (since there are additional -- patterns qsi) nor with the type of f-aux (since -- there are the surface-level patterns ps₁i instead of the -- actual patterns ps₂i). module Agda.Termination.Inlining -- | Returns Nothing if no inlining happened, otherwise, the new -- clauses. inlineWithClauses :: QName -> Clause -> TCM (Maybe [Clause]) isWithFunction :: MonadTCM tcm => QName -> tcm (Maybe QName) expandWithFunctionCall :: QName -> Elims -> TCM Term module Agda.Termination.TermCheck -- | Entry point: Termination check a single declaration. -- -- Precondition: envMutualBlock must be set correctly. termDecl :: Declaration -> TCM Result -- | Entry point: Termination check the current mutual block. termMutual :: [QName] -> TCM Result -- | The result of termination checking a module. Must be a Monoid -- and have Singleton. type Result = [TerminationError] instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Level 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.Common.Dom a) instance Agda.Termination.TermCheck.ExtractCalls a => Agda.Termination.TermCheck.ExtractCalls (Agda.Syntax.Internal.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 Agda.Syntax.Internal.Sort instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Type instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.Term instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.PlusLevel instance Agda.Termination.TermCheck.ExtractCalls Agda.Syntax.Internal.LevelAtom 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 module Agda.TypeChecking.Rules.Decl -- | Cached checkDecl checkDeclCached :: Declaration -> TCM () -- | Type check a sequence of declarations. checkDecls :: [Declaration] -> TCM () -- | Type check a single declaration. checkDecl :: Declaration -> TCM () mutualChecks :: MutualInfo -> Declaration -> [Declaration] -> MutualId -> Set QName -> TCM () -- | Check if there is a inferred eta record type in the mutual block. If -- yes, repeat the record pattern translation for all function -- definitions in the block. This is necessary since the original record -- pattern translation will have skipped record patterns of the new -- record types (as eta was off for them). See issue 2197). revisitRecordPatternTranslation :: [QName] -> TCM () type FinalChecks = Maybe (TCM ()) checkUnquoteDecl :: MutualInfo -> [DefInfo] -> [QName] -> Expr -> TCM FinalChecks checkUnquoteDef :: [DefInfo] -> [QName] -> Expr -> TCM () -- | Run a reflected TCM computatation expected to define a given list of -- names. unquoteTop :: [QName] -> Expr -> TCM [QName] -- | Instantiate all metas in Definition associated to QName. -- Makes sense after freezing metas. Some checks, like free variable -- analysis, are not in TCM, so they will be more precise (see -- issue 1099) after meta instantiation. Precondition: name has been -- added to signature already. instantiateDefinitionType :: QName -> TCM () -- | Highlight a declaration. highlight_ :: Declaration -> TCM () -- | Termination check a declaration. checkTermination_ :: Declaration -> TCM () -- | Check a set of mutual names for positivity. checkPositivity_ :: MutualInfo -> Set QName -> TCM () -- | Check that all coinductive records are actually recursive. (Otherwise, -- one can implement invalid recursion schemes just like for the old -- coinduction.) checkCoinductiveRecords :: [Declaration] -> TCM () -- | Check a set of mutual names for constructor-headedness. checkInjectivity_ :: Set QName -> TCM () -- | Check a set of mutual names for projection likeness. -- -- Only a single, non-abstract function can be projection-like. Making an -- abstract function projection-like would break the invariant that the -- type of the principle argument of a projection-like function is always -- inferable. checkProjectionLikeness_ :: Set QName -> TCM () -- | Freeze metas created by given computation if in abstract mode. whenAbstractFreezeMetasAfter :: DefInfo -> TCM a -> TCM a -- | Type check an axiom. checkAxiom :: Axiom -> DefInfo -> ArgInfo -> Maybe [Occurrence] -> QName -> Expr -> TCM () -- | Type check a primitive function declaration. checkPrimitive :: DefInfo -> QName -> Expr -> TCM () assertCurrentModule :: QName -> String -> TCM () -- | Check a pragma. checkPragma :: Range -> Pragma -> TCM () -- | Type check a bunch of mutual inductive recursive definitions. -- -- All definitions which have so far been assigned to the given mutual -- block are returned. checkMutual :: MutualInfo -> [Declaration] -> TCM (MutualId, Set QName) -- | Type check the type signature of an inductive or recursive definition. checkTypeSignature :: TypeSignature -> TCM () -- | Type check a module. checkSection :: ModuleInfo -> ModuleName -> Telescope -> [Declaration] -> TCM () -- | Helper for checkSectionApplication. -- -- Matches the arguments of the module application with the module -- parameters. -- -- Returns the remaining module parameters as an open telescope. Warning: -- the returned telescope is not the final result, an actual -- instantiation of the parameters does not occur. checkModuleArity :: ModuleName -> Telescope -> [NamedArg Expr] -> TCM Telescope -- | Check an application of a section (top-level function, includes -- traceCall). checkSectionApplication :: ModuleInfo -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> TCM () -- | Check an application of a section. checkSectionApplication' :: ModuleInfo -> ModuleName -> ModuleApplication -> ScopeCopyInfo -> TCM () -- | Type check an import declaration. Actually doesn't do anything, since -- all the work is done when scope checking. checkImport :: ModuleInfo -> ModuleName -> TCM () class ShowHead a showHead :: ShowHead a => a -> String debugPrintDecl :: Declaration -> TCM () instance Agda.TypeChecking.Rules.Decl.ShowHead Agda.Syntax.Abstract.Declaration module Agda.TheTypeChecker -- | Type check a sequence of declarations. checkDecls :: [Declaration] -> TCM () -- | Type check a single declaration. checkDecl :: Declaration -> TCM () -- | Cached checkDecl checkDeclCached :: Declaration -> TCM () -- | Infer the type of an expression. Implemented by checking against a -- meta variable. Except for neutrals, for them a polymorphic type is -- inferred. inferExpr :: Expr -> TCM (Term, Type) -- | Type check an expression. checkExpr :: Expr -> Type -> TCM Term module Agda.Compiler.Treeless.Erase eraseTerms :: QName -> TTerm -> TCM TTerm -- | Takes the name of the data/record type. computeErasedConstructorArgs :: QName -> TCM () instance GHC.Show.Show Agda.Compiler.Treeless.Erase.TypeInfo instance GHC.Classes.Eq Agda.Compiler.Treeless.Erase.TypeInfo module Agda.Compiler.ToTreeless -- | Converts compiled clauses to treeless syntax. -- -- Note: Do not use any of the concrete names in the returned term for -- identification purposes! If you wish to do so, first apply the -- Agda.Compiler.Treeless.NormalizeNames transformation. toTreeless :: QName -> TCM (Maybe TTerm) closedTermToTreeless :: Term -> TCM TTerm module Agda.Syntax.Abstract.Copatterns translateCopatternClauses :: [Clause] -> ScopeM (Delayed, [Clause]) instance GHC.Classes.Ord Agda.Syntax.Abstract.Copatterns.ProjEntry instance GHC.Classes.Eq Agda.Syntax.Abstract.Copatterns.ProjEntry instance GHC.Base.Functor (Agda.Syntax.Abstract.Copatterns.Path a) instance Agda.Syntax.Abstract.Copatterns.Alpha Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Abstract.Copatterns.Alpha (Agda.Syntax.Abstract.Pattern' e) instance Agda.Syntax.Abstract.Copatterns.Alpha (Agda.Syntax.Abstract.LHSCore' e) instance Agda.Syntax.Abstract.Copatterns.Alpha Agda.Syntax.Abstract.LHS instance Agda.Syntax.Abstract.Copatterns.Alpha a => Agda.Syntax.Abstract.Copatterns.Alpha (Agda.Syntax.Common.Arg a) instance (GHC.Classes.Eq n, Agda.Syntax.Abstract.Copatterns.Alpha a) => Agda.Syntax.Abstract.Copatterns.Alpha (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Abstract.Copatterns.Alpha a => Agda.Syntax.Abstract.Copatterns.Alpha [a] instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.BindName instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Expr instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Abstract.Copatterns.Rename a => Agda.Syntax.Abstract.Copatterns.Rename (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.LetBinding instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.LamBinding instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.TypedBindings instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.ProblemEq instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Clause instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.RHS instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.WhereDeclarations instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.LHS instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.LHSCore instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Pattern instance Agda.Syntax.Abstract.Copatterns.Rename Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Abstract.Copatterns.Rename a => Agda.Syntax.Abstract.Copatterns.Rename (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Abstract.Copatterns.Rename a => Agda.Syntax.Abstract.Copatterns.Rename (Agda.Syntax.Common.Named n a) instance Agda.Syntax.Abstract.Copatterns.Rename a => Agda.Syntax.Abstract.Copatterns.Rename [a] instance (Agda.Syntax.Abstract.Copatterns.Rename a, Agda.Syntax.Abstract.Copatterns.Rename b) => Agda.Syntax.Abstract.Copatterns.Rename (Data.Either.Either a b) instance (Agda.Syntax.Abstract.Copatterns.Rename a, Agda.Syntax.Abstract.Copatterns.Rename b) => Agda.Syntax.Abstract.Copatterns.Rename (a, b) instance Agda.Syntax.Position.HasRange Agda.Syntax.Abstract.Copatterns.ProjEntry -- | 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 into an application. parseApplication :: [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 module Agda.Syntax.IdiomBrackets parseIdiomBrackets :: 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 -> [DoStmt] -> ScopeM Expr -- | Translation from Agda.Syntax.Concrete to -- Agda.Syntax.Abstract. Involves scope analysis, figuring out -- infix operator precedences and tidying up definitions. module Agda.Syntax.Translation.ConcreteToAbstract -- | Things that can be translated to abstract syntax are instances of this -- class. class ToAbstract concrete abstract | concrete -> abstract toAbstract :: ToAbstract concrete abstract => concrete -> ScopeM abstract -- | This operation does not affect the scope, i.e. the original scope is -- restored upon completion. localToAbstract :: ToAbstract c a => c -> (a -> ScopeM b) -> ScopeM b concreteToAbstract_ :: ToAbstract c a => c -> ScopeM a concreteToAbstract :: ToAbstract c a => ScopeInfo -> c -> ScopeM a newtype NewModuleQName NewModuleQName :: QName -> NewModuleQName newtype OldName a OldName :: a -> OldName a -- | Temporary data type to scope check a file. data TopLevel a TopLevel :: AbsolutePath -> TopLevelModuleName -> a -> TopLevel a -- | The file path from which we loaded this module. [topLevelPath] :: TopLevel a -> AbsolutePath -- | The expected module name (coming from the import statement that -- triggered scope checking this file). [topLevelExpectedName] :: TopLevel a -> TopLevelModuleName -- | The file content. [topLevelTheThing] :: TopLevel a -> a data TopLevelInfo TopLevelInfo :: [Declaration] -> ScopeInfo -> TopLevelInfo [topLevelDecls] :: TopLevelInfo -> [Declaration] -- | as seen from inside the module [topLevelScope] :: TopLevelInfo -> ScopeInfo -- | The top-level module name. topLevelModuleName :: TopLevelInfo -> ModuleName data AbstractRHS data NewModuleName data OldModuleName data NewName a data OldQName data LeftHandSide data RightHandSide data PatName data APatName data LetDef data LetDefs instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Pragma [Agda.Syntax.Abstract.Pragma] instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Definitions.Clause Agda.Syntax.Abstract.Clause instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.LeftHandSide Agda.Syntax.Abstract.LHS instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.AbstractRHS Agda.Syntax.Abstract.RHS instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.RightHandSide Agda.Syntax.Translation.ConcreteToAbstract.AbstractRHS instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.RHS Agda.Syntax.Translation.ConcreteToAbstract.AbstractRHS instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Definitions.NiceDeclaration Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.ConstrDecl Agda.Syntax.Abstract.Declaration instance Agda.Syntax.Translation.ConcreteToAbstract.LivesInCurrentModule Agda.Syntax.Scope.Base.AbstractName instance Agda.Syntax.Translation.ConcreteToAbstract.LivesInCurrentModule Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.Blind a) (Agda.Syntax.Translation.ConcreteToAbstract.Blind a) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.LetDefs [Agda.Syntax.Abstract.LetBinding] instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.LetDef [Agda.Syntax.Abstract.LetBinding] instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Expr Agda.Syntax.Abstract.Expr instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.TypedBinding Agda.Syntax.Abstract.TypedBinding instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.TopLevel [Agda.Syntax.Concrete.Declaration]) Agda.Syntax.Translation.ConcreteToAbstract.TopLevelInfo instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms Agda.Syntax.Concrete.TypedBinding instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms (Agda.Syntax.Concrete.LamBinding' a) instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms (Agda.Syntax.Concrete.TypedBindings' a) instance Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms a => Agda.Syntax.Translation.ConcreteToAbstract.EnsureNoLetStms [a] instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.OldModuleName Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.ModuleAssignment (Agda.Syntax.Abstract.Name.ModuleName, [Agda.Syntax.Abstract.LetBinding]) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.NewModuleQName Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.NewModuleName Agda.Syntax.Abstract.Name.ModuleName instance Agda.Syntax.Translation.ConcreteToAbstract.ToQName Agda.Syntax.Concrete.Name.Name instance Agda.Syntax.Translation.ConcreteToAbstract.ToQName Agda.Syntax.Concrete.Name.QName instance (GHC.Show.Show a, Agda.Syntax.Translation.ConcreteToAbstract.ToQName a) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.OldName a) Agda.Syntax.Abstract.Name.QName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.PatName Agda.Syntax.Translation.ConcreteToAbstract.APatName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.ResolveQName Agda.Syntax.Scope.Base.ResolvedName instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.LHSCore (Agda.Syntax.Abstract.LHSCore' Agda.Syntax.Concrete.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Translation.ConcreteToAbstract.OldQName Agda.Syntax.Abstract.Expr instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.Pattern (Agda.Syntax.Abstract.Pattern' Agda.Syntax.Concrete.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.NewName Agda.Syntax.Concrete.Name.Name) Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Translation.ConcreteToAbstract.NewName Agda.Syntax.Concrete.BoundName) Agda.Syntax.Abstract.Name.Name instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.LamBinding Agda.Syntax.Abstract.LamBinding instance (Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c1 a1, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c2 a2) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (c1, c2) (a1, a2) instance (Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c1 a1, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c2 a2, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c3 a3) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (c1, c2, c3) (a1, a2, a3) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c a => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract [c] [a] instance (Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c1 a1, Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c2 a2) => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Data.Either.Either c1 c2) (Data.Either.Either a1 a2) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c a => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (GHC.Base.Maybe c) (GHC.Base.Maybe a) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c a => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Concrete.FieldAssignment' c) (Agda.Syntax.Concrete.FieldAssignment' a) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.TypedBindings Agda.Syntax.Abstract.TypedBindings instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract [Agda.Syntax.Concrete.Declaration] [Agda.Syntax.Abstract.Declaration] instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c a => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.WithHiding c) (Agda.Syntax.Common.WithHiding a) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c a => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.Arg c) (Agda.Syntax.Common.Arg a) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract c a => Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Common.Named name c) (Agda.Syntax.Common.Named name a) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Abstract.LHSCore' Agda.Syntax.Concrete.Expr) (Agda.Syntax.Abstract.LHSCore' Agda.Syntax.Abstract.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract (Agda.Syntax.Abstract.Pattern' Agda.Syntax.Concrete.Expr) (Agda.Syntax.Abstract.Pattern' Agda.Syntax.Abstract.Expr) instance Agda.Syntax.Translation.ConcreteToAbstract.ToAbstract Agda.Syntax.Concrete.HoleContent Agda.Syntax.Abstract.HoleContent module Agda.Interaction.BasicOps -- | Parses an expression. parseExpr :: Range -> String -> TCM Expr parseExprIn :: InteractionId -> Range -> String -> TCM Expr giveExpr :: UseForce -> Maybe InteractionId -> MetaId -> Expr -> TCM () -- | After a give, redo termination etc. checks for function which was -- complemented. redoChecks :: Maybe InteractionId -> TCM () -- | Try to fill hole by expression. -- -- Returns the given expression unchanged (for convenient generalization -- to refine). give :: UseForce -> InteractionId -> Maybe Range -> Expr -> TCM Expr -- | Try to refine hole by expression e. -- -- This amounts to successively try to give e, e ?, -- e ? ?, ... Returns the successfully given expression. refine :: UseForce -> InteractionId -> Maybe Range -> Expr -> TCM Expr -- | Evaluate the given expression in the current environment evalInCurrent :: Expr -> TCM Expr evalInMeta :: InteractionId -> Expr -> TCM Expr -- | Modifier for interactive commands, specifying the amount of -- normalization in the output. data Rewrite AsIs :: Rewrite Instantiated :: Rewrite HeadNormal :: Rewrite Simplified :: Rewrite Normalised :: Rewrite normalForm :: (Reduce t, Simplify t, Normalise t) => Rewrite -> t -> TCM t -- | Modifier for the interactive computation command, specifying the mode -- of computation and result display. data ComputeMode DefaultCompute :: ComputeMode IgnoreAbstract :: ComputeMode UseShowInstance :: ComputeMode computeIgnoreAbstract :: ComputeMode -> Bool computeWrapInput :: ComputeMode -> String -> String showComputed :: ComputeMode -> Expr -> TCM Doc -- | Modifier for interactive commands, specifying whether safety checks -- should be ignored. data UseForce -- | Ignore additional checks, like termination/positivity... WithForce :: UseForce -- | Don't ignore any checks. WithoutForce :: UseForce data OutputForm a b OutputForm :: Range -> [ProblemId] -> (OutputConstraint a b) -> OutputForm a b data OutputConstraint a b OfType :: b -> a -> OutputConstraint a b CmpInType :: Comparison -> a -> b -> b -> OutputConstraint a b CmpElim :: [Polarity] -> a -> [b] -> [b] -> OutputConstraint a b JustType :: b -> OutputConstraint a b CmpTypes :: Comparison -> b -> b -> OutputConstraint a b CmpLevels :: Comparison -> b -> b -> OutputConstraint a b CmpTeles :: Comparison -> b -> b -> OutputConstraint a b JustSort :: b -> OutputConstraint a b CmpSorts :: Comparison -> b -> b -> OutputConstraint a b Guard :: (OutputConstraint a b) -> ProblemId -> OutputConstraint a b Assign :: b -> a -> OutputConstraint a b TypedAssign :: b -> a -> a -> OutputConstraint a b PostponedCheckArgs :: b -> [a] -> a -> a -> OutputConstraint a b IsEmptyType :: a -> OutputConstraint a b SizeLtSat :: a -> OutputConstraint a b FindInScopeOF :: b -> a -> [(a, a)] -> OutputConstraint a b PTSInstance :: b -> b -> OutputConstraint a b -- | A subset of OutputConstraint. data OutputConstraint' a b OfType' :: b -> a -> OutputConstraint' a b [ofName] :: OutputConstraint' a b -> b [ofExpr] :: OutputConstraint' a b -> a outputFormId :: OutputForm a b -> b reifyElimToExpr :: Elim -> TCM Expr showComparison :: Comparison -> String getConstraints :: TCM [OutputForm Expr Expr] -- | getSolvedInteractionPoints True returns all solutions, even -- if just solved by another, non-interaction meta. -- -- getSolvedInteractionPoints False only returns metas that are -- solved by a non-meta. getSolvedInteractionPoints :: Bool -> Rewrite -> TCM [(InteractionId, MetaId, Expr)] typeOfMetaMI :: Rewrite -> MetaId -> TCM (OutputConstraint Expr NamedMeta) typeOfMeta :: Rewrite -> InteractionId -> TCM (OutputConstraint Expr InteractionId) typeOfMeta' :: Rewrite -> (InteractionId, MetaId) -> TCM (OutputConstraint Expr InteractionId) typesOfVisibleMetas :: Rewrite -> TCM [OutputConstraint Expr InteractionId] typesOfHiddenMetas :: Rewrite -> TCM [OutputConstraint Expr NamedMeta] metaHelperType :: Rewrite -> InteractionId -> Range -> String -> TCM (OutputConstraint' Expr Expr) contextOfMeta :: InteractionId -> Rewrite -> TCM [OutputConstraint' Expr Name] -- | Returns the type of the expression in the current environment We wake -- up irrelevant variables just in case the user want to invoke that -- command in an irrelevant context. typeInCurrent :: Rewrite -> Expr -> TCM Expr typeInMeta :: InteractionId -> Rewrite -> Expr -> TCM Expr withInteractionId :: InteractionId -> TCM a -> TCM a withMetaId :: MetaId -> TCM a -> TCM a introTactic :: Bool -> InteractionId -> TCM [String] -- | Runs the given computation as if in an anonymous goal at the end of -- the top-level module. -- -- Sets up current module, scope, and context. atTopLevel :: TCM a -> TCM a -- | Parse a name. parseName :: Range -> String -> TCM QName -- | Check whether an expression is a (qualified) identifier. isQName :: Expr -> Maybe QName -- | Returns the contents of the given module or record. moduleContents :: Rewrite -> Range -> String -> TCM ([Name], [(Name, Type)]) -- | Returns the contents of the given record identifier. getRecordContents :: Rewrite -> Expr -> TCM ([Name], [(Name, Type)]) -- | Returns the contents of the given module. getModuleContents :: Rewrite -> QName -> TCM ([Name], [(Name, Type)]) whyInScope :: String -> TCM (Maybe LocalVar, [AbstractName], [AbstractModule]) instance GHC.Base.Functor (Agda.Interaction.BasicOps.OutputForm a) instance GHC.Base.Functor (Agda.Interaction.BasicOps.OutputConstraint a) instance GHC.Show.Show Agda.Interaction.BasicOps.UseForce instance GHC.Read.Read Agda.Interaction.BasicOps.UseForce instance GHC.Classes.Eq Agda.Interaction.BasicOps.UseForce instance GHC.Classes.Eq Agda.Interaction.BasicOps.ComputeMode instance GHC.Read.Read Agda.Interaction.BasicOps.ComputeMode instance GHC.Show.Show Agda.Interaction.BasicOps.ComputeMode instance GHC.Read.Read Agda.Interaction.BasicOps.Rewrite instance GHC.Show.Show Agda.Interaction.BasicOps.Rewrite instance (Agda.Utils.Pretty.Pretty a, Agda.Utils.Pretty.Pretty b) => Agda.Utils.Pretty.Pretty (Agda.Interaction.BasicOps.OutputConstraint' a b) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete b d) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Interaction.BasicOps.OutputConstraint' a b) (Agda.Interaction.BasicOps.OutputConstraint' c d) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.ProblemConstraint (Agda.TypeChecking.Monad.Base.Closure (Agda.Interaction.BasicOps.OutputForm Agda.Syntax.Abstract.Expr Agda.Syntax.Abstract.Expr)) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Interaction.BasicOps.OutputForm a b) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete b d) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Interaction.BasicOps.OutputForm a b) (Agda.Interaction.BasicOps.OutputForm c d) instance Agda.Syntax.Translation.InternalToAbstract.Reify Agda.TypeChecking.Monad.Base.Constraint (Agda.Interaction.BasicOps.OutputConstraint Agda.Syntax.Abstract.Expr Agda.Syntax.Abstract.Expr) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Agda.Interaction.BasicOps.OutputConstraint a b) instance (Agda.Syntax.Translation.AbstractToConcrete.ToConcrete a c, Agda.Syntax.Translation.AbstractToConcrete.ToConcrete b d) => Agda.Syntax.Translation.AbstractToConcrete.ToConcrete (Agda.Interaction.BasicOps.OutputConstraint a b) (Agda.Interaction.BasicOps.OutputConstraint c d) module Agda.Interaction.SearchAbout findMentions :: Rewrite -> Range -> String -> ScopeM [(Name, Type)] module Agda.Interaction.CommandLine data ExitCode a Continue :: ExitCode a ContinueIn :: TCEnv -> ExitCode a Return :: a -> ExitCode a type Command a = (String, [String] -> TCM (ExitCode a)) matchCommand :: String -> [Command a] -> Either [String] ([String] -> TCM (ExitCode a)) interaction :: String -> [Command a] -> (String -> TCM (ExitCode a)) -> IM a -- | The interaction loop. interactionLoop :: TCM (Maybe Interface) -> IM () continueAfter :: TCM a -> TCM (ExitCode b) -- | Set envCurrentPath to optInputFile. withCurrentFile :: TCM a -> TCM a loadFile :: TCM () -> [String] -> TCM () showConstraints :: [String] -> TCM () showMetas :: [String] -> TCM () showScope :: TCM () metaParseExpr :: InteractionId -> String -> TCM Expr actOnMeta :: [String] -> (InteractionId -> Expr -> TCM a) -> TCM a giveMeta :: [String] -> TCM () refineMeta :: [String] -> TCM () retryConstraints :: TCM () evalIn :: [String] -> TCM () parseExpr :: String -> TCM Expr evalTerm :: String -> TCM (ExitCode a) typeOf :: [String] -> TCM () typeIn :: [String] -> TCM () showContext :: [String] -> TCM () -- | The logo that prints when Agda is started in interactive mode. splashScreen :: String -- | The help message help :: [Command a] -> IO () module Agda.Interaction.MakeCase type CaseContext = Maybe ExtLamInfo -- | Parse variables (visible or hidden), returning their de Bruijn -- indices. Used in makeCase. parseVariables :: QName -> Telescope -> InteractionId -> Range -> [String] -> TCM [Int] -- | Lookup the clause for an interaction point in the signature. Returns -- the CaseContext, the clause itself, and a list of previous clauses getClauseForIP :: QName -> Int -> TCM (CaseContext, Clause, [Clause]) -- | Entry point for case splitting tactic. makeCase :: InteractionId -> Range -> String -> TCM (QName, CaseContext, [Clause]) -- | Make the given pattern variables visible by marking their origin as -- CaseSplit and pattern origin as PatOSplit in the -- SplitClause. makePatternVarsVisible :: [Nat] -> SplitClause -> SplitClause -- | Make clause with no rhs (because of absurd match). makeAbsurdClause :: QName -> SplitClause -> TCM Clause -- | Make a clause with a question mark as rhs. makeAbstractClause :: QName -> RHS -> SplitClause -> TCM Clause module Agda.Auto.Convert data Hint Hint :: Bool -> QName -> Hint [hintIsConstructor] :: Hint -> Bool [hintQName] :: Hint -> QName type O = (Maybe Int, QName) data TMode TMAll :: TMode type MapS a b = (Map a b, [a]) initMapS :: MapS a b popMapS :: (S -> (a, [b])) -> ((a, [b]) -> S -> S) -> TOM (Maybe b) data S S :: MapS QName (TMode, ConstRef O) -> MapS MetaId (Metavar (Exp O) (RefInfo O), Maybe (MExp O, [MExp O]), [MetaId]) -> MapS Int (Maybe (Bool, MExp O, MExp O)) -> Maybe MetaId -> MetaId -> S [sConsts] :: S -> MapS QName (TMode, ConstRef O) [sMetas] :: S -> MapS MetaId (Metavar (Exp O) (RefInfo O), Maybe (MExp O, [MExp O]), [MetaId]) [sEqs] :: S -> MapS Int (Maybe (Bool, MExp O, MExp O)) [sCurMeta] :: S -> Maybe MetaId [sMainMeta] :: S -> MetaId type TOM = StateT S TCM type MOT = ExceptT String IO tomy :: MetaId -> [Hint] -> [Type] -> TCM ([ConstRef O], [MExp O], Map MetaId (Metavar (Exp O) (RefInfo O), MExp O, [MExp O], [MetaId]), [(Bool, MExp O, MExp O)], Map QName (TMode, ConstRef O)) getConst :: Bool -> QName -> TMode -> TOM (ConstRef O) getdfv :: MetaId -> QName -> TCM Nat getMeta :: MetaId -> TOM (Metavar (Exp O) (RefInfo O)) getEqs :: TCM [(Bool, Term, Term)] copatternsNotImplemented :: TCM a literalsNotImplemented :: TCM a class Conversion m a b convert :: Conversion m a b => a -> m b tomyIneq :: Comparison -> Bool fmType :: MetaId -> Type -> Bool fmExp :: MetaId -> Term -> Bool fmExps :: MetaId -> Args -> Bool fmLevel :: MetaId -> PlusLevel -> Bool icnvh :: Hiding -> ArgInfo frommyExps :: Nat -> MArgList O -> Term -> ExceptT String IO Term abslamvarname :: String modifyAbstractExpr :: Expr -> Expr modifyAbstractClause :: Clause -> Clause constructPats :: Map QName (TMode, ConstRef O) -> MetaId -> Clause -> TCM ([(Hiding, MId)], [CSPat O]) frommyClause :: (CSCtx O, [CSPat O], Maybe (MExp O)) -> ExceptT String IO Clause contains_constructor :: [CSPat O] -> Bool freeIn :: Nat -> MExp o -> Bool negtype :: ConstRef o -> MExp o -> MExp o findClauseDeep :: InteractionId -> TCM (Maybe (QName, Clause, Bool)) matchType :: Int -> Int -> Type -> Type -> Maybe (Nat, Nat) instance GHC.Classes.Eq Agda.Auto.Convert.TMode instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM [Agda.Syntax.Internal.Clause] [([Agda.Auto.Syntax.Pat Agda.Auto.Convert.O], Agda.Auto.Syntax.MExp Agda.Auto.Convert.O)] instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM Agda.Syntax.Internal.Clause (GHC.Base.Maybe ([Agda.Auto.Syntax.Pat Agda.Auto.Convert.O], Agda.Auto.Syntax.MExp Agda.Auto.Convert.O)) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM (Agda.Syntax.Common.Arg Agda.Syntax.Internal.Pattern) (Agda.Auto.Syntax.Pat Agda.Auto.Convert.O) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM Agda.Syntax.Internal.Type (Agda.Auto.Syntax.MExp Agda.Auto.Convert.O) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM Agda.Syntax.Internal.Term (Agda.Auto.Syntax.MExp Agda.Auto.Convert.O) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM a b => Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM (Agda.Syntax.Common.Arg a) (Agda.Syntax.Common.Hiding, b) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.TOM Agda.Syntax.Internal.Args (Agda.Auto.NarrowingSearch.MM (Agda.Auto.Syntax.ArgList Agda.Auto.Convert.O) (Agda.Auto.Syntax.RefInfo Agda.Auto.Convert.O)) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.MOT a b => Agda.Auto.Convert.Conversion Agda.Auto.Convert.MOT (Agda.Auto.NarrowingSearch.MM a (Agda.Auto.Syntax.RefInfo Agda.Auto.Convert.O)) b instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.MOT a b => Agda.Auto.Convert.Conversion Agda.Auto.Convert.MOT (Agda.Auto.Syntax.Abs a) (Agda.Syntax.Internal.Abs b) instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.MOT (Agda.Auto.Syntax.Exp Agda.Auto.Convert.O) Agda.Syntax.Internal.Type instance Agda.Auto.Convert.Conversion Agda.Auto.Convert.MOT (Agda.Auto.Syntax.Exp Agda.Auto.Convert.O) Agda.Syntax.Internal.Term module Agda.Auto.Auto -- | Entry point for Auto tactic (Agsy). -- -- If the autoMessage part of the result is set to Just -- msg, the message msg produced by Agsy should be -- displayed to the user. auto :: InteractionId -> Range -> String -> TCM AutoResult data AutoResult AutoResult :: AutoProgress -> Maybe String -> AutoResult [autoProgress] :: AutoResult -> AutoProgress [autoMessage] :: AutoResult -> Maybe String -- | Result type: Progress & potential Message for the user -- -- The of the Auto tactic can be one of the following three: -- --
-- COMPILE GHC x as f --HsExport :: Range -> HaskellCode -> HaskellPragma parsePragma :: CompilerPragma -> Either String HaskellPragma parseHaskellPragma :: CompilerPragma -> TCM HaskellPragma getHaskellPragma :: QName -> TCM (Maybe HaskellPragma) sanityCheckPragma :: Definition -> Maybe HaskellPragma -> TCM () getHaskellConstructor :: QName -> TCM (Maybe HaskellCode) -- | Get content of FOREIGN GHC pragmas, sorted by -- KindOfForeignCode: file header pragmas, import statements, -- rest. foreignHaskell :: TCM ([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 module Agda.Compiler.MAlonzo.Misc curHsMod :: TCM ModuleName ihname :: String -> Nat -> Name unqhname :: String -> QName -> Name tlmodOf :: ModuleName -> TCM ModuleName xqual :: QName -> Name -> TCM QName xhqn :: String -> QName -> TCM QName hsName :: String -> QName conhqn :: QName -> TCM QName bltQual :: String -> String -> TCM QName dname :: QName -> Name -- | Name for definition stripped of unused arguments duname :: QName -> Name hsPrimOp :: String -> QOp hsPrimOpApp :: String -> Exp -> Exp -> Exp hsInt :: Integer -> Exp hsTypedInt :: Integral a => a -> Exp hsLet :: Name -> Exp -> Exp -> Exp hsVarUQ :: Name -> Exp hsAppView :: Exp -> [Exp] hsOpToExp :: QOp -> Exp hsLambda :: [Pat] -> Exp -> Exp hsMapAlt :: (Exp -> Exp) -> Alt -> Alt hsMapRHS :: (Exp -> Exp) -> Rhs -> Rhs mazstr :: String mazName :: Name mazMod' :: String -> ModuleName mazMod :: ModuleName -> ModuleName mazerror :: String -> a mazCoerceName :: String mazErasedName :: String mazAnyTypeName :: String mazCoerce :: Exp mazIncompleteMatch :: Exp rtmIncompleteMatch :: QName -> Exp mazUnreachableError :: Exp rtmUnreachableError :: Exp mazAnyType :: Type mazRTE :: ModuleName rtmQual :: String -> QName rtmVar :: String -> Exp rtmError :: String -> Exp unsafeCoerceMod :: ModuleName fakeD :: Name -> String -> Decl fakeDS :: String -> String -> Decl fakeDQ :: QName -> String -> Decl fakeType :: String -> Type fakeExp :: String -> Exp fakeDecl :: String -> Decl emptyBinds :: Maybe Binds -- | Can the character be used in a Haskell module name part -- (conid)? This function is more restrictive than what the -- Haskell report allows. isModChar :: Char -> Bool 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 isMainFunction :: QName -> Bool hasMainFunction :: Interface -> IsMain -- | Check that the main function has type IO a, for some a. checkTypeOfMain :: QName -> Type -> TCM [Decl] -> TCM [Decl] treelessPrimName :: TPrim -> String -- | Haskell modules to be imported for BUILT-INs importsForPrim :: TCM [ModuleName] xForPrim :: [(String, TCM [a])] -> TCM [a] -- | Definition bodies for primitive functions primBody :: String -> TCM Exp noCheckCover :: QName -> TCM Bool pconName :: String -> TCM String bltQual' :: String -> String -> TCM 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 -> TCM Type checkConstructorCount :: QName -> [QName] -> [HaskellCode] -> TCM () hsTelApproximation :: Type -> TCM ([Type], Type) hsTelApproximation' :: PolyApprox -> Type -> TCM ([Type], Type) instance GHC.Classes.Eq Agda.Compiler.MAlonzo.HaskellTypes.PolyApprox -- | Function for generating highlighted and aligned LaTeX from literate -- Agda source. module Agda.Interaction.Highlighting.LaTeX -- | Generates a LaTeX file for the given interface. -- -- The underlying source file is assumed to match the interface, but this -- is not checked. TODO: Fix this problem, perhaps by storing the source -- code in the interface. generateLaTeX :: Interface -> TCM () instance GHC.Show.Show Agda.Interaction.Highlighting.LaTeX.Debug instance GHC.Classes.Eq Agda.Interaction.Highlighting.LaTeX.Debug instance GHC.Show.Show Agda.Interaction.Highlighting.LaTeX.Token instance GHC.Show.Show Agda.Interaction.Highlighting.LaTeX.Output instance GHC.Show.Show Agda.Interaction.Highlighting.LaTeX.AlignmentColumn instance GHC.Show.Show Agda.Interaction.Highlighting.LaTeX.Kind instance GHC.Classes.Eq Agda.Interaction.Highlighting.LaTeX.Kind -- | Function for generating highlighted, hyperlinked HTML from Agda -- sources. module Agda.Interaction.Highlighting.HTML -- | Generates HTML files from all the sources which have been visited -- during the type checking phase. -- -- This function should only be called after type checking has completed -- successfully. generateHTML :: TCM () -- | The name of the default CSS file. defaultCSSFile :: FilePath -- | Prepare information for HTML page generation. -- -- The page generator receives the file path of the module, the top level -- module name of the module and the highlighting information of the -- module. generateHTMLWithPageGen :: (FilePath -> TopLevelModuleName -> CompressedFile -> TCM ()) -> TCM () -- | Generates a highlighted, hyperlinked version of the given module. generatePage :: (FilePath -> FilePath -> String -> Text) -> FilePath -> TopLevelModuleName -> TCM () -- | Constructs the web page, including headers. page :: FilePath -> TopLevelModuleName -> Html -> Text -- | Constructs token stream ready to print. tokenStream :: String -> CompressedFile -> [(Int, String, Aspects)] -- | Constructs the HTML displaying the code. code :: [(Int, String, Aspects)] -> Html -- | Interface for compiler backend writers. module Agda.Compiler.Backend data Backend [Backend] :: 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 ModuleName mod -> TCM () -> env -> ModuleName -> FilePath -> TCM (Recompile menv mod) -> env -> menv -> IsMain -> ModuleName -> [def] -> TCM mod -> env -> menv -> Definition -> TCM def -> 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 ModuleName 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. [preModule] :: Backend' opts env menv mod def -> env -> ModuleName -> FilePath -> TCM (Recompile menv mod) -- | Called after all definitions of a module has been compiled. [postModule] :: Backend' opts env menv mod def -> env -> menv -> IsMain -> ModuleName -> [def] -> TCM mod -- | Compile a single definition. [compileDef] :: Backend' opts env menv mod def -> env -> menv -> Definition -> TCM def -- | True if the backend works if --only-scope-checking is used. [scopeCheckingSuffices] :: Backend' opts env menv mod def -> 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 :: QName -> TCM (Maybe TTerm) backendInteraction :: [Backend] -> (TCM (Maybe Interface) -> TCM ()) -> TCM (Maybe Interface) -> TCM () parseBackendOptions :: [Backend] -> [String] -> OptM ([Backend], CommandLineOptions) callBackend :: String -> IsMain -> Interface -> TCM () module Agda.Interaction.InteractionTop -- | Print open metas nicely. showOpenMetas :: TCM [String] data GiveRefine Give :: GiveRefine Refine :: GiveRefine Intro :: GiveRefine -- | Available backends. data CompilerBackend LaTeX :: CompilerBackend QuickLaTeX :: CompilerBackend OtherBackend :: String -> CompilerBackend -- | The Parse monad. StateT state holds the remaining input. type Parse a = ExceptT String (StateT String Identity) a -- | Used to indicate whether something should be removed or not. data Remove Remove :: Remove Keep :: Remove data IOTCM' range IOTCM :: FilePath -> HighlightingLevel -> HighlightingMethod -> (Interaction' range) -> IOTCM' range type IOTCM = IOTCM' Range data Interaction' range -- | cmd_load m argv loads the module in file m, using -- argv as the command-line options. Cmd_load :: FilePath -> [String] -> Interaction' range -- | cmd_compile b m argv compiles the module in file m -- using the backend b, using argv as the command-line -- options. Cmd_compile :: CompilerBackend -> FilePath -> [String] -> Interaction' range Cmd_constraints :: Interaction' range -- | Show unsolved metas. If there are no unsolved metas but unsolved -- constraints show those instead. Cmd_metas :: Interaction' range -- | Shows all the top-level names in the given module, along with their -- types. Uses the top-level scope. Cmd_show_module_contents_toplevel :: Rewrite -> String -> Interaction' range -- | Shows all the top-level names in scope which mention all the given -- identifiers in their type. Cmd_search_about_toplevel :: Rewrite -> String -> Interaction' range -- | Solve (all goals / the goal at point) whose values are determined by -- the constraints. Cmd_solveAll :: Rewrite -> Interaction' range Cmd_solveOne :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Parse the given expression (as if it were defined at the top-level of -- the current module) and infer its type. Cmd_infer_toplevel :: Rewrite -> String -> Interaction' range -- | Parse and type check the given expression (as if it were defined at -- the top-level of the current module) and normalise it. Cmd_compute_toplevel :: ComputeMode -> String -> Interaction' range -- | cmd_load_highlighting_info source loads syntax highlighting -- information for the module in source, and asks Emacs to apply -- highlighting info from this file. -- -- If the module does not exist, or its module name is malformed or -- cannot be determined, or the module has not already been visited, or -- the cached info is out of date, then no highlighting information is -- printed. -- -- This command is used to load syntax highlighting information when a -- new file is opened, and it would probably be annoying if jumping to -- the definition of an identifier reset the proof state, so this command -- tries not to do that. One result of this is that the command uses the -- current include directories, whatever they happen to be. Cmd_load_highlighting_info :: FilePath -> Interaction' range -- | Tells Agda to compute token-based highlighting information for the -- file. -- -- This command works even if the file's module name does not match its -- location in the file system, or if the file is not scope-correct. -- Furthermore no file names are put in the generated output. Thus it is -- fine to put source code into a temporary file before calling this -- command. However, the file extension should be correct. -- -- If the second argument is Remove, then the (presumably -- temporary) file is removed after it has been read. Cmd_tokenHighlighting :: FilePath -> Remove -> Interaction' range -- | Tells Agda to compute highlighting information for the expression just -- spliced into an interaction point. Cmd_highlight :: InteractionId -> range -> String -> Interaction' range -- | Tells Agda whether or not to show implicit arguments. ShowImplicitArgs :: Bool -> Interaction' range -- | Toggle display of implicit arguments. ToggleImplicitArgs :: Interaction' range -- | Goal commands -- -- If the range is noRange, then the string comes from the -- minibuffer rather than the goal. Cmd_give :: UseForce -> InteractionId -> range -> String -> Interaction' range Cmd_refine :: InteractionId -> range -> String -> Interaction' range Cmd_intro :: Bool -> InteractionId -> range -> String -> Interaction' range Cmd_refine_or_intro :: Bool -> InteractionId -> range -> String -> Interaction' range Cmd_auto :: InteractionId -> range -> String -> Interaction' range Cmd_context :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_helper_function :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_infer :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_goal_type :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Displays the current goal and context. Cmd_goal_type_context :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Displays the current goal and context and infers the type of an -- expression. Cmd_goal_type_context_infer :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Grabs the current goal's type and checks the expression in the hole -- against it. Cmd_goal_type_context_check :: Rewrite -> InteractionId -> range -> String -> Interaction' range -- | Shows all the top-level names in the given module, along with their -- types. Uses the scope of the given goal. Cmd_show_module_contents :: Rewrite -> InteractionId -> range -> String -> Interaction' range Cmd_make_case :: InteractionId -> range -> String -> Interaction' range Cmd_compute :: ComputeMode -> InteractionId -> range -> String -> Interaction' range Cmd_why_in_scope :: InteractionId -> range -> String -> Interaction' range Cmd_why_in_scope_toplevel :: String -> Interaction' range -- | Displays version of the running Agda Cmd_show_version :: Interaction' range -- | Abort the current computation. -- -- Does nothing if no computation is in progress. Cmd_abort :: Interaction' range -- | An interactive computation. type Interaction = Interaction' Range -- | Command queues. type CommandQueue = TChan Command -- | Commands. data Command -- | An IOTCM command. Command :: IOTCM -> Command -- | Stop processing commands. Done :: Command -- | An error message for a command that could not be parsed. Error :: String -> Command -- | Monad for computing answers to interactive commands. -- -- CommandM is TCM extended with state CommandState. type CommandM = StateT CommandState TCM type OldInteractionScopes = Map InteractionId ScopeInfo -- | Auxiliary state of an interactive computation. data CommandState CommandState :: [InteractionId] -> Maybe (AbsolutePath, ClockTime) -> CommandLineOptions -> !OldInteractionScopes -> CommandQueue -> CommandState -- | The interaction points of the buffer, in the order in which they -- appear in the buffer. The interaction points are recorded in -- theTCState, but when new interaction points are added by give -- or refine Agda does not ensure that the ranges of later interaction -- points are updated. [theInteractionPoints] :: CommandState -> [InteractionId] -- | The file which the state applies to. Only stored if the module was -- successfully type checked (potentially with warnings). The -- ClockTime is the modification time stamp of the file when it -- was last loaded. [theCurrentFile] :: CommandState -> Maybe (AbsolutePath, ClockTime) -- | Reset the options on each reload to these. [optionsOnReload] :: CommandState -> CommandLineOptions -- | We remember (the scope of) old interaction points to make it possible -- to parse and compute highlighting information for the expression that -- it got replaced by. [oldInteractionScopes] :: CommandState -> !OldInteractionScopes -- | Command queue. -- -- The commands in the queue are processed in the order in which they are -- received. Abort commands do not have precedence over other commands, -- they only abort the immediately preceding command. (The Emacs mode is -- expected not to send a new command, other than the abort command, -- before the previous command has completed.) [commandQueue] :: CommandState -> CommandQueue -- | Initial auxiliary interaction state initCommandState :: CommandQueue -> CommandState -- | Restore both TCState and CommandState. localStateCommandM :: CommandM a -> CommandM a -- | Restore TCState, do not touch CommandState. liftLocalState :: TCM a -> CommandM a -- | Build an opposite action to lift for state monads. revLift :: MonadState st m => (forall c. m c -> st -> k (c, st)) -> (forall b. k b -> m b) -> (forall x. (m a -> k x) -> k x) -> m a -- | Opposite of liftIO for CommandM. Use only if main errors -- are already catched. commandMToIO :: (forall x. (CommandM a -> IO x) -> IO x) -> CommandM a -- | Lift a TCM action transformer to a CommandM action transformer. liftCommandMT :: (forall a. TCM a -> TCM a) -> CommandM a -> CommandM a -- | Ditto, but restore state. liftCommandMTLocalState :: (forall a. TCM a -> TCM a) -> CommandM a -> CommandM a -- | Put a response by the callback function given by -- stInteractionOutputCallback. putResponse :: Response -> CommandM () -- | 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 () -- | 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 () -- | The next command. nextCommand :: CommandM Command -- | Runs the given computation, but 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. maybeAbort :: CommandM () -> CommandM () -- | Creates a command queue, and forks a thread that writes commands to -- the queue. The queue is returned. initialiseCommandQueue :: IO Command -> IO CommandQueue -- | Converter from the type of reads to Parse The first -- paramter is part of the error message in case the parse fails. readsToParse :: String -> (String -> Maybe (a, String)) -> Parse a parseToReadsPrec :: Parse a -> Int -> String -> [(a, String)] -- | Demand an exact string. exact :: String -> Parse () readParse :: Read a => Parse a parens' :: Parse a -> Parse a -- | Can the command run even if the relevant file has not been loaded into -- the state? independent :: Interaction -> Bool -- | Should Resp_InteractionPoints be issued after the command has -- run? updateInteractionPointsAfter :: Interaction -> Bool -- | Interpret an interaction interpret :: Interaction -> CommandM () -- | Show warnings interpretWarnings :: CommandM (String, String) -- | Solved goals already instantiated internally The second argument -- potentially limits it to one specific goal. solveInstantiatedGoals :: Rewrite -> Maybe InteractionId -> CommandM () -- | cmd_load' file argv unsolvedOk cmd loads the module in file -- file, using argv as the command-line options. -- -- If type checking completes without any exceptions having been -- encountered then the command cmd r is executed, where -- r is the result of typeCheckMain. cmd_load' :: FilePath -> [String] -> Bool -> Mode -> ((Interface, MaybeWarnings) -> CommandM ()) -> CommandM () -- | Set envCurrentPath to theCurrentFile, if any. withCurrentFile :: CommandM a -> CommandM a -- | 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 () highlightExpr :: Expr -> TCM () -- | Sorts interaction points based on their ranges. sortInteractionPoints :: [InteractionId] -> TCM [InteractionId] -- | Pretty-prints the type of the meta-variable. prettyTypeOfMeta :: Rewrite -> InteractionId -> TCM Doc -- | Pretty-prints the context of the given meta-variable. prettyContext :: Rewrite -> Bool -> InteractionId -> TCM Doc -- | Create type of application of new helper function that would solve the -- goal. cmd_helper_function :: Rewrite -> InteractionId -> Range -> String -> TCM Doc -- | Displays the current goal, the given document, and the current -- context. -- -- Should not modify the state. cmd_goal_type_context_and :: Doc -> Rewrite -> InteractionId -> Range -> String -> StateT CommandState (TCMT IO) () -- | 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 () -- | Explain why something is in scope. whyInScope :: String -> CommandM () -- | Sets the command line options and updates the status information. setCommandLineOpts :: CommandLineOptions -> CommandM () -- | Computes some status information. -- -- Does not change the state. status :: CommandM Status -- | 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 () refreshStr :: [String] -> String -> ([String], String) nameModifiers :: [String] -- | Parses and scope checks an expression (using the "inside scope" as the -- scope), performs the given command with the expression as input, and -- displays the result. parseAndDoAtToplevel :: (Expr -> TCM Doc) -> (Doc -> DisplayInfo) -> String -> CommandM () maybeTimed :: CommandM a -> CommandM (Maybe Doc, a) -- | Tell to highlight the code using the given highlighting info (unless -- it is Nothing). tellToUpdateHighlighting :: Maybe (HighlightingInfo, HighlightingMethod, ModuleToSource) -> IO [Response] -- | Tells the Emacs mode to go to the first error position (if any). tellEmacsToJumpToError :: Range -> [Response] instance GHC.Show.Show Agda.Interaction.InteractionTop.GiveRefine instance GHC.Classes.Eq Agda.Interaction.InteractionTop.GiveRefine instance GHC.Show.Show Agda.Interaction.InteractionTop.Command instance Data.Traversable.Traversable Agda.Interaction.InteractionTop.IOTCM' instance Data.Foldable.Foldable Agda.Interaction.InteractionTop.IOTCM' instance GHC.Base.Functor Agda.Interaction.InteractionTop.IOTCM' instance GHC.Read.Read range => GHC.Read.Read (Agda.Interaction.InteractionTop.IOTCM' range) instance GHC.Show.Show range => GHC.Show.Show (Agda.Interaction.InteractionTop.IOTCM' range) instance Data.Traversable.Traversable Agda.Interaction.InteractionTop.Interaction' instance Data.Foldable.Foldable Agda.Interaction.InteractionTop.Interaction' instance GHC.Base.Functor Agda.Interaction.InteractionTop.Interaction' instance GHC.Read.Read range => GHC.Read.Read (Agda.Interaction.InteractionTop.Interaction' range) instance GHC.Show.Show range => GHC.Show.Show (Agda.Interaction.InteractionTop.Interaction' range) instance GHC.Classes.Eq Agda.Interaction.InteractionTop.CompilerBackend instance GHC.Read.Read Agda.Interaction.InteractionTop.Remove instance GHC.Show.Show Agda.Interaction.InteractionTop.Remove instance GHC.Show.Show Agda.Interaction.InteractionTop.CompilerBackend instance GHC.Read.Read Agda.Interaction.InteractionTop.CompilerBackend instance GHC.Read.Read Agda.Syntax.Common.InteractionId instance GHC.Read.Read a => GHC.Read.Read (Agda.Syntax.Position.Range' a) instance GHC.Read.Read a => GHC.Read.Read (Agda.Syntax.Position.Interval' a) instance GHC.Read.Read Agda.Utils.FileName.AbsolutePath instance GHC.Read.Read a => GHC.Read.Read (Agda.Syntax.Position.Position' a) 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 () module Agda.Compiler.MAlonzo.Compiler ghcBackend :: Backend ghcBackend' :: Backend' GHCOptions GHCOptions GHCModuleEnv IsMain [Decl] data GHCOptions GHCOptions :: Bool -> Bool -> [String] -> GHCOptions [optGhcCompile] :: GHCOptions -> Bool [optGhcCallGhc] :: GHCOptions -> Bool [optGhcFlags] :: GHCOptions -> [String] defaultGHCOptions :: GHCOptions ghcCommandLineFlags :: [OptDescr (Flag GHCOptions)] ghcPreCompile :: GHCOptions -> TCM GHCOptions ghcPostCompile :: GHCOptions -> IsMain -> Map ModuleName IsMain -> TCM () -- | This environment is no longer used for anything. type GHCModuleEnv = () ghcPreModule :: GHCOptions -> ModuleName -> FilePath -> TCM (Recompile GHCModuleEnv IsMain) ghcPostModule :: GHCOptions -> GHCModuleEnv -> IsMain -> ModuleName -> [[Decl]] -> TCM IsMain ghcCompileDef :: GHCOptions -> GHCModuleEnv -> Definition -> TCM [Decl] imports :: TCM [ImportDecl] definition :: GHCModuleEnv -> Definition -> TCM [Decl] constructorCoverageCode :: QName -> Int -> [QName] -> HaskellType -> [HaskellCode] -> TCM [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 type CC = ReaderT CCEnv TCM freshNames :: Int -> ([Name] -> CC a) -> CC a -- | Introduce n variables into the context. intros :: Int -> ([Name] -> CC a) -> CC a checkConstructorType :: QName -> HaskellCode -> TCM [Decl] checkCover :: QName -> HaskellType -> Nat -> [QName] -> [HaskellCode] -> TCM [Decl] closedTerm :: TTerm -> TCM Exp mkIf :: TTerm -> CC TTerm -- | Extract Agda term to Haskell expression. Erased arguments are -- extracted as (). Types are extracted as (). term :: TTerm -> CC Exp hsCoerce :: Exp -> Exp compilePrim :: TPrim -> Exp alt :: Int -> TAlt -> CC Alt literal :: Literal -> Exp hslit :: Literal -> Literal litString :: String -> Exp litqname :: QName -> Exp litqnamepat :: QName -> Pat erasedArity :: QName -> TCM Nat condecl :: QName -> Induction -> TCM ConDecl compiledcondecl :: QName -> TCM Decl compiledTypeSynonym :: QName -> String -> Nat -> Decl tvaldecl :: QName -> Induction -> Nat -> [ConDecl] -> Maybe Clause -> [Decl] infodecl :: QName -> [Decl] -> [Decl] copyRTEModules :: TCM () writeModule :: Module -> TCM () outFile' :: Pretty a => a -> TCM (FilePath, FilePath) outFile :: ModuleName -> TCM FilePath outFile_ :: TCM FilePath callGHC :: GHCOptions -> IsMain -> Map ModuleName IsMain -> TCM () module Agda.Compiler.JS.Compiler jsBackend :: Backend jsBackend' :: Backend' JSOptions JSOptions JSModuleEnv () (Maybe Export) data JSOptions JSOptions :: Bool -> JSOptions [optJSCompile] :: JSOptions -> Bool defaultJSOptions :: JSOptions jsCommandLineFlags :: [OptDescr (Flag JSOptions)] jsPreCompile :: JSOptions -> TCM JSOptions jsPostCompile :: JSOptions -> IsMain -> a -> TCM () type JSModuleEnv = Maybe CoinductionKit jsPreModule :: JSOptions -> ModuleName -> FilePath -> TCM (Recompile JSModuleEnv ()) jsPostModule :: JSOptions -> JSModuleEnv -> IsMain -> ModuleName -> [Maybe Export] -> TCM () jsCompileDef :: JSOptions -> JSModuleEnv -> Definition -> TCM (Maybe Export) prefix :: [Char] jsMod :: ModuleName -> GlobalId jsFileName :: GlobalId -> String jsMember :: Name -> MemberId global' :: QName -> TCM (Exp, [MemberId]) global :: QName -> TCM (Exp, [MemberId]) reorder :: [Export] -> [Export] reorder' :: Set [MemberId] -> [Export] -> [Export] isTopLevelValue :: Export -> Bool isEmptyObject :: Export -> Bool insertAfter :: Set [MemberId] -> Export -> [Export] -> [Export] curModule :: IsMain -> TCM Module definition :: Maybe CoinductionKit -> (QName, Definition) -> TCM (Maybe Export) -- | Ensure that there is at most one pragma for a name. checkCompilerPragmas :: QName -> TCM () defJSDef :: Definition -> Maybe String definition' :: Maybe CoinductionKit -> QName -> Definition -> Type -> [MemberId] -> TCM (Maybe Export) compileTerm :: TTerm -> TCM Exp compileTerm' :: Maybe CoinductionKit -> TTerm -> TCM Exp compilePrim :: TPrim -> Exp compileAlt :: TAlt -> TCM (MemberId, Exp) visitorName :: QName -> TCM MemberId flatName :: MemberId local :: Nat -> Exp qname :: QName -> TCM Exp literal :: Literal -> Exp litqname :: QName -> Exp writeModule :: Module -> TCM () outFile :: GlobalId -> TCM FilePath outFile_ :: TCM FilePath copyRTEModules :: TCM () -- | Primitives implemented in the JS Agda RTS. primitives :: Set String -- | Agda main module. module Agda.Main builtinBackends :: [Backend] -- | The main function runAgda :: [Backend] -> IO () runAgda' :: [Backend] -> IO () defaultInteraction :: CommandLineOptions -> TCM (Maybe Interface) -> TCM () -- | Run Agda with parsed command line options and with a custom HTML -- generator runAgdaWithOptions :: [Backend] -> TCM () -> (TCM (Maybe Interface) -> TCM a) -> String -> CommandLineOptions -> TCM (Maybe a) -- | Print usage information. printUsage :: [Backend] -> Help -> IO () backendUsage :: Backend -> String -- | Print version information. printVersion :: [Backend] -> IO () -- | What to do for bad options. optionError :: String -> IO () -- | Run a TCM action in IO; catch and pretty print errors. runTCMPrettyErrors :: TCM () -> IO () -- | Main main :: IO ()