Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Parser = Parsec ErrorContext Text
- type ParseError = ParseErrorBundle Text ErrorContext
- newtype ErrorContext = ErrorContext {
- getErrorContext :: [Text]
- newtype ObjectParser a = ObjectParser {}
- newtype ArrayParser a = ArrayParser {
- getArrayParser :: Parser a
- lexeme :: Parser a -> Parser a
- takeSpace :: Parser ()
- parseAnyField :: Parser ()
- objectKey :: Text -> Parser ()
- parseCharInText :: Char -> Parser ()
- parseDictField :: Parser a -> Parser (Text, a)
- parseObjectField :: Text -> Parser a -> Parser a
- parseJSONText :: Parser Text
- innerText :: Parser Text
- parseEscape :: Parser Text
- parseHexDigit :: Parser Int
- comma :: Parser ()
- labelSep :: Parser ()
- parseAnyObject :: Parser ()
- parseAnyArray :: Parser ()
- consumeJunkValue :: Parser ()
- parseJSONNumber :: Parser Scientific
- parseJSONNull :: Parser ()
- parseJSONBool :: Parser Bool
- junkFieldsAtEnd :: Parser ()
- newtype MegaparsecParser a = MegaparsecParser {}
- convertParserToMegaparsecParser :: (forall parser. JSONParser parser => parser a) -> Parser a
- megaparsecParser :: FromJSON val => Parser val
- runParserViaMegaparsec :: (forall parser. JSONParser parser => parser a) -> Text -> Either String a
- parseViaMegaparsec :: forall val. FromJSON val => Text -> Either String val
Documentation
newtype ErrorContext Source #
Instances
Eq ErrorContext Source # | |
Defined in Jordan.FromJSON.Megaparsec (==) :: ErrorContext -> ErrorContext -> Bool # (/=) :: ErrorContext -> ErrorContext -> Bool # | |
Ord ErrorContext Source # | |
Defined in Jordan.FromJSON.Megaparsec compare :: ErrorContext -> ErrorContext -> Ordering # (<) :: ErrorContext -> ErrorContext -> Bool # (<=) :: ErrorContext -> ErrorContext -> Bool # (>) :: ErrorContext -> ErrorContext -> Bool # (>=) :: ErrorContext -> ErrorContext -> Bool # max :: ErrorContext -> ErrorContext -> ErrorContext # min :: ErrorContext -> ErrorContext -> ErrorContext # | |
Show ErrorContext Source # | |
Defined in Jordan.FromJSON.Megaparsec showsPrec :: Int -> ErrorContext -> ShowS # show :: ErrorContext -> String # showList :: [ErrorContext] -> ShowS # | |
ShowErrorComponent ErrorContext Source # | |
Defined in Jordan.FromJSON.Megaparsec showErrorComponent :: ErrorContext -> String # errorComponentLen :: ErrorContext -> Int # |
newtype ObjectParser a Source #
Instances
Functor ObjectParser Source # | |
Defined in Jordan.FromJSON.Megaparsec fmap :: (a -> b) -> ObjectParser a -> ObjectParser b # (<$) :: a -> ObjectParser b -> ObjectParser a # | |
Applicative ObjectParser Source # | |
Defined in Jordan.FromJSON.Megaparsec pure :: a -> ObjectParser a # (<*>) :: ObjectParser (a -> b) -> ObjectParser a -> ObjectParser b # liftA2 :: (a -> b -> c) -> ObjectParser a -> ObjectParser b -> ObjectParser c # (*>) :: ObjectParser a -> ObjectParser b -> ObjectParser b # (<*) :: ObjectParser a -> ObjectParser b -> ObjectParser a # | |
JSONObjectParser ObjectParser Source # | |
Defined in Jordan.FromJSON.Megaparsec parseFieldWith :: Text -> (forall (valueParser :: Type -> Type). JSONParser valueParser => valueParser a) -> ObjectParser a Source # parseField :: FromJSON v => Text -> ObjectParser v Source # |
newtype ArrayParser a Source #
Instances
Functor ArrayParser Source # | |
Defined in Jordan.FromJSON.Megaparsec fmap :: (a -> b) -> ArrayParser a -> ArrayParser b # (<$) :: a -> ArrayParser b -> ArrayParser a # | |
Applicative ArrayParser Source # | |
Defined in Jordan.FromJSON.Megaparsec pure :: a -> ArrayParser a # (<*>) :: ArrayParser (a -> b) -> ArrayParser a -> ArrayParser b # liftA2 :: (a -> b -> c) -> ArrayParser a -> ArrayParser b -> ArrayParser c # (*>) :: ArrayParser a -> ArrayParser b -> ArrayParser b # (<*) :: ArrayParser a -> ArrayParser b -> ArrayParser a # | |
JSONTupleParser ArrayParser Source # | |
Defined in Jordan.FromJSON.Megaparsec consumeItemWith :: (forall (valueParser :: Type -> Type). JSONParser valueParser => valueParser a) -> ArrayParser a Source # consumeItem :: FromJSON v => ArrayParser v Source # |
parseAnyField :: Parser () Source #
parseCharInText :: Char -> Parser () Source #
parseEscape :: Parser Text Source #
parseAnyObject :: Parser () Source #
parseAnyArray :: Parser () Source #
consumeJunkValue :: Parser () Source #
parseJSONNull :: Parser () Source #
junkFieldsAtEnd :: Parser () Source #
newtype MegaparsecParser a Source #
Instances
convertParserToMegaparsecParser :: (forall parser. JSONParser parser => parser a) -> Parser a Source #
Convert an abstract JSONParser to a Megaparsec parser.
megaparsecParser :: FromJSON val => Parser val Source #
Get a megaparsec parser for your JSON value. This parser will not construct any intermediate maps or other structures - your object will be parsed directly!
Note: this parser, until the ones that are built into the class, can consume whitespace at the start of the JSON.
runParserViaMegaparsec :: (forall parser. JSONParser parser => parser a) -> Text -> Either String a Source #
Run an abstract JSONParser via Megaparsec.