!-=      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Maintainer: Toshio Ito debug.ito@gmail.comNone  greskell-core)Types that have an intrinsic type ID for gsonType field. greskell-core Type ID for gsonType. greskell-core greskell-core greskell-core greskell-core greskell-core greskell-coreMap to "g:Double". greskell-core greskell-core greskell-core2Map to "gx:Byte". Note that Java's Byte is signed.Maintainer: Toshio Ito debug.ito@gmail.comNone71  greskell-coreGWrapper for "typed JSON object" introduced in GraphSON version 2. See 9http://tinkerpop.apache.org/docs/current/dev/io/#graphson=This data type is useful for encoding/decoding GraphSON text.-Aeson.decode "1000" :: Maybe (GraphSON Int32)6Just (GraphSON {gsonType = Nothing, gsonValue = 1000})SAeson.decode "{\"@type\": \"g:Int32\", \"@value\": 1000}" :: Maybe (GraphSON Int32)=Just (GraphSON {gsonType = Just "g:Int32", gsonValue = 1000})uNote that encoding of the "g:Map" type is inconsistent between GraphSON v1 and v2, v3. To handle the encoding, use Data.Greskell.GMap. greskell-coreType ID, corresponding to @type field. greskell-coreValue, correspoding to @value field. greskell-core Create a  without .nonTypedGraphSON (10 :: Int)-GraphSON {gsonType = Nothing, gsonValue = 10} greskell-core Create a  with its type ID.typedGraphSON (10 :: Int32)4GraphSON {gsonType = Just "g:Int32", gsonValue = 10}  greskell-core Create a  with the given type ID.$typedGraphSON' "g:Int32" (10 :: Int)4GraphSON {gsonType = Just "g:Int32", gsonValue = 10}  greskell-coreParse  GraphSON v, but it checks . If  is  or it's not equal to , the  fails. greskell-coretNote: this function is not exported because I don't need it for now. If you need this function, just open an issue.Like  8, but this handles parse errors in a finer granularity. If the given + is not a typed JSON object, it returns . If the given I is a typed JSON object but it fails to parse the "@value" field, the  fails. If the given E is a typed JSON object but the "@type" field is not equal to the  of type v, the  fails.Otherwise (if the given O is a typed JSON object with valid "@type" and "@value" fields,) it returns . greskell-core If the given  is a typed JSON object,  field of the result is . Otherwise, the given  is directly parsed into , and  is . greskell-coreIf  is , the ( is encoded as a typed JSON object. If  is , the  is directly encoded. greskell-core  "Aeson Value with GraphSON wrappers Toshio Ito <debug.ito@gmail.com>None7A'  greskell-core without the top-level  wrapper. greskell-core An Aeson  wrapped in b wrapper type. Basically this type is the Haskell representaiton of a GraphSON-encoded document.9This type is used to parse GraphSON documents. See also  class. greskell-core Create a  without "@type" field. greskell-core Create a  with the given "@type" field. greskell-core Remove all  wrappers recursively from . greskell-coreRemove the top-level W wrapper, but leave other wrappers as-is. The remaining wrappers are reconstructed by  to make them into . greskell-coreGet the   from . greskell-coreGet the  field from . greskell-core Reconstruct  from &. It preserves all GraphSON wrappers. greskell-coreParse  wrappers recursively in , making it into . greskell-core"@type" field.  data type for g:Map Toshio Ito <debug.ito@gmail.com>None 456HMV|& greskell-coreHaskell representation of  Map.Entry type."Basically GraphSON encodes Java's  Map.Entry type as if it were a Mapp with a single entry. Thus its encoded form is either a JSON object or a flattened key-values, as explained in +.KAeson.eitherDecode "{\"1\": \"one\"}" :: Either String (GMapEntry Int Text)SRight (GMapEntry {gmapEntryFlat = False, gmapEntryKey = 1, gmapEntryValue = "one"})GAeson.eitherDecode "[1, \"one\"]" :: Either String (GMapEntry Int Text)RRight (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.  instance of &# supports this format as well, but  instance doesn't support it.ZAeson.eitherDecode "{\"key\":1, \"value\": \"one\"}" :: Either String (GMapEntry Int Text)SRight (GMapEntry {gmapEntryFlat = False, gmapEntryKey = 1, gmapEntryValue = "one"})+ greskell-coreHaskell representation of g:Map type.GraphSON v1 and v2 encode Java Mapf type as a JSON Object, while GraphSON v3 encodes it as an array of flattened keys and values (like /.) +$ type handles both encoding schemes.type c!: container type for a map (e.g.    and ).type k: key of the map.type v: value of the map.KAeson.eitherDecode "{\"ten\": 10}" :: Either String (GMap HashMap Text Int)BRight (GMap {gmapFlat = False, gmapValue = fromList [("ten",10)]})KAeson.eitherDecode "[\"ten\", 10]" :: Either String (GMap HashMap Text Int)ARight (GMap {gmapFlat = True, gmapValue = fromList [("ten",10)]})NAeson.encode $ GMap False (HashMap.fromList [(9, "nine")] :: HashMap Int Text)"{\"9\":\"nine\"}"MAeson.encode $ GMap True (HashMap.fromList [(9, "nine")] :: HashMap Int Text)"[9,\"nine\"]"- greskell-coreIf %, the map is encoded as an array. If !, it's encoded as a JSON Object.. greskell-coreMap implementation./ greskell-core@JSON encoding of a map as an array of flattened key-value pairs.Q instance of this type encodes the internal map as an array of keys and values. 2 instance of this type parses that flattened map.type c!: container type for a map (e.g.    and ).type k: key of the map.type v: value of the map.Vlet decode s = Aeson.eitherDecode s :: Either String (FlattenedMap HashMap Int String)9let 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...TAeson.encode $ FlattenedMap $ (HashMap.fromList [(10, "ten")] :: HashMap Int String)"[10,\"ten\"]" greskell-core6Parse a flattened key-values to an associative Vector.2 greskell-coreGeneral parser for /.3 greskell-coreGeneral parser for +.4 greskell-core Get the map implementation from +.5 greskell-coreGeneral parser for &.6 greskell-coreGet the key-value pair from &.7 greskell-coreCreate + that has the single &.8 greskell-core Deconstruct + into a list of &s.9 greskell-coreMap to "g:Map".; greskell-coreUse 2.< greskell-coreMap to "g:Map".> greskell-coreUse 3.@ greskell-coreUse 5.A greskell-coreMap to "g:Map".2 greskell-core key parser greskell-core value parser greskell-core%input vector of flattened key-values.3 greskell-core key parser greskell-core value parser greskell-core object parser greskell-core%input object or flattened key-values.5 greskell-core key parser greskell-core value parser greskell-core$input object or flattened key-values&'()*+,-./012345678/012+,-.4783&'()*65Encoding and decoding GraphSON Toshio Ito <debug.ito@gmail.com>None7HV S greskell-core#Types that can be constructed from . This is analogous to  class.FInstances of basic types are implemented based on the following rule.Simple scalar types (e.g.  and ): use U.List-like types (e.g. [],  and  ): use V.Map-like types (e.g.  and ): parse into + first, then unwrap the +M wrapper. That way, all versions of GraphSON formats are handled properly.7Other types: see the individual instance documentation. Note that  does not have S? instance. This is intentional. As stated in the document of  , using C in greskell is an error in most cases. To prevent you from using ,  (and thus  ) don't have S instances.U greskell-coreUnwrap the given  with ", and just parse the result with .Useful to implement S instances for scalar types.V greskell-coreExtract   from the given 4, parse the items in the array, and gather them by .Useful to implement S instances for  types.W greskell-coreParse  into S.X greskell-core Like Aeson's  , but for S.Y greskell-coreImplementation of  based on T . The input  is first converted to &, and it's parsed to the output type.Z greskell-coreFor any input , T returns ()O. For example, you can use it to ignore data you get from the Gremlin server.\ greskell-coreCall ! to remove all GraphSON wrappers.] greskell-coreTry , then .^ greskell-coreParse  into .b greskell-coreUse 5.c greskell-coreUse 3.d greskell-coreUse 2. STUVWXY  STWUVXY-Conversion from Object to Iterator in Gremlin Toshio Ito <debug.ito@gmail.com>NoneHV greskell-core,Types that are converted to an iterator by Corg.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 . % type family is association of type a% and the type of its item when type a is converted to an iterator. 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 &.(Other types are converted to themselves.Caveat:Because Haskell's  is [Char], IteratorItem String returns , which is incorrect. Use  if you want to deal with String s in Gremlin."Low-level Gremlin script data type Toshio Ito <debug.ito@gmail.com>NoneHVٙ greskell-coreSomething that can convert to . greskell-core!type of return value by Greskell. greskell-coreGremlin expression of type a.N is essentially just a piece of Gremlin script with a phantom type. The type aI represents the type of data that the script is supposed to evaluate to. and E instances compare Gremlin scripts, NOT the values they evaluate to. greskell-coreUnsafely create a ? of arbitrary type. The given Gremlin script is printed as-is.$toGremlin $ unsafeGreskell "x + 100" "x + 100" greskell-coreSame as , but it takes lazy . greskell-coreQCreate a String literal in Gremlin script. The content is automatically escaped.toGremlin $ string "foo bar" "\"foo bar\""5toGremlin $ string "escape newline\n escape dollar $")"\"escape newline\\n escape dollar \\$\"" greskell-coreBoolean true literal.toGremlin true"true" greskell-coreBoolean false literal.toGremlin false"false" greskell-core List literal.4toGremlin $ list ([100, 200, 300] :: [Greskell Int])"[100,200,300]" greskell-corewMake a list with a single object. Useful to prevent the Gremlin Server from automatically iterating the result object.,toGremlin $ single ("hoge" :: Greskell Text) "[\"hoge\"]" greskell-core1Arbitrary precision number literal, like "123e8".toGremlin $ number 123e8 "1.23e10" greskell-coreAeson  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 @ does not distinguish integers from floating-point numbers, so d function may format an integer as a floating-point number. To ensure formatting as integers, use . greskell-coreInteger literal as  type.!toGremlin $ valueInt (100 :: Int)"100" greskell-core literal as  type. greskell-coreInteger literal as  type."toGremlin $ gvalueInt (256 :: Int)"256" greskell-core&Create a readable Gremlin script from . greskell-coreSame as  except that this returns lazy . greskell-coreUnsafely create a 9 that calls the given function with the given arguments.,toGremlin $ unsafeFunCall "add" ["10", "20"] "add(10,20)" greskell-coreUnsafely create a N that calls the given object method call with the given target and arguments.DtoGremlin $ unsafeMethodCall ("foobar" :: Greskell Text) "length" []"(\"foobar\").length()" greskell-coreMonoidal operations on  assumes String operations in Gremlin.  is the empty String, and  is String concatenation. greskell-coreSemigroup operator  on  assumes String concatenation on Gremlin. greskell-core?Floating-point number literals and numeric operation in Gremlin greskell-core1Integer literals and numeric operation in Gremlin greskell-core"Unsafely convert the phantom type. greskell-coreSame as & except for the input and output type. greskell-core It's just . greskell-coreGremlin script greskell-coreGremlin script greskell-core function name greskell-core arguments greskell-core!return value of the function call greskell-core target object greskell-core method name greskell-core arguments greskell-corereturn value of the method call  !"#$%&'()*+,-./0122345667899:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       ` ,greskell-core-0.1.2.5-CAxkOnRdkr36DQYCl7SGtpData.Greskell.GraphSONData.Greskell.GraphSON.GValueData.Greskell.GMapData.Greskell.AsIteratorData.Greskell.Greskell$Data.Greskell.GraphSON.GraphSONTypedData.Greskell.GraphSON.Core FromGraphSONData.MapMap AsIterator$aeson-1.4.2.0-2sEqtSBEUwWKm1fS4E2xoyData.Aeson.Types.InternalParser GraphSONTyped gsonTypeForGraphSONgsonType gsonValuenonTypedGraphSON typedGraphSONtypedGraphSON'parseTypedGraphSON GValueBodyGObjectGArrayGStringGNumberGBoolGNullGValueunGValuenonTypedGValue typedGValue' unwrapAll unwrapOne gValueBody gValueType$fToJSONGValueBody$fToJSONGValue$fFromJSONGValue$fHashableGValueBody$fHashableGValue$fShowGValueBody$fEqGValueBody$fGenericGValueBody $fShowGValue $fEqGValue$fGenericGValue GMapEntry gmapEntryFlat gmapEntryKeygmapEntryValueGMapgmapFlat gmapValue FlattenedMapunFlattenedMapparseToFlattenedMap parseToGMapunGMapparseToGMapEntry unGMapEntry singletontoList$fGraphSONTypedFlattenedMap$fToJSONFlattenedMap$fFromJSONFlattenedMap$fGraphSONTypedGMap $fToJSONGMap$fFromJSONGMap$fToJSONGMapEntry$fFromJSONGMapEntry$fGraphSONTypedGMapEntry$fShowFlattenedMap$fEqFlattenedMap$fOrdFlattenedMap$fFoldableFlattenedMap$fTraversableFlattenedMap$fFunctorFlattenedMap $fShowGMap$fEqGMap$fFoldableGMap$fTraversableGMap $fFunctorGMap$fShowGMapEntry $fEqGMapEntry$fOrdGMapEntry$fFoldableGMapEntry$fTraversableGMapEntry$fFunctorGMapEntry parseGraphSONparseUnwrapAllparseUnwrapList parseEither.:parseJSONViaGValue$fFromGraphSON()$fFromGraphSONUUID$fFromGraphSONValue$fFromGraphSONEither$fFromGraphSONMaybe$fFromGraphSONIntMap$fFromGraphSONMap$fFromGraphSONHashMap$fFromGraphSONGMapEntry$fFromGraphSONGMap$fFromGraphSONFlattenedMap$fFromGraphSONHashSet$fFromGraphSONSet$fFromGraphSONSeq$fFromGraphSONVector$fFromGraphSON[]$fFromGraphSONIntSet$fFromGraphSONScientific$fFromGraphSONWord64$fFromGraphSONWord32$fFromGraphSONWord16$fFromGraphSONWord8$fFromGraphSONWord$fFromGraphSONRatio$fFromGraphSONNatural$fFromGraphSONInteger$fFromGraphSONInt64$fFromGraphSONInt32$fFromGraphSONInt16$fFromGraphSONInt8$fFromGraphSONFloat$fFromGraphSONDouble$fFromGraphSONBool$fFromGraphSONText$fFromGraphSONText0$fFromGraphSONInt$fFromGraphSONGValue IteratorItem$fAsIteratorMaybe$fAsIteratorIntMap$fAsIteratorMap$fAsIteratorHashMap$fAsIteratorGMapEntry$fAsIteratorGMap$fAsIteratorIntSet$fAsIteratorSet$fAsIteratorSeq$fAsIteratorHashSet$fAsIteratorVector$fAsIterator[]$fAsIteratorScientific$fAsIteratorWord64$fAsIteratorWord32$fAsIteratorWord16$fAsIteratorWord8$fAsIteratorWord$fAsIteratorRatio$fAsIteratorNatural$fAsIteratorInteger$fAsIteratorInt64$fAsIteratorInt32$fAsIteratorInt16$fAsIteratorInt8$fAsIteratorFloat$fAsIteratorDouble$fAsIteratorChar$fAsIteratorBool$fAsIteratorText$fAsIteratorText0$fAsIteratorInt$fAsIterator() ToGreskellGreskellReturn toGreskellGreskellunsafeGreskellunsafeGreskellLazystringtruefalselistsinglenumbervaluevalueIntgvalue gvalueInt toGremlin toGremlinLazy unsafeFunCallunsafeMethodCall$fMonoidGreskell$fSemigroupGreskell$fFractionalGreskell $fNumGreskell$fFunctorGreskell$fIsStringGreskell$fToGreskellGreskell$fShowGreskell $fEqGreskell $fOrdGreskell$fGraphSONTypedEither$fGraphSONTypedIntMap$fGraphSONTypedMap$fGraphSONTypedSet$fGraphSONTypedIntSet$fGraphSONTypedScientific$fGraphSONTypedSeq$fGraphSONTypedVector$fGraphSONTypedInt8base GHC.MaybeNothingparseTypedGraphSON'Value Data.EitherLeftRight$fFromJSONGraphSONJust$fToJSONGraphSON$fHashableGraphSONData.Aeson.Types.ToJSONtoJSONData.Aeson.Types.FromJSONFromJSONToJSON4unordered-containers-0.2.10.0-LgoTL3wbBEY5bZIDJiyxW4Data.HashMap.BaseHashMapghc-prim GHC.TypesTrueFalse parseToAVecInt text-1.2.3.1Data.Text.InternalText&vector-0.12.0.2-H1Eu1OCXL0L9y980iV8EwU Data.VectorVectorcontainers-0.6.0.1Data.Set.InternalSetData.Map.InternalCharGHC.BaseString parseJSONGHC.ExtsfromListIsList GHC.ClassesEqOrdData.Text.Internal.LazyNumbermemptymappend<>id