| Copyright | (c) 2015-2016 Bryan O'Sullivan |
|---|---|
| License | BSD3 |
| Maintainer | Bryan O'Sullivan <bos@serpentine.com> |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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
- data IResult a
- data JSONPathElement
- type JSONPath = [JSONPathElement]
- (<?>) :: Parser a -> JSONPathElement -> Parser a
- formatError :: JSONPath -> String -> String
- ifromJSON :: FromJSON a => Value -> IResult a
- iparse :: (a -> Parser b) -> a -> IResult b
Documentation
The internal result of running a Parser .
Instances
Instances details
Instance details
Defined in Data.Aeson.Types.Internal
Methods
fold :: Monoid m => IResult m -> m #
foldMap :: Monoid m => (a -> m) -> IResult a -> m #
foldMap' :: Monoid m => (a -> m) -> IResult a -> m #
foldr :: (a -> b -> b) -> b -> IResult a -> b #
foldr' :: (a -> b -> b) -> b -> IResult a -> b #
foldl :: (b -> a -> b) -> b -> IResult a -> b #
foldl' :: (b -> a -> b) -> b -> IResult a -> b #
foldr1 :: (a -> a -> a) -> IResult a -> a #
foldl1 :: (a -> a -> a) -> IResult a -> a #
elem :: Eq a => a -> IResult a -> Bool #
maximum :: Ord a => IResult a -> a #
minimum :: Ord a => IResult a -> a #
Instance details
Defined in Data.Aeson.Types.Internal
data JSONPathElement Source #
Elements of a JSON path used to describe the location of an error.
Constructors
Instances
Instances details
Instance details
Defined in Data.Aeson.Types.Internal
Methods
showsPrec :: Int -> JSONPathElement -> ShowS #
show :: JSONPathElement -> String #
showList :: [JSONPathElement] -> ShowS #
Instance details
Defined in Data.Aeson.Types.Internal
Methods
(==) :: JSONPathElement -> JSONPathElement -> Bool #
(/=) :: JSONPathElement -> JSONPathElement -> Bool #
Instance details
Defined in Data.Aeson.Types.Internal
Methods
compare :: JSONPathElement -> JSONPathElement -> Ordering #
(<) :: JSONPathElement -> JSONPathElement -> Bool #
(<=) :: JSONPathElement -> JSONPathElement -> Bool #
(>) :: JSONPathElement -> JSONPathElement -> Bool #
(>=) :: JSONPathElement -> JSONPathElement -> Bool #
max :: JSONPathElement -> JSONPathElement -> JSONPathElement #
min :: JSONPathElement -> JSONPathElement -> JSONPathElement #
type JSONPath = [JSONPathElement] Source #
(<?>) :: 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.