yi-core-0.19.4: Yi editor core library

License | GPL-2
Maintainer | yi-devel@googlegroups.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Extensions

- Cpp
- TemplateHaskell
- TemplateHaskellQuotes
- OverloadedStrings
- DeriveDataTypeable
- GeneralizedNewtypeDeriving
- LambdaCase

Yi.Eval

Contents

- Main (generic) evaluation interface
  - Standard evaluators
- Eval/Interpretation

Description

Evaluator for actions (`Action`, `YiAction`). Uses a `GHCi` session under the hood.

Synopsis

- execEditorAction :: String -> YiM ()
- getAllNamesInScope :: YiM [String]
- describeNamedAction :: String -> YiM String
- data Evaluator = Evaluator {
  - execEditorActionImpl :: String -> YiM ()
  - getAllNamesInScopeImpl :: YiM [String]
  - describeNamedActionImpl :: String -> YiM String
  }
- evaluator :: Field Evaluator
- publishedActionsEvaluator :: Evaluator
- publishedActions :: Field (HashMap String Action)
- publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM ()
- jumpToErrorE :: YiM ()
- jumpToE :: FilePath -> Int -> Int -> YiM ()
- consoleKeymap :: Keymap

# Main (generic) evaluation interface

execEditorAction :: String -> YiM () Source #

Runs the action, as written by the user.

The behaviour of this function can be customised by modifying the `Evaluator` variable.

getAllNamesInScope :: YiM [String] Source #

Lists the action names in scope, for use by `execEditorAction`, and `help` index.

The behaviour of this function can be customised by modifying the `Evaluator` variable.

describeNamedAction :: String -> YiM String Source #

Describes the named action in scope, for use by `help`.

The behaviour of this function can be customised by modifying the `Evaluator` variable.

data Evaluator Source #

Config variable for customising the behaviour of `execEditorAction` and `getAllNamesInScope`.

Set this variable using `evaluator`. See `ghciEvaluator` and `finiteListEvaluator` for two implementation.

Constructors

Evaluator |

Fields

- execEditorActionImpl :: String -> YiM ()

  implementation of `execEditorAction`

- getAllNamesInScopeImpl :: YiM [String]

  implementation of `getAllNamesInScope`

- describeNamedActionImpl :: String -> YiM String

  describe named action (or at least its type.), simplest implementation is at least `return`.

#### Instances

Instances details

Default Evaluator Source # |
Instance details Defined in Yi.Eval Methods def :: Evaluator Source #
YiConfigVariable Evaluator Source # |
Instance details Defined in Yi.Eval

evaluator :: Field Evaluator Source #

The evaluator to use for `execEditorAction` and `getAllNamesInScope`.

## Standard evaluators

publishedActionsEvaluator :: Evaluator Source #

Evaluator based on a fixed list of published actions. Has a few differences from `ghciEvaluator`:

- expressions can't be evaluated
- all suggested actions are actually valued
- (related to the above) doesn't contain junk actions from Prelude
- doesn't require GHCi backend, so uses less memory

publishedActions :: Field (HashMap String Action) Source #

Accessor for the published actions. Consider using `publishAction`.

publishAction :: (YiAction a x, Show x) => String -> a -> ConfigM () Source #

Publish the given action, by the given name. This will overwrite any existing actions by the same name.

# Eval/Interpretation

jumpToErrorE :: YiM () Source #

Tries to jump to error at the current line. See `parseErrorMessageB`.

jumpToE Source #

Arguments

:: FilePath | Filename to make the jump in.
-> Int | Line to jump to.
-> Int | Column to jump to.
-> YiM () |

Jumps to specified position in a given file.

consoleKeymap :: Keymap Source #