From f88fcc1391f5152a01cd0476b4f9a11c1a68d09f Mon Sep 17 00:00:00 2001 From: Dennis Frieberg Date: Sat, 10 May 2025 13:36:56 +0200 Subject: [PATCH] fixed for new ghc version --- app/Main.hs | 29 ++++++++++++++--------------- app/Requester.hs | 1 - choirMail.cabal | 2 +- flake.lock | 12 ++++++------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 48ea82c..363759a 100644 --- a/app/Main.hs +++ b/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' diff --git a/app/Requester.hs b/app/Requester.hs index ee4bd23..2890757 100644 --- a/app/Requester.hs +++ b/app/Requester.hs @@ -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" diff --git a/choirMail.cabal b/choirMail.cabal index 74671e4..168d001 100644 --- a/choirMail.cabal +++ b/choirMail.cabal @@ -76,7 +76,7 @@ executable choirMail -- Other library packages from which modules are imported. -- ^>=4.15.1.0 - build-depends: base >=4.15.1.0 && < 4.19 + build-depends: base >=4.15.1.0 && < 4.21 ,transformers ,tomland >= 1.3.3.0 ,smtp-mail diff --git a/flake.lock b/flake.lock index c8aedb6..123b37c 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1712192574, - "narHash": "sha256-LbbVOliJKTF4Zl2b9salumvdMXuQBr2kuKP5+ZwbYq4=", + "lastModified": 1746576598, + "narHash": "sha256-FshoQvr6Aor5SnORVvh/ZdJ1Sa2U4ZrIMwKBX5k2wu0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f480f9d09e4b4cf87ee6151eba068197125714de", + "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55", "type": "github" }, "original": {