-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Extra goodies for aeson
--   
--   The package motivation is twofold:
--   
--   
--   
- provide compatibility layer for aeson
--   
- provide extra combinators
--   
@package aeson-extra
@version 0.2.2.0

-- | Compatibility notices
--   
--   
--   
- decode etc. work as in aeson >=0.9
--   
- but it is generalised to work in any MonadThrow (that is
--   extra)
--   
- .:? works as in aeson <0.10
--   
- .:! works as .:? in aeson ==0.10
--   
module Data.Aeson.Compat

-- | Like original decode but in arbitrary MonadThrow.
--   
--   Parse a top-level JSON value, i.e. also strings, numbers etc.
decode :: (FromJSON a, MonadThrow m) => ByteString -> m a

-- | Like original decode' but in arbitrary MonadThrow.
decode' :: (FromJSON a, MonadThrow m) => ByteString -> m a

-- | Like original decodeStrict but in arbitrary MonadThrow.
decodeStrict :: (FromJSON a, MonadThrow m) => ByteString -> m a

-- | Like original decodeStrict' but in arbitrary MonadThrow.
decodeStrict' :: (FromJSON a, MonadThrow m) => ByteString -> m a

-- | Exception thrown by decode - family of functions in this
--   module.
newtype AesonException
AesonException :: String -> AesonException

-- | Like decode but returns an error message when decoding fails.
eitherDecode :: FromJSON a => ByteString -> Either String a

-- | Like decode' but returns an error message when decoding fails.
eitherDecode' :: FromJSON a => ByteString -> Either String a

-- | Like decodeStrict but returns an error message when decoding
--   fails.
eitherDecodeStrict :: FromJSON a => ByteString -> Either String a

-- | Like decodeStrict' but returns an error message when decoding
--   fails.
eitherDecodeStrict' :: FromJSON a => ByteString -> Either String a

-- | Retrieve the value associated with the given key of an Object.
--   The result is Nothing if the key is not present, or
--   empty if the value cannot be converted to the desired type.
--   
--   This accessor is most useful if the key and value can be absent from
--   an object without affecting its validity. If the key and value are
--   mandatory, use .: instead.
--   
--   This operator is consistent in 'aeson >=0.8 && <0.11'
(.:?) :: (FromJSON a) => Object -> Text -> Parser (Maybe a)

-- | Like .:?, but the resulting parser will fail, if the key is
--   present but is Null.
(.:!) :: (FromJSON a) => Object -> Text -> Parser (Maybe a)
instance GHC.Show.Show Data.Aeson.Compat.AesonException
instance GHC.Exception.Exception Data.Aeson.Compat.AesonException

-- | More or less useful newtypes for writing FromJSON &
--   ToJSON instances
module Data.Aeson.Extra

-- | A wrapper type to parse arbitrary maps
--   
--   
--   λ > decode "{\"1\": 1, \"2\": 2}" :: Maybe (M (H.HashMap Int Int))
--   Just (M {getMap = fromList [(1,1),(2,2)]})
--   
newtype M a
M :: a -> M a
[getMap] :: M a -> a
class FromJSONKey a
parseJSONKey :: FromJSONKey a => Text -> Parser a
parseIntegralJSONKey :: Integral a => Text -> Parser a
class FromJSONMap m k v | m -> k v
parseJSONMap :: FromJSONMap m k v => HashMap Text Value -> Parser m
class ToJSONKey a
toJSONKey :: ToJSONKey a => a -> Text
class ToJSONMap m k v | m -> k v
toJSONMap :: ToJSONMap m k v => m -> HashMap Text Value

-- | Singleton string encoded and decoded as ifself.
--   
--   
--   λ> encode (SymTag :: SymTag "foobar")
--   "\"foobar\""
--   
--   
--   
--   decode "\"foobar\"" :: Maybe (SymTag "foobar")
--   Just SymTag
--   
--   
--   
--   decode "\"foobar\"" :: Maybe (SymTag "barfoo")
--   Nothing
--   
--   
--   Available with: base >=4.7
data SymTag (s :: Symbol)
SymTag :: SymTag

-- | Singleton value object
--   
--   
--   λ > decode "{\"value\": 42 }" :: Maybe (SingObject "value" Int)
--   Just (SingObject 42)
--   
--   
--   
--   λ > encode (SingObject 42 :: SingObject "value" Int)
--   "{\"value\":42}"
--   
--   
--   Available with: base >=4.7
newtype SingObject (s :: Symbol) a
SingObject :: a -> SingObject a
mkSingObject :: Proxy s -> a -> SingObject s a
getSingObject :: Proxy s -> SingObject s a -> a

-- | Collapsed list, singleton is represented as the value itself in JSON
--   encoding.
--   
--   
--   λ > decode "null" :: Maybe (CollapsedList [Int] Int)
--   Just (CollapsedList [])
--   λ > decode "42" :: Maybe (CollapsedList [Int] Int)
--   Just (CollapsedList [42])
--   λ > decode "[1, 2, 3]" :: Maybe (CollapsedList [Int] Int)
--   Just (CollapsedList [1,2,3])
--   
--   
--   
--   λ > encode (CollapsedList ([] :: [Int]))
--   "null"
--   λ > encode (CollapsedList ([42] :: [Int]))
--   "42"
--   λ > encode (CollapsedList ([1, 2, 3] :: [Int]))
--   "[1,2,3]"
--   
--   
--   Documentation rely on f Alternative instance behaving
--   like lists'.
newtype CollapsedList f a
CollapsedList :: (f a) -> CollapsedList f a
getCollapsedList :: CollapsedList f a -> f a

-- | Parses possibly collapsed array value from the object's field.
--   
--   
--   λ > newtype V = V [Int] deriving (Show)
--   λ > instance FromJSON V where parseJSON = withObject "V" $ \obj -> V <$> parseCollapsedList obj "value"
--   λ > decode "{}" :: Maybe V
--   Just (V [])
--   λ > decode "{\"value\": null}" :: Maybe V
--   Just (V [])
--   λ > decode "{\"value\": 42}" :: Maybe V
--   Just (V [42])
--   λ > decode "{\"value\": [1, 2, 3, 4]}" :: Maybe V
--   Just (V [1,2,3,4])
--   
parseCollapsedList :: (FromJSON a, FromJSON (f a), Alternative f) => Object -> Text -> Parser (f a)

-- | A type to parse UTCTime
--   
--   FromJSON instance accepts for example:
--   
--   
--   2015-09-07T08:16:40.807Z
--   2015-09-07 11:16:40.807 +03:00
--   
--   
--   Latter format is accepted by aeson staring from version
--   0.10.0.0.
--   
--   See
--   https://github.com/bos/aeson/blob/4667ef1029a373cf4510f7deca147c357c6d8947/Data/Aeson/Parser/Time.hs#L150
--   
--   Since: aeson-extra-0.2.2.0
newtype U
U :: UTCTime -> U
[getU] :: U -> UTCTime

-- | A type to parse ZonedTime
--   
--   Since: aeson-extra-0.2.2.0
newtype Z
Z :: ZonedTime -> Z
[getZ] :: Z -> ZonedTime
instance GHC.Read.Read Data.Aeson.Extra.Z
instance GHC.Show.Show Data.Aeson.Extra.Z
instance GHC.Read.Read Data.Aeson.Extra.U
instance GHC.Show.Show Data.Aeson.Extra.U
instance GHC.Classes.Ord Data.Aeson.Extra.U
instance GHC.Classes.Eq Data.Aeson.Extra.U
instance Data.Traversable.Traversable f => Data.Traversable.Traversable (Data.Aeson.Extra.CollapsedList f)
instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Data.Aeson.Extra.CollapsedList f)
instance GHC.Base.Functor f => GHC.Base.Functor (Data.Aeson.Extra.CollapsedList f)
instance GHC.Read.Read (f a) => GHC.Read.Read (Data.Aeson.Extra.CollapsedList f a)
instance GHC.Show.Show (f a) => GHC.Show.Show (Data.Aeson.Extra.CollapsedList f a)
instance GHC.Classes.Ord (f a) => GHC.Classes.Ord (Data.Aeson.Extra.CollapsedList f a)
instance GHC.Classes.Eq (f a) => GHC.Classes.Eq (Data.Aeson.Extra.CollapsedList f a)
instance Data.Traversable.Traversable (Data.Aeson.Extra.SingObject s)
instance Data.Foldable.Foldable (Data.Aeson.Extra.SingObject s)
instance GHC.Base.Functor (Data.Aeson.Extra.SingObject s)
instance GHC.Read.Read a => GHC.Read.Read (Data.Aeson.Extra.SingObject s a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Aeson.Extra.SingObject s a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Aeson.Extra.SingObject s a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Aeson.Extra.SingObject s a)
instance GHC.Enum.Bounded (Data.Aeson.Extra.SymTag s)
instance GHC.Enum.Enum (Data.Aeson.Extra.SymTag s)
instance GHC.Read.Read (Data.Aeson.Extra.SymTag s)
instance GHC.Show.Show (Data.Aeson.Extra.SymTag s)
instance GHC.Classes.Ord (Data.Aeson.Extra.SymTag s)
instance GHC.Classes.Eq (Data.Aeson.Extra.SymTag s)
instance Data.Traversable.Traversable Data.Aeson.Extra.M
instance Data.Foldable.Foldable Data.Aeson.Extra.M
instance GHC.Base.Functor Data.Aeson.Extra.M
instance GHC.Read.Read a => GHC.Read.Read (Data.Aeson.Extra.M a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Aeson.Extra.M a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Aeson.Extra.M a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Aeson.Extra.M a)
instance Data.Aeson.Extra.FromJSONKey Data.Text.Internal.Text
instance Data.Aeson.Extra.FromJSONKey Data.Text.Internal.Lazy.Text
instance Data.Aeson.Extra.FromJSONKey GHC.Base.String
instance Data.Aeson.Extra.FromJSONKey GHC.Types.Int
instance Data.Aeson.Extra.FromJSONKey GHC.Integer.Type.Integer
instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k, Data.Aeson.Extra.FromJSONKey k, Data.Aeson.Types.Class.FromJSON v) => Data.Aeson.Extra.FromJSONMap (Data.HashMap.Base.HashMap k v) k v
instance (GHC.Classes.Ord k, Data.Aeson.Extra.FromJSONKey k, Data.Aeson.Types.Class.FromJSON v) => Data.Aeson.Extra.FromJSONMap (Data.Map.Base.Map k v) k v
instance Data.Aeson.Extra.FromJSONMap m k v => Data.Aeson.Types.Class.FromJSON (Data.Aeson.Extra.M m)
instance Data.Aeson.Extra.ToJSONKey Data.Text.Internal.Text
instance Data.Aeson.Extra.ToJSONKey Data.Text.Internal.Lazy.Text
instance Data.Aeson.Extra.ToJSONKey GHC.Base.String
instance Data.Aeson.Extra.ToJSONKey GHC.Types.Int
instance Data.Aeson.Extra.ToJSONKey GHC.Integer.Type.Integer
instance (Data.Aeson.Extra.ToJSONKey k, Data.Aeson.Types.Class.ToJSON v) => Data.Aeson.Extra.ToJSONMap (Data.HashMap.Base.HashMap k v) k v
instance (Data.Aeson.Extra.ToJSONKey k, Data.Aeson.Types.Class.ToJSON v) => Data.Aeson.Extra.ToJSONMap (Data.Map.Base.Map k v) k v
instance Data.Aeson.Extra.ToJSONMap m k v => Data.Aeson.Types.Class.ToJSON (Data.Aeson.Extra.M m)
instance GHC.TypeLits.KnownSymbol s => Data.Aeson.Types.Class.FromJSON (Data.Aeson.Extra.SymTag s)
instance GHC.TypeLits.KnownSymbol s => Data.Aeson.Types.Class.ToJSON (Data.Aeson.Extra.SymTag s)
instance (GHC.TypeLits.KnownSymbol s, Data.Aeson.Types.Class.FromJSON a) => Data.Aeson.Types.Class.FromJSON (Data.Aeson.Extra.SingObject s a)
instance (GHC.TypeLits.KnownSymbol s, Data.Aeson.Types.Class.ToJSON a) => Data.Aeson.Types.Class.ToJSON (Data.Aeson.Extra.SingObject s a)
instance (Data.Aeson.Types.Class.FromJSON a, Data.Aeson.Types.Class.FromJSON (f a), GHC.Base.Alternative f) => Data.Aeson.Types.Class.FromJSON (Data.Aeson.Extra.CollapsedList f a)
instance (Data.Aeson.Types.Class.ToJSON a, Data.Aeson.Types.Class.ToJSON (f a), Data.Foldable.Foldable f) => Data.Aeson.Types.Class.ToJSON (Data.Aeson.Extra.CollapsedList f a)
instance Data.Aeson.Types.Class.ToJSON Data.Aeson.Extra.U
instance Data.Aeson.Types.Class.FromJSON Data.Aeson.Extra.U
instance Data.Aeson.Types.Class.ToJSON Data.Aeson.Extra.Z
instance Data.Aeson.Types.Class.FromJSON Data.Aeson.Extra.Z
