1
0
Fork 0

Enable Haskell warnings

This commit is contained in:
Malte Brandy 2020-05-16 17:29:26 +02:00
parent 1cc86bf9e6
commit 532f86f78e
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
3 changed files with 13 additions and 12 deletions

View file

@ -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}"

View file

@ -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

View file

@ -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"; } ''