hermit-0.5.0.0: Haskell Equational Reasoning Model-to-Implementation Tunnel

Safe HaskellNone
LanguageHaskell2010

HERMIT.Shell.Types

Synopsis

Documentation

newtype CLT 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.

Constructors

CLT 

Instances

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.

clm :: CLT IO a -> PluginM a Source

Lift a CLM computation into the PluginM monad.

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

Constructors

VersionStore 

Fields

vs_graph :: [(SAST, ExprH, SAST)]
 
vs_tags :: [(String, SAST)]
 

data CommandLineState Source

Constructors

CommandLineState 

Fields

cl_pstate :: PluginState

Access to the enclosing plugin state. This is propagated back to the plugin after the CLT computation ends. We do it this way because nested StateT is a pain.

cl_height :: Int

console height, in lines

cl_scripts :: [(ScriptName, Script)]
 
cl_lemmas :: [Lemma]

list of lemmas, with flag indicating whether proven

cl_nav :: Bool

keyboard input the nav panel

cl_version :: VersionStore
 
cl_window :: PathH

path to beginning of window, always a prefix of focus path in kernel

cl_externals :: [External]

Currently visible externals

cl_running_script :: Maybe Script

Nothing = no script running, otherwise the remaining script commands this should be in a reader

cl_initSAST :: SAST
 

mkCLS :: PluginM CommandLineState Source

Create default CommandLineState from PluginState. Note: the dictionary (cl_dict) will be empty, and should be populated if needed.

newtype CLSBox Source

Constructors

CLSBox CommandLineState 

Instances