Representation of arbitrary types for a plugin #14
Description
My thinking is that we have an "inner" and an "outer" protocol. The inner/logical one is processed by all the plugins, the outer one comes about when a specific inner message is wrapped in a transport for delivery on the wire.
A possible version of the inner protocol is defined in https://github.com/haskell/haskell-ide-engine/blob/plugins-definitions-play/haskell-ide-plugin-api/Haskell/Ide/PluginDescriptor.hs.
A IdeRequest
is defined as
data IdeRequest = IdeRequest
{ ideCommand :: CommandName
, ideSession :: SessionContext
, ideContext :: CommandContext
, ideParams :: Map.Map ParamId ParamVal
} deriving Show
type ParamId = String
type ParamVal = String
This initially expects any additional parameters required for a command are String
values.
The response is defined as
data IdeResponse = IdeResponseOk String -- ^ Command Succeeded
| IdeResponseFail String -- ^ Command Failed
| IdeResponseError String -- ^ some error in haskell-ide-engine
-- driver. Equivalent to HTTP 500
-- status
deriving Show
The String
type is a problem.
What is a good way to represent the value for the IdeResponse
inner protocol so that it can be serialised/deserialied via an arbitrary transport mechanism, such as JSON, MSGPACK, etc.