Skip to content

Conversation

alt-romes
Copy link
Collaborator

Fixes #15

Exposes 'sendRunInTerminalReverseRequest' helper too.
@alt-romes
Copy link
Collaborator Author

@dmjio I'm using this change in the debugger successfully. Perhaps you'd like to review?

Copy link
Contributor

@dmjio dmjio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but wondering if we can reuse send here.

writeToHandle address handle payload
resetAdaptorStatePayload
----------------------------------------------------------------------------
-- | Write reverse request to Handle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since reverse requests technically do inherit from ProtocolMesssage, I think it might best if we set the seqNum. It should be possible to define sendReverseRequest in terms of send, and then we'd get this for free.

sendReverseRequest
  :: ReverseCommand
  -> Adaptor app request ()
sendReverseRequest rcmd = send $ do
  setField "type" MessageTypeRequest
  setField "command" rcmd

It very well might be true that reverse requests are not subject to sequence numbers, but since it technically inherits ProtocolMesssage it's "the right thing to do".

Then sendRunInTerminalReverseRequest could be

sendRunInTerminalReverseRequest :: RunInTerminalRequestArguments -> Adaptor app request ()
sendRunInTerminalReverseRequest args = do
  setField "arguments" args
  sendReverseRequest ReverseCommandRunInTerminal

monad-control >= 1.0.3 && < 1.1,
mtl >= 2.2.2 && < 2.4,
network >= 3.1.2 && < 3.2,
network >= 3.1.2 && < 3.3,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

name = show (typeRep (Proxy @ReverseCommand))
----------------------------------------------------------------------------
instance ToJSON ReverseCommand where
toJSON cmd = genericToJSONWithModifier cmd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

point free 💅🏼 toJSON = genericToJSONWithModifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'runInTerminal' not supported by API
2 participants