JSON-Combinator 0.1.0 → 0.1.1
raw patch · 2 files changed
+22/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.JSON.Combinator: readJSONFile :: (JSONParse j a e, InteractFile a) => String -> IO (Either e j)
+ Text.JSON.Combinator: writeJSONFile :: (InteractFile b, JSONPrint a b) => FilePath -> a -> IO ()
Files
- JSON-Combinator.cabal +1/−1
- Text/JSON/Combinator.hs +21/−1
JSON-Combinator.cabal view
@@ -1,5 +1,5 @@ Name: JSON-Combinator-Version: 0.1.0+Version: 0.1.1 License: BSD3 License-File: LICENSE Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
Text/JSON/Combinator.hs view
@@ -78,6 +78,8 @@ , interactJSON' , withJSON -- * File I/O+, readJSONFile+, writeJSONFile , interactJSONFile , interactJSONFile' , withJSONFile@@ -672,6 +674,24 @@ field'OrEmptyObject = field'Or jemptyobject +-- | Parses a JSON file into a possible JSON object.+readJSONFile ::+ (JSONParse j a e, InteractFile a) =>+ String+ -> IO (Either e j)+readJSONFile f =+ parseJSON f `fmap` readFile' f++-- | Writes a JSON object to a file.+writeJSONFile ::+ (InteractFile b, JSONPrint a b) =>+ FilePath+ ->+ a+ -> IO ()+writeJSONFile f =+ writeFile' f . printJSON+ -- | Interacts by parsing the standard input for JSON, passing the result to the given function, then printing the result to standard output. interactJSON :: (JSONPrint j' s, JSONParse j s e, Interact s) =>@@ -706,7 +726,7 @@ -> FilePath -> IO () interactJSONFile f i o =- readFile' i >>= writeFile' o . (printJSON . f) . parseJSON ""+ readFile' i >>= writeFile' o . (printJSON . f) . parseJSON "stdin" -- | Interacts by parsing the given file for JSON, passing a failed result with a string error message to the given function, or a successful result to the given function, then writing the result to the given file. interactJSONFile' ::