{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FunctionalDependencies #-}
module Agda.IR where
import qualified Agda.Interaction.Response as Agda
import Agda.TypeChecking.Monad (TCM)
import Data.Aeson
import GHC.Generics (Generic)
import Render
class FromAgda a b | a -> b where
fromAgda :: a -> b
class FromAgdaTCM a b | a -> b where
fromAgdaTCM :: a -> TCM b
data Response
=
ResponseHighlightingInfoDirect HighlightingInfos
| ResponseHighlightingInfoIndirect FilePath
| ResponseDisplayInfo DisplayInfo
| ResponseStatus Bool Bool
| ResponseClearHighlightingTokenBased
| ResponseClearHighlightingNotOnlyTokenBased
| ResponseRunningInfo Int String
| ResponseClearRunningInfo
| ResponseDoneAborting
| ResponseDoneExiting
| ResponseGiveAction Int GiveResult
|
ResponseInteractionPoints [Int]
|
ResponseMakeCaseFunction [String]
| ResponseMakeCaseExtendedLambda [String]
| ResponseSolveAll [(Int, String)]
|
ResponseJumpToError FilePath Int
| ResponseEnd
deriving ((forall x. Response -> Rep Response x)
-> (forall x. Rep Response x -> Response) -> Generic Response
forall x. Rep Response x -> Response
forall x. Response -> Rep Response x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Response -> Rep Response x
from :: forall x. Response -> Rep Response x
$cto :: forall x. Rep Response x -> Response
to :: forall x. Rep Response x -> Response
Generic)
instance ToJSON Response
data DisplayInfo
= DisplayInfoGeneric String [Block]
| DisplayInfoAllGoalsWarnings String [Block] [Block] [String] [String]
| DisplayInfoCurrentGoal Block
| DisplayInfoInferredType Block
| DisplayInfoCompilationOk [String] [String]
| DisplayInfoAuto String
| DisplayInfoError String
| DisplayInfoTime String
| DisplayInfoNormalForm String
deriving ((forall x. DisplayInfo -> Rep DisplayInfo x)
-> (forall x. Rep DisplayInfo x -> DisplayInfo)
-> Generic DisplayInfo
forall x. Rep DisplayInfo x -> DisplayInfo
forall x. DisplayInfo -> Rep DisplayInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DisplayInfo -> Rep DisplayInfo x
from :: forall x. DisplayInfo -> Rep DisplayInfo x
$cto :: forall x. Rep DisplayInfo x -> DisplayInfo
to :: forall x. Rep DisplayInfo x -> DisplayInfo
Generic)
instance ToJSON DisplayInfo
data GiveResult
= GiveString String
| GiveParen
| GiveNoParen
deriving ((forall x. GiveResult -> Rep GiveResult x)
-> (forall x. Rep GiveResult x -> GiveResult) -> Generic GiveResult
forall x. Rep GiveResult x -> GiveResult
forall x. GiveResult -> Rep GiveResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GiveResult -> Rep GiveResult x
from :: forall x. GiveResult -> Rep GiveResult x
$cto :: forall x. Rep GiveResult x -> GiveResult
to :: forall x. Rep GiveResult x -> GiveResult
Generic)
instance FromAgda Agda.GiveResult GiveResult where
fromAgda :: GiveResult -> GiveResult
fromAgda (Agda.Give_String FilePath
s) = FilePath -> GiveResult
GiveString FilePath
s
fromAgda GiveResult
Agda.Give_Paren = GiveResult
GiveParen
fromAgda GiveResult
Agda.Give_NoParen = GiveResult
GiveNoParen
instance ToJSON GiveResult
data HighlightingInfo
= HighlightingInfo
Int
Int
[String]
Bool
String
(Maybe (FilePath, Int))
deriving ((forall x. HighlightingInfo -> Rep HighlightingInfo x)
-> (forall x. Rep HighlightingInfo x -> HighlightingInfo)
-> Generic HighlightingInfo
forall x. Rep HighlightingInfo x -> HighlightingInfo
forall x. HighlightingInfo -> Rep HighlightingInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HighlightingInfo -> Rep HighlightingInfo x
from :: forall x. HighlightingInfo -> Rep HighlightingInfo x
$cto :: forall x. Rep HighlightingInfo x -> HighlightingInfo
to :: forall x. Rep HighlightingInfo x -> HighlightingInfo
Generic, Int -> HighlightingInfo -> ShowS
[HighlightingInfo] -> ShowS
HighlightingInfo -> FilePath
(Int -> HighlightingInfo -> ShowS)
-> (HighlightingInfo -> FilePath)
-> ([HighlightingInfo] -> ShowS)
-> Show HighlightingInfo
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HighlightingInfo -> ShowS
showsPrec :: Int -> HighlightingInfo -> ShowS
$cshow :: HighlightingInfo -> FilePath
show :: HighlightingInfo -> FilePath
$cshowList :: [HighlightingInfo] -> ShowS
showList :: [HighlightingInfo] -> ShowS
Show)
instance ToJSON HighlightingInfo
data HighlightingInfos = HighlightingInfos Bool [HighlightingInfo]
deriving ((forall x. HighlightingInfos -> Rep HighlightingInfos x)
-> (forall x. Rep HighlightingInfos x -> HighlightingInfos)
-> Generic HighlightingInfos
forall x. Rep HighlightingInfos x -> HighlightingInfos
forall x. HighlightingInfos -> Rep HighlightingInfos x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HighlightingInfos -> Rep HighlightingInfos x
from :: forall x. HighlightingInfos -> Rep HighlightingInfos x
$cto :: forall x. Rep HighlightingInfos x -> HighlightingInfos
to :: forall x. Rep HighlightingInfos x -> HighlightingInfos
Generic, Int -> HighlightingInfos -> ShowS
[HighlightingInfos] -> ShowS
HighlightingInfos -> FilePath
(Int -> HighlightingInfos -> ShowS)
-> (HighlightingInfos -> FilePath)
-> ([HighlightingInfos] -> ShowS)
-> Show HighlightingInfos
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HighlightingInfos -> ShowS
showsPrec :: Int -> HighlightingInfos -> ShowS
$cshow :: HighlightingInfos -> FilePath
show :: HighlightingInfos -> FilePath
$cshowList :: [HighlightingInfos] -> ShowS
showList :: [HighlightingInfos] -> ShowS
Show)
instance ToJSON HighlightingInfos