Skip to content

Instantly share code, notes, and snippets.

@funrep
Created October 17, 2013 14:27
Show Gist options
  • Save funrep/7025938 to your computer and use it in GitHub Desktop.
Save funrep/7025938 to your computer and use it in GitHub Desktop.
module Tob.Config where
import Data.ConfigFile (readstring, emptyCP, get)
import Tob.Types
getConfig :: FilePath -> IO Config
getConfig f = do
s <- readFile f
let config = do
c <- readstring emptyCP s
srv <- get c "BOT" "server"
prt <- get c "BOT" "port"
chn <- get c "BOT" "channel"
nck <- get c "BOT" "nick"
nme <- get c "BOT" "name"
own <- get c "BOT" "owner"
return Config {
server = srv,
port = prt,
chan = chn,
nick = nck,
name = nme,
botowner = own }
case config of
Left err -> error $ show err
Right config -> return config
@funrep
Copy link
Author

funrep commented Oct 17, 2013

src/Tob/Config.hs:10:5: parse error on input `c'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment