-- 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 1.0.0.3
-- | 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 :: !KeyMap 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.Show.Show Data.Greskell.GraphSON.GValue.GValue
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.GValueBody
instance GHC.Generics.Generic Data.Greskell.GraphSON.GValue.GValueBody
instance GHC.Classes.Eq 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.
--
--
-- - type c: container type for a map (e.g. Map and
-- HashMap).
-- - type k: key of the map.
-- - type v: value of the map.
--
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.
--
--
-- - type c: container type for a map (e.g. Map and
-- HashMap).
-- - type k: key of the map.
-- - type v: value of the map.
--
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) -> (KeyMap s -> Parser (c k v)) -> Either (KeyMap 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.
--
-- 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.
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 (KeyMap s) (Vector s) -> Parser (GMapEntry k v)
-- | Examples of using this module. See the source. The fst of the
-- output is the testee, while the snd is the expectation.
examples :: [(String, String)]
instance Data.Traversable.Traversable (c k) => Data.Traversable.Traversable (Data.Greskell.GMap.FlattenedMap c k)
instance GHC.Show.Show (c k v) => GHC.Show.Show (Data.Greskell.GMap.FlattenedMap c k v)
instance GHC.Classes.Ord (c k v) => GHC.Classes.Ord (Data.Greskell.GMap.FlattenedMap c k v)
instance GHC.Base.Functor (c k) => GHC.Base.Functor (Data.Greskell.GMap.FlattenedMap c k)
instance Data.Foldable.Foldable (c k) => Data.Foldable.Foldable (Data.Greskell.GMap.FlattenedMap c k)
instance GHC.Classes.Eq (c k v) => GHC.Classes.Eq (Data.Greskell.GMap.FlattenedMap c k v)
instance Data.Traversable.Traversable (c k) => Data.Traversable.Traversable (Data.Greskell.GMap.GMap c k)
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.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 Data.Traversable.Traversable (Data.Greskell.GMap.GMapEntry k)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Data.Greskell.GMap.GMapEntry k v)
instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Data.Greskell.GMap.GMapEntry k v)
instance GHC.Base.Functor (Data.Greskell.GMap.GMapEntry k)
instance Data.Foldable.Foldable (Data.Greskell.GMap.GMapEntry k)
instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Data.Greskell.GMap.GMapEntry 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.IsList.IsList (c k v), GHC.IsList.Item (c k v) GHC.Types.~ (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.IsList.IsList (c k v), GHC.IsList.Item (c k v) GHC.Types.~ (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.IsList.IsList (c k v), GHC.IsList.Item (c k v) GHC.Types.~ (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.IsList.IsList (c k v), GHC.IsList.Item (c k v) GHC.Types.~ (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.
--
-- 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 :: v -> GraphSON v
-- | Create a GraphSON with its type ID.
typedGraphSON :: GraphSONTyped v => v -> GraphSON v
-- | Create a GraphSON with the given type ID.
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 :: !KeyMap 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.
--
--
-- - Simple scalar types (e.g. Int and Text): use
-- parseUnwrapAll.
-- - List-like types (e.g. [], Vector and Set):
-- use parseUnwrapList.
-- - Map-like types (e.g. HashMap and Map): parse into
-- GMap first, then unwrap the GMap wrapper. That way, all
-- versions of GraphSON formats are handled properly.
-- - Trivial wrapper types (e.g. Identity): just parse the item
-- inside.
-- - Other types: see the individual instance documentation.
--
--
-- Note that Char does not have FromGraphSON instance. This
-- is intentional. As stated in the document of AsIterator, using
-- Value in greskell is an error in most cases. To prevent you
-- from using Value, Char (and thus Value) 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 => KeyMap GValue -> Key -> 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
-- | Examples of using this module. See the source. The fst of the
-- output is the testee, while the snd is the expectation.
examples :: [(String, String)]
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.Num.Integer.Integer
instance Data.Greskell.GraphSON.FromGraphSON GHC.Num.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 Data.Aeson.Key.Key
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.Internal.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.IsList.IsList (c k v), GHC.IsList.Item (c k v) GHC.Types.~ (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.IsList.IsList (c k v), GHC.IsList.Item (c k v) GHC.Types.~ (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.Internal.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 v => Data.Greskell.GraphSON.FromGraphSON (Data.Aeson.KeyMap.KeyMap 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.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:
--
--
-- - Iterator and Iterable types like List,
-- Stream and GraphTraversal are converted to their
-- element types.
-- - Map type is converted to its Map.Entry. In
-- greskell, Map.Entry is expressed as GMapEntry.
-- - Other types are converted to themselves.
--
--
-- Caveat:
--
--
-- - Because Haskell's String is [Char],
-- IteratorItem String returns Char, which is incorrect.
-- Use Text if you want to deal with Strings in
-- Gremlin.
--
class AsIterator a where {
type 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.Num.Integer.Integer
instance Data.Greskell.AsIterator.AsIterator GHC.Num.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.Internal.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.Internal.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 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.
string :: Text -> Greskell Text
-- | Boolean true literal.
true :: Greskell Bool
-- | Boolean false literal.
false :: Greskell Bool
-- | List literal.
list :: [Greskell a] -> Greskell [a]
-- | Make a list with a single object. Useful to prevent the Gremlin Server
-- from automatically iterating the result object.
single :: Greskell a -> Greskell [a]
-- | Arbitrary precision number literal, like "123e8".
number :: Scientific -> Greskell Scientific
-- | Aeson Value literal.
--
-- 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.
valueInt :: Integral a => a -> Greskell Value
-- | Value literal as GValue type.
gvalue :: Value -> Greskell GValue
-- | Integer literal as GValue type.
gvalueInt :: Integral a => a -> Greskell GValue
-- | Unsafely create a Greskell of arbitrary type. The given Gremlin
-- script is printed as-is.
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.
unsafeFunCall :: Text -> [Text] -> Greskell a
-- | Unsafely create a Greskell that calls the given object method
-- call with the given target and arguments.
unsafeMethodCall :: Greskell a -> Text -> [Text] -> Greskell b
-- | Examples of using this module. See the source. The fst of the
-- output is the testee, while the snd is the expectation.
examples :: [(Text, Text)]
instance GHC.Show.Show (Data.Greskell.Greskell.Greskell a)
instance GHC.Classes.Ord (Data.Greskell.Greskell.Greskell a)
instance GHC.Classes.Eq (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)