{-|
This module will never contain any namespace conflicts with Prelude,
so it can be imported unqualified.
-}
module JSONAST where

import Prelude
import Data.Data (Data, Typeable)
import Data.HashMap.Strict (HashMap)
import Data.Vector (Vector)
import Data.Text (Text)
import Data.Scientific (Scientific)


{-|
JSON value abstract syntax tree.

It is intended to be used instead of \"aeson\" @Value@ as lingua franca
for JSON libraries, removing the need to depend on \"aeson\" when all that's needed
is a representation of a JSON value.

Note that this datastructure is representationally identical to \"aeson\" @Value@.
Meaning that conversions between them can be made at 0 performance cost,
(using the 'Unsafe.Coerce.unsafeCoerce' function).
The \"aeson-json-ast\" package provides a typed interface for such conversions.
-}
data JSON =
  JSON_Object !(HashMap Text JSON) |
  JSON_Array !(Vector JSON) |
  JSON_String !Text |
  JSON_Number !Scientific |
  JSON_Bool !Bool |
  JSON_Null
  deriving (JSON -> JSON -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JSON -> JSON -> Bool
$c/= :: JSON -> JSON -> Bool
== :: JSON -> JSON -> Bool
$c== :: JSON -> JSON -> Bool
Eq, ReadPrec [JSON]
ReadPrec JSON
Int -> ReadS JSON
ReadS [JSON]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JSON]
$creadListPrec :: ReadPrec [JSON]
readPrec :: ReadPrec JSON
$creadPrec :: ReadPrec JSON
readList :: ReadS [JSON]
$creadList :: ReadS [JSON]
readsPrec :: Int -> ReadS JSON
$creadsPrec :: Int -> ReadS JSON
Read, Int -> JSON -> ShowS
[JSON] -> ShowS
JSON -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JSON] -> ShowS
$cshowList :: [JSON] -> ShowS
show :: JSON -> String
$cshow :: JSON -> String
showsPrec :: Int -> JSON -> ShowS
$cshowsPrec :: Int -> JSON -> ShowS
Show, Typeable, Typeable JSON
JSON -> DataType
JSON -> Constr
(forall b. Data b => b -> b) -> JSON -> JSON
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> JSON -> u
forall u. (forall d. Data d => d -> u) -> JSON -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSON -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSON -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JSON
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JSON -> c JSON
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JSON)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSON)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JSON -> m JSON
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JSON -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JSON -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> JSON -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> JSON -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSON -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSON -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSON -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSON -> r
gmapT :: (forall b. Data b => b -> b) -> JSON -> JSON
$cgmapT :: (forall b. Data b => b -> b) -> JSON -> JSON
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSON)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSON)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JSON)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JSON)
dataTypeOf :: JSON -> DataType
$cdataTypeOf :: JSON -> DataType
toConstr :: JSON -> Constr
$ctoConstr :: JSON -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JSON
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JSON
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JSON -> c JSON
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JSON -> c JSON
Data)