aeson-2.1.2.1: Fast JSON parsing and encoding
Copyright(c) 2015-2016 Bryan O'Sullivan
LicenseBSD3
MaintainerBryan O'Sullivan <bos@serpentine.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Aeson.Internal

Description

Deprecated: All contents of this module are exported from Data.Aeson.Types module. This module will be removed in the next major aeson version.

Internal types and functions.

Note: all declarations in this module are unstable, and prone to being changed at any time.

Synopsis

Documentation

data IResult a Source #

The internal result of running a Parser.

Constructors

IError JSONPath String 
ISuccess a 

Instances

Instances details
MonadFail IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

fail :: String -> IResult a Source #

Foldable IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

fold :: Monoid m => IResult m -> m Source #

foldMap :: Monoid m => (a -> m) -> IResult a -> m Source #

foldMap' :: Monoid m => (a -> m) -> IResult a -> m Source #

foldr :: (a -> b -> b) -> b -> IResult a -> b Source #

foldr' :: (a -> b -> b) -> b -> IResult a -> b Source #

foldl :: (b -> a -> b) -> b -> IResult a -> b Source #

foldl' :: (b -> a -> b) -> b -> IResult a -> b Source #

foldr1 :: (a -> a -> a) -> IResult a -> a Source #

foldl1 :: (a -> a -> a) -> IResult a -> a Source #

toList :: IResult a -> [a] Source #

null :: IResult a -> Bool Source #

length :: IResult a -> Int Source #

elem :: Eq a => a -> IResult a -> Bool Source #

maximum :: Ord a => IResult a -> a Source #

minimum :: Ord a => IResult a -> a Source #

sum :: Num a => IResult a -> a Source #

product :: Num a => IResult a -> a Source #

Traversable IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

traverse :: Applicative f => (a -> f b) -> IResult a -> f (IResult b) Source #

sequenceA :: Applicative f => IResult (f a) -> f (IResult a) Source #

mapM :: Monad m => (a -> m b) -> IResult a -> m (IResult b) Source #

sequence :: Monad m => IResult (m a) -> m (IResult a) Source #

Alternative IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Applicative IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

pure :: a -> IResult a Source #

(<*>) :: IResult (a -> b) -> IResult a -> IResult b Source #

liftA2 :: (a -> b -> c) -> IResult a -> IResult b -> IResult c Source #

(*>) :: IResult a -> IResult b -> IResult b Source #

(<*) :: IResult a -> IResult b -> IResult a Source #

Functor IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

fmap :: (a -> b) -> IResult a -> IResult b Source #

(<$) :: a -> IResult b -> IResult a Source #

Monad IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

(>>=) :: IResult a -> (a -> IResult b) -> IResult b Source #

(>>) :: IResult a -> IResult b -> IResult b Source #

return :: a -> IResult a Source #

MonadPlus IResult Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

mzero :: IResult a Source #

mplus :: IResult a -> IResult a -> IResult a Source #

Monoid (IResult a) Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Semigroup (IResult a) Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

(<>) :: IResult a -> IResult a -> IResult a Source #

sconcat :: NonEmpty (IResult a) -> IResult a Source #

stimes :: Integral b => b -> IResult a -> IResult a Source #

Show a => Show (IResult a) Source # 
Instance details

Defined in Data.Aeson.Types.Internal

NFData a => NFData (IResult a) Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

rnf :: IResult a -> () Source #

Eq a => Eq (IResult a) Source # 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

(==) :: IResult a -> IResult a -> Bool Source #

(/=) :: IResult a -> IResult a -> Bool Source #

data JSONPathElement Source #

Elements of a JSON path used to describe the location of an error.

Constructors

Key Key

JSON path element of a key into an object, "object.key".

Index !Int

JSON path element of an index into an array, "array[index]".

(<?>) :: Parser a -> JSONPathElement -> Parser a Source #

Add JSON Path context to a parser

When parsing a complex structure, it helps to annotate (sub)parsers with context, so that if an error occurs, you can find its location.

withObject "Person" $ \o ->
  Person
    <$> o .: "name" <?> Key "name"
    <*> o .: "age"  <?> Key "age"

(Standard methods like (.:) already do this.)

With such annotations, if an error occurs, you will get a JSON Path location of that error.

Since 0.10

formatError :: JSONPath -> String -> String Source #

Annotate an error message with a JSONPath error location.

ifromJSON :: FromJSON a => Value -> IResult a Source #

Convert a value from JSON, failing if the types do not match.

iparse :: (a -> Parser b) -> a -> IResult b Source #

Run a Parser.