АÄ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Maintainer: Toshio Ito debug.ito@gmail.comNone; )Types that have an intrinsic type ID for gsonType field. Type ID for gsonType.Map to "g:Double".2Map to "gx:Byte". Note that Java's Byte is signed.Maintainer: Toshio Ito debug.ito@gmail.comNone6- GWrapper 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.Type ID, corresponding to @type field.Value, correspoding to @value field. Create a  without .nonTypedGraphSON (10 :: Int)-GraphSON {gsonType = Nothing, gsonValue = 10} Create a  with its type ID.typedGraphSON (10 :: Int32)4GraphSON {gsonType = Just "g:Int32", gsonValue = 10}  Create a  with the given type ID.$typedGraphSON' "g:Int32" (10 :: Int)4GraphSON {gsonType = Just "g:Int32", gsonValue = 10} Parse  GraphSON v, but it checks . If  is  or it's not equal to , the  fails.tNote: 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 . If the given  is a typed JSON object,  field of the result is . Otherwise, the given  is directly parsed into , and  is .If  is , the ( is encoded as a typed JSON object. If  is , the  is directly encoded.  "Aeson Value with GraphSON wrappers Toshio Ito <debug.ito@gmail.com>None6:O  without the top-level  wrapper. 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. Create a  without "@type" field. Create a  with the given "@type" field. Remove all  wrappers recursively from .Remove the top-level W wrapper, but leave other wrappers as-is. The remaining wrappers are reconstructed by  to make them into .Get the   from .Get the  field from . Reconstruct  from &. It preserves all GraphSON wrappers.Parse  wrappers recursively in , making it into ."@type" field.    data type for g:Map Toshio Ito <debug.ito@gmail.com>None 345FKTo&Haskell 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"})+Haskell 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\"]"-If %, the map is encoded as an array. If !, it's encoded as a JSON Object..Map implementation./@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\"]"6Parse a flattened key-values to an associative Vector.2General parser for /.3General parser for +.4 Get the map implementation from +.5General parser for &.6Get the key-value pair from &.7Create + that has the single &.8 Deconstruct + into a list of &s.9Map to "g:Map".;Use 2.<Map to "g:Map".>Use 3.@Use 5.AMap to "g:Map".2 key parser value parser%input vector of flattened key-values.3 key parser value parser object parser%input object or flattened key-values.5 key parser value parser$input object or flattened key-values&'()*+,-./012345678/012+,-.4783&'()*65&'()*+,-./01Encoding and decoding GraphSON Toshio Ito <debug.ito@gmail.com>None6FTZ S#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.UUnwrap the given  with ", and just parse the result with .Useful to implement S instances for scalar types.VExtract   from the given 4, parse the items in the array, and gather them by .Useful to implement S instances for  types.WParse  into S.X Like Aeson's  , but for S.YImplementation of  based on T . The input  is first converted to &, and it's parsed to the output type.ZFor any input , T returns ()O. For example, you can use it to ignore data you get from the Gremlin server.\Call ! to remove all GraphSON wrappers.]Try , then .^Parse  into .bUse 5.cUse 3.dUse 2. STUVWXY  STWUVXYST-Conversion from Object to Iterator in Gremlin Toshio Ito <debug.ito@gmail.com>NoneFT,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>NoneFTSomething that can convert to .!type of return value by Greskell.Gremlin 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.Unsafely create a ? of arbitrary type. The given Gremlin script is printed as-is.$toGremlin $ unsafeGreskell "x + 100" "x + 100"Same as , but it takes lazy .QCreate 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 \\$\""Boolean true literal.toGremlin true"true"Boolean false literal.toGremlin false"false" List literal.4toGremlin $ list ([100, 200, 300] :: [Greskell Int])"[100,200,300]"wMake a list with a single object. Useful to prevent the Gremlin Server from automatically iterating the result object.,toGremlin $ single ("hoge" :: Greskell Text) "[\"hoge\"]"1Arbitrary precision number literal, like "123e8".toGremlin $ number 123e8 "1.23e10"Aeson  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 .Integer literal as  type.!toGremlin $ valueInt (100 :: Int)"100" literal as  type.Integer literal as  type."toGremlin $ gvalueInt (256 :: Int)"256"&Create a readable Gremlin script from .Same as  except that this returns lazy .Unsafely create a 9 that calls the given function with the given arguments.,toGremlin $ unsafeFunCall "add" ["10", "20"] "add(10,20)"Unsafely create a N that calls the given object method call with the given target and arguments.DtoGremlin $ unsafeMethodCall ("foobar" :: Greskell Text) "length" []"(\"foobar\").length()"Monoidal operations on  assumes String operations in Gremlin.  is the empty String, and  is String concatenation.Semigroup operator  on  assumes String concatenation on Gremlin.?Floating-point number literals and numeric operation in Gremlin1Integer literals and numeric operation in Gremlin"Unsafely convert the phantom type.Same as & except for the input and output type. It's just .Gremlin scriptGremlin script function name arguments!return value of the function call target object method name argumentsreturn value of the method call  !"#$%&'()*+,-./0122345667899:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       ` ,greskell-core-0.1.2.0-HrobBCKEhQy2PrcN852fWrData.Greskell.GraphSONData.Greskell.GraphSON.GValueData.Greskell.GMapData.Greskell.AsIteratorData.Greskell.Greskell$Data.Greskell.GraphSON.GraphSONTypedData.Greskell.GraphSON.Core FromGraphSONData.MapMap AsIterator$aeson-1.2.4.0-H5AjmDBnHfNIj8n3LiLwAGData.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$fGraphSONTypedInt8baseGHC.BaseNothingparseTypedGraphSON'Value Data.EitherLeftRight$fFromJSONGraphSONJust$fToJSONGraphSON$fHashableGraphSONData.Aeson.Types.ToJSONtoJSONData.Aeson.Types.FromJSONFromJSONToJSON3unordered-containers-0.2.8.0-3iSQJVS3Sio885UUC852ojData.HashMap.BaseHashMapghc-prim GHC.TypesTrueFalse parseToAVecInt#text-1.2.2.2-EakMpasry3jA6OIwSZhq9MData.Text.InternalText&vector-0.12.0.1-LflPw1fguMb6as60UrZpxN Data.VectorVectorcontainers-0.5.10.2Data.Set.InternalSetData.Map.InternalCharString parseJSONGHC.ExtsfromListIsList GHC.ClassesEqOrdData.Text.Internal.LazyNumbermemptymappendData.Semigroup<>id unGreskell