acowley / roshask

Haskell client library for the ROS robotics framework.
BSD 3-Clause "New" or "Revised" License
107 stars 18 forks source link

Build error with new haxr version. #29

Closed akru closed 9 years ago

akru commented 9 years ago

Build error with x86_64 GHC version 7.8.4:

src/Ros/Graph/Master.hs:56:20:
    Couldn't match expected type ‘Control.Monad.Trans.Error.ErrorT
                                    [Char] IO (Int, String, String)’
                with actual type ‘ExceptT String IO b0’
    Relevant bindings include
      res :: ExceptT String IO b0 (bound at src/Ros/Graph/Master.hs:55:7)
    In the first argument of ‘runErrorT’, namely ‘res’
    In a stmt of a 'do' block: err <- runErrorT res

Branch master.

http://hackage.haskell.org/package/haxr-3000.10.3.1/docs/Network-XmlRpc-Internals.html#t:Err BUT http://hackage.haskell.org/package/haxr-3000.10.4.2/docs/Network-XmlRpc-Internals.html#t:Err

Simple fix:

diff --git a/roshask.cabal b/roshask.cabal
index 898ea35..c112bd4 100644
--- a/roshask.cabal
+++ b/roshask.cabal
@@ -112,7 +112,7 @@ Library
                        snap-server >= 0.9,
                        storable-tuple >= 0.0.2,
                        transformers >= 0.4,
-                       haxr >= 3000.10.3,
+                       haxr >= 3000.10.4,
                        utf8-string >= 0.3.6,
                        uri >= 0.1.5,
                        vector-space,
diff --git a/src/Ros/Graph/Master.hs b/src/Ros/Graph/Master.hs
index faba000..533c169 100644
--- a/src/Ros/Graph/Master.hs
+++ b/src/Ros/Graph/Master.hs
@@ -5,9 +5,8 @@ import Network.XmlRpc.Client
 import Ros.Internal.RosTypes
 import Ros.Service.ServiceTypes
 import Network.XmlRpc.Internals (fromValue, toValue)
-import Control.Monad.Except (ExceptT(..))
+import Control.Monad.Except (ExceptT(..), runExceptT)
 import System.IO.Error (catchIOError)
-import Control.Monad.Error (runErrorT)

 -- |Subscribe the caller to the specified topic. In addition to
 -- receiving a list of current publishers, the subscriber will also
@@ -53,7 +52,7 @@ unregisterPublisher = flip remote "unregisterPublisher"
 lookupService :: URI -> String -> ServiceName -> ExceptT ServiceResponseExcept IO (Int, String, String)
 lookupService u s1 s2 = ExceptT . (flip catchIOError) handler $ do
   let res = call u "lookupService" (fmap toValue [s1, s2]) >>= fromValue
-  err <- runErrorT res
+  err <- runExceptT res
   return $ case err of
     Left x -> Left $ MasterExcept $ "Could not look up service with master. Got message: " ++ x
     Right y -> Right y