module Agda.Interaction.Response
( Response (..)
, RemoveTokenBasedHighlighting (..)
, MakeCaseVariant (..)
, DisplayInfo (..)
, GoalDisplayInfo(..)
, Goals
, WarningsAndNonFatalErrors
, Info_Error(..)
, GoalTypeAux(..)
, ResponseContextEntry(..)
, Status (..)
, GiveResult (..)
, InteractionOutputCallback
, defaultInteractionOutputCallback
) where
import Agda.Interaction.Base
( CommandState
, CompilerBackend
, ComputeMode
, OutputConstraint
, OutputConstraint'
, OutputForm
, Rewrite
)
import Agda.Interaction.Highlighting.Precise
import qualified Agda.Syntax.Abstract as A
import Agda.Syntax.Common (InteractionId(..), Arg)
import Agda.Syntax.Concrete (Expr)
import Agda.Syntax.Concrete.Name (Name, QName, NameInScope)
import Agda.Syntax.Scope.Base (AbstractModule, AbstractName, LocalVar, WhyInScopeData)
import qualified Agda.Syntax.Internal as I
import {-# SOURCE #-} Agda.TypeChecking.Monad.Base
(TCM, TCErr, TCWarning, HighlightingMethod, ModuleToSource, NamedMeta, TCWarning, IPBoundary')
import Agda.TypeChecking.Warnings (WarningsAndNonFatalErrors)
import Agda.Utils.Impossible
import Agda.Utils.Time
import Control.Monad.Trans
import Data.Int
import System.IO
data Response
= Resp_HighlightingInfo
HighlightingInfo
RemoveTokenBasedHighlighting
HighlightingMethod
ModuleToSource
| Resp_Status Status
| Resp_JumpToError FilePath Int32
| Resp_InteractionPoints [InteractionId]
| Resp_GiveAction InteractionId GiveResult
| Resp_MakeCase InteractionId MakeCaseVariant [String]
| Resp_SolveAll [(InteractionId, Expr)]
| Resp_DisplayInfo DisplayInfo
| Resp_RunningInfo Int String
| Resp_ClearRunningInfo
| Resp_ClearHighlighting TokenBased
| Resp_DoneAborting
| Resp_DoneExiting
data RemoveTokenBasedHighlighting
= RemoveHighlighting
| KeepHighlighting
data MakeCaseVariant = Function | ExtendedLambda
data DisplayInfo
= Info_CompilationOk CompilerBackend WarningsAndNonFatalErrors
| Info_Constraints [OutputForm Expr Expr]
| Info_AllGoalsWarnings Goals WarningsAndNonFatalErrors
| Info_Time CPUTime
| Info_Error Info_Error
| Info_Intro_NotFound
| Info_Intro_ConstructorUnknown [String]
| Info_Auto String
| Info_ModuleContents [Name] I.Telescope [(Name, I.Type)]
| Info_SearchAbout [(Name, I.Type)] String
| Info_WhyInScope WhyInScopeData
| Info_NormalForm CommandState ComputeMode (Maybe CPUTime) A.Expr
| Info_InferredType CommandState (Maybe CPUTime) A.Expr
| Info_Context InteractionId [ResponseContextEntry]
| Info_Version
| Info_GoalSpecific InteractionId GoalDisplayInfo
data GoalDisplayInfo
= Goal_HelperFunction (OutputConstraint' A.Expr A.Expr)
| Goal_NormalForm ComputeMode A.Expr
| Goal_GoalType Rewrite GoalTypeAux [ResponseContextEntry] [IPBoundary' Expr] [OutputForm Expr Expr]
| Goal_CurrentGoal Rewrite
| Goal_InferredType A.Expr
type Goals = ( [OutputConstraint A.Expr InteractionId]
, [OutputConstraint A.Expr NamedMeta]
)
data Info_Error
= Info_GenericError TCErr
| Info_CompilationError [TCWarning]
| Info_HighlightingParseError InteractionId
| Info_HighlightingScopeCheckError InteractionId
data GoalTypeAux
= GoalOnly
| GoalAndHave A.Expr
| GoalAndElaboration I.Term
data ResponseContextEntry = ResponseContextEntry
{ ResponseContextEntry -> Name
respOrigName :: Name
, ResponseContextEntry -> Name
respReifName :: Name
, ResponseContextEntry -> Arg Expr
respType :: Arg A.Expr
, ResponseContextEntry -> Maybe Expr
respLetValue :: Maybe A.Expr
, ResponseContextEntry -> NameInScope
respInScope :: NameInScope
}
data Status = Status
{ Status -> Bool
sShowImplicitArguments :: Bool
, Status -> Bool
sShowIrrelevantArguments :: Bool
, Status -> Bool
sChecked :: Bool
}
data GiveResult
= Give_String String
| Give_Paren
| Give_NoParen
type InteractionOutputCallback = Response -> TCM ()
defaultInteractionOutputCallback :: InteractionOutputCallback
defaultInteractionOutputCallback :: InteractionOutputCallback
defaultInteractionOutputCallback = \case
Resp_HighlightingInfo {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_Status {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_JumpToError {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_InteractionPoints {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_GiveAction {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_MakeCase {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_SolveAll {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_DisplayInfo {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_RunningInfo Int
_ String
s -> forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
String -> IO ()
putStr String
s
Handle -> IO ()
hFlush Handle
stdout
Resp_ClearRunningInfo {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_ClearHighlighting {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_DoneAborting {} -> forall a. HasCallStack => a
__IMPOSSIBLE__
Resp_DoneExiting {} -> forall a. HasCallStack => a
__IMPOSSIBLE__