From f73acacd8623dc25c9a35f8e04e4ff33cc596af8 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 15 May 2021 04:20:00 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20compatibility=20with=20hnix=E2=89=A50.13.?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Raise upper bound on hnix. hnix 0.13.0 replaced the `Result` type with `Either`[1]. [1] https://github.com/haskell-nix/hnix/commit/2fea0dc330bd3b3da10c893847b21ffb0855dca1 --- main/Main.hs | 4 ++-- nix-linter.cabal | 2 +- tests/Main.hs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main/Main.hs b/main/Main.hs index c2f518a..01691cc 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -95,9 +95,9 @@ listDirRecursive path = resolveDir' path >>= readDir parseFiles = S.mapMaybeM $ (\path -> parseNixFileLoc path >>= \case - Success parse -> do + Right parse -> do pure $ Just parse - Failure why -> do + Left why -> do liftIO $ whenNormal $ log $ "Failure when parsing:\n" <> pShow why pure Nothing) diff --git a/nix-linter.cabal b/nix-linter.cabal index 21790e0..64d6584 100644 --- a/nix-linter.cabal +++ b/nix-linter.cabal @@ -68,7 +68,7 @@ library build-depends: base >=4.9, - hnix >=0.8 && < 0.11, + hnix >=0.8 && < 0.14, data-fix, fixplate >= 0.1.7, cmdargs >= 0.10, diff --git a/tests/Main.hs b/tests/Main.hs index a946d4f..a4556c5 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -47,8 +47,8 @@ case_examples_match = do let check = checkCategories $ Set.toList category parsed <- parseNixFileLoc (exampleDir example) >>= \case - Success x -> pure x - Failure err -> assertFailure (show err) + Right x -> pure x + Left err -> assertFailure (show err) let offenses = Set.fromList $ offense <$> check parsed assertEqual strippedName offenses category