{-# OPTIONS_GHC -Wunused-imports #-}
module Agda.Compiler.Backend.Base where
import Control.DeepSeq (NFData, rnf)
import Data.Map (Map)
import Data.Text (Text)
import GHC.Generics (Generic)
import Agda.Syntax.Abstract.Name (QName)
import Agda.Syntax.Common (BackendName, IsMain, InteractionId)
import Agda.Syntax.TopLevelModuleName (TopLevelModuleName)
import Agda.Syntax.Position (Range)
import Agda.Interaction.Base (CommandM')
import Agda.Interaction.Options (ArgDescr(..), OptDescr(..), Flag)
type BackendVersion = Text
data Backend_boot definition tcm where
Backend :: NFData opts => Backend'_boot definition tcm opts env menv mod def -> Backend_boot definition tcm
data Backend'_boot definition tcm opts env menv mod def = Backend'
{ forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def -> BackendName
backendName :: BackendName
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> Maybe BackendName
backendVersion :: Maybe BackendVersion
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def -> opts
options :: opts
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> [OptDescr (Flag opts)]
commandLineFlags :: [OptDescr (Flag opts)]
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def -> opts -> Bool
isEnabled :: opts -> Bool
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> opts -> tcm env
preCompile :: opts -> tcm env
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> env -> IsMain -> Map TopLevelModuleName mod -> tcm ()
postCompile :: env -> IsMain -> Map TopLevelModuleName mod ->
tcm ()
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> env
-> IsMain
-> TopLevelModuleName
-> Maybe FilePath
-> tcm (Recompile menv mod)
preModule :: env -> IsMain -> TopLevelModuleName ->
Maybe FilePath -> tcm (Recompile menv mod)
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> env -> menv -> IsMain -> TopLevelModuleName -> [def] -> tcm mod
postModule :: env -> menv -> IsMain -> TopLevelModuleName ->
[def] -> tcm mod
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> env -> menv -> IsMain -> definition -> tcm def
compileDef :: env -> menv -> IsMain -> definition -> tcm def
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def -> Bool
scopeCheckingSuffices :: Bool
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> QName -> tcm Bool
mayEraseType :: QName -> tcm Bool
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> Maybe (BackendCommandTop tcm)
backendInteractTop :: Maybe (BackendCommandTop tcm)
, forall definition (tcm :: * -> *) opts env menv mod def.
Backend'_boot definition tcm opts env menv mod def
-> Maybe (BackendCommandHole tcm)
backendInteractHole :: Maybe (BackendCommandHole tcm)
}
deriving (forall x.
Backend'_boot definition tcm opts env menv mod def
-> Rep (Backend'_boot definition tcm opts env menv mod def) x)
-> (forall x.
Rep (Backend'_boot definition tcm opts env menv mod def) x
-> Backend'_boot definition tcm opts env menv mod def)
-> Generic (Backend'_boot definition tcm opts env menv mod def)
forall x.
Rep (Backend'_boot definition tcm opts env menv mod def) x
-> Backend'_boot definition tcm opts env menv mod def
forall x.
Backend'_boot definition tcm opts env menv mod def
-> Rep (Backend'_boot definition tcm opts env menv mod def) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall definition (tcm :: * -> *) opts env menv mod def x.
Rep (Backend'_boot definition tcm opts env menv mod def) x
-> Backend'_boot definition tcm opts env menv mod def
forall definition (tcm :: * -> *) opts env menv mod def x.
Backend'_boot definition tcm opts env menv mod def
-> Rep (Backend'_boot definition tcm opts env menv mod def) x
$cfrom :: forall definition (tcm :: * -> *) opts env menv mod def x.
Backend'_boot definition tcm opts env menv mod def
-> Rep (Backend'_boot definition tcm opts env menv mod def) x
from :: forall x.
Backend'_boot definition tcm opts env menv mod def
-> Rep (Backend'_boot definition tcm opts env menv mod def) x
$cto :: forall definition (tcm :: * -> *) opts env menv mod def x.
Rep (Backend'_boot definition tcm opts env menv mod def) x
-> Backend'_boot definition tcm opts env menv mod def
to :: forall x.
Rep (Backend'_boot definition tcm opts env menv mod def) x
-> Backend'_boot definition tcm opts env menv mod def
Generic
data Recompile menv mod = Recompile menv | Skip mod
type CommandPayload = String
type BackendCommandTop tcm
= CommandPayload
-> CommandM' tcm ()
type BackendCommandHole tcm
= CommandPayload
-> InteractionId
-> Range
-> String
-> CommandM' tcm ()
instance NFData (Backend_boot definition tcm) where
rnf :: Backend_boot definition tcm -> ()
rnf (Backend Backend'_boot definition tcm opts env menv mod def
b) = Backend'_boot definition tcm opts env menv mod def -> ()
forall a. NFData a => a -> ()
rnf Backend'_boot definition tcm opts env menv mod def
b
instance NFData opts => NFData (Backend'_boot definition tcm opts env menv mod def) where
rnf :: Backend'_boot definition tcm opts env menv mod def -> ()
rnf (Backend' BackendName
a Maybe BackendName
b opts
c [OptDescr (Flag opts)]
d opts -> Bool
e opts -> tcm env
f env -> IsMain -> Map TopLevelModuleName mod -> tcm ()
g env
-> IsMain
-> TopLevelModuleName
-> Maybe FilePath
-> tcm (Recompile menv mod)
h env -> menv -> IsMain -> TopLevelModuleName -> [def] -> tcm mod
i env -> menv -> IsMain -> definition -> tcm def
j Bool
k QName -> tcm Bool
l Maybe (BackendCommandTop tcm)
m Maybe (BackendCommandHole tcm)
n) =
BackendName -> ()
forall a. NFData a => a -> ()
rnf BackendName
a () -> () -> ()
forall a b. a -> b -> b
`seq` Maybe BackendName -> ()
forall a. NFData a => a -> ()
rnf Maybe BackendName
b () -> () -> ()
forall a b. a -> b -> b
`seq` opts -> ()
forall a. NFData a => a -> ()
rnf opts
c () -> () -> ()
forall a b. a -> b -> b
`seq` [OptDescr (Flag opts)] -> ()
forall {a}. NFData a => [OptDescr a] -> ()
rnf' [OptDescr (Flag opts)]
d () -> () -> ()
forall a b. a -> b -> b
`seq` (opts -> Bool) -> ()
forall a. NFData a => a -> ()
rnf opts -> Bool
e () -> () -> ()
forall a b. a -> b -> b
`seq`
(opts -> tcm env) -> ()
forall a. NFData a => a -> ()
rnf opts -> tcm env
f () -> () -> ()
forall a b. a -> b -> b
`seq` (env -> IsMain -> Map TopLevelModuleName mod -> tcm ()) -> ()
forall a. NFData a => a -> ()
rnf env -> IsMain -> Map TopLevelModuleName mod -> tcm ()
g () -> () -> ()
forall a b. a -> b -> b
`seq` (env
-> IsMain
-> TopLevelModuleName
-> Maybe FilePath
-> tcm (Recompile menv mod))
-> ()
forall a. NFData a => a -> ()
rnf env
-> IsMain
-> TopLevelModuleName
-> Maybe FilePath
-> tcm (Recompile menv mod)
h () -> () -> ()
forall a b. a -> b -> b
`seq` (env -> menv -> IsMain -> TopLevelModuleName -> [def] -> tcm mod)
-> ()
forall a. NFData a => a -> ()
rnf env -> menv -> IsMain -> TopLevelModuleName -> [def] -> tcm mod
i () -> () -> ()
forall a b. a -> b -> b
`seq` (env -> menv -> IsMain -> definition -> tcm def) -> ()
forall a. NFData a => a -> ()
rnf env -> menv -> IsMain -> definition -> tcm def
j () -> () -> ()
forall a b. a -> b -> b
`seq`
Bool -> ()
forall a. NFData a => a -> ()
rnf Bool
k () -> () -> ()
forall a b. a -> b -> b
`seq` (QName -> tcm Bool) -> ()
forall a. NFData a => a -> ()
rnf QName -> tcm Bool
l () -> () -> ()
forall a b. a -> b -> b
`seq` Maybe (BackendCommandTop tcm) -> ()
forall a. NFData a => a -> ()
rnf Maybe (BackendCommandTop tcm)
m () -> () -> ()
forall a b. a -> b -> b
`seq` Maybe (BackendCommandHole tcm) -> ()
forall a. NFData a => a -> ()
rnf Maybe (BackendCommandHole tcm)
n
where
rnf' :: [OptDescr a] -> ()
rnf' [] = ()
rnf' (Option FilePath
a [FilePath]
b ArgDescr a
c FilePath
d : [OptDescr a]
e) =
FilePath -> ()
forall a. NFData a => a -> ()
rnf FilePath
a () -> () -> ()
forall a b. a -> b -> b
`seq` [FilePath] -> ()
forall a. NFData a => a -> ()
rnf [FilePath]
b () -> () -> ()
forall a b. a -> b -> b
`seq` ArgDescr a -> ()
forall {a}. NFData a => ArgDescr a -> ()
rnf'' ArgDescr a
c () -> () -> ()
forall a b. a -> b -> b
`seq` FilePath -> ()
forall a. NFData a => a -> ()
rnf FilePath
d () -> () -> ()
forall a b. a -> b -> b
`seq` [OptDescr a] -> ()
rnf' [OptDescr a]
e
rnf'' :: ArgDescr a -> ()
rnf'' (NoArg a
a) = a -> ()
forall a. NFData a => a -> ()
rnf a
a
rnf'' (ReqArg FilePath -> a
a FilePath
b) = (FilePath -> a) -> ()
forall a. NFData a => a -> ()
rnf FilePath -> a
a () -> () -> ()
forall a b. a -> b -> b
`seq` FilePath -> ()
forall a. NFData a => a -> ()
rnf FilePath
b
rnf'' (OptArg Maybe FilePath -> a
a FilePath
b) = (Maybe FilePath -> a) -> ()
forall a. NFData a => a -> ()
rnf Maybe FilePath -> a
a () -> () -> ()
forall a b. a -> b -> b
`seq` FilePath -> ()
forall a. NFData a => a -> ()
rnf FilePath
b