-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell binding for Gremlin graph query language - core data types and tools -- -- Haskell binding for Gremlin graph query language. See -- README.md for detail. -- -- This package contains only core data types and tools used commonly by -- other related packages. @package greskell-core @version 0.1.1.0 module Data.Greskell.GraphSON -- | Wrapper for "typed JSON object" introduced in GraphSON version 2. See -- http://tinkerpop.apache.org/docs/current/dev/io/#graphson -- -- This data type is useful for encoding/decoding GraphSON text. -- --
--   >>> Aeson.decode "1000" :: Maybe (GraphSON Int32)
--   Just (GraphSON {gsonType = Nothing, gsonValue = 1000})
--   
--   >>> Aeson.decode "{\"@type\": \"g:Int32\", \"@value\": 1000}" :: Maybe (GraphSON Int32)
--   Just (GraphSON {gsonType = Just "g:Int32", gsonValue = 1000})
--   
data GraphSON v GraphSON :: Maybe Text -> v -> GraphSON v -- | Type ID, corresponding to @type field. [gsonType] :: GraphSON v -> Maybe Text -- | Value, correspoding to @value field. [gsonValue] :: GraphSON v -> v -- | Types that have an intrinsic type ID for gsonType field. class GraphSONTyped a -- | Type ID for gsonType. gsonTypeFor :: GraphSONTyped a => a -> Text -- | Create a GraphSON without gsonType. -- --
--   >>> nonTypedGraphSON (10 :: Int)
--   GraphSON {gsonType = Nothing, gsonValue = 10}
--   
nonTypedGraphSON :: v -> GraphSON v -- | Create a GraphSON with its type ID. -- --
--   >>> typedGraphSON (10 :: Int32)
--   GraphSON {gsonType = Just "g:Int32", gsonValue = 10}
--   
typedGraphSON :: GraphSONTyped v => v -> GraphSON v -- | Create a GraphSON with the given type ID. -- --
--   >>> typedGraphSON' "g:Int32" (10 :: Int)
--   GraphSON {gsonType = Just "g:Int32", gsonValue = 10}
--   
typedGraphSON' :: Text -> v -> GraphSON v -- | Parse GraphSON v, but it checks gsonType. If -- gsonType is Nothing or it's not equal to -- gsonTypeFor, the Parser fails. parseTypedGraphSON :: (GraphSONTyped v, FromJSON v) => Value -> Parser (GraphSON v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Data.Greskell.GraphSON.GraphSON v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Data.Greskell.GraphSON.GraphSON v) instance GHC.Show.Show v => GHC.Show.Show (Data.Greskell.GraphSON.GraphSON v) instance Data.Greskell.GraphSON.GraphSONTyped GHC.Types.Char instance Data.Greskell.GraphSON.GraphSONTyped GHC.Int.Int8 instance Data.Greskell.GraphSON.GraphSONTyped GHC.Int.Int16 instance Data.Greskell.GraphSON.GraphSONTyped GHC.Int.Int32 instance Data.Greskell.GraphSON.GraphSONTyped GHC.Int.Int64 instance Data.Greskell.GraphSON.GraphSONTyped GHC.Types.Float instance Data.Greskell.GraphSON.GraphSONTyped GHC.Types.Double instance Data.Greskell.GraphSON.GraphSONTyped [a] instance Data.Greskell.GraphSON.GraphSONTyped Data.Scientific.Scientific instance Data.Greskell.GraphSON.GraphSONTyped (Data.HashMap.Base.HashMap k v) instance Data.Greskell.GraphSON.GraphSONTyped (Data.HashSet.HashSet a) instance GHC.Base.Functor Data.Greskell.GraphSON.GraphSON instance Data.Foldable.Foldable Data.Greskell.GraphSON.GraphSON instance Data.Traversable.Traversable Data.Greskell.GraphSON.GraphSON instance Data.Aeson.Types.ToJSON.ToJSON v => Data.Aeson.Types.ToJSON.ToJSON (Data.Greskell.GraphSON.GraphSON v) instance Data.Aeson.Types.FromJSON.FromJSON v => Data.Aeson.Types.FromJSON.FromJSON (Data.Greskell.GraphSON.GraphSON v) module Data.Greskell.Greskell -- | Gremlin expression of type a. -- -- Greskell is essentially just a piece of Gremlin script with a -- phantom type. The type a represents the type of data that the -- script is supposed to evaluate to. -- -- Eq and Ord instances compare Gremlin scripts, NOT the -- values they evaluate to. data Greskell a -- | Something that can convert to Greskell. class ToGreskell a where { type family GreskellReturn a; } toGreskell :: ToGreskell a => a -> Greskell (GreskellReturn a) -- | Create a readable Gremlin script from Greskell. toGremlin :: ToGreskell a => a -> Text -- | Same as toGremlin except that this returns lazy Text. toGremlinLazy :: ToGreskell a => a -> Text -- | Create a String literal in Gremlin script. The content is -- automatically escaped. -- --
--   >>> toGremlin $ string "foo bar"
--   "\"foo bar\""
--   
--   >>> toGremlin $ string "escape newline\n escape dollar $"
--   "\"escape newline\\n escape dollar \\$\""
--   
string :: Text -> Greskell Text -- | Boolean true literal. -- --
--   >>> toGremlin true
--   "true"
--   
true :: Greskell Bool -- | Boolean false literal. -- --
--   >>> toGremlin false
--   "false"
--   
false :: Greskell Bool -- | List literal. -- --
--   >>> toGremlin $ list ([100, 200, 300] :: [Greskell Int])
--   "[100,200,300]"
--   
list :: [Greskell a] -> Greskell [a] -- | Make a list with a single object. Useful to prevent the Gremlin Server -- from automatically iterating the result object. -- --
--   >>> toGremlin $ single ("hoge" :: Greskell String)
--   "[\"hoge\"]"
--   
single :: Greskell a -> Greskell [a] -- | Arbitrary precision number literal, like "123e8". -- --
--   >>> toGremlin $ number 123e8
--   "1.23e10"
--   
number :: Scientific -> Greskell Scientific -- | Aeson Value literal. -- --
--   >>> toGremlin $ value Aeson.Null
--   "null"
--   
--   >>> toGremlin $ value $ Aeson.toJSON $ ([10, 20, 30] :: [Int])
--   "[10.0,20.0,30.0]"
--   
--   >>> toGremlin $ value $ Aeson.Object mempty
--   "[:]"
--   
value :: Value -> Greskell Value -- | Unsafely create a Greskell of arbitrary type. The given Gremlin -- script is printed as-is. -- --
--   >>> toGremlin $ unsafeGreskell "x + 100"
--   "x + 100"
--   
unsafeGreskell :: Text -> Greskell a -- | Same as unsafeGreskell, but it takes lazy Text. unsafeGreskellLazy :: Text -> Greskell a -- | Unsafely create a Greskell that calls the given function with -- the given arguments. -- --
--   >>> toGremlin $ unsafeFunCall "add" ["10", "20"]
--   "add(10,20)"
--   
unsafeFunCall :: Text -> [Text] -> Greskell a -- | Unsafely create a Greskell that calls the given object method -- call with the given target and arguments. -- --
--   >>> toGremlin $ unsafeMethodCall ("foobar" :: Greskell String) "length" []
--   "(\"foobar\").length()"
--   
unsafeMethodCall :: Greskell a -> Text -> [Text] -> Greskell b instance GHC.Classes.Ord (Data.Greskell.Greskell.Greskell a) instance GHC.Classes.Eq (Data.Greskell.Greskell.Greskell a) instance GHC.Show.Show (Data.Greskell.Greskell.Greskell a) instance Data.Greskell.Greskell.ToGreskell (Data.Greskell.Greskell.Greskell a) instance Data.String.IsString a => Data.String.IsString (Data.Greskell.Greskell.Greskell a) instance GHC.Base.Functor Data.Greskell.Greskell.Greskell instance GHC.Num.Num a => GHC.Num.Num (Data.Greskell.Greskell.Greskell a) instance GHC.Real.Fractional a => GHC.Real.Fractional (Data.Greskell.Greskell.Greskell a) instance Data.String.IsString a => Data.Semigroup.Semigroup (Data.Greskell.Greskell.Greskell a) instance Data.String.IsString a => GHC.Base.Monoid (Data.Greskell.Greskell.Greskell a)