module Data.Ini.Types where
import Control.Arrow (second)
import qualified Data.Map as M
type Config = M.Map SectionName Section
type SectionName = String
type Section = M.Map OptionName OptionValue
type OptionName = String
type OptionValue = String
cfgFromList :: [(SectionName, [(OptionName, OptionValue)])] -> Config
cfgFromList :: [(SectionName, [(SectionName, SectionName)])] -> Config
cfgFromList = forall k a. Ord k => [(k, a)] -> Map k a
M.fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map (forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second forall k a. Ord k => [(k, a)] -> Map k a
M.fromList)
cfgToList :: Config -> [(SectionName, [(OptionName, OptionValue)])]
cfgToList :: Config -> [(SectionName, [(SectionName, SectionName)])]
cfgToList = forall k a. Map k a -> [(k, a)]
M.toList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b k. (a -> b) -> Map k a -> Map k b
M.map forall k a. Map k a -> [(k, a)]
M.toList