lens-aeson-0.1.1: Law-abiding lenses for aeson

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Control.Lens.Aeson

Contents

Description

 

Synopsis

Numbers

integralValue :: (AsNumber t, Integral a) => Prism' t aSource

Access Integer Values as Integrals.

defined as `integer . integral'

nonNull :: Prism' Value ValueSource

Prism into non-Null values

Primitive

Objects and Arrays

class AsPrimitive t => AsValue t whereSource

Methods

_Value :: Prism' t ValueSource

>>> putStrLn $ "{\"a\": 1, \"b\": 3}" & key "a"._Integer *~ 100
{"a":100,"b":3}

_Object :: Prism' t (HashMap Text Value)Source

_Array :: Prism' t (Vector Value)Source

key :: AsValue t => Text -> Traversal' t ValueSource

Like ix, but for Object with Text indices. This often has better inference than ix when used with OverloadedStrings

nth :: AsValue t => Int -> Traversal' t ValueSource

Like ix, but for Arrays with Int indexes

Decoding

class AsJSON t whereSource

Methods

_JSON :: (FromJSON a, ToJSON a) => Prism' t aSource

A Prism into Value on lazy ByteStrings.