Closed JeffreyBenjaminBrown closed 5 years ago
Thanks for reporting!
To run examples of README.md, just type stack test test-readme
. You can directly modify README.md.
I'll revise the README.md to show that fact.
Updated README.md and "submit" example.
Thanks for this repo! I can't wait to dig in.
It took me a day of work to get Greskell working. I'm hoping that by sharing this recipe I can save others some time. The problem is mostly not in Greskell; it's that there are a gazillion ways to use Gremlin. Eventually I struck on the following, which works:
docker run --name gremlin -p 8182:8182 tinkerpop/gremlin-server:3.4.2
(if that's still the latest version). (I've added the -name and -p arguments; the first is optional, but the second is critical.)hspec
to thebuild-depends
list ingreskell/greskell/greskell.cabal
.submit to the Gremlin Server
code from the README into a file called something liketest-server.hs
.import Test.Hspec
. Second, so that you can see whether it's actually working, add print statements to the case statement. For convenience, here's the result of those substitutions:submitExample :: IO [Int] submitExample = bracket (connect "localhost" 8182) close $ \client -> do let (g, binding) = runBinder $ plusTen 50 result_handle <- submit client g (Just binding) fmap toList $ slurpResults result_handle
plusTen :: Int -> Binder (Greskell Int) plusTen x = do var_x <- newBind x return $ var_x + 10
main :: IO () main = hspec $ specify "submit" $ do egot <- try submitExample :: IO (Either SomeException [Int]) case egot of Left _ -> print "LEFT" >> return () -- probably there's no server running Right got -> print "RIGHT" >> (got
shouldBe
[60])