Small fixes and tests.
diff --git a/Network/YAML/Base.hs b/Network/YAML/Base.hs
index 3c82805..2a3c416 100644
--- a/Network/YAML/Base.hs
+++ b/Network/YAML/Base.hs
@@ -70,6 +70,5 @@ unserialize :: IsYamlObject a => BS.ByteString -> Maybe a
unserialize x =
let d :: Maybe YamlObject
d = decode x
- in case d of
- Just y -> Just $ cs y
- Nothing -> Nothing
+ in cs `fmap` d
+
diff --git a/Test.hs b/Test.hs
index 1421dbd..35cd10a 100644
--- a/Test.hs
+++ b/Test.hs
@@ -18,8 +18,18 @@ double (Point x y) = return $ Point (x*2) (y*2)
mySum :: [Double] -> IO Double
mySum = return . sum
+counter :: Int -> IO Int
+counter k = do
+ mapM count [k..k+10]
+ return (k+10)
+ where
+ count i = do
+ print i
+ threadDelay 1000000
+
rules = mkRules [("double", yamlMethod double),
- ("sum", yamlMethod mySum)]
+ ("sum", yamlMethod mySum),
+ ("count", yamlMethod counter)]
main = do
putStrLn "Listening..."
diff --git a/TestCall.hs b/TestCall.hs
index b21aeda..5a1a1fb 100644
--- a/TestCall.hs
+++ b/TestCall.hs
@@ -28,3 +28,5 @@ main = do
print (s :: Double)
rs <- callP getService "test" "double" ps
print (rs :: [Point])
+ cs <- callP getService "test" "count" ([3,4,5,6] :: [Int])
+ print (cs :: [Int])
diff --git a/yaml-rpc.cabal b/yaml-rpc.cabal
index 710a2de..e8a08a2 100644
--- a/yaml-rpc.cabal
+++ b/yaml-rpc.cabal
@@ -43,7 +43,7 @@ Build-type: Simple
-- Extra-source-files:
-- Constraint on the version of Cabal needed to build this package.
-Cabal-version: >=1.2
+Cabal-version: >=1.4
Library
@@ -57,7 +57,7 @@ Library
-- Packages needed in order to build this package.
Build-depends: yaml, data-object-yaml, network, template-haskell, bytestring,
- data-object, data-default, base, mtl, convertible-text,
+ data-object, data-default, base >= 3 && <= 5, mtl, convertible-text,
containers
-- Modules not exported by this package.