aeson-2.0.2.0: Fast JSON parsing and encoding
Copyright (c) 2015-2016 Bryan O'Sullivan
License BSD3
Maintainer Bryan O'Sullivan <bos@serpentine.com>
Stability experimental
Portability portable
Safe Haskell None
Language Haskell2010

Data.Aeson.Internal

Description

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 .

Instances

Instances details
Monad IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

Functor IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

MonadFail IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

Applicative IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

Foldable IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

Traversable IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

Alternative IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

MonadPlus IResult Source #
Instance details

Defined in Data.Aeson.Types.Internal

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

Defined in Data.Aeson.Types.Internal

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

Defined in Data.Aeson.Types.Internal

Semigroup ( IResult a) Source #
Instance details

Defined in Data.Aeson.Types.Internal

Monoid ( 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

(<?>) :: 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.