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

-- | Law-abiding lenses for aeson
--   
--   Law-abiding lenses for aeson
@package lens-aeson
@version 0.1.2

module Control.Lens.Aeson
class AsNumber t where _Number = _Primitive . _Number _Double = _Number . prism D (\ v -> case v of { D d -> Right d _ -> Left v }) _Integer = _Number . prism I (\ v -> case v of { I i -> Right i _ -> Left v })
_Number :: AsNumber t => Prism' t Number
_Double :: AsNumber t => Prism' t Double
_Integer :: AsNumber t => Prism' t Integer

-- | Access Integer Values as Integrals.
--   
--   defined as `integer . integral'
--   
--   
--   >>> "[10]" ^? nth 0 . integralValue
--   Just 10
--   
--   
--   
--   >>> "[10.5]" ^? nth 0 . integralValue
--   Nothing
--   
integralValue :: (AsNumber t, Integral a) => Prism' t a

-- | Prism 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 :: Prism' Value Value

-- | Primitives of Value
data Primitive
StringPrim :: !Text -> Primitive
NumberPrim :: !Number -> Primitive
BoolPrim :: !Bool -> Primitive
NullPrim :: Primitive
class AsNumber t => AsPrimitive t where _Primitive = _Value . _Primitive _String = _Primitive . prism StringPrim (\ v -> case v of { StringPrim s -> Right s _ -> Left v }) _Bool = _Primitive . prism BoolPrim (\ v -> case v of { BoolPrim b -> Right b _ -> Left v }) _Null = _Primitive . prism (const NullPrim) (\ v -> case v of { NullPrim -> Right () _ -> Left v })
_Primitive :: AsPrimitive t => Prism' t Primitive
_String :: AsPrimitive t => Prism' t Text
_Bool :: AsPrimitive t => Prism' t Bool
_Null :: AsPrimitive t => Prism' t ()
class AsPrimitive t => AsValue t where _Object = _Value . prism Object (\ v -> case v of { Object o -> Right o _ -> Left v }) _Array = _Value . prism Array (\ v -> case v of { Array a -> Right a _ -> Left v })
_Value :: AsValue t => Prism' t Value
_Object :: AsValue t => Prism' t (HashMap Text Value)
_Array :: AsValue t => Prism' t (Vector Value)

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

-- | Like ix, but for Arrays with Int indexes
--   
--   
--   >>> "[1,2,3]" ^? nth 1
--   Just (Number 2)
--   
--   
--   
--   >>> "\"a\": 100, \"b\": 200}" ^? nth 1
--   Nothing
--   
--   
--   
--   >>> "[1,2,3]" & nth 1 .~ (Number 20)
--   "[1,20,3]"
--   
nth :: AsValue t => Int -> Traversal' t Value
values :: AsValue t => IndexedTraversal' Int t Value
class AsJSON t
_JSON :: (AsJSON t, FromJSON a, ToJSON a) => Prism' t a
instance Typeable Primitive
instance Eq Primitive
instance Ord Primitive
instance Show Primitive
instance Data Primitive
instance Plated Value
instance (Applicative f, Gettable f) => Contains f Value
instance Applicative f => Ixed f Value
instance AsJSON String
instance AsJSON ByteString
instance AsValue String
instance AsValue ByteString
instance AsValue Value
instance AsPrimitive Primitive
instance AsPrimitive String
instance AsPrimitive ByteString
instance AsPrimitive Value
instance AsNumber Primitive
instance AsNumber String
instance AsNumber ByteString
instance AsNumber Number
instance AsNumber Value
