1 module Java.META.Spec where
4 import Control.Monad.Error
5 import qualified Data.Map as M
7 import Data.Char (toLower)
11 class MetaSpec s where
12 loadFirstSection :: Section -> s
14 loadOtherSection :: s -> Section -> s
15 loadOtherSection s _ = s
17 storeMeta :: s -> META
19 loadSpec :: (MetaSpec s) => META -> s
20 loadSpec [] = error "Cannot load empty metadata"
22 let x = loadFirstSection s
23 in foldl loadOtherSection x ss
25 lookupList :: String -> Maybe String -> [(String, String)]
26 lookupList _ Nothing = []
27 lookupList name (Just val) = [(name, val)]
29 bool2string :: Bool -> String
30 bool2string True = "true"
31 bool2string False = "false"
33 string2bool :: String -> Bool
35 | map toLower s == "true" = True