greskell-1.1.0.1: Haskell binding for Gremlin graph query language

MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Greskell.Binder

Contents

Description

 
Synopsis

Types

data Binder a Source #

A Monad that manages binding variables and labels to values.

>>> let binder = (,) <$> newBind (10 :: Int) <*> newBind "hoge"
>>> let ((var_int, var_str), binding) = runBinder binder
>>> toGremlin var_int
"__v0"
>>> toGremlin var_str
"__v1"
>>> sortBy (comparing fst) $ HashMap.toList binding
[("__v0",Number 10.0),("__v1",String "hoge")]
Instances
Monad Binder Source # 
Instance details

Defined in Data.Greskell.Binder

Methods

(>>=) :: Binder a -> (a -> Binder b) -> Binder b #

(>>) :: Binder a -> Binder b -> Binder b #

return :: a -> Binder a #

fail :: String -> Binder a #

Functor Binder Source # 
Instance details

Defined in Data.Greskell.Binder

Methods

fmap :: (a -> b) -> Binder a -> Binder b #

(<$) :: a -> Binder b -> Binder a #

Applicative Binder Source # 
Instance details

Defined in Data.Greskell.Binder

Methods

pure :: a -> Binder a #

(<*>) :: Binder (a -> b) -> Binder a -> Binder b #

liftA2 :: (a -> b -> c) -> Binder a -> Binder b -> Binder c #

(*>) :: Binder a -> Binder b -> Binder b #

(<*) :: Binder a -> Binder b -> Binder a #

type Binding = Object Source #

Binding between Gremlin variable names and JSON values.

Actions

newBind Source #

Arguments

:: ToJSON v 
=> v

bound value

-> Binder (Greskell v)

variable

Create a new Gremlin variable bound to the given value.

The value v is kept in the monadic context. The returned Greskell is a Gremlin variable pointing to the v. The Gremlin variable is guaranteed to be unique in the current monadic context.

newAsLabel :: Binder (AsLabel a) Source #

Create a new AsLabel.

The returned AsLabel is guaranteed to be unique in the current monadic context.

Since: 0.2.2.0

Runners

runBinder :: Binder a -> (a, Binding) Source #

Execute the given Binder monad to obtain Binding.