-- 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.3.4 -- | This module is for advanced use. Most users should just use -- Data.Greskell.GraphSON. -- -- This module defines GValue and exposes its deconstructors. module Data.Greskell.GraphSON.GValue -- | An Aeson Value wrapped in GraphSON wrapper type. -- Basically this type is the Haskell representaiton of a -- GraphSON-encoded document. -- -- This type is used to parse GraphSON documents. See also -- FromGraphSON class. newtype GValue GValue :: GraphSON GValueBody -> GValue [unGValue] :: GValue -> GraphSON GValueBody -- | GValue without the top-level GraphSON wrapper. data GValueBody GObject :: !HashMap Text GValue -> GValueBody GArray :: !Vector GValue -> GValueBody GString :: !Text -> GValueBody GNumber :: !Scientific -> GValueBody GBool :: !Bool -> GValueBody GNull :: GValueBody -- | Create a GValue without "@type" field. nonTypedGValue :: GValueBody -> GValue -- | Create a GValue with the given "@type" field. typedGValue' :: Text -> GValueBody -> GValue -- | Remove all GraphSON wrappers recursively from GValue. unwrapAll :: GValue -> Value -- | Remove the top-level GraphSON wrapper, but leave other wrappers -- as-is. The remaining wrappers are reconstructed by toJSON to -- make them into Value. unwrapOne :: GValue -> Value -- | Get the GValueBody from GValue. gValueBody :: GValue -> GValueBody -- | Get the gsonType field from GValue. gValueType :: GValue -> Maybe Text instance GHC.Generics.Generic Data.Greskell.GraphSON.GValue.GValue instance GHC.Classes.Eq Data.Greskell.GraphSON.GValue.GValue instance GHC.Show.Show Data.Greskell.GraphSON.GValue.GValue instance GHC.Generics.Generic Data.Greskell.GraphSON.GValue.GValueBody instance GHC.Classes.Eq Data.Greskell.GraphSON.GValue.GValueBody instance GHC.Show.Show Data.Greskell.GraphSON.GValue.GValueBody instance Data.Hashable.Class.Hashable Data.Greskell.GraphSON.GValue.GValue instance Data.Hashable.Class.Hashable Data.Greskell.GraphSON.GValue.GValueBody instance Data.Aeson.Types.FromJSON.FromJSON Data.Greskell.GraphSON.GValue.GValue instance Data.Aeson.Types.ToJSON.ToJSON Data.Greskell.GraphSON.GValue.GValue instance Data.Aeson.Types.ToJSON.ToJSON Data.Greskell.GraphSON.GValue.GValueBody -- | This module defines types for parsing a "g:Map" GraphSON object. -- Usually users only have to use GMapEntry, because other types -- are just used internally to implement GraphSON parsers. module Data.Greskell.GMap -- | JSON encoding of a map as an array of flattened key-value pairs. -- -- ToJSON instance of this type encodes the internal map as an -- array of keys and values. FromJSON instance of this type parses -- that flattened map. -- -- -- --
--   >>> let decode s = Aeson.eitherDecode s :: Either String (FlattenedMap HashMap Int String)
--   
--   >>> let toSortedList = sort . HashMap.toList . unFlattenedMap
--   
--   >>> fmap toSortedList $ decode "[10, \"ten\", 11, \"eleven\"]"
--   Right [(10,"ten"),(11,"eleven")]
--   
--   >>> fmap toSortedList $ decode "[]"
--   Right []
--   
--   >>> let (Left err_msg) = decode "[10, \"ten\", 11]"
--   
--   >>> err_msg
--   ...odd number of elements...
--   
--   >>> Aeson.encode $ FlattenedMap $ (HashMap.fromList [(10, "ten")] :: HashMap Int String)
--   "[10,\"ten\"]"
--   
newtype FlattenedMap c k v FlattenedMap :: c k v -> FlattenedMap c k v [unFlattenedMap] :: FlattenedMap c k v -> c k v -- | General parser for FlattenedMap. parseToFlattenedMap :: (IsList (c k v), Item (c k v) ~ (k, v)) => (s -> Parser k) -> (s -> Parser v) -> Vector s -> Parser (FlattenedMap c k v) -- | Haskell representation of g:Map type. -- -- GraphSON v1 and v2 encode Java Map type as a JSON Object, -- while GraphSON v3 encodes it as an array of flattened keys and values -- (like FlattenedMap.) GMap type handles both encoding -- schemes. -- -- -- --
--   >>> Aeson.eitherDecode "{\"ten\": 10}" :: Either String (GMap HashMap Text Int)
--   Right (GMap {gmapFlat = False, gmapValue = fromList [("ten",10)]})
--   
--   >>> Aeson.eitherDecode "[\"ten\", 10]" :: Either String (GMap HashMap Text Int)
--   Right (GMap {gmapFlat = True, gmapValue = fromList [("ten",10)]})
--   
--   >>> Aeson.encode $ GMap False (HashMap.fromList [(9, "nine")] :: HashMap Int Text)
--   "{\"9\":\"nine\"}"
--   
--   >>> Aeson.encode $ GMap True (HashMap.fromList [(9, "nine")] :: HashMap Int Text)
--   "[9,\"nine\"]"
--   
data GMap c k v GMap :: !Bool -> !c k v -> GMap c k v -- | If True, the map is encoded as an array. If False, it's -- encoded as a JSON Object. [gmapFlat] :: GMap c k v -> !Bool -- | Map implementation. [gmapValue] :: GMap c k v -> !c k v -- | Get the map implementation from GMap. unGMap :: GMap c k v -> c k v -- | Create GMap that has the single GMapEntry. singleton :: (IsList (c k v), Item (c k v) ~ (k, v)) => GMapEntry k v -> GMap c k v -- | Deconstruct GMap into a list of GMapEntrys. toList :: (IsList (c k v), Item (c k v) ~ (k, v)) => GMap c k v -> [GMapEntry k v] -- | General parser for GMap. parseToGMap :: (IsList (c k v), Item (c k v) ~ (k, v)) => (s -> Parser k) -> (s -> Parser v) -> (HashMap Text s -> Parser (c k v)) -> Either (HashMap Text s) (Vector s) -> Parser (GMap c k v) -- | Haskell representation of Map.Entry type. -- -- Basically GraphSON encodes Java's Map.Entry type as if it -- were a Map with a single entry. Thus its encoded form is -- either a JSON object or a flattened key-values, as explained in -- GMap. -- --
--   >>> Aeson.eitherDecode "{\"1\": \"one\"}" :: Either String (GMapEntry Int Text)
--   Right (GMapEntry {gmapEntryFlat = False, gmapEntryKey = 1, gmapEntryValue = "one"})
--   
--   >>> Aeson.eitherDecode "[1, \"one\"]" :: Either String (GMapEntry Int Text)
--   Right (GMapEntry {gmapEntryFlat = True, gmapEntryKey = 1, gmapEntryValue = "one"})
--   
--   >>> Aeson.encode (GMapEntry False "one" 1 :: GMapEntry Text Int)
--   "{\"one\":1}"
--   
--   >>> Aeson.encode (GMapEntry True "one" 1 :: GMapEntry Text Int)
--   "[\"one\",1]"
--   
-- -- In old versions of TinkerPop, Map.Entry is encoded as a JSON -- object with "key" and "value" fields. FromJSON instance of -- GMapEntry supports this format as well, but ToJSON -- instance doesn't support it. -- --
--   >>> Aeson.eitherDecode "{\"key\":1, \"value\": \"one\"}" :: Either String (GMapEntry Int Text)
--   Right (GMapEntry {gmapEntryFlat = False, gmapEntryKey = 1, gmapEntryValue = "one"})
--   
data GMapEntry k v GMapEntry :: !Bool -> !k -> !v -> GMapEntry k v [gmapEntryFlat] :: GMapEntry k v -> !Bool [gmapEntryKey] :: GMapEntry k v -> !k [gmapEntryValue] :: GMapEntry k v -> !v -- | Get the key-value pair from GMapEntry. unGMapEntry :: GMapEntry k v -> (k, v) -- | General parser for GMapEntry. parseToGMapEntry :: FromJSONKey k => (s -> Parser k) -> (s -> Parser v) -> Either (HashMap Text s) (Vector s) -> Parser (GMapEntry k v) instance GHC.Base.Functor (Data.Greskell.GMap.GMapEntry k) instance Data.Traversable.Traversable (Data.Greskell.GMap.GMapEntry k) instance Data.Foldable.Foldable (Data.Greskell.GMap.GMapEntry k) instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Data.Greskell.GMap.GMapEntry k v) instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Data.Greskell.GMap.GMapEntry k v) instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Data.Greskell.GMap.GMapEntry k v) instance GHC.Base.Functor (c k) => GHC.Base.Functor (Data.Greskell.GMap.GMap c k) instance Data.Traversable.Traversable (c k) => Data.Traversable.Traversable (Data.Greskell.GMap.GMap c k) instance Data.Foldable.Foldable (c k) => Data.Foldable.Foldable (Data.Greskell.GMap.GMap c k) instance GHC.Classes.Eq (c k v) => GHC.Classes.Eq (Data.Greskell.GMap.GMap c k v) instance GHC.Show.Show (c k v) => GHC.Show.Show (Data.Greskell.GMap.GMap c k v) instance GHC.Base.Functor (c k) => GHC.Base.Functor (Data.Greskell.GMap.FlattenedMap c k) instance Data.Traversable.Traversable (c k) => Data.Traversable.Traversable (Data.Greskell.GMap.FlattenedMap c k) instance Data.Foldable.Foldable (c k) => Data.Foldable.Foldable (Data.Greskell.GMap.FlattenedMap c k) instance GHC.Classes.Ord (c k v) => GHC.Classes.Ord (Data.Greskell.GMap.FlattenedMap c k v) instance GHC.Classes.Eq (c k v) => GHC.Classes.Eq (Data.Greskell.GMap.FlattenedMap c k v) instance GHC.Show.Show (c k v) => GHC.Show.Show (Data.Greskell.GMap.FlattenedMap c k v) instance Data.Greskell.GraphSON.GraphSONTyped.GraphSONTyped (Data.Greskell.GMap.GMapEntry k v) instance (Data.Aeson.Types.FromJSON.FromJSON k, Data.Aeson.Types.FromJSON.FromJSONKey k, Data.Aeson.Types.FromJSON.FromJSON v) => Data.Aeson.Types.FromJSON.FromJSON (Data.Greskell.GMap.GMapEntry k v) instance (Data.Aeson.Types.ToJSON.ToJSON k, Data.Aeson.Types.ToJSON.ToJSONKey k, GHC.Classes.Ord k, Data.Aeson.Types.ToJSON.ToJSON v) => Data.Aeson.Types.ToJSON.ToJSON (Data.Greskell.GMap.GMapEntry k v) instance (Data.Aeson.Types.FromJSON.FromJSON k, Data.Aeson.Types.FromJSON.FromJSON v, GHC.Exts.IsList (c k v), GHC.Exts.Item (c k v) Data.Type.Equality.~ (k, v), Data.Aeson.Types.FromJSON.FromJSON (c k v)) => Data.Aeson.Types.FromJSON.FromJSON (Data.Greskell.GMap.GMap c k v) instance (Data.Aeson.Types.ToJSON.ToJSON k, Data.Aeson.Types.ToJSON.ToJSON v, GHC.Exts.IsList (c k v), GHC.Exts.Item (c k v) Data.Type.Equality.~ (k, v), Data.Aeson.Types.ToJSON.ToJSON (c k v)) => Data.Aeson.Types.ToJSON.ToJSON (Data.Greskell.GMap.GMap c k v) instance Data.Greskell.GraphSON.GraphSONTyped.GraphSONTyped (Data.Greskell.GMap.GMap c k v) instance (Data.Aeson.Types.FromJSON.FromJSON k, Data.Aeson.Types.FromJSON.FromJSON v, GHC.Exts.IsList (c k v), GHC.Exts.Item (c k v) Data.Type.Equality.~ (k, v)) => Data.Aeson.Types.FromJSON.FromJSON (Data.Greskell.GMap.FlattenedMap c k v) instance (Data.Aeson.Types.ToJSON.ToJSON k, Data.Aeson.Types.ToJSON.ToJSON v, GHC.Exts.IsList (c k v), GHC.Exts.Item (c k v) Data.Type.Equality.~ (k, v)) => Data.Aeson.Types.ToJSON.ToJSON (Data.Greskell.GMap.FlattenedMap c k v) instance Data.Greskell.GraphSON.GraphSONTyped.GraphSONTyped (Data.Greskell.GMap.FlattenedMap c k v) 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})
--   
-- -- Note that encoding of the "g:Map" type is inconsistent between -- GraphSON v1 and v2, v3. To handle the encoding, use -- Data.Greskell.GMap. 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) -- | An Aeson Value wrapped in GraphSON wrapper type. -- Basically this type is the Haskell representaiton of a -- GraphSON-encoded document. -- -- This type is used to parse GraphSON documents. See also -- FromGraphSON class. data GValue -- | GValue without the top-level GraphSON wrapper. data GValueBody GObject :: !HashMap Text GValue -> GValueBody GArray :: !Vector GValue -> GValueBody GString :: !Text -> GValueBody GNumber :: !Scientific -> GValueBody GBool :: !Bool -> GValueBody GNull :: GValueBody -- | Create a GValue without "@type" field. nonTypedGValue :: GValueBody -> GValue -- | Create a GValue with the given "@type" field. typedGValue' :: Text -> GValueBody -> GValue -- | Types that can be constructed from GValue. This is analogous to -- FromJSON class. -- -- Instances of basic types are implemented based on the following rule. -- -- -- -- Note that Char does not have FromGraphSON instance. This -- is intentional. As stated in the document of AsIterator, using -- String in greskell is an error in most cases. To prevent you -- from using String, Char (and thus String) don't -- have FromGraphSON instances. class FromGraphSON a parseGraphSON :: FromGraphSON a => GValue -> Parser a -- | A JSON parser. N.B. This might not fit your usual understanding of -- "parser". Instead you might like to think of Parser as a "parse -- result", i.e. a parser to which the input has already been applied. data Parser a -- | Parse GValue into FromGraphSON. parseEither :: FromGraphSON a => GValue -> Either String a -- | Unwrap the given GValue with unwrapAll, and just parse -- the result with parseJSON. -- -- Useful to implement FromGraphSON instances for scalar types. parseUnwrapAll :: FromJSON a => GValue -> Parser a -- | Extract GArray from the given GValue, parse the items in -- the array, and gather them by fromList. -- -- Useful to implement FromGraphSON instances for IsList -- types. parseUnwrapList :: (IsList a, i ~ Item a, FromGraphSON i) => GValue -> Parser a -- | Like Aeson's .:, but for FromGraphSON. (.:) :: FromGraphSON a => HashMap Text GValue -> Text -> Parser a -- | Implementation of parseJSON based on parseGraphSON. The -- input Value is first converted to GValue, and it's -- parsed to the output type. parseJSONViaGValue :: FromGraphSON a => Value -> Parser a instance Data.Greskell.GraphSON.FromGraphSON Data.Greskell.GraphSON.GValue.GValue instance Data.Greskell.GraphSON.FromGraphSON GHC.Types.Int instance Data.Greskell.GraphSON.FromGraphSON Data.Text.Internal.Text instance Data.Greskell.GraphSON.FromGraphSON Data.Text.Internal.Lazy.Text instance Data.Greskell.GraphSON.FromGraphSON GHC.Types.Bool instance Data.Greskell.GraphSON.FromGraphSON GHC.Types.Double instance Data.Greskell.GraphSON.FromGraphSON GHC.Types.Float instance Data.Greskell.GraphSON.FromGraphSON GHC.Int.Int8 instance Data.Greskell.GraphSON.FromGraphSON GHC.Int.Int16 instance Data.Greskell.GraphSON.FromGraphSON GHC.Int.Int32 instance Data.Greskell.GraphSON.FromGraphSON GHC.Int.Int64 instance Data.Greskell.GraphSON.FromGraphSON GHC.Integer.Type.Integer instance Data.Greskell.GraphSON.FromGraphSON GHC.Natural.Natural instance (Data.Aeson.Types.FromJSON.FromJSON a, GHC.Real.Integral a) => Data.Greskell.GraphSON.FromGraphSON (GHC.Real.Ratio a) instance Data.Greskell.GraphSON.FromGraphSON GHC.Types.Word instance Data.Greskell.GraphSON.FromGraphSON GHC.Word.Word8 instance Data.Greskell.GraphSON.FromGraphSON GHC.Word.Word16 instance Data.Greskell.GraphSON.FromGraphSON GHC.Word.Word32 instance Data.Greskell.GraphSON.FromGraphSON GHC.Word.Word64 instance Data.Greskell.GraphSON.FromGraphSON Data.Scientific.Scientific instance Data.Greskell.GraphSON.FromGraphSON Data.IntSet.Internal.IntSet instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON [a] instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Vector.Vector a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Sequence.Internal.Seq a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (GHC.Base.NonEmpty a) instance (Data.Greskell.GraphSON.FromGraphSON a, GHC.Classes.Ord a) => Data.Greskell.GraphSON.FromGraphSON (Data.Set.Internal.Set a) instance (Data.Greskell.GraphSON.FromGraphSON a, GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Data.Greskell.GraphSON.FromGraphSON (Data.HashSet.Base.HashSet a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Functor.Identity.Identity a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Min a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Max a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.First a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Last a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.WrappedMonoid a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Internal.Dual a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Internal.Sum a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Internal.Product a) instance Data.Greskell.GraphSON.FromGraphSON Data.Semigroup.Internal.All instance Data.Greskell.GraphSON.FromGraphSON Data.Semigroup.Internal.Any instance (Data.Greskell.GraphSON.FromGraphSON k, Data.Greskell.GraphSON.FromGraphSON v, GHC.Exts.IsList (c k v), GHC.Exts.Item (c k v) Data.Type.Equality.~ (k, v)) => Data.Greskell.GraphSON.FromGraphSON (Data.Greskell.GMap.FlattenedMap c k v) instance (Data.Greskell.GraphSON.FromGraphSON k, Data.Greskell.GraphSON.FromGraphSON v, GHC.Exts.IsList (c k v), GHC.Exts.Item (c k v) Data.Type.Equality.~ (k, v), Data.Traversable.Traversable (c k), Data.Aeson.Types.FromJSON.FromJSON (c k Data.Greskell.GraphSON.GValue.GValue)) => Data.Greskell.GraphSON.FromGraphSON (Data.Greskell.GMap.GMap c k v) instance (Data.Greskell.GraphSON.FromGraphSON k, Data.Greskell.GraphSON.FromGraphSON v, Data.Aeson.Types.FromJSON.FromJSONKey k) => Data.Greskell.GraphSON.FromGraphSON (Data.Greskell.GMap.GMapEntry k v) instance (Data.Greskell.GraphSON.FromGraphSON v, GHC.Classes.Eq k, Data.Hashable.Class.Hashable k, Data.Aeson.Types.FromJSON.FromJSONKey k, Data.Greskell.GraphSON.FromGraphSON k) => Data.Greskell.GraphSON.FromGraphSON (Data.HashMap.Base.HashMap k v) instance (Data.Greskell.GraphSON.FromGraphSON v, GHC.Classes.Ord k, Data.Aeson.Types.FromJSON.FromJSONKey k, Data.Greskell.GraphSON.FromGraphSON k) => Data.Greskell.GraphSON.FromGraphSON (Data.Map.Internal.Map k v) instance Data.Greskell.GraphSON.FromGraphSON v => Data.Greskell.GraphSON.FromGraphSON (Data.IntMap.Internal.IntMap v) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (GHC.Maybe.Maybe a) instance (Data.Greskell.GraphSON.FromGraphSON a, Data.Greskell.GraphSON.FromGraphSON b) => Data.Greskell.GraphSON.FromGraphSON (Data.Either.Either a b) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Semigroup.Option a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Monoid.First a) instance Data.Greskell.GraphSON.FromGraphSON a => Data.Greskell.GraphSON.FromGraphSON (Data.Monoid.Last a) instance Data.Greskell.GraphSON.FromGraphSON Data.Aeson.Types.Internal.Value instance Data.Greskell.GraphSON.FromGraphSON Data.UUID.Types.Internal.UUID instance Data.Greskell.GraphSON.FromGraphSON () module Data.Greskell.AsIterator -- | Types that are converted to an iterator by -- org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.asIterator -- method. In fact, that method can convert any type to an iterator, but -- greskell limits types to which the conversion is applicable. -- -- Associated with this type-class is IteratorItem. -- IteratorItem type family is association of type a and -- the type of its item when type a is converted to an iterator. -- -- IteratorItem rule of thumb: -- -- -- -- Caveat: -- -- class AsIterator a where { type family IteratorItem a; } instance Data.Greskell.AsIterator.AsIterator () instance Data.Greskell.AsIterator.AsIterator GHC.Types.Int instance Data.Greskell.AsIterator.AsIterator Data.Text.Internal.Text instance Data.Greskell.AsIterator.AsIterator Data.Text.Internal.Lazy.Text instance Data.Greskell.AsIterator.AsIterator GHC.Types.Bool instance Data.Greskell.AsIterator.AsIterator GHC.Types.Char instance Data.Greskell.AsIterator.AsIterator GHC.Types.Double instance Data.Greskell.AsIterator.AsIterator GHC.Types.Float instance Data.Greskell.AsIterator.AsIterator GHC.Int.Int8 instance Data.Greskell.AsIterator.AsIterator GHC.Int.Int16 instance Data.Greskell.AsIterator.AsIterator GHC.Int.Int32 instance Data.Greskell.AsIterator.AsIterator GHC.Int.Int64 instance Data.Greskell.AsIterator.AsIterator GHC.Integer.Type.Integer instance Data.Greskell.AsIterator.AsIterator GHC.Natural.Natural instance GHC.Real.Integral a => Data.Greskell.AsIterator.AsIterator (GHC.Real.Ratio a) instance Data.Greskell.AsIterator.AsIterator GHC.Types.Word instance Data.Greskell.AsIterator.AsIterator GHC.Word.Word8 instance Data.Greskell.AsIterator.AsIterator GHC.Word.Word16 instance Data.Greskell.AsIterator.AsIterator GHC.Word.Word32 instance Data.Greskell.AsIterator.AsIterator GHC.Word.Word64 instance Data.Greskell.AsIterator.AsIterator Data.Scientific.Scientific instance Data.Greskell.AsIterator.AsIterator [a] instance Data.Greskell.AsIterator.AsIterator (Data.Vector.Vector a) instance Data.Greskell.AsIterator.AsIterator (Data.HashSet.Base.HashSet a) instance Data.Greskell.AsIterator.AsIterator (Data.Sequence.Internal.Seq a) instance Data.Greskell.AsIterator.AsIterator (Data.Set.Internal.Set a) instance Data.Greskell.AsIterator.AsIterator Data.IntSet.Internal.IntSet instance Data.Greskell.AsIterator.AsIterator (GHC.Base.NonEmpty a) instance Data.Greskell.AsIterator.AsIterator (Data.Greskell.GMap.GMap c k v) instance Data.Greskell.AsIterator.AsIterator (Data.Greskell.GMap.GMapEntry k v) instance Data.Greskell.AsIterator.AsIterator (Data.HashMap.Base.HashMap k v) instance Data.Greskell.AsIterator.AsIterator (Data.Map.Internal.Map k v) instance Data.Greskell.AsIterator.AsIterator (Data.IntMap.Internal.IntMap v) instance Data.Greskell.AsIterator.AsIterator a => Data.Greskell.AsIterator.AsIterator (GHC.Maybe.Maybe a) 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 of return value by Greskell. 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 Text)
--   "[\"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
--   "[:]"
--   
-- -- Note that Number does not distinguish integers from -- floating-point numbers, so value function may format an integer -- as a floating-point number. To ensure formatting as integers, use -- valueInt. value :: Value -> Greskell Value -- | Integer literal as Value type. -- --
--   >>> toGremlin $ valueInt (100 :: Int)
--   "100"
--   
valueInt :: Integral a => a -> Greskell Value -- | Value literal as GValue type. gvalue :: Value -> Greskell GValue -- | Integer literal as GValue type. -- --
--   >>> toGremlin $ gvalueInt (256 :: Int)
--   "256"
--   
gvalueInt :: Integral a => a -> Greskell GValue -- | 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 Text) "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 => GHC.Base.Semigroup (Data.Greskell.Greskell.Greskell a) instance Data.String.IsString a => GHC.Base.Monoid (Data.Greskell.Greskell.Greskell a)