RJson 0.3.3 → 0.3.4
raw patch · 3 files changed
+17/−26 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README +9/−0
- RJson.cabal +1/−1
- Text/RJson.hs +7/−25
README view
@@ -1,3 +1,6 @@+Author: Alex Drummond.+Thanks to Dustin DeWeese for a patch fixing a bug in the parser.+ This is some documentation on how to use the library. I wrote a blog post about an older version of the library which may contain some useful information on using syb-with-class:@@ -173,3 +176,9 @@ because it seems to be necessary to temporarily create records with dummy field values. If the fields are strict, these dummy values get evaluated, leading to an exception being raised.++OTHER WEIRD BUG: You cannot have a field of type X and a field whose type is a+synonym of X in the same record. This leads to weird compile-time errors if you+try to serialize the record. I have no idea why (but this is normally easy to+work around).+
RJson.cabal view
@@ -1,5 +1,5 @@ Name: RJson-Version: 0.3.3+Version: 0.3.4 Cabal-Version: >= 1.2 License: BSD3 License-File: LICENSE
Text/RJson.hs view
@@ -633,18 +633,16 @@ -- be more common). number :: P.Parser JsonData number = do+ neg <- (P.char '-' >> return True) <|> return False i <- P.many1 P.digit point <- P.option Nothing (apply Just (P.char '.' >> P.many1 P.digit)) exponent <- P.option Nothing (apply Just (P.char 'e' >> pconcat (P.option "" (listify (P.char '-'))) (P.many1 P.digit)))- (if point == Nothing && exponent == Nothing- then return (JDNumber (read i :: Double))- else return (- JDNumber (- read (i ++ (if point == Nothing then "" else "." ++ fromJust point) ++- (if exponent == Nothing then "" else "e" ++ fromJust exponent))- :: Double- )))-+ let n = if point == Nothing && exponent == Nothing+ then read i :: Double+ else read (i ++ (if point == Nothing then "" else "." ++ fromJust point) +++ (if exponent == Nothing then "" else "e" ++ fromJust exponent)) :: Double+ return . JDNumber $ if neg then negate n else n+ stringChar :: Char -> P.Parser Char stringChar opener = do -- Fail immediately on either single or double quotes or@@ -750,19 +748,3 @@ firstCharToLower "" = "" firstCharToLower (c:cs) = (toLower c) : cs -{--data Test = Foo | Bar deriving Show-$(derive[''Test])--instance ToJson Test where- toJson = enumToJson firstCharToLower-instance FromJson Test where- fromJson = enumFromJson firstCharToUpper--data Test2 = Test2 Int Int deriving Show-$(derive[''Test2])-data Test4 = Test4 { z :: String } deriving Show-$(derive[''Test4])-data Test3 = Test3 { x :: Int, y :: Test4} deriving Show-$(derive[''Test3])--}