Updates to the README
Getty Ritter
8 years ago
22 | 22 | |
23 | 23 | ~~~.haskell |
24 | 24 | data Config = Config |
25 | { cfNetwork :: NetworkConfig, cfLocal :: Maybe LocalConfig } | |
26 | deriving (Eq, Show) | |
25 | { cfNetwork :: NetworkConfig | |
26 | , cfLocal :: Maybe LocalConfig | |
27 | } deriving (Eq, Show) | |
27 | 28 | |
28 | 29 | data NetworkConfig = NetworkConfig |
29 | { netHost :: String, netPort :: Int } | |
30 | deriving (Eq, Show) | |
30 | { netHost :: String | |
31 | , netPort :: Int | |
32 | } deriving (Eq, Show) | |
31 | 33 | |
32 | 34 | data LocalConfig = LocalConfig |
33 | { localUser :: Text } | |
34 | deriving (Eq, Show) | |
35 | { localUser :: Text | |
36 | } deriving (Eq, Show) | |
35 | 37 | |
36 | 38 | configParser :: IniParser Config |
37 | 39 | configParser = do |
40 | 42 | port <- fieldOf "port" number |
41 | 43 | return NetworkConfig { netHost = host, netPort = port } |
42 | 44 | locCf <- sectionMb "LOCAL" $ |
43 |
LocalConfig <$ |
|
45 | LocalConfig <$> field "user" | |
44 | 46 | return Config { cfNetwork = netCf, cfLocal = locCf } |
45 | 47 | ~~~ |
46 | 48 |