{-# options_haddock prune, hide #-}
module Ribosome.Examples.Example2 where
import Data.MessagePack (Object)
import Ribosome
import Ribosome.Api
changed ::
Members NvimPlugin r =>
Object ->
Handler r ()
changed :: forall (r :: [(* -> *) -> * -> *]).
Members NvimPlugin r =>
Object -> Handler r ()
changed Object
value =
Sem (Rpc : Stop Report : r) () -> Sem (Stop Report : r) ()
forall (r :: [(* -> *) -> * -> *]) a.
Member (Rpc !! RpcError) r =>
Sem (Rpc : r) a -> Sem r ()
ignoreRpcError (Text -> Sem (Rpc : Stop Report : r) ()
forall (r :: [(* -> *) -> * -> *]).
Members '[Rpc, Reader PluginName] r =>
Text -> Sem r ()
echo (Text
"Update value to: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Object -> Text
forall b a. (Show a, IsString b) => a -> b
show Object
value))
main :: IO ()
main :: IO ()
main =
PluginConfig () -> Sem (RemoteStack ()) () -> IO ()
runRemoteStack PluginConfig ()
"watch-plugin" (Map
WatchedVariable
(Object
-> Handler
'[Resumable RpcError Scratch, Resumable SettingError Settings,
VariableWatcher !! Report, Resumable Report Handlers, Log,
DataLog LogReport, Rpc !! RpcError,
Resumable RpcError (Responses RequestId Response),
Events (OutChan Event) Event,
PScoped () (EventChan Event) (Consume Event), Reports,
Process RpcMessage (Either Text RpcMessage), UserError,
Reader PluginName, Reader (CustomConfig ()), Log,
Tagged "stderr" Log, Tagged "file" Log, Reader LogConfig,
Reader HostConfig, Time Time Date, Error BootError,
Mask Restoration, Mask Restoration, GatesIO, Race, Async, Resource,
Embed IO, Final IO]
())
-> Sem
'[Resumable RpcError Scratch, Resumable SettingError Settings,
VariableWatcher !! Report, Resumable Report Handlers, Log,
DataLog LogReport, Rpc !! RpcError,
Resumable RpcError (Responses RequestId Response),
Events (OutChan Event) Event,
PScoped () (EventChan Event) (Consume Event), Reports,
Process RpcMessage (Either Text RpcMessage), UserError,
Reader PluginName, Reader (CustomConfig ()), Log,
Tagged "stderr" Log, Tagged "file" Log, Reader LogConfig,
Reader HostConfig, Time Time Date, Error BootError,
Mask Restoration, Mask Restoration, GatesIO, Race, Async, Resource,
Embed IO, Final IO]
()
-> Sem
'[Resumable RpcError Scratch, Resumable SettingError Settings,
VariableWatcher !! Report, Resumable Report Handlers, Log,
DataLog LogReport, Rpc !! RpcError,
Resumable RpcError (Responses RequestId Response),
Events (OutChan Event) Event,
PScoped () (EventChan Event) (Consume Event), Reports,
Process RpcMessage (Either Text RpcMessage), UserError,
Reader PluginName, Reader (CustomConfig ()), Log,
Tagged "stderr" Log, Tagged "file" Log, Reader LogConfig,
Reader HostConfig, Time Time Date, Error BootError,
Mask Restoration, Mask Restoration, GatesIO, Race, Async, Resource,
Embed IO, Final IO]
()
forall mres (r :: [(* -> *) -> * -> *]) a.
Members
'[VariableWatcher !! Report, Rpc !! RpcError, Resource, Mask mres,
Race, Embed IO]
r =>
Map WatchedVariable (Object -> Handler r ()) -> Sem r a -> Sem r a
watchVariables [(WatchedVariable
"trigger", Object
-> Handler
'[Resumable RpcError Scratch, Resumable SettingError Settings,
VariableWatcher !! Report, Resumable Report Handlers, Log,
DataLog LogReport, Rpc !! RpcError,
Resumable RpcError (Responses RequestId Response),
Events (OutChan Event) Event,
PScoped () (EventChan Event) (Consume Event), Reports,
Process RpcMessage (Either Text RpcMessage), UserError,
Reader PluginName, Reader (CustomConfig ()), Log,
Tagged "stderr" Log, Tagged "file" Log, Reader LogConfig,
Reader HostConfig, Time Time Date, Error BootError,
Mask Restoration, Mask Restoration, GatesIO, Race, Async, Resource,
Embed IO, Final IO]
()
forall (r :: [(* -> *) -> * -> *]).
Members NvimPlugin r =>
Object -> Handler r ()
changed)] Sem
'[Resumable RpcError Scratch, Resumable SettingError Settings,
VariableWatcher !! Report, Resumable Report Handlers, Log,
DataLog LogReport, Rpc !! RpcError,
Resumable RpcError (Responses RequestId Response),
Events (OutChan Event) Event,
PScoped () (EventChan Event) (Consume Event), Reports,
Process RpcMessage (Either Text RpcMessage), UserError,
Reader PluginName, Reader (CustomConfig ()), Log,
Tagged "stderr" Log, Tagged "file" Log, Reader LogConfig,
Reader HostConfig, Time Time Date, Error BootError,
Mask Restoration, Mask Restoration, GatesIO, Race, Async, Resource,
Embed IO, Final IO]
()
forall c (r :: [(* -> *) -> * -> *]).
(Members HandlerStack r, Members (BasicPluginStack c) r) =>
Sem r ()
remotePlugin)