Tested with: tinkerpop/gremlin-server:3.7.3 (docker container)
README.md has the following code.
import Control.Exception.Safe (bracket, try, SomeException) import Data.Foldable (toList) import Data.Greskell.Greskell (Greskell) -- from greskell package import Data.Greskell.Binder -- from greskell package (Binder, newBind, runBinder) import Network.Greskell.WebSocket -- from greskell-websocket package (connect, close, submit, slurpResults) import System.IO (hPutStrLn, stderr) 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 = hspec $ specify "submit" $ do egot <- try submitExample :: IO (Either SomeException [Int]) case egot of Left e -> do hPutStrLn stderr ("submit error: " ++ show e) hPutStrLn stderr (" We ignore the error. Probably there's no server running?") Right got -> do hPutStrLn stderr ("submit success: " ++ show got) got `shouldBe` [60]
This fails, because the gremlin-server emits an exception with message "unable to resolve class __v0".
This is due to the bug in Groovy: [GROOVY-10355] Compiler interpret variable name as class name when in parentheses. - ASF JIRA
The above greskell code constructs a script (__v0)+(10). According to the above bug, the Groovy compiler treats (__v0) as the typecast unary operator and + as the unary plus, thus it treats __v0 as a type name.
I confirmed that ((__v0))+(10) worked as expected, that is, __v0 was resolved as a varible name.