descrilo-0.1.0.2: Loads a list of items with fields

LicenseGPL-3
Maintainermarcelogmillani@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.DescriLo

Description

Loads a file or String into a list of Descriptions. Descriptions with the same name are allowed.

Example file:

[item A] # the first item
  property 1 = value 1 # indentation is ignored
  property 2 = value 2
[item B]
  something=else # whitespaces after and before each value / property are ignored

Synopsis

Documentation

loadDescriptionFile :: FilePath -> String -> IO [Description] Source

loads all descriptions from a file

usage: loadDescriptionFile filename defaultName

loads the given file, using defaultName as the default description name in case the document doesn't start with the definition of one

loadDescriptionString :: String -> String -> [Description] Source

loads all descriptions from a string

usage: loadDescriptionString string defaultName

behaves just like loadDescriptionFile, but receives a String instead

checkAttribute :: String -> (String -> Bool) -> Description -> Bool Source

checks if the specified attribute satisfies the given function, when it exists if the given attribute does not exist, returns False

data Description Source

Constructors

Description 

Fields

name :: String
 
values :: [(String, String)]
 

Instances