-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A Valve Value-keyvalue parser for Haskell made with Parsec.
--
-- This is a package made to parse Valve's value-keyvalue format, common
-- in Source Engine games. Valve value-keyvalue files may take the
-- extensions ".pop" or ".vtf". The main module is Text.ValveVKV. The
-- main function you will be using is parseValveVKV.
@package ValveValueKeyvalue
@version 1.1.0.0
module Text.ValveVKV
-- | The main function you will be using. Turns the ValveVKV string into a
-- type that has the ValveVKV typeclass.
parseValveVKV :: ValveVKV a => String -> Either String a
-- | 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
parseToVKV :: String -> Either ParseError [ValveKeyValueEntry]
-- | The first argument is the entry that should be turned into the type.
-- The second argument is the entry just above that.
fromValveVKV :: ValveVKV a => ValveKeyValueEntry -> Context -> Either String a
-- | 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.
(.:) :: ValveVKV a => ValveKeyValueEntry -> String -> Either String a
infixl 5 .:
-- | 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.
(^:) :: ValveKeyValueEntry -> String -> Maybe String
infixl 5 ^:
-- | 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"
class ValveVKV a
data ValveKeyValueEntry
KVObject :: Pair [ValveKeyValueEntry] -> ValveKeyValueEntry
KVString :: Pair String -> ValveKeyValueEntry
KVInt :: Pair Int -> ValveKeyValueEntry
data Pair a
Pair :: String -> a -> Pair a
unpair :: Pair a -> (String, a)
-- | A type synonim for ValveKeyValueEntry
type Context = ValveKeyValueEntry
-- | The Parsec parser itself.
vkvParser :: Parsec String () [ValveKeyValueEntry]