EEConfig-1.0: ExtremlyEasyConfig - Extremly Simple parser for config filesSource codeContentsIndex
EEConfig
Description

This module is a very simple parser for parameters recognition. It recognizes given parameters and their values. As input it becomes list of parameters and their values in format [ParameterInput] and input String where parameters will be searched. As output it deliveres recognized parameters and values in format [ParameterOutput], where only these parameters are present which have been found in the input string. In output list each exisitng parameter has exactly one value - this one that has been recognized in the input string. Parameters in the input string have to be always given in following format: (<flagname> <parameter>)*

Example how to use it.

 let paramsList = matchParamsL params inputText
 let paramsTree = matchParamsT paramsList
 params :: [ParameterInput]
 params = [(-pl1,algNum),(-pl2,algNum),
          (-br1,0:(map show [5..30])),(-br2,0:(map show [5..30])),
          (-dp1,0:(map show [3..8])),(-dp2,0:(map show [3..8])),
          (-verbose,[0,1,2]),
          (-evaluator,[only,all])]
Synopsis
type ParameterInput = (String, [String])
type ParameterOutput = (String, String)
type ParameterTree = Map String String
matchParamsL :: [ParameterInput] -> String -> [ParameterOutput]
matchParamsT :: [ParameterOutput] -> ParameterTree
member :: Ord k => k -> Map k a -> Bool
(!) :: Ord k => Map k a -> k -> a
Documentation
type ParameterInput = (String, [String])Source
ParameterInput is a pair of parameter label and all its valid values.
type ParameterOutput = (String, String)Source
Parameter's label and its value formated for output.
type ParameterTree = Map String StringSource
Read parameters [ParameterOutput] formated can be transformed into binary tree for search purposes.
matchParamsLSource
:: [ParameterInput]List of parameters' labels and their all possible values
-> StringInput
-> [ParameterOutput]Output - list of matched parameters and values.
matchParamsT :: [ParameterOutput] -> ParameterTreeSource
Transfers list of regonized parameters into a tree.
member :: Ord k => k -> Map k a -> BoolSource
(!) :: Ord k => Map k a -> k -> aSource
Produced by Haddock version 2.6.0