Agda-2.5.1.2: A dependently typed functional programming language and proof assistant

Agda.Interaction.InteractionTop

Synopsis

# Documentation

Auxiliary state of an interactive computation.

Constructors

 CommandState FieldstheInteractionPoints :: [InteractionId]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.theCurrentFile :: Maybe (AbsolutePath, ClockTime)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.optionsOnReload :: CommandLineOptionsReset the options on each reload to these.oldInteractionScopes :: !OldInteractionScopesWe 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.

Initial auxiliary interaction state

CommandM is TCM extended with state CommandState.

Arguments

 :: MonadState st m => (forall c. m c -> st -> k (c, st)) run -> (forall b. k b -> m b) lift -> (forall x. (m a -> k x) -> k x) -> m a reverse lift in double negative position

Build an opposite action to lift for state monads.

commandMToIO :: (forall x. (CommandM a -> IO x) -> IO x) -> CommandM a Source #

Opposite of liftIO for CommandM. Use only if main errors are already catched.

liftCommandMT :: (forall a. TCM a -> TCM a) -> CommandM a -> CommandM a Source #

Lift a TCM action transformer to a CommandM action transformer.

Put a response by the callback function given by stInteractionOutputCallback.

modifyTheInteractionPoints :: ([InteractionId] -> [InteractionId]) -> CommandM () Source #

A Lens for theInteractionPoints.

# Operations for manipulating oldInteractionScopes.

A Lens for oldInteractionScopes.

Do setup and error handling for a command.

handleCommand :: (forall a. CommandM a -> CommandM a) -> CommandM () -> CommandM () -> CommandM () Source #

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).

An interactive computation.

data Interaction' range Source #

Constructors

 Cmd_load FilePath [String] cmd_load m argv loads the module in file m, using argv as the command-line options. Cmd_compile Backend FilePath [String] cmd_compile b m argv compiles the module in file m using the backend b, using argv as the command-line options. Cmd_constraints Cmd_metas Show unsolved metas. If there are no unsolved metas but unsolved constraints show those instead. Cmd_show_module_contents_toplevel Rewrite String Shows all the top-level names in the given module, along with their types. Uses the top-level scope. Cmd_search_about_toplevel Rewrite String Shows all the top-level names in scope which mention all the given identifiers in their type. Cmd_solveAll Cmd_infer_toplevel Rewrite String Parse the given expression (as if it were defined at the top-level of the current module) and infer its type. Cmd_compute_toplevel Bool String Parse and type check the given expression (as if it were defined at the top-level of the current module) and normalise it. Cmd_load_highlighting_info FilePath 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_highlight InteractionId range String Tells Agda to compute highlighting information for the expression just spliced into an interaction point. ShowImplicitArgs Bool Tells Agda whether or not to show implicit arguments. ToggleImplicitArgs Toggle display of implicit arguments. Cmd_give InteractionId range String Goal commandsIf the range is noRange, then the string comes from the minibuffer rather than the goal. Cmd_refine InteractionId range String Cmd_intro Bool InteractionId range String Cmd_refine_or_intro Bool InteractionId range String Cmd_auto InteractionId range String Cmd_context Rewrite InteractionId range String Cmd_helper_function Rewrite InteractionId range String Cmd_infer Rewrite InteractionId range String Cmd_goal_type Rewrite InteractionId range String Cmd_goal_type_context Rewrite InteractionId range String Displays the current goal and context. Cmd_goal_type_context_infer Rewrite InteractionId range String Displays the current goal and context and infers the type of an expression. Cmd_show_module_contents Rewrite InteractionId range String Shows all the top-level names in the given module, along with their types. Uses the scope of the given goal. Cmd_make_case InteractionId range String Cmd_compute Bool InteractionId range String Cmd_why_in_scope InteractionId range String Cmd_why_in_scope_toplevel String Cmd_show_version Displays version of the running Agda

Instances

 Source # Methodsfmap :: (a -> b) -> Interaction' a -> Interaction' b #(<$) :: a -> Interaction' b -> Interaction' a # Source # Methodsfold :: Monoid m => Interaction' m -> m #foldMap :: Monoid m => (a -> m) -> Interaction' a -> m #foldr :: (a -> b -> b) -> b -> Interaction' a -> b #foldr' :: (a -> b -> b) -> b -> Interaction' a -> b #foldl :: (b -> a -> b) -> b -> Interaction' a -> b #foldl' :: (b -> a -> b) -> b -> Interaction' a -> b #foldr1 :: (a -> a -> a) -> Interaction' a -> a #foldl1 :: (a -> a -> a) -> Interaction' a -> a #toList :: Interaction' a -> [a] #null :: Interaction' a -> Bool #length :: Interaction' a -> Int #elem :: Eq a => a -> Interaction' a -> Bool #maximum :: Ord a => Interaction' a -> a #minimum :: Ord a => Interaction' a -> a #sum :: Num a => Interaction' a -> a #product :: Num a => Interaction' a -> a # Source # Methodstraverse :: Applicative f => (a -> f b) -> Interaction' a -> f (Interaction' b) #sequenceA :: Applicative f => Interaction' (f a) -> f (Interaction' a) #mapM :: Monad m => (a -> m b) -> Interaction' a -> m (Interaction' b) #sequence :: Monad m => Interaction' (m a) -> m (Interaction' a) # Read range => Read (Interaction' range) Source # MethodsreadsPrec :: Int -> ReadS (Interaction' range) #readList :: ReadS [Interaction' range] #readPrec :: ReadPrec (Interaction' range) #readListPrec :: ReadPrec [Interaction' range] # data IOTCM' range Source # Constructors  IOTCM FilePath HighlightingLevel HighlightingMethod (Interaction' range) Instances  Source # Methodsfmap :: (a -> b) -> IOTCM' a -> IOTCM' b #(<$) :: a -> IOTCM' b -> IOTCM' a # Source # Methodsfold :: Monoid m => IOTCM' m -> m #foldMap :: Monoid m => (a -> m) -> IOTCM' a -> m #foldr :: (a -> b -> b) -> b -> IOTCM' a -> b #foldr' :: (a -> b -> b) -> b -> IOTCM' a -> b #foldl :: (b -> a -> b) -> b -> IOTCM' a -> b #foldl' :: (b -> a -> b) -> b -> IOTCM' a -> b #foldr1 :: (a -> a -> a) -> IOTCM' a -> a #foldl1 :: (a -> a -> a) -> IOTCM' a -> a #toList :: IOTCM' a -> [a] #null :: IOTCM' a -> Bool #length :: IOTCM' a -> Int #elem :: Eq a => a -> IOTCM' a -> Bool #maximum :: Ord a => IOTCM' a -> a #minimum :: Ord a => IOTCM' a -> a #sum :: Num a => IOTCM' a -> a #product :: Num a => IOTCM' a -> a # Source # Methodstraverse :: Applicative f => (a -> f b) -> IOTCM' a -> f (IOTCM' b) #sequenceA :: Applicative f => IOTCM' (f a) -> f (IOTCM' a) #mapM :: Monad m => (a -> m b) -> IOTCM' a -> m (IOTCM' b) #sequence :: Monad m => IOTCM' (m a) -> m (IOTCM' a) # Read range => Read (IOTCM' range) Source # MethodsreadsPrec :: Int -> ReadS (IOTCM' range) #readList :: ReadS [IOTCM' range] #readPrec :: ReadPrec (IOTCM' range) #readListPrec :: ReadPrec [IOTCM' range] #

The Parse monad. StateT state holds the remaining input.

readsToParse :: String -> (String -> Maybe (a, String)) -> Parse a Source #

Converter from the type of reads to Parse The first paramter is part of the error message in case the parse fails.

exact :: String -> Parse () Source #

Demand an exact string.

Can the command run even if the relevant file has not been loaded into the state?

Interpret an interaction

Print open metas nicely.

Arguments

 :: FilePath -> [String] -> Bool Allow unsolved meta-variables? -> ((Interface, MaybeWarnings) -> CommandM ()) -> 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.

Set envCurrentPath to theCurrentFile, if any.

data Backend Source #

Available backends.

Constructors

 MAlonzo MAlonzoNoMain Epic JS

Instances

 Source # Methods Source # MethodsshowList :: [Backend] -> ShowS #

Constructors

 Give Refine Intro

Instances

 Source # Methods Source # MethodsshowList :: [GiveRefine] -> ShowS #

A "give"-like action (give, refine, etc).

give_gen 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.

Sorts interaction points based on their ranges.

Pretty-prints the type of the meta-variable.

Arguments

 :: Rewrite Normalise? -> Bool Print the elements in reverse order? -> InteractionId -> TCM Doc

Pretty-prints the context of the given meta-variable.

Create type of application of new helper function that would solve the goal.

Displays the current goal, the given document, and the current context.

Shows all the top-level names in the given module, along with their types.

Shows all the top-level names in scope which mention all the given identifiers in their type.

Explain why something is in scope.

Sets the command line options and updates the status information.

Computes some status information.

display_info does what display_info' False does, but additionally displays some status information (see status and displayStatus).

lowerMeta :: ExprLike a => a -> a Source #

Kill meta numbers and ranges from all metas (? and _).

Arguments

 :: (Expr -> TCM Expr) The command to perform. -> (Doc -> DisplayInfo) The name to use for the buffer displaying the output. -> String The expression to parse. -> CommandM ()

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.

Tell to highlight the code using the given highlighting info (unless it is Nothing).

Tells the Emacs mode to go to the first error position (if any).