4      !"#$%&'()*+,-./0123 portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered A key/value pair for an  . -A JSON value represented as a Haskell value. A JSON "array" (sequence). A JSON "object" (key/ value map). "A continuation-based parser type. The result of running a  . The empty array. 4Determines if the  is an empty .  Note that:  isEmptyArray . The empty object. Run a  . Run a   with a 5 result type. Run a   with an 6 result type.  Create a  from a list of name/value s. If duplicate ; keys arise, earlier keys and their associated values win. % 4789:;<=>?@ABCDEF 4  4789:;<=>?@ABCDEFportable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-InferedG Transform a H into a I while transforming the keys. J Transform a H into a I while transforming the keys. K#Transform the keys and values of a I. LTransform the keys of a I. GJKLMNOGJKLMNOGJKLMNO portable experimental%Bryan O'Sullivan <bos@serpentine.com>None A newtype wrapper for P! that uses the same non-standard / serialization format as Microsoft .NET, whose System.DateTime D type is by default serialized to JSON as in the following example:   /Date(1302547608878)/ 9The number represents milliseconds since the Unix epoch. @A type that can be converted from JSON, with the possibility of  failure. When writing an instance, use empty, mzero, or Q to make a  conversion fail, e.g. if an   is missing a required key, or ! the value is of the wrong type. An example type and instance:  {-# LANGUAGE OverloadedStrings #-}  (data Coord { x :: Double, y :: Double }  instance FromJSON Coord where  parseJSON (  v) = Coord R  v  "x" S  v  "y"  -- A non- $ value is of the wrong type, so use mzero to fail.  parseJSON _ = mzero Note the use of the OverloadedStrings" language extension which enables  T* values to be written as string literals. !Instead of manually writing your # instance, there are three options  to do it automatically:   Data.Aeson.TH: provides template-haskell functions which will derive an M instance at compile-time. The generated instance is optimized for your type D so will probably be more efficient than the following two options:  Data.Aeson.Generic provides a generic fromJSON function that parses to " any type which is an instance of Data. & If your compiler has support for the  DeriveGeneric and  DefaultSignatures language extensions,  parseJSON will have a default  generic implementation. To use this, simply add a  deriving U clause to your datatype and  declare a FromJSON8 instance for your datatype without giving a definition  for  parseJSON. <For example the previous example can be simplified to just: {-# LANGUAGE DeriveGeneric #-}  import GHC.Generics  9data Coord { x :: Double, y :: Double } deriving Generic  instance FromJSON Coord &A type that can be converted to JSON. An example type and instance:  {-# LANGUAGE OverloadedStrings #-}  (data Coord { x :: Double, y :: Double }  instance ToJSON Coord where  toJSON (Coord x y) =  ["x"  x, "y"  y] Note the use of the OverloadedStrings" language extension which enables  T* values to be written as string literals. !Instead of manually writing your # instance, there are three options  to do it automatically:   Data.Aeson.TH: provides template-haskell functions which will derive an M instance at compile-time. The generated instance is optimized for your type D so will probably be more efficient than the following two options:  Data.Aeson.Generic provides a generic toJSON function that accepts any  type which is an instance of Data. & If your compiler has support for the  DeriveGeneric and  DefaultSignatures language extensions, toJSON will have a default generic  implementation. 'To use the latter option, simply add a  deriving U clause to your  datatype and declare a ToJSON- instance for your datatype without giving a  definition for toJSON. <For example the previous example can be simplified to just: {-# LANGUAGE DeriveGeneric #-}  import GHC.Generics  9data Coord { x :: Double, y :: Double } deriving Generic  instance ToJSON Coord  Construct a  from a key and a value. >Convert a value from JSON, failing if the types do not match. 7Retrieve the value associated with the given key of an  .  The result is empty/ if the key is not present or the value cannot # be converted to the desired type. 2This accessor is appropriate if the key and value must be present < in an object for it to be valid. If the key and value are  optional, use '(.:?)' instead. 7Retrieve the value associated with the given key of an  .  The result is V if the key is not present, or empty if 4 the value cannot be converted to the desired type. @This accessor is most useful if the key and value can be absent @ from an object without affecting its validity. If the key and  value are mandatory, use '(.:)' instead. #Helper for use in combination with  to provide default ) values for optional JSON object fields. BThis combinator is most useful if the key and value can be absent E from an object without affecting its validity and we know a default D value to assign in that case. If the key and value are mandatory,  use '(.:)' instead. Example usage:  v1 <- o  "opt_field_with_dfl" .!= " default_val"  v2 <- o  "mandatory_field"  v3 <- o  " opt_field2"  AFail parsing due to a type mismatch, with a descriptive message. {WXYZ .The name of the type you are trying to parse. The actual value encountered. [\]^_`abcdefghijklmnopqrstuvwxyz{|}~WXYZ uWXYZ [\]^_`abcdefghijklmnopqrstuvwxyz{|}~ portable experimental%Bryan O'Sullivan <bos@serpentine.com>None%%portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered!  !   portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered!@Parse a top-level JSON value. This must be either an object or  an array, per RFC 4627. @The conversion of a parsed value to a Haskell value is deferred E until the Haskell value is needed. This may improve performance if B only a subset of the results of conversions are needed, but at a  cost in thunk allocation. "@Parse a top-level JSON value. This must be either an object or  an array, per RFC 4627. This is a strict version of !! which avoids building up thunks B during parsing; it performs all conversions immediately. Prefer = this version if most of the JSON data needs to be accessed. #*Parse any JSON value. You should usually ! in preference to = this function, as this function relaxes the object-or-array  requirement of RFC 4627. CIn particular, be careful in using this function if you think your / code might interoperate with Javascript. A nave Javascript % library that parses JSON data using eval is vulnerable to attack A unless the encoded data represents an object or an array. JSON E implementations in other languages conform to that same restriction , to preserve interoperability and security. $Strict version of # . See also ". %Parse a quoted JSON string. !"#$%!"#$%!"#$%portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered!"#$%!#%"$portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered&Encode a JSON value to a . You can convert this to a  string using e.g. #, or encode straight to UTF-8 (the  standard JSON encoding) using '. '-Efficiently serialize a JSON value as a lazy . &'&'&'&'portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered(-Efficiently serialize a JSON value as a lazy . )1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, V is  returned. >This function parses immediately, but defers conversion. See  ! for details. *1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, V is  returned. ?This function parses and performs conversion immediately. See  " for details. ()*+,()*+,)*(,+()*+,portable experimental%Bryan O'Sullivan <bos@serpentine.com> Safe-Infered-1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, V is  returned. >This function parses immediately, but defers conversion. See  ! for details. .1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, V is  returned. ?This function parses and performs conversion immediately. See  " for details. -. !"'-.-.'  !"-.portable experimentalNone/Generates both  and % instance declarations for the given  data type. DThis is a convienience function which is equivalent to calling both  0 and 2. 0 Generates a / instance declaration for the given data type.  Example:    data Foo = Foo Char Int  $(0  ''Foo) (This will splice in the following code:   instance  Foo where   =  value -> case value of ' Foo arg1 arg2 ->  $  $ do  mv <-  2   mv 0 ( arg1)   mv 1 ( arg2) " return mv 1IGenerates a lambda expression which encodes the given data type as JSON.  Example:    data Foo = Foo Int    encodeFoo :: Foo ->   encodeFoo = $(1 id ''Foo) (This will splice in the following code:   v"alue -> case value of Foo arg1 ->  arg1 2 Generates a / instance declaration for the given data type.  Example:    data Foo = Foo Char Int  $(2 id ''Foo) (This will splice in the following code:   instance  Foo where   =  value -> case value of   arr -> . if (V.length arr == 2)  then Foo <$>  (arr  0)  <*>  (arr  1) ! else fail "< error message>" # other -> fail "< error message>" 3JGenerates a lambda expression which parses the JSON encoding of the given  data type.  Example:    data Foo = Foo Int    parseFoo ::  ->   Foo  parseFoo = $(3 id ''Foo) (This will splice in the following code:   \"value -> case value of arg -> Foo <$>  arg / Function to change field names. 'Name of the type for which to generate  and   instances. 0 Function to change field names. )Name of the type for which to generate a  instance  declaration. 1 Function to change field names. Name of the type to encode. 2 Function to change field names. )Name of the type for which to generate a  instance  declaration. 3 Function to change field names. Name of the encoded type. /0123/0213/0123       ! " # $ % & ' ( ) * + , - ./0012#%123456789:;9<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY1Z[\9]^9_`9abcdefgh9:i j k l m n o p q r s t u v w x y z { | } ~  cc9]    aeson-0.6.0.2Data.Aeson.TypesData.Aeson.ParserData.Aeson.EncodeData.Aeson.Generic Data.Aeson Data.Aeson.THData.Aeson.Types.InternalData.Aeson.FunctionsData.Aeson.Types.ClassData.Aeson.Types.GenericData.Aeson.Parser.InternalPairValueNullBoolNumberStringArrayObjectParserResultSuccessError emptyArray emptyObjectparse parseMaybe parseEitherobject DotNetTimefromDotNetTimeFromJSON parseJSONToJSONtoJSON.=fromJSON.:.:?.!= typeMismatchjsonjson'valuevalue'jstring fromValueencodedecodedecode' deriveJSON deriveToJSONmkToJSONderiveFromJSON mkParseJSON isEmptyArraybase Data.MaybeMaybe Data.EitherEither$fHashableValue$fIsStringValue $fNFDataValue$fMonoidParser$fMonadPlusParser$fAlternativeParser$fApplicativeParser$fFunctorParser $fMonadParser$fMonoidResult$fAlternativeResult$fMonadPlusResult$fApplicativeResult $fMonadResult$fFunctorResult$fNFDataResult mapHashKeyValcontainers-0.4.2.1Data.MapMapunordered-containers-0.2.1.0Data.HashMap.BaseHashMap hashMapKey mapKeyValmapKeystrictlazytime-1.4Data.Time.Clock.UTCUTCTimeGHC.Basefail Data.Functor<$>Control.Applicative<*>text-0.11.1.13Data.Text.InternalTextghc-prim GHC.GenericsGenericNothing GFromJSON gParseJSONGToJSONgToJSON$fFromJSONLast $fToJSONLast$fFromJSONFirst $fToJSONFirst$fFromJSONDual $fToJSONDual$fFromJSON(,,,) $fToJSON(,,,)$fFromJSON(,,) $fToJSON(,,) $fFromJSON(,) $fToJSON(,)$fFromJSONUTCTime$fToJSONUTCTime$fFromJSONDotNetTime$fToJSONDotNetTime$fFromJSONValue $fToJSONValue$fFromJSONHashMap$fToJSONHashMap$fFromJSONHashMap0$fToJSONHashMap0$fFromJSONHashMap1$fToJSONHashMap1$fFromJSONHashMap2$fToJSONHashMap2$fFromJSONHashMap3$fToJSONHashMap3 $fFromJSONMap $fToJSONMap$fFromJSONMap0 $fToJSONMap0$fFromJSONMap1 $fToJSONMap1$fFromJSONMap2 $fToJSONMap2$fFromJSONMap3 $fToJSONMap3$fFromJSONIntMap$fToJSONIntMap$fFromJSONIntSet$fToJSONIntSet$fFromJSONHashSet$fToJSONHashSet $fFromJSONSet $fToJSONSet$fFromJSONVector$fToJSONVector$fFromJSONVector0$fToJSONVector0$fFromJSONVector1$fToJSONVector1$fFromJSONVector2$fToJSONVector2 $fFromJSON[] $fToJSON[]$fFromJSONByteString$fToJSONByteString$fFromJSONByteString0$fToJSONByteString0$fFromJSONText $fToJSONText$fFromJSONText0 $fToJSONText0$fFromJSONWord64$fToJSONWord64$fFromJSONWord32$fToJSONWord32$fFromJSONWord16$fToJSONWord16$fFromJSONWord8 $fToJSONWord8$fFromJSONWord $fToJSONWord$fFromJSONInt64 $fToJSONInt64$fFromJSONInt32 $fToJSONInt32$fFromJSONInt16 $fToJSONInt16$fFromJSONInt8 $fToJSONInt8$fFromJSONInteger$fToJSONInteger $fFromJSONInt $fToJSONInt$fFromJSONRatio $fToJSONRatio$fFromJSONFloat $fToJSONFloat$fFromJSONNumber$fToJSONNumber$fFromJSONDouble$fToJSONDouble$fFromJSONChar $fToJSONChar $fFromJSON[]0 $fToJSON[]0 $fFromJSON() $fToJSON()$fFromJSONBool $fToJSONBool$fFromJSONEither$fToJSONEither$fFromJSONMaybe $fToJSONMaybe$fIsRecordU1False$fIsRecordK1True $fIsRecordM1b$fIsRecordM1False$fIsRecord:*:b $fGFromSumM1 $fGFromSum:+:$fGFromProductM1$fGFromProduct:*:$fProductSizeM1$fProductSize:*:$fGFromRecordM1$fGFromRecord:*:$fConsFromJSON'Falsef$fConsFromJSON'Truef$fConsFromJSONf$fGFromJSON:+:$fGFromJSON:*: $fGFromJSONM1 $fGFromJSONU1 $fGFromJSONK1$fGFromJSONM10 $fGObjectM1 $fGObject:+:$fGProductToValuesa$fGProductToValues:*:$fGRecordToPairsM1$fGRecordToPairs:*:$fConsToJSON'Falsef$fConsToJSON'Truef $fConsToJSONf $fGToJSON:+: $fGToJSON:*: $fGToJSONM1 $fGToJSONU1 $fGToJSONK1 $fGToJSONM10 decodeWithData.Text.Lazy.BuilderBuilder toLazyTextbytestring-0.9.2.1Data.ByteString.Lazy.Internal ByteStringid vector-0.9.1 Data.VectorcreateData.Vector.Mutable unsafeNew unsafeWrite unsafeIndex