Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- parseValveVKV :: ValveVKV a => String -> Either String a
- parseToVKV :: String -> Either ParseError [ValveKeyValueEntry]
- fromValveVKV :: ValveVKV a => ValveKeyValueEntry -> Context -> Either String a
- (.:) :: ValveVKV a => ValveKeyValueEntry -> String -> Either String a
- (^:) :: ValveKeyValueEntry -> String -> Maybe String
- class ValveVKV a
- data ValveKeyValueEntry
- data Pair a = Pair String a
- unpair :: Pair a -> (String, a)
- type Context = ValveKeyValueEntry
- vkvParser :: Parsec String () [ValveKeyValueEntry]
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.
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"
Instances
ValveVKV Bool Source # | |
Defined in Text.ValveVKV.Class fromValveVKV :: ValveKeyValueEntry -> Context -> Either String Bool Source # | |
ValveVKV Int Source # | |
Defined in Text.ValveVKV.Class fromValveVKV :: ValveKeyValueEntry -> Context -> Either String Int Source # | |
ValveVKV a => ValveVKV [a] Source # | |
Defined in Text.ValveVKV.Class fromValveVKV :: ValveKeyValueEntry -> Context -> Either String [a] Source # | |
ValveVKV a => ValveVKV (Maybe a) Source # | |
Defined in Text.ValveVKV.Class fromValveVKV :: ValveKeyValueEntry -> Context -> Either String (Maybe a) Source # | |
ValveVKV a => ValveVKV (NonEmpty a) Source # | |
Defined in Text.ValveVKV.Class fromValveVKV :: ValveKeyValueEntry -> Context -> Either String (NonEmpty a) Source # |
data ValveKeyValueEntry Source #
Instances
Show ValveKeyValueEntry Source # | |
Defined in Text.ValveVKV.Internal showsPrec :: Int -> ValveKeyValueEntry -> ShowS # show :: ValveKeyValueEntry -> String # showList :: [ValveKeyValueEntry] -> ShowS # |
type Context = ValveKeyValueEntry Source #
A type synonim for ValveKeyValueEntry