úÎ!GEC[@      !"#$%&'()*+,-./0123456789:;<=>?(c) Scrive 20114BSD-style (see the LICENSE file in the distribution)mariusz@scrive.com developmentportableNone=?@AMg(c) Scrive 20114BSD-style (see the LICENSE file in the distribution)mariusz@scrive.com developmentportableNone=?@AM8¥  fields-json+Structures that can be matched with JSValue fields-jsonStructures that can be parsed] from JSON, fields absent in the JSON will be filled in using (optional) original structure.dBy convention JSON null should be treated as a request to reset structure element to default value.  fields-jsonStructures that can be parsed+ from JSON. Instances must declare either   (parse directly from @) or   (uses A).Example implementation: ¢data D = D String Int instance FromJSValue D where fromJSValue = do s <- fromJSValue "string_key" i <- fromJSValue "int_key" return (D <$> s <*> i)Note that we make use of A instance for "(->)" and of  programming style with B and C.Note:   is deprecated, in future  % will be generalized to work in any A @.D fields-jsonGetting JSON part of envirement fields-json1Reading the value that is on some field. Returns E} if JSON is not an object or field is present but cannot be parsed, 'Just Nothing' if absent, and 'Just (Just a)' otherwise fields-jsoniReading the value that is on a field. Semantics are a bit involved, example GHCi session should clarify: ÿnPrelude> :set -XNoMonomorphismRestriction Prelude> let x = withJSValue (JSObject (toJSObject [("key",JSString $ toJSString "value")])) Prelude> x (fromJSValueField "key") :: IO (Maybe Int) Nothing Prelude> x (fromJSValueField "key") :: IO (Maybe (Maybe Int)) Just Nothing Prelude> x (fromJSValueField "key") :: IO (Maybe (Maybe (Maybe Int))) Just (Just Nothing) Prelude> x (fromJSValueField "key") :: IO (Maybe String) Just "value" Prelude> x (fromJSValueField "key") :: IO (Maybe (Maybe String)) Just (Just "value") Prelude> x (fromJSValueField "key") :: IO (Maybe (Maybe (Maybe String))) Just (Just (Just "value")) Prelude> let x = withJSValue (JSArray []) Prelude> x (fromJSValueField "key") :: IO (Maybe String) Nothing Prelude> x (fromJSValueField "key") :: IO (Maybe (Maybe String)) Nothing Prelude> x (fromJSValueField "key") :: IO (Maybe (Maybe (Maybe String))) Nothing  fields-json Version of / for Base64 encoded data to avoid memory leak. fields-jsonGeneralization of . Does not use   instances. fields-jsonQRuns parser on each element of underlaying json. Returns Just iff JSON is array. fields-jsonGeneralization of 9, where each element of array can have different parser. fields-json8Runs parser on each element of underlying json. Returns F iff JSON is an array.rNote: This method has quadratic complexity. It is better to write less general matching algorithms that use Maps. fields-jsonSimple runner. Example: Alet (v :: MyStruct) = runIdentity $ withJSValue js (fromJSValueM) or inline: Ëlet z = runIdentity $ withJSValue js $ do a <- fromJSValueField "a" b <- fromJSValueField "b" c <- fromJSValueField "c" return ((,,) <$> a <*> b <*> <*> c)or using the monad transformer: ¶z <- withJSValue js $ do a <- fromJSValueField "a" b <- fromJSValueField "b" c <- fromJSValueField "c" return ((,,) <$> a <*> b <*> c) fields-json%Parsing any Maybe always returns Just   (c) Scrive 20114BSD-style (see the LICENSE file in the distribution)mariusz@scrive.com developmentportableNone=?@AM;H()()(c) Scrive 20114BSD-style (see the LICENSE file in the distribution)andrzej@scrive.com developmentportableNone=?@AMC3 fields-json Basic types4 fields-json Simple runner6 fields-json4Set pure value under given name in final JSON object7 fields-jsonMonadic verion of 68 fields-json:Embed other JSON object as field in resulting JSON object.9 fields-jsonVersion for lists of objects. ; fields-jsonPThis instance gives us the ability to use FromJSValue function while generating. ()2345678932456789G      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOMPQRMSTMSUV*fields-json-0.2.2.4-FjKS4BWYbaHBrPBAVdq07EText.JSON.JSValueContainerText.JSON.FromJSValueText.JSON.ToJSValue Text.JSON.GenControl ApplicativeJSValueContainer getJSValue setJSValue$fJSValueContainerSeq$fJSValueContainerJSValueMatchWithJSValuematchesWithJSValuematchesWithJSValueMFromJSValueWithUpdatefromJSValueWithUpdatefromJSValueWithUpdateM FromJSValue fromJSValue fromJSValueM jsValueFieldfromJSValueFieldfromJSValueFieldBase64fromJSValueFieldCustomfromJSValueCustomManyfromJSValueCustomListfromJSValueManyWithUpdate withJSValue$fFromJSValue(,,,,,)$fFromJSValue(,,,,)$fFromJSValue(,,,)$fFromJSValue(,,)$fFromJSValue(,)$fFromJSValueMaybe$fFromJSValue[]$fFromJSValueFloat$fFromJSValueDouble$fFromJSValueBool$fFromJSValueInt64$fFromJSValueInt32$fFromJSValueInt16$fFromJSValueInt$fFromJSValueInteger$fFromJSValueByteString$fFromJSValue[]0$fFromJSValueJSValue ToJSValue toJSValue$fToJSValue(,)$fToJSValueMaybe$fToJSValueMap $fToJSValue[] $fToJSValuea$fToJSValue[]0$fToJSValueBool$fToJSValueJSValueJSONGenTJSONGen runJSONGen runJSONGenTvaluevalueMobjectobjects$fMonadIOJSONGenT$fMonadReaderSeqJSONGenT$fApplicativeJSONGenT$fFunctorJSONGenT$fMonadJSONGenT$fMonadTransJSONGenT!json-0.9.3-KJzdCiQpLH94fTYJv4hgdRText.JSON.TypesJSValue mtl-2.2.2Control.Monad.Reader.Class MonadReaderbase Data.Functor<$>GHC.Base<*> askJSValue GHC.MaybeNothingJust