-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parse and render JSON simply. -- -- Derulo parses and renders JSON simply. @package derulo @version 0.0.0 -- | Derulo parses and renders JSON simply. It aims to provide an RFC 7159 -- compliant parser and renderer without incurring any dependencies. It -- is intended to be used either for learning or in situations where -- dependencies are unwanted. In normal usage, prefer a faster, more -- robust library like Aeson. -- -- Derulo does not export any identifiers that conflict with the prelude -- and can be imported unqualified. -- --
-- >>> import Derulo ---- -- Use readJSON to parse a String into a JSON value. -- --
-- >>> readJSON " null " -- Just Null ---- -- Use showJSON to render a JSON value as a String. -- --
-- >>> showJSON Null -- "null" --module Derulo -- | A JSON value as described by RFC 7159. data JSON Null :: JSON Boolean :: Bool -> JSON Number :: Integer -> Integer -> JSON String :: String -> JSON Array :: [JSON] -> JSON Object :: [(String, JSON)] -> JSON -- | Parses a string as JSON. -- --
-- >>> readJSON "null" -- Just Null ---- --
-- >>> readJSON "true" -- Just (Boolean True) -- -- >>> readJSON "false" -- Just (Boolean False) ---- --
-- >>> readJSON "0e0" -- Just (Number 0 0) -- -- >>> readJSON "12e34" -- Just (Number 12 34) -- -- >>> readJSON "-12e-34" -- Just (Number (-12) (-34)) ---- --
-- >>> readJSON "\"\"" -- Just (String "") -- -- >>> readJSON "\"js\"" -- Just (String "js") -- -- >>> readJSON "\"\\\"\\\\\\b\\f\\n\\r\\t\"" -- Just (String "\"\\\b\f\n\r\t") -- -- >>> readJSON "\"\\u001f\"" -- Just (String "\US") ---- --
-- >>> readJSON "[]" -- Just (Array []) -- -- >>> readJSON "[null]" -- Just (Array [Null]) -- -- >>> readJSON "[true,false]" -- Just (Array [Boolean True,Boolean False]) ---- --
-- >>> readJSON "{}"
-- Just (Object [])
--
-- >>> readJSON "{\"\":null}"
-- Just (Object [("",Null)])
--
-- >>> readJSON "{\"t\":true,\"f\":false}"
-- Just (Object [("t",Boolean True),("f",Boolean False)])
--
readJSON :: String -> Maybe JSON
pJSON :: ReadP JSON
pValue :: ReadP JSON
pNull :: ReadP JSON
pBoolean :: ReadP JSON
pTrue :: ReadP JSON
pFalse :: ReadP JSON
pNumber :: ReadP JSON
pInteger :: ReadP Integer
pZero :: ReadP Integer
pNonZero :: ReadP Integer
pFraction :: ReadP (Integer, Integer)
pPower :: ReadP Integer
pString :: ReadP JSON
pCharacter :: ReadP Char
pLiteral :: ReadP Char
pEscape :: ReadP Char
pArray :: ReadP JSON
pObject :: ReadP JSON
pPair :: ReadP (String, JSON)
-- | Renders JSON as a string.
--
-- -- >>> showJSON Null -- "null" ---- --
-- >>> showJSON (Boolean True) -- "true" -- -- >>> showJSON (Boolean False) -- "false" ---- --
-- >>> showJSON (Number 0 0) -- "0e0" -- -- >>> showJSON (Number 12 34) -- "12e34" -- -- >>> showJSON (Number (-12) (-34)) -- "-12e-34" ---- --
-- >>> showJSON (String "") -- "\"\"" -- -- >>> showJSON (String "js") -- "\"js\"" -- -- >>> showJSON (String "\"\\\b\f\n\r\t") -- "\"\\\"\\\\\\b\\f\\n\\r\\t\"" -- -- >>> showJSON (String "\x1f") -- "\"\\u001f\"" ---- --
-- >>> showJSON (Array []) -- "[]" -- -- >>> showJSON (Array [Null]) -- "[null]" -- -- >>> showJSON (Array [Boolean True, Boolean False]) -- "[true,false]" ---- --
-- >>> showJSON (Object [])
-- "{}"
--
-- >>> showJSON (Object [("", Null)])
-- "{\"\":null}"
--
-- >>> showJSON (Object [("t", Boolean True), ("f", Boolean False)])
-- "{\"t\":true,\"f\":false}"
--
showJSON :: JSON -> String
sJSON :: JSON -> ShowS
sNull :: ShowS
sBoolean :: Bool -> ShowS
sTrue :: ShowS
sFalse :: ShowS
sNumber :: Integer -> Integer -> ShowS
sString :: String -> ShowS
sCharacter :: Char -> ShowS
sArray :: [JSON] -> ShowS
sObject :: [(String, JSON)] -> ShowS
sPair :: (String, JSON) -> ShowS
fromBase :: Integer -> (Char -> Maybe Integer) -> String -> Maybe Integer
fromDecimal :: String -> Maybe Integer
fromDecimalDigit :: Char -> Maybe Integer
fromHexadecimal :: String -> Maybe Integer
fromHexadecimalDigit :: Char -> Maybe Integer
isControl :: Char -> Bool
isDecimalDigit :: Char -> Bool
isHexadecimalDigit :: Char -> Bool
isLiteral :: Char -> Bool
isNonZeroDigit :: Char -> Bool
isWhitespace :: Char -> Bool
negateIf :: Bool -> Integer -> Integer
pSymbol :: String -> ReadP ()
pWhitespaces :: ReadP ()
padLeft :: Integer -> a -> [a] -> [a]
padRight :: Integer -> a -> [a] -> [a]
runParser :: ReadP a -> String -> Maybe a
sBetween :: ShowS -> ShowS -> (anything -> ShowS) -> anything -> ShowS
sSeparated :: ShowS -> (element -> ShowS) -> [element] -> ShowS
sSeparatedBetween :: ShowS -> ShowS -> ShowS -> (element -> ShowS) -> [element] -> ShowS
toBase :: Integer -> (Integer -> Maybe Char) -> Integer -> String
toBase' :: Integer -> (Integer -> Maybe Char) -> Integer -> String
toHexadecimal :: Integer -> String
toHexadecimalDigit :: Integer -> Maybe Char
instance GHC.Show.Show Derulo.JSON
instance GHC.Read.Read Derulo.JSON
instance GHC.Classes.Ord Derulo.JSON
instance GHC.Generics.Generic Derulo.JSON
instance GHC.Classes.Eq Derulo.JSON
instance Data.Data.Data Derulo.JSON