Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Interpreters for VariableWatcher
Synopsis
- interpretVariableWatcherNull :: InterpreterFor (VariableWatcher !! Report) r
- runIfDifferent :: (Object -> Handler r ()) -> Object -> Object -> Handler r ()
- checkVar :: Member (Rpc !! RpcError) r => WatchedVariable -> Object -> (Object -> Handler r ()) -> Handler r Object
- watchVariables :: Members [VariableWatcher !! Report, Rpc !! RpcError, Resource, Mask mres, Race, Embed IO] r => Map WatchedVariable (Object -> Handler r ()) -> Sem r a -> Sem r a
- interpretVariableWatcher :: Members [Rpc !! RpcError, Resource, Mask mres, Race, Embed IO] r => Map WatchedVariable (Object -> Handler ((VariableWatcher !! Report) ': r) ()) -> InterpreterFor (VariableWatcher !! Report) r
Documentation
interpretVariableWatcherNull :: InterpreterFor (VariableWatcher !! Report) r Source #
Interpret VariableWatcher
by doing nothing.
runIfDifferent :: (Object -> Handler r ()) -> Object -> Object -> Handler r () Source #
Run the handler if the two Object
s are different.
checkVar :: Member (Rpc !! RpcError) r => WatchedVariable -> Object -> (Object -> Handler r ()) -> Handler r Object Source #
Fetch the current value of the watched variable and call the handler if its value has changed.
watchVariables :: Members [VariableWatcher !! Report, Rpc !! RpcError, Resource, Mask mres, Race, Embed IO] r => Map WatchedVariable (Object -> Handler r ()) -> Sem r a -> Sem r a Source #
This is a reactive system that is triggered by several frequently sent autocommands to inspect a user-defined set of Neovim variables for changes. When a variable's value has been observed to have changed from the previously recorded state, the associated handler is executed.
This handler has to be passed to runNvimPluginIO
or similar as part of the custom effect stack, like:
runNvimPluginIO "my-plugin" (watchVariables [("variable_name", handler)]) mempty
This does not remove VariableWatcher
from the stack, but intercepts and resends it, to make it simpler to use
with the plugin runners.
interpretVariableWatcher :: Members [Rpc !! RpcError, Resource, Mask mres, Race, Embed IO] r => Map WatchedVariable (Object -> Handler ((VariableWatcher !! Report) ': r) ()) -> InterpreterFor (VariableWatcher !! Report) r Source #
Interpret VariableWatcher
with watchVariables
, but eliminate the effect from the stack.