module Drasil.Data.Formats.JSON.Core
(
JSON(..),
)
where
import Data.Text (Text)
import qualified Data.Text as T (pack)
import Data.Scientific (Scientific)
import Data.String (IsString(..))
data JSON =
JObject [(Text, JSON)]
| JArray [JSON]
| JString Text
| JNumber Scientific
| JBool Bool
| JNull
deriving (Int -> JSON -> ShowS
[JSON] -> ShowS
JSON -> String
(Int -> JSON -> ShowS)
-> (JSON -> String) -> ([JSON] -> ShowS) -> Show JSON
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JSON -> ShowS
showsPrec :: Int -> JSON -> ShowS
$cshow :: JSON -> String
show :: JSON -> String
$cshowList :: [JSON] -> ShowS
showList :: [JSON] -> ShowS
Show, JSON -> JSON -> Bool
(JSON -> JSON -> Bool) -> (JSON -> JSON -> Bool) -> Eq JSON
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JSON -> JSON -> Bool
== :: JSON -> JSON -> Bool
$c/= :: JSON -> JSON -> Bool
/= :: JSON -> JSON -> Bool
Eq)
instance IsString JSON where
fromString :: String -> JSON
fromString = Text -> JSON
JString (Text -> JSON) -> (String -> Text) -> String -> JSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack