From 532f86f78ea62c067ac260e4bf433a8b656df1cf Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Sat, 16 May 2020 17:29:26 +0200 Subject: [PATCH] Enable Haskell warnings --- home/mail.nix | 11 +++++------ home/taskwarrior.nix | 4 ++-- lib/default.nix | 10 ++++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/home/mail.nix b/home/mail.nix index 1c76e08c..f6b2730f 100644 --- a/home/mail.nix +++ b/home/mail.nix @@ -41,13 +41,13 @@ let reScan = notmuch "new" "--quiet" findFilterMail :: (Text,Text) -> IO (Maybe (LByteString, Text, Text)) - findFilterMail (filter, target) = do - files <- notmuch "search" "--output" "files" (toString filter) "folder:${unsortedSuffix}" |> capture - pure $ if (LBS.length files > 0) then Just (files, filter, target) else Nothing + findFilterMail (filter_, target) = do + files <- notmuch "search" "--output" "files" (toString filter_) "folder:${unsortedSuffix}" |> capture + pure $ if (LBS.length files > 0) then Just (files, filter_, target) else Nothing executeFilterMail :: (LByteString, Text, Text) -> IO () - executeFilterMail (files, filter, target) = do - say [i|Sorting "#{filter}" into #{target}|] + executeFilterMail (files, filter_, target) = do + say [i|Sorting "#{filter_}" into #{target}|] writeOutput files |> mscan mmkdir ([i|${archive}/#{target}|] :: String) writeOutput files |> mrefile ([i|${archive}/#{target}|] :: String) @@ -83,7 +83,6 @@ let mySearch :: [String] -> IO [Text] mySearch param = lines . decodeUtf8 <$> (Main.find ("${archive}":param) |> captureTrim) - main :: IO () main = do setEnv "MBLAZE_PAGER" "cat" setEnv "NOTMUCH_CONFIG" "${config.home.sessionVariables.NOTMUCH_CONFIG}" diff --git a/home/taskwarrior.nix b/home/taskwarrior.nix index c47ba950..2270d88c 100644 --- a/home/taskwarrior.nix +++ b/home/taskwarrior.nix @@ -62,8 +62,8 @@ fmap That (HM.difference task2 task1), (HM.mapMaybe (\x->x) $ HM.intersectionWith (\old new -> if old /= new then Just $ These old new else Nothing) task1 task2) ] - String description <- HM.lookup "description" task2 - pure (description, printMap diff) + String description2 <- HM.lookup "description" task2 + pure (description2, printMap diff) Control.Monad.forM_ description $ \(d,b) -> do client <- try connectSession either diff --git a/lib/default.nix b/lib/default.nix index d1e07ca5..81563921 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -61,7 +61,7 @@ rec { pkgs.haskellPackages.cmdargs pkgs.haskellPackages.text ]) - }/bin/ghc ${name}.hs -threaded + }/bin/ghc ${name}.hs -threaded -Wall -Wno-unused-top-binds -Wno-missing-signatures -Wno-type-defaults -Wno-unused-imports -Werror mv ${name} $out ${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded "$out" ''; @@ -100,16 +100,18 @@ rec { getNivPath :: Text -> Text -> IO Text getNivPath sources channel = do - let expr = [i|(import #{sources}/nix/sources.nix).#{channel}|] :: String - nix_build ["-Q", "-E", expr, "--no-out-link"] &> devNull - escaped <- nix_instantiate ["--eval" :: String, "-E", [i|toString #{expr}|]] |> captureTrim + let expression = [i|(import #{sources}/nix/sources.nix).#{channel}|] :: String + nix_build ["-Q", "-E", expression, "--no-out-link"] &> devNull + escaped <- nix_instantiate ["--eval" :: String, "-E", [i|toString #{expression}|]] |> captureTrim pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped + myNixPath :: Text -> IO [String] myNixPath path = concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"] where tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String] getNivAssign name = tag name <$> getNivPath path name + main :: IO () ${code} ''; get-niv-path = writeHaskellScript { name = "get-niv-path"; } ''