toml-parser-0.1.0.0: Parser for the TOML configuration language

Copyright(c) Eric Mertens 2017
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe
LanguageHaskell2010

TOML

Contents

Description

Parser for the TOML file format: https://github.com/toml-lang/toml

Synopsis

Parsing

parseTOML :: Text -> Either TOMLError [(Text, Value)] Source #

Parse the given TOML file. Returns the top-level table as a list of key-value pairs or returns an error.

Values

data Value Source #

Values possible in a TOML file

Constructors

Table [(Text, Value)]

table, key-value pairs

List [Value]

array

Double !Double

floating-point literal

Integer !Integer

integer literal

String !Text

string literal

Bool Bool

boolean literal

ZonedTimeV !ZonedTime

offset date-time

LocalTimeV !LocalTime

local date-time

DayV !Day

local date

TimeOfDayV !TimeOfDay

local time

Error information

data TOMLError Source #

Errors that can occur while loading a TOML file.

Constructors

Unexpected (Located Token)

unexpected token while parser

Unterminated (Located Token)

unterminated token while parser

OverlappingKey [Text]

ambiguous table entry

data LexerError Source #

Errors possible in the course of lexing

Constructors

UntermString

unterminated string literal

BadEscape

invalid escape sequence

NoMatch Char

no matching lexer rule

data Located a Source #

A value annotated with its text file position

Constructors

Located 

Fields

Instances

Functor Located Source # 

Methods

fmap :: (a -> b) -> Located a -> Located b #

(<$) :: a -> Located b -> Located a #

Foldable Located Source # 

Methods

fold :: Monoid m => Located m -> m #

foldMap :: Monoid m => (a -> m) -> Located a -> m #

foldr :: (a -> b -> b) -> b -> Located a -> b #

foldr' :: (a -> b -> b) -> b -> Located a -> b #

foldl :: (b -> a -> b) -> b -> Located a -> b #

foldl' :: (b -> a -> b) -> b -> Located a -> b #

foldr1 :: (a -> a -> a) -> Located a -> a #

foldl1 :: (a -> a -> a) -> Located a -> a #

toList :: Located a -> [a] #

null :: Located a -> Bool #

length :: Located a -> Int #

elem :: Eq a => a -> Located a -> Bool #

maximum :: Ord a => Located a -> a #

minimum :: Ord a => Located a -> a #

sum :: Num a => Located a -> a #

product :: Num a => Located a -> a #

Traversable Located Source # 

Methods

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

sequenceA :: Applicative f => Located (f a) -> f (Located a) #

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

sequence :: Monad m => Located (m a) -> m (Located a) #

Read a => Read (Located a) Source # 
Show a => Show (Located a) Source # 

Methods

showsPrec :: Int -> Located a -> ShowS #

show :: Located a -> String #

showList :: [Located a] -> ShowS #

data Position Source #

A position in a text file

Constructors

Position 

Fields