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

-- | Law-abiding lenses for Aeson, using microlens
--   
--   Law-abiding lenses for Aeson, using microlens.
@package microlens-aeson
@version 2.5.2

-- | Traversals for Data.Aeson, based on microlens for minimal
--   dependencies.
--   
--   For basic manipulation of Aeson values, full Prism
--   functionality isn't necessary. Since all Prisms are inherently
--   Traversals, we provide Traversals that mimic the behaviour of the
--   Prisms found in the original Data.Aeson.Lens.
module Lens.Micro.Aeson

-- | Traverse into various number types.
class AsNumber t

-- | 
--   >>> "[1, \"x\"]" ^? nth 0 . _Number
--   Just 1.0
--   
--   
--   
--   >>> "[1, \"x\"]" ^? nth 1 . _Number
--   Nothing
--   
_Number :: AsNumber t => Traversal' t Scientific
($dm_Number) :: (AsNumber t, AsValue t) => Traversal' t Scientific

-- | Traversal into an Double over a Value or
--   Scientific
--   
--   
--   >>> "[10.2]" ^? nth 0 . _Double
--   Just 10.2
--   
_Double :: AsNumber t => Traversal' t Double

-- | Traversal into an Integer over a Value or
--   Scientific
--   
--   
--   >>> "[10]" ^? nth 0 . _Integer
--   Just 10
--   
--   
--   
--   >>> "[10.5]" ^? nth 0 . _Integer
--   Just 10
--   
--   
--   
--   >>> "42" ^? _Integer
--   Just 42
--   
_Integer :: AsNumber t => Traversal' t Integer

-- | Access Integer Values as Integrals.
--   
--   
--   >>> "[10]" ^? nth 0 . _Integral
--   Just 10
--   
--   
--   
--   >>> "[10.5]" ^? nth 0 . _Integral
--   Just 10
--   
_Integral :: (AsNumber t, Integral a) => Traversal' t a

-- | Traversal into non-Null values
--   
--   
--   >>> "{\"a\": \"xyz\", \"b\": null}" ^? key "a" . nonNull
--   Just (String "xyz")
--   
--   
--   
--   >>> "{\"a\": {}, \"b\": null}" ^? key "a" . nonNull
--   Just (Object (fromList []))
--   
--   
--   
--   >>> "{\"a\": \"xyz\", \"b\": null}" ^? key "b" . nonNull
--   Nothing
--   
nonNull :: Traversal' Value Value

-- | Traverse into JSON Objects and Arrays.
class AsNumber t => AsValue t

-- | Traverse into data that encodes a Value
_Value :: AsValue t => Traversal' t Value

-- | 
--   >>> "{\"a\": \"xyz\", \"b\": true}" ^? key "a" . _String
--   Just "xyz"
--   
--   
--   
--   >>> "{\"a\": \"xyz\", \"b\": true}" ^? key "b" . _String
--   Nothing
--   
_String :: AsValue t => Traversal' t Text

-- | 
--   >>> "{\"a\": \"xyz\", \"b\": true}" ^? key "b" . _Bool
--   Just True
--   
--   
--   
--   >>> "{\"a\": \"xyz\", \"b\": true}" ^? key "a" . _Bool
--   Nothing
--   
_Bool :: AsValue t => Traversal' t Bool

-- | 
--   >>> "{\"a\": \"xyz\", \"b\": null}" ^? key "b" . _Null
--   Just ()
--   
--   
--   
--   >>> "{\"a\": \"xyz\", \"b\": null}" ^? key "a" . _Null
--   Nothing
--   
_Null :: AsValue t => Traversal' t ()

-- | 
--   >>> "{\"a\": {}, \"b\": null}" ^? key "a" . _Object
--   Just (fromList [])
--   
--   
--   
--   >>> "{\"a\": {}, \"b\": null}" ^? key "b" . _Object
--   Nothing
--   
_Object :: AsValue t => Traversal' t (KeyMap Value)
_Array :: AsValue t => Traversal' t (Vector Value)

-- | Like ix, but for Object with Key indices. This
--   often has better inference than ix when used with
--   OverloadedStrings.
--   
--   
--   >>> "{\"a\": 100, \"b\": 200}" ^? key "a"
--   Just (Number 100.0)
--   
--   
--   
--   >>> "[1,2,3]" ^? key "a"
--   Nothing
--   
key :: AsValue t => Key -> Traversal' t Value

-- | A Traversal into Object properties
--   
--   
--   >>> "{\"a\": 4, \"b\": 7}" ^.. members
--   [Number 4.0,Number 7.0]
--   
--   
--   
--   >>> "{\"a\": 4, \"b\": 7}" & members . _Number %~ (* 10)
--   "{\"a\":40,\"b\":70}"
--   
members :: AsValue t => Traversal' t Value

-- | Like ix, but for Arrays with Int indexes
--   
--   
--   >>> "[1,2,3]" ^? nth 1
--   Just (Number 2.0)
--   
--   
--   
--   >>> "{\"a\": 100, \"b\": 200}" ^? nth 1
--   Nothing
--   
--   
--   
--   >>> "[1,2,3]" & nth 1 .~ Number 20
--   "[1,20,3]"
--   
nth :: AsValue t => Int -> Traversal' t Value

-- | A Traversal into Array elements
--   
--   
--   >>> "[1,2,3]" ^.. values
--   [Number 1.0,Number 2.0,Number 3.0]
--   
--   
--   
--   >>> "[1,2,3]" & values . _Number %~ (* 10)
--   "[10,20,30]"
--   
values :: AsValue t => Traversal' t Value

-- | Traverse into actual encoded JSON.
class AsJSON t

-- | _JSON is a Traversal from something containing JSON to
--   something encoded in that structure.
_JSON :: (AsJSON t, FromJSON a, ToJSON a) => Traversal' t a
instance Lens.Micro.Aeson.AsJSON Data.ByteString.Lazy.Internal.ByteString
instance Lens.Micro.Aeson.AsJSON Data.ByteString.Internal.Type.ByteString
instance Lens.Micro.Aeson.AsJSON GHC.Internal.Base.String
instance Lens.Micro.Aeson.AsJSON Data.Text.Internal.Lazy.Text
instance Lens.Micro.Aeson.AsJSON Data.Text.Internal.Text
instance Lens.Micro.Aeson.AsJSON Data.Aeson.Types.Internal.Value
instance Lens.Micro.Aeson.AsNumber Data.ByteString.Lazy.Internal.ByteString
instance Lens.Micro.Aeson.AsNumber Data.ByteString.Internal.Type.ByteString
instance Lens.Micro.Aeson.AsNumber GHC.Internal.Base.String
instance Lens.Micro.Aeson.AsNumber Data.Scientific.Scientific
instance Lens.Micro.Aeson.AsNumber Data.Text.Internal.Lazy.Text
instance Lens.Micro.Aeson.AsNumber Data.Text.Internal.Text
instance Lens.Micro.Aeson.AsNumber Data.Aeson.Types.Internal.Value
instance Lens.Micro.Aeson.AsValue Data.ByteString.Lazy.Internal.ByteString
instance Lens.Micro.Aeson.AsValue Data.ByteString.Internal.Type.ByteString
instance Lens.Micro.Aeson.AsValue GHC.Internal.Base.String
instance Lens.Micro.Aeson.AsValue Data.Text.Internal.Lazy.Text
instance Lens.Micro.Aeson.AsValue Data.Text.Internal.Text
instance Lens.Micro.Aeson.AsValue Data.Aeson.Types.Internal.Value
