Îõ³h&D™Asù      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx(c) Marek FajkusBSD3marek.faj@gmail.com Safe-InferredA(c) Marek FajkusBSD3marek.faj@gmail.com Safe-Inferredã-"Áaeson-combinatorsãA value describing how other values are decoded from JSON. This type is an alternative to Aeson's y instance implementation.Use 9, 9, ;, < =, >, ? or @9 alternatives provided by this module for decoding from  ByteString.For decoding files use A, B C, D also provided by this module.When working with z, use E or F function.Functor to map function over  ?intToString :: Decoder String intToString = show <$> Decode.int #>>> decode intToString "2" Just "2"!Applicative to construct products ñstringIntPair :: Decoder (String, Int) stringIntPair = (,) <$> index 0 string <*> index 1 int =>>> decode stringIntPair "[\"hello\", 42]" Just ("hello", 42)Alternative to construct sums ûeitherTextOrInt :: Decoder (Either Text Int) eitherTextOrInt = Left <$> Decode.text <|> Right <$> Decode.int ö>>> decode eitherTextOrInt "\"Lorem Ipsum\"" Just (Left "Lorem Ipsum") >>> decode eitherTextOrInt "42" Just (Right 42) Monad for  chaining ‡odd :: Decoder Int odd = do val <- int if val `mod` 2 == 1 then $ return val else fail $ "Expected odd value, got " <> show val æ>>> eitherDecode odd "3" Right 3 >>> eitherDecode odd "4" Left "Error in $: Expected odd value, got 4"aeson-combinatorsConversely, an Aeson's y& instance can be implemented by using  combinators. ønewtype People = People [Person] instance FromJSON People where parseJSON = fromDecoder $ Decode.list personDecoderaeson-combinators is compatible with Aeson's y class. ÿ decoder acts like a proxy to instance implementation. Any type that is an instance of this class is automatically compatible.While Ö is universally usable for all primitive values, this library provides individual type constraint functions for decoding most common primitives and combinators for decoding larger structure from these primitives. aeson-combinators)Decode JSON null and other JSON value to  . JSON null will be decoded to {#. Other value decoded by provided  to | aeson-combinators?Decode JSON array of values to '[a]' of values using provided . aeson-combinatorsDecode JSON array of values to } of values using provided . aeson-combinatorsDecode JSON object to ~ with  key using provided . aeson-combinatorsDecode JSON object to ~ with  key using provided .aeson-combinatorsDecode JSON object to  with  key using provided .aeson-combinatorsDecode JSON object to  with  key using provided .aeson-combinatorsDecode JSON object to  with  key using provided .aeson-combinatorsõDecode JSON null to any value. This function is useful for decoding constructors which represented by null in JSON. ™data Codomain = NotSet | Foo | Bar myDomainDecoder :: Decoder Codomain myDomainDecoder = jsonNull NotSet <|> (text >>= fooBar) where fooBar "foo" = return Foo fooBar "bar" = return Bar fooBar unknown = fail $ "Unknown value " <> show unknownaeson-combinators'Extract JSON value from JSON object key(decode (key "data" int) "{\"data\": 42}"Just 42aeson-combinatorsSame as Ü but works with omitted attributes in payloads and produces parsed values in the context of €Ç. Note that this combinator behaves differently to a combination of  and ÿ, which produce error if the attribute is missing from the json object. >>> decode (maybeKey "data" int) "{}" Just Nothingaeson-combinators(Extract JSON value from JSON object keys?decode (at ["data", "value"] int) "{\"data\": {\"value\": 42}}"Just 42aeson-combinators(Extract JSON value from JSON array index"decode (index 2 int) "[0,1,2,3,4]"Just 2aeson-combinators*Extract JSON value from JSON array indexes 9>>> decode (indexes [0,1,0] int) "[[true, [42]]]" Just 42aeson-combinators!Decode value from JSON structure.From object key:8decode (element (Key "data") text) "{\"data\": \"foo\"}" Just "foo"From array index:(decode (element (Index 1) int) "[0,1,2]"Just 1aeson-combinators&Decode value from deep JSON structure.Êdecode (path [Key "data", Index 0] bool) "{\"data\":[true, false, false]}" Just Trueaeson-combinators9Try a decoder and get back a 'Just a' if it succeeds and {Ó if it fails. In other words, this decoder always succeeds with a 'Maybe a' value.decode (maybe string) "42" Just Nothingdecode (maybe int) "42"Just (Just 42)aeson-combinators¥Try a decoder and get back a 'Right a' if it succeeds and a 'Left String' if it fails. In other words, this decoder always succeeds with an 'Either String a' value.decode (either string) "42"5Just (Left "expected String, but encountered Number")decode (either int) "42"Just (Right 42)aeson-combinators?Try a number of decoders in order and return the first success.import Data.List.NonEmptyÉdecode (oneOf $ (words <$> string) :| [ list string ]) "\"Hello world!\""Just ["Hello","world!"]Ídecode (oneOf $ (list string) :| [ words <$> string ] ) "[\"Hello world!\"]"Just ["Hello world!"]Îdecode (oneOf $ (Right <$> bool) :| [ return (Left "Not a boolean") ]) "false"Just (Right False)Ëdecode (oneOf $ (Right <$> bool) :| [ return (Left "Not a boolean") ]) "42"Just (Left "Not a boolean")aeson-combinatorsDecode any JSON value to ) value which is impossible to construct.#This Decoder is guarenteed to fail.aeson-combinatorsDecode JSON null into ()aeson-combinators Decode JSON booleans to Haskell aeson-combinatorsDecode JSON number to  aeson-combinatorsDecode JSON number to ‚!aeson-combinatorsDecode JSON number to ƒ"aeson-combinatorsDecode JSON number to „#aeson-combinatorsDecode JSON number to …$aeson-combinators Decode JSON number to unbounded †%aeson-combinatorsDecode JSON number to GHC's    (non negative)This function requires base >= 4.8.0&aeson-combinatorsDecode JSON number to bounded ‡'aeson-combinatorsDecode JSON number to bounded ˆ(aeson-combinatorsDecode JSON number to bounded ‰)aeson-combinatorsDecode JSON number to bounded Š*aeson-combinatorsDecode JSON number to bounded ‹+aeson-combinatorsDecode JSON number to Œ,aeson-combinatorsDecode JSON number to -aeson-combinators*Decode JSON number to arbitrary precision Ž.aeson-combinators'Decode single character JSON string to  /aeson-combinatorsDecode JSON string to  0aeson-combinatorsDecode JSON string to 1aeson-combinatorsDecode JSON string to 2aeson-combinatorsDecode JSON string to 3aeson-combinatorsDecode JSON string to ( using Aeson's instance implementation.Supported string formats:ÂYYYY-MM-DD HH:MM Z YYYY-MM-DD HH:MM:SS Z YYYY-MM-DD HH:MM:SS.SSS Z•The first space may instead be a T, and the second space is optional. The Z represents UTC. The Z may be replaced with a time zone offset of the form +0000 or -08:00, where the first two digits are hours, the : is optional and the second two digits (also optional) are minutes.4aeson-combinatorsDecode JSON string to ( using Aeson's instance implementation.5aeson-combinatorsDecode JSON string to ( using Aeson's instance implementation.6aeson-combinatorsDecode JSON string to ( using Aesons's instance implementation7aeson-combinatorsDecode JSON string to ‘( using Aesons's instance implementation8aeson-combinatorsDecode JSON string to ’( using Aesons's instance implementation-This function requires 'time-compat' >= 1.9.29aeson-combinators1Efficiently deserialize a JSON value from a lazy 5. If this fails due to incomplete or invalid input, { is returned.ßThe input must consist solely of a JSON document, with no trailing data except for whitespace.>This function parses immediately, but defers conversion. See  for details.:aeson-combinators1Efficiently deserialize a JSON value from a lazy 5. If this fails due to incomplete or invalid input, { is returned.ßThe input must consist solely of a JSON document, with no trailing data except for whitespace.?This function parses and performs conversion immediately. See  for details.;aeson-combinatorsLike 92 but returns an error message when decoding fails.<aeson-combinatorsLike :2 but returns an error message when decoding fails.=aeson-combinators3Efficiently deserialize a JSON value from a strict “5. If this fails due to incomplete or invalid input, { is returned.ßThe input must consist solely of a JSON document, with no trailing data except for whitespace.>This function parses immediately, but defers conversion. See  for details.>aeson-combinators3Efficiently deserialize a JSON value from a strict “5. If this fails due to incomplete or invalid input, { is returned.ßThe input must consist solely of a JSON document, with no trailing data except for whitespace.ÀThis function parses and performs conversion immediately. See  for details.?aeson-combinatorsLike =2 but returns an error message when decoding fails.@aeson-combinatorsLike >2 but returns an error message when decoding fails.Aaeson-combinatorsåEfficiently deserialize a JSON value from a file. If this fails due to incomplete or invalid input, { is returned.îThe input file's content must consist solely of a JSON document, with no trailing data except for whitespace.>This function parses immediately, but defers conversion. See  for details.Baeson-combinatorsåEfficiently deserialize a JSON value from a file. If this fails due to incomplete or invalid input, { is returned.îThe input file's content must consist solely of a JSON document, with no trailing data except for whitespace.ÀThis function parses and performs conversion immediately. See  for details.Caeson-combinatorsLike A2 but returns an error message when decoding fails.Daeson-combinatorsLike B2 but returns an error message when decoding fails.Eaeson-combinatorsRun decoder over z . Returns { in case of failureFaeson-combinatorsRun decoder over z . Returns ”& with error message in case of failureÇ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFÇ $ !"#&'()*%+,-.0/123456789:;<=>?@ABCDEF(c) Marek FajkusBSD3marek.faj@gmail.com Safe-InferredA +Laeson-combinatorsObject Encoder (alternative):set -XRecordWildCards:{ data Object = Object { name :: Text , age :: Int } deriving (Show, Eq):}:{" objectEncoder' :: Encoder Object+ objectEncoder' = object' $ \Object{..} -> [ field' "name" text name , field' "age" int age ]:}'encode objectEncoder' $ Object "Joe" 30"{\"age\":30,\"name\":\"Joe\"}"Maeson-combinatorsObject Encoder:{ data Object = Object { name :: Text , age :: Int } deriving (Show, Eq):}:{! objectEncoder :: Encoder Object objectEncoder = object [ field "name" text name , field "age" int age ]:}&encode objectEncoder $ Object "Joe" 30"{\"age\":30,\"name\":\"Joe\"}"Naeson-combinatorsValue describing encoding of a into a JSON zÒ. This is essentially just a wrapper around function that should be applied later.$Covariant to map function over inputGiven::{data Person = Person { name :: String , age :: Int } deriving (Show, Eq):}:{personEncoder :: Encoder PersonpersonEncoder = object [ field "name" string name , field "age" int age ]:}$We can extract person from any pair::{4-- Using personEncoder definition from example above#pairEncoder2 :: Encoder (Person, a)*pairEncoder2 = contramap fst personEncoder:}/encode pairEncoder2 (Person "Jane" 42, Nothing) "{\"age\":42,\"name\":\"Jane\"}"Divisible and DecidableSome of you might know library  covariantú and ask what is a support for other covariant typeclasses. It's not possible to define lawful Divisble instance for JSON z° and by extension it's not possible to define Decidable either. While it is posible to provide somewhat useful unlawful instances for these this library opts to not to do that.Paeson-combinatorsRun NÀ given a value. this is essentially just a function application.Qaeson-combinatorsGrab N from • definition.Raeson-combinatorsObject combinators Saeson-combinatorsDefine object field Taeson-combinators!Object combinators (alternative) Uaeson-combinators"Define object field (alternative) Vaeson-combinatorsEncode } Waeson-combinatorsEncode List Xaeson-combinators Encode multiple values as array Yaeson-combinatorsEncode any JSON value to ) value which is impossible to construct.#This Encoder is guarenteed to fail.Zaeson-combinatorsEncode JSON null into ()[aeson-combinators Encode JSON booleans to Haskell \aeson-combinatorsEncode JSON number to  ]aeson-combinatorsEncode JSON number to ‚^aeson-combinatorsEncode JSON number to ƒ_aeson-combinatorsEncode JSON number to „`aeson-combinatorsEncode JSON number to …aaeson-combinators Encode JSON number to unbounded †baeson-combinatorsEncode JSON number to GHC's    (non negative)This function requires base >= 4.8.0caeson-combinatorsEncode JSON number to bounded ‡daeson-combinatorsEncode JSON number to bounded ˆeaeson-combinatorsEncode JSON number to bounded ‰faeson-combinatorsEncode JSON number to bounded Šgaeson-combinatorsEncode JSON number to bounded ‹haeson-combinatorsEncode JSON number to Œiaeson-combinatorsEncode JSON number to jaeson-combinators*Encode JSON number to arbitrary precision Žkaeson-combinators'Encode single character JSON string to  laeson-combinatorsEncode JSON string to  maeson-combinatorsEncode JSON string to naeson-combinatorsEncode JSON string to oaeson-combinatorsEncode JSON string to paeson-combinatorsEncode JSON string to ( using Aeson's instance implementation.Supported string formats:ÂYYYY-MM-DD HH:MM Z YYYY-MM-DD HH:MM:SS Z YYYY-MM-DD HH:MM:SS.SSS Z•The first space may instead be a T, and the second space is optional. The Z represents UTC. The Z may be replaced with a time zone offset of the form +0000 or -08:00, where the first two digits are hours, the : is optional and the second two digits (also optional) are minutes.qaeson-combinatorsEncode JSON string to ( using Aeson's instance implementation.raeson-combinatorsEncode JSON string to ( using Aeson's instance implementation.saeson-combinatorsEncode JSON string to ( using Aesons's instance implementationtaeson-combinatorsEncode JSON string to ‘( using Aesons's instance implementationuaeson-combinatorsEncode JSON string to ’( using Aesons's instance implementation-This function requires 'time-compat' >= 1.9.2vaeson-combinatorsEncode value into (Lazy)  ByteStringwaeson-combinatorsConvert value to encoding1LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw1NOQPMRSLTUWVXYZ[\a]^_`cdefgbhijkmlnopqrstuvw–  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghhi"jklm%$n6789:;<=>?@ABCDEFGHIJKLMNOPQRopqrstuvwxvwyz{|}~€‚vwvƒ„v…†v…‡v…ˆv…‰Š‹ŒŽv‘v’v“v”ޕޖ—˜™š›œžŸ ¡¢£¤¥v¦§¨©ª0aeson-combinators-0.1.2.1-FyBnqfi1WIh5VnASGmFOO1Data.Aeson.Combinators.DecodeData.Aeson.Combinators.EncodeData.Aeson.Combinators.CompatDataMaybeTextBoolData.IntIntGHCNaturalCharStringVersionData.Local.Time ZonedTime LocalTime TimeOfDayL ByteString Data.Aesonjsonjson'#aeson-2.2.1.0-gTjjz3pxNq9NJD6yGhQn8Data.Aeson.KeyMap toHashMapTextKeyMapData.Aeson.KeytoTextfromTextKeyDecoder fromDecoderautonullablelistvector hashMapLazy hashMapStrictkeyMapmapLazy mapStrictjsonNullkeymaybeKeyatindexindexeselementpathmaybeeitheroneOfvoidunitboolintint8int16int32int64integernaturalwordword8word16word32word64floatdouble scientificcharstringtextuuidversion zonedTime localTime timeOfDayutcTimeday dayOfWeekdecodedecode' eitherDecode eitherDecode' decodeStrict decodeStrict'eitherDecodeStricteitherDecodeStrict'decodeFileStrictdecodeFileStrict'eitherDecodeFileStricteitherDecodeFileStrict' parseMaybe parseEither$fMonadFailDecoder$fAlternativeDecoder$fMonadDecoder$fApplicativeDecoder$fFunctorDecoderKeyValueEncoder'KeyValueEncoderEncoderrunobjectfieldobject'field' jsonArrayencode toEncoding$fContravariantEncoderData.Aeson.Types.FromJSONFromJSONData.Aeson.Types.InternalValuebase GHC.MaybeNothingJust%vector-0.13.1.0-2lCeeCyC2I3KCSVrGQfe2 Data.VectorVector4unordered-containers-0.2.19.1-EafiWdAo79jF0YOmnCRXwdData.HashMap.InternalHashMapcontainers-0.6.5.1Data.Map.InternalMap Data.VoidVoidGHC.IntInt8Int16Int32Int64 ghc-bignumGHC.Num.IntegerIntegerghc-prim GHC.TypesWordGHC.WordWord8Word16Word32Word64FloatDouble)scientific-0.3.7.0-CAQWnYGfrPu7JmdgZDOyDXData.Scientific Scientific)uuid-types-1.0.5.1-Ea1bORQOs4w2mZFBseTdnmData.UUID.Types.InternalUUID time-1.11.1.1 Data.Time.Clock.Internal.UTCTimeUTCTimeData.Time.Calendar.DaysDayData.Time.Calendar.Week DayOfWeek*bytestring-0.11.5.3-98zjhRZoRi4C6cwRzaRvVYData.ByteString.Internal.Type Data.EitherLeftData.Aeson.Types.ToJSONToJSON