ucl-0.2.0.1: Datatype and parser for the Universal Configuration Language (UCL) using libucl
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.UCL

Synopsis

Documentation

data UCL Source #

An UCL object

Instances

Instances details
Show UCL Source # 
Instance details

Defined in Data.UCL

Methods

showsPrec :: Int -> UCL -> ShowS #

show :: UCL -> String #

showList :: [UCL] -> ShowS #

Eq UCL Source # 
Instance details

Defined in Data.UCL

Methods

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

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

Ord UCL Source # 
Instance details

Defined in Data.UCL

Methods

compare :: UCL -> UCL -> Ordering #

(<) :: UCL -> UCL -> Bool #

(<=) :: UCL -> UCL -> Bool #

(>) :: UCL -> UCL -> Bool #

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

max :: UCL -> UCL -> UCL #

min :: UCL -> UCL -> UCL #

parseString :: String -> IO (Either String UCL) Source #

Parse a String into a UCL, resolving includes, macros, variables...

>>> parseString "{a: [1,2], 🌅: 3min, a: [4]}"
Right (UCLMap (fromList
  [ ("a"      , UCLArray [UCLInt 1, UCLInt 2, UCLInt 4])
  , ("\127749", UCLTime 180s                           )
  ]))

This function is not safe to call on untrusted input: configurations can read files, make http requests, do "billion laughs" attacks, and possibly crash the parser.

parseByteString :: ByteString -> IO (Either String UCL) Source #

Parse a ByteString into a UCL, resolving includes, macros, variables... Note that unicode does not get converted when using fromString. Prefer parseString when working on Strings or literals.

>>> parseByteString $ fromString "{a: [1,2], b: 3min, a: [4]}"
Right (UCLMap (fromList
  [ ("a", UCLArray [UCLInt 1, UCLInt 2, UCLInt 4])
  , ("b", UCLTime 180s                           )
  ]))

This function is not safe to call on untrusted input: configurations can read files, make http requests, do "billion laughs" attacks, and possibly crash the parser.

parseFile :: FilePath -> IO (Either String UCL) Source #

Parse the contents of a file into a UCL, resolving includes, macros, variables...

This function is not safe to call on untrusted input: configurations can read files, make http requests, do "billion laughs" attacks, and possibly crash the parser.