ValveValueKeyvalue-1.1.0.0: A Valve Value-keyvalue parser for Haskell made with Parsec.
Safe HaskellNone
LanguageHaskell2010

Text.ValveVKV

Synopsis

Documentation

parseValveVKV :: ValveVKV a => String -> Either String a Source #

The main function you will be using. Turns the ValveVKV string into a type that has the ValveVKV typeclass.

parseToVKV :: String -> Either ParseError [ValveKeyValueEntry] Source #

Parses it directly to a list of entries. Most of the times, parseValveVKV will be better to directly turn it into a Haskell type of your choice

Since: 1.0.1.0

fromValveVKV :: ValveVKV a => ValveKeyValueEntry -> Context -> Either String a Source #

The first argument is the entry that should be turned into the type. The second argument is the entry just above that.

(.:) :: ValveVKV a => ValveKeyValueEntry -> String -> Either String a infixl 5 Source #

This operator receives an entry on the left side and a string on the right side. It tries to find the subentry named the string inside the entry you gave in on the left.

(^:) :: ValveKeyValueEntry -> String -> Maybe String infixl 5 Source #

This operator receives an entry on the left side and a string on the right side. It tries to find the string subentry named the string inside the entry you gave in on the left.

class ValveVKV a Source #

The class that lets a value to be made from a Valve value-keyvalue format. For example, if you have data My = My {name :: String, count :: Int} You write your instance as instance ValveVKV My where fromValveVKV this _ = My <$> this ^: "name" <*> this .: "count"

Minimal complete definition

fromValveVKV

Instances

Instances details
ValveVKV Bool Source # 
Instance details

Defined in Text.ValveVKV.Class

ValveVKV Int Source # 
Instance details

Defined in Text.ValveVKV.Class

ValveVKV a => ValveVKV [a] Source # 
Instance details

Defined in Text.ValveVKV.Class

ValveVKV a => ValveVKV (Maybe a) Source # 
Instance details

Defined in Text.ValveVKV.Class

ValveVKV a => ValveVKV (NonEmpty a) Source # 
Instance details

Defined in Text.ValveVKV.Class

data Pair a Source #

Constructors

Pair String a 

Instances

Instances details
Show a => Show (Pair a) Source # 
Instance details

Defined in Text.ValveVKV.Internal

Methods

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

show :: Pair a -> String #

showList :: [Pair a] -> ShowS #

unpair :: Pair a -> (String, a) Source #

type Context = ValveKeyValueEntry Source #

A type synonim for ValveKeyValueEntry

vkvParser :: Parsec String () [ValveKeyValueEntry] Source #

The Parsec parser itself.