htoml-parse-0.1: Parse TOML values produced by htoml-megaparsec package.
Copyright(c) Sergey Vinokurov 2018
LicenseApache-2.0 (see LICENSE)
Maintainerserg.foo@gmail.com
Safe HaskellNone
LanguageHaskell2010

Data.Toml.Parse

Description

 
Synopsis

Documentation

data Node #

Instances

Instances details
Eq Node 
Instance details

Defined in Text.Toml.Types

Methods

(==) :: Node -> Node -> Bool #

(/=) :: Node -> Node -> Bool #

Show Node 
Instance details

Defined in Text.Toml.Types

Methods

showsPrec :: Int -> Node -> ShowS #

show :: Node -> String #

showList :: [Node] -> ShowS #

Generic Node 
Instance details

Defined in Text.Toml.Types

Associated Types

type Rep Node :: Type -> Type #

Methods

from :: Node -> Rep Node x #

to :: Rep Node x -> Node #

NFData Node 
Instance details

Defined in Text.Toml.Types

Methods

rnf :: Node -> () #

FromToml Node Bool Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node Double Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node Int Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node String Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node Text Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node UTCTime Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node a => FromToml Node (NonEmpty a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Node -> Parser (NonEmpty a) Source #

FromToml Node a => FromToml Node (Vector a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Node -> Parser (Vector a) Source #

(Ord k, FromToml Text k, FromToml Node v) => FromToml Node (Map k v) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Node -> Parser (Map k v) Source #

(Ord k, FromToml Text k, FromToml Node v) => FromToml Table (Map k v) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Table -> Parser (Map k v) Source #

Index (L Node) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => L Node -> Text -> Parser b Source #

(.:?) :: FromToml Node b => L Node -> Text -> Parser (Maybe b) Source #

Index (L Table) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => L Table -> Text -> Parser b Source #

(.:?) :: FromToml Node b => L Table -> Text -> Parser (Maybe b) Source #

type Rep Node 
Instance details

Defined in Text.Toml.Types

data Parser a Source #

Instances

Instances details
Monad Parser Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(>>=) :: Parser a -> (a -> Parser b) -> Parser b #

(>>) :: Parser a -> Parser b -> Parser b #

return :: a -> Parser a #

Functor Parser Source # 
Instance details

Defined in Data.Toml.Parse

Methods

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

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

Applicative Parser Source # 
Instance details

Defined in Data.Toml.Parse

Methods

pure :: a -> Parser a #

(<*>) :: Parser (a -> b) -> Parser a -> Parser b #

liftA2 :: (a -> b -> c) -> Parser a -> Parser b -> Parser c #

(*>) :: Parser a -> Parser b -> Parser b #

(<*) :: Parser a -> Parser b -> Parser a #

Alternative Parser Source # 
Instance details

Defined in Data.Toml.Parse

Methods

empty :: Parser a #

(<|>) :: Parser a -> Parser a -> Parser a #

some :: Parser a -> Parser [a] #

many :: Parser a -> Parser [a] #

MonadPlus Parser Source # 
Instance details

Defined in Data.Toml.Parse

Methods

mzero :: Parser a #

mplus :: Parser a -> Parser a -> Parser a #

TomlParse Parser Source # 
Instance details

Defined in Data.Toml.Parse

a ~ L Node => Index (Parser a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => Parser a -> Text -> Parser b Source #

(.:?) :: FromToml Node b => Parser a -> Text -> Parser (Maybe b) Source #

runParser :: a -> (L a -> Parser b) -> Either (Doc Void) b Source #

data AtomicTomlError Source #

Constructors

UnexpectedType 

Fields

  • !TomlType

    Expected

  • Node

    Got

MissingKey !Text Table 
IndexOutOfBounds !Int Node 
OtherError (Doc Void) 

Instances

Instances details
Show AtomicTomlError Source # 
Instance details

Defined in Data.Toml.Parse

Generic AtomicTomlError Source # 
Instance details

Defined in Data.Toml.Parse

Associated Types

type Rep AtomicTomlError :: Type -> Type #

Pretty AtomicTomlError Source # 
Instance details

Defined in Data.Toml.Parse

type Rep AtomicTomlError Source # 
Instance details

Defined in Data.Toml.Parse

data TomlError Source #

Instances

Instances details
Show TomlError Source # 
Instance details

Defined in Data.Toml.Parse

Generic TomlError Source # 
Instance details

Defined in Data.Toml.Parse

Associated Types

type Rep TomlError :: Type -> Type #

Pretty TomlError Source # 
Instance details

Defined in Data.Toml.Parse

Methods

pretty :: TomlError -> Doc ann #

prettyList :: [TomlError] -> Doc ann #

type Rep TomlError Source # 
Instance details

Defined in Data.Toml.Parse

(<?>) :: L a -> Text -> L a infixl 9 Source #

Add textual annotation to the provided located thing. The annotation will be shows as part of error message if the location ultimately gets passed to throwParseError.

data L a Source #

Adds to a its provenance in the toml file.

Instances

Instances details
Functor L Source # 
Instance details

Defined in Data.Toml.Parse

Methods

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

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

Foldable L Source # 
Instance details

Defined in Data.Toml.Parse

Methods

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

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

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

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

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

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

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

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

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

toList :: L a -> [a] #

null :: L a -> Bool #

length :: L a -> Int #

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

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

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

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

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

Traversable L Source # 
Instance details

Defined in Data.Toml.Parse

Methods

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

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

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

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

Comonad L Source # 
Instance details

Defined in Data.Toml.Parse

Methods

extract :: L a -> a #

duplicate :: L a -> L (L a) #

extend :: (L a -> b) -> L a -> L b #

FromToml a (L a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L a -> Parser (L a) Source #

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

Defined in Data.Toml.Parse

Methods

(==) :: L a -> L a -> Bool #

(/=) :: L a -> L a -> Bool #

Ord a => Ord (L a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

compare :: L a -> L a -> Ordering #

(<) :: L a -> L a -> Bool #

(<=) :: L a -> L a -> Bool #

(>) :: L a -> L a -> Bool #

(>=) :: L a -> L a -> Bool #

max :: L a -> L a -> L a #

min :: L a -> L a -> L a #

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

Defined in Data.Toml.Parse

Methods

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

show :: L a -> String #

showList :: [L a] -> ShowS #

Generic (L a) Source # 
Instance details

Defined in Data.Toml.Parse

Associated Types

type Rep (L a) :: Type -> Type #

Methods

from :: L a -> Rep (L a) x #

to :: Rep (L a) x -> L a #

Pretty a => Pretty (L a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

pretty :: L a -> Doc ann #

prettyList :: [L a] -> Doc ann #

Index (L Node) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => L Node -> Text -> Parser b Source #

(.:?) :: FromToml Node b => L Node -> Text -> Parser (Maybe b) Source #

Index (L Table) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => L Table -> Text -> Parser b Source #

(.:?) :: FromToml Node b => L Table -> Text -> Parser (Maybe b) Source #

type Rep (L a) Source # 
Instance details

Defined in Data.Toml.Parse

type Rep (L a)

extract :: Comonad w => w a -> a #

extract . fmap f = f . extract

class (Applicative m, Alternative m) => TomlParse m where Source #

Methods

throwParseError :: L b -> AtomicTomlError -> m a Source #

Instances

Instances details
TomlParse Parser Source # 
Instance details

Defined in Data.Toml.Parse

class FromToml a b where Source #

Methods

fromToml :: L a -> Parser b Source #

Instances

Instances details
FromToml a a Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L a -> Parser a Source #

FromToml Node Bool Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node Double Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node Int Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node String Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node Text Source # 
Instance details

Defined in Data.Toml.Parse

FromToml Node UTCTime Source # 
Instance details

Defined in Data.Toml.Parse

FromToml a (L a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L a -> Parser (L a) Source #

FromToml Node a => FromToml Node (NonEmpty a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Node -> Parser (NonEmpty a) Source #

FromToml Node a => FromToml Node (Vector a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Node -> Parser (Vector a) Source #

(Ord k, FromToml Text k, FromToml Node v) => FromToml Node (Map k v) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Node -> Parser (Map k v) Source #

(Ord k, FromToml Text k, FromToml Node v) => FromToml Table (Map k v) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

fromToml :: L Table -> Parser (Map k v) Source #

class Index a where Source #

Methods

(.:) :: FromToml Node b => a -> Text -> Parser b infixl 5 Source #

(.:?) :: FromToml Node b => a -> Text -> Parser (Maybe b) infixl 5 Source #

Instances

Instances details
Index (L Node) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => L Node -> Text -> Parser b Source #

(.:?) :: FromToml Node b => L Node -> Text -> Parser (Maybe b) Source #

Index (L Table) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => L Table -> Text -> Parser b Source #

(.:?) :: FromToml Node b => L Table -> Text -> Parser (Maybe b) Source #

a ~ L Node => Index (Parser a) Source # 
Instance details

Defined in Data.Toml.Parse

Methods

(.:) :: FromToml Node b => Parser a -> Text -> Parser b Source #

(.:?) :: FromToml Node b => Parser a -> Text -> Parser (Maybe b) Source #

(.!=) :: Functor m => m (Maybe a) -> a -> m a infixl 5 Source #

Assign default value to a parser that produces Maybe. Typically used together with .:?:

foo .:? "bar" .!= 10

pTable :: TomlParse m => L Node -> m (L Table) Source #

pKey :: TomlParse m => Text -> L Table -> m (L Node) Source #

pStrL :: TomlParse m => L Node -> m (L Text) Source #

pInt :: TomlParse m => L Node -> m Int Source #

pIntL :: TomlParse m => L Node -> m (L Int) Source #

pCases :: (Ord k, FromToml Node k, Pretty k) => Map k v -> L Node -> Parser v Source #

ppToml :: Node -> Doc ann Source #

Prettyprint toml value.