mirror of
https://git.nerfingen.de/nerf/choirMail.git
synced 2025-05-15 17:50:31 +00:00
fixed for new ghc version
This commit is contained in:
parent
6ab55f82a6
commit
f88fcc1391
4 changed files with 21 additions and 23 deletions
29
app/Main.hs
29
app/Main.hs
|
@ -37,21 +37,20 @@ findChoirDay today table = maybe
|
|||
main' :: App ()
|
||||
main' = do
|
||||
args <- liftIO getArgs
|
||||
if length args /= 1
|
||||
then
|
||||
fail "We need exactly one config path as option"
|
||||
else do
|
||||
config <- parseConfigFile (head args)
|
||||
-- we want to handle these while we have the config in scope
|
||||
result <- liftIO $ runApp $ do
|
||||
bs <- request
|
||||
table <- except $ parseBString bs
|
||||
today <- liftIO getToday
|
||||
record <- except $ findChoirDay today table
|
||||
send (mailDomain config) (mailUsername config) (mailPassword config) (mailTo config) (mailFrom config) (mailSubject record) (mailText record)
|
||||
case result of
|
||||
Right x -> return x
|
||||
Left error' -> reportErrorMail config error'
|
||||
case L.uncons args of
|
||||
Nothing -> fail "We need exactly one config path as option"
|
||||
Just (headArgs,_) -> do
|
||||
config <- parseConfigFile headArgs
|
||||
-- we want to handle these while we have the config in scope
|
||||
result <- liftIO $ runApp $ do
|
||||
bs <- request
|
||||
table <- except $ parseBString bs
|
||||
today <- liftIO getToday
|
||||
record <- except $ findChoirDay today table
|
||||
send (mailDomain config) (mailUsername config) (mailPassword config) (mailTo config) (mailFrom config) (mailSubject record) (mailText record)
|
||||
case result of
|
||||
Right x -> return x
|
||||
Left error' -> reportErrorMail config error'
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import Network.HTTP.Req
|
|||
-- import qualified Data.Text as T
|
||||
import Control.Monad.IO.Class(MonadIO)
|
||||
import qualified Data.ByteString as B
|
||||
import Text.URI
|
||||
|
||||
url :: Url 'Https
|
||||
url = https "md.darmstadt.ccc.de" /: "mathechor-probenplanung" /: "download"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue