-
Notifications
You must be signed in to change notification settings - Fork 17
Services code review 1 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n be generated simultaneously. The gen tests now pass, still need to update md5 specific tests.
… response messages>
…in enough information.
…ieve the return values.
…te (in progress), add add_two_ints_server.py as a local file for servicetest.
…sts/ServiceClientTest.hs)
|
The Travis build fails since ServiceClientTest (servicetest test suite) needs manual set up. |
…tter error message.
|
Since making the pull request I have added error detection and exception handling to callService. |
Tests/MsgGen.hs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haddock syntax doesn't need the vertical bar character (|) on each line.
Perhaps we should deal with the requirement to call cachePkg ourselves by keeping a Set of cached packages, and calling cachePkg ourselves when loading a message definition from an uncached package.
|
This is an outstanding job! It's really great that not only will this add a really useful feature, but I think it's forcing improvements through the existing code you've had to touch. |
src/Ros/Graph/Master.hs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you replace return . left with throwError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing that results in a type error. Since handler returns an IO action, throwError expects an IOException. This is because in the MonadError class the error has a functional dependency on the monad returned by throwError.
Couldn't match type `GHC.IO.Exception.IOException'
with `ServiceResponseExcept'
When using functional dependencies to combine
Control.Monad.Error.Class.MonadError
GHC.IO.Exception.IOException IO,
arising from the dependency `m -> e'
in the instance declaration in `Control.Monad.Error.Class'
Control.Monad.Error.Class.MonadError ServiceResponseExcept IO,
arising from a use of `handler'
at /home/robbie/git/robbie/roshask/src/Ros/Graph/Master.hs:55:55-61
In the second argument of `flip', namely `handler'
In the second argument of `(.)', namely
`(flip catchIOError) handler'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point! I had looked at the docs but read right over the fundep.
|
The previous two commits should address the remaining comments. |
I have been working on implementing services and thought it would be nice to get some feedback. This is still a work in progress, so this should not be merged.
Check out the new tests in Tests/MsgGen.hs, and Tests/ServiceClientTests/ServiceClientTest.hs (instructions in comments). Right now it can generate Haskell types for service messages (tested by MsgGen), and call ROS services without any error handling (tested by ServiceClientTest).
Service message generation is not yet integrated into the executable.
Service Haskell types are just like message types except that they are also instances of SrvInfo. The generated Haskell message type files should be the same as before except they might have an extra newline at the end.
Except for MsgGen, changes to existing code are minimal: there is some code extraction and changes suggested by hlint.