Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data QueryFun :: * where
- QueryString :: (Injection ModGuts g, Walker HermitC g) => TransformH g String -> QueryFun
- QueryDocH :: (PrettyC -> PrettyH CoreTC -> TransformH CoreTC DocH) -> QueryFun
- Diff :: SAST -> SAST -> QueryFun
- Display :: QueryFun
- Inquiry :: (CommandLineState -> IO String) -> QueryFun
- CorrectnessCritera :: (Injection ModGuts g, Walker HermitC g) => TransformH g () -> QueryFun
- message :: String -> QueryFun
- performQuery :: (MonadCatch m, MonadError CLException m, MonadIO m, MonadState CommandLineState m) => QueryFun -> ExprH -> m ()
- ppWholeProgram :: (MonadIO m, MonadState CommandLineState m) => AST -> m DocH
- data VersionCmd
- data CLException
- abort :: MonadError CLException m => m ()
- resume :: MonadError CLException m => SAST -> m ()
- continue :: MonadError CLException m => CommandLineState -> m ()
- rethrowCLE :: CLException -> PluginM a
- rethrowPE :: MonadError CLException m => PException -> m a
- newtype CLT m a = CLT {
- unCLT :: ErrorT CLException (StateT CommandLineState m) a
- runCLT :: CommandLineState -> CLT m a -> m (Either CLException a, CommandLineState)
- clm2clt :: MonadIO m => CLT IO a -> CLT m a
- clm :: CLT IO a -> PluginM a
- pluginM :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => PluginM a -> m a
- data VersionStore = VersionStore {}
- newSAST :: ExprH -> SAST -> CommandLineState -> CommandLineState
- data CommandLineState = CommandLineState {
- cl_pstate :: PluginState
- cl_height :: Int
- cl_scripts :: [(ScriptName, Script)]
- cl_lemmas :: [Lemma]
- cl_nav :: Bool
- cl_version :: VersionStore
- cl_window :: PathH
- cl_externals :: [External]
- cl_running_script :: Maybe Script
- cl_initSAST :: SAST
- cl_corelint :: CommandLineState -> Bool
- setCoreLint :: CommandLineState -> Bool -> CommandLineState
- cl_cursor :: CommandLineState -> SAST
- setCursor :: CommandLineState -> SAST -> CommandLineState
- cl_diffonly :: CommandLineState -> Bool
- setDiffOnly :: CommandLineState -> Bool -> CommandLineState
- cl_failhard :: CommandLineState -> Bool
- setFailHard :: CommandLineState -> Bool -> CommandLineState
- cl_kernel :: CommandLineState -> ScopedKernel
- cl_kernel_env :: CommandLineState -> HermitMEnv
- cl_pretty :: CommandLineState -> PrettyPrinter
- setPretty :: CommandLineState -> PrettyPrinter -> CommandLineState
- cl_pretty_opts :: CommandLineState -> PrettyOptions
- setPrettyOpts :: CommandLineState -> PrettyOptions -> CommandLineState
- cl_render :: CommandLineState -> Handle -> PrettyOptions -> Either String DocH -> IO ()
- mkCLS :: PluginM CommandLineState
- getTermDimensions :: IO (Int, Int)
- newtype CLSBox = CLSBox CommandLineState
- type ScriptName = String
- type LemmaName = String
- type Lemma = (LemmaName, CoreExprEquality, Bool)
- tick :: TVar (Map String Int) -> String -> IO Int
- cl_putStr :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => String -> m ()
- cl_putStrLn :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => String -> m ()
- isRunningScript :: MonadState CommandLineState m => m Bool
- setRunningScript :: MonadState CommandLineState m => Maybe Script -> m ()
- putStrToConsole :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => String -> m ()
- shellComplete :: MVar CommandLineState -> String -> String -> IO [Completion]
- data CompletionType
- completionType :: String -> CompletionType
- completionQuery :: CommandLineState -> CompletionType -> IO (TransformH CoreTC [String])
- fixWindow :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => m ()
- showWindow :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => m ()
- showGraph :: [(SAST, ExprH, SAST)] -> [(String, SAST)] -> SAST -> String
Documentation
data QueryFun :: * where Source
QueryString :: (Injection ModGuts g, Walker HermitC g) => TransformH g String -> QueryFun | |
QueryDocH :: (PrettyC -> PrettyH CoreTC -> TransformH CoreTC DocH) -> QueryFun | |
Diff :: SAST -> SAST -> QueryFun | |
Display :: QueryFun | |
Inquiry :: (CommandLineState -> IO String) -> QueryFun | |
CorrectnessCritera :: (Injection ModGuts g, Walker HermitC g) => TransformH g () -> QueryFun |
performQuery :: (MonadCatch m, MonadError CLException m, MonadIO m, MonadState CommandLineState m) => QueryFun -> ExprH -> m () Source
ppWholeProgram :: (MonadIO m, MonadState CommandLineState m) => AST -> m DocH Source
data CLException Source
Error CLException | |
Monad m => MonadError CLException (CLT m) |
abort :: MonadError CLException m => m () Source
resume :: MonadError CLException m => SAST -> m () Source
continue :: MonadError CLException m => CommandLineState -> m () Source
rethrowCLE :: CLException -> PluginM a Source
rethrowPE :: MonadError CLException m => PException -> m a Source
This type is similiar to PluginM, except that its exception and state types are
supersets of those for PluginM, and it is a transformer. There are two functions:
clm
and pluginM
for converting between the two. The reason we do this is to obtain
a clean separation of plugin state from commandline state without nesting state
transformers. Nesting StateT leads to a lot of awkward lifting and manual state
management in the command line code.
NB: an alternative to monad transformers, like Oleg's Extensible Effects, might be useful here.
CLT | |
|
MonadTrans CLT | |
Monad m => MonadError CLException (CLT m) | |
Monad m => MonadState CommandLineState (CLT m) | |
Monad m => Monad (CLT m) | Our own custom instance of Monad for CLT so we don't have to depend on newtype deriving to do the right thing for fail. |
Functor m => Functor (CLT m) | |
(Monad m, Functor m) => Applicative (CLT m) | |
MonadIO m => MonadIO (CLT m) | |
Monad m => MonadCatch (CLT m) |
runCLT :: CommandLineState -> CLT m a -> m (Either CLException a, CommandLineState) Source
Run a CLT computation.
clm2clt :: MonadIO m => CLT IO a -> CLT m a Source
Lift a CLT IO computation into a CLT computation over an arbitrary MonadIO.
pluginM :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => PluginM a -> m a Source
Lift a PluginM computation into the CLM monad.
data VersionStore Source
newSAST :: ExprH -> SAST -> CommandLineState -> CommandLineState Source
data CommandLineState Source
CommandLineState | |
|
Extern CommandLineState | |
Typeable * CommandLineState | |
Monad m => MonadState CommandLineState (CLT m) | |
type Box CommandLineState = CLSBox |
cl_cursor :: CommandLineState -> SAST Source
setCursor :: CommandLineState -> SAST -> CommandLineState Source
cl_render :: CommandLineState -> Handle -> PrettyOptions -> Either String DocH -> IO () Source
mkCLS :: PluginM CommandLineState Source
Create default CommandLineState from PluginState. Note: the dictionary (cl_dict) will be empty, and should be populated if needed.
getTermDimensions :: IO (Int, Int) Source
type ScriptName = String Source
type Lemma = (LemmaName, CoreExprEquality, Bool) Source
cl_putStr :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => String -> m () Source
cl_putStrLn :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => String -> m () Source
isRunningScript :: MonadState CommandLineState m => m Bool Source
setRunningScript :: MonadState CommandLineState m => Maybe Script -> m () Source
putStrToConsole :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => String -> m () Source
shellComplete :: MVar CommandLineState -> String -> String -> IO [Completion] Source
data CompletionType Source
completionQuery :: CommandLineState -> CompletionType -> IO (TransformH CoreTC [String]) Source
fixWindow :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => m () Source
showWindow :: (MonadError CLException m, MonadIO m, MonadState CommandLineState m) => m () Source