diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 67afb5c0bc2d..67bf8684bf72 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -69,7 +69,7 @@ self: super: { # The Hackage tarball is purposefully broken, because it's not intended to be, like, useful. # https://git-annex.branchable.com/bugs/bash_completion_file_is_missing_in_the_6.20160527_tarball_on_hackage/ - git-annex = (overrideSrc super.git-annex { + git-annex = (overrideSrc (appendPatch super.git-annex ./patches/git-annex-fix-build-with-ghc-8.8.x.patch) { src = pkgs.fetchgit { name = "git-annex-${super.git-annex.version}-src"; url = "git://git-annex.branchable.com/"; diff --git a/pkgs/development/haskell-modules/patches/git-annex-fix-build-with-ghc-8.8.x.patch b/pkgs/development/haskell-modules/patches/git-annex-fix-build-with-ghc-8.8.x.patch new file mode 100644 index 000000000000..e28a1f5949ee --- /dev/null +++ b/pkgs/development/haskell-modules/patches/git-annex-fix-build-with-ghc-8.8.x.patch @@ -0,0 +1,125 @@ +From f8d8959e43abd88c5e977079f0948e45cf4c0b0c Mon Sep 17 00:00:00 2001 +From: Peter Simons +Date: Fri, 28 Feb 2020 11:56:48 +0100 +Subject: [PATCH] Fix build with ghc-8.8.x. + +The 'fail' method has been moved to the 'MonadFail' class. I made the changes +so that the code still compiles with previous versions of 'base' that don't +have the new MonadFail class exported by Prelude yet. +--- + CmdLine/GitAnnex/Options.hs | 5 +++-- + Command/Expire.hs | 5 +++-- + Command/Init.hs | 7 ++++--- + Utility/HumanTime.hs | 5 +++-- + 4 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/CmdLine/GitAnnex/Options.hs b/CmdLine/GitAnnex/Options.hs +index 030c83dd5..a9a36d76f 100644 +--- a/CmdLine/GitAnnex/Options.hs ++++ b/CmdLine/GitAnnex/Options.hs +@@ -9,6 +9,7 @@ + + module CmdLine.GitAnnex.Options where + ++import Control.Monad.Fail as Fail ( MonadFail(..) ) + import Options.Applicative + import qualified Data.Map as M + +@@ -215,8 +216,8 @@ parseAllOption = flag' WantAllKeys + <> help "operate on all versions of all files" + ) + +-parseKey :: Monad m => String -> m Key +-parseKey = maybe (fail "invalid key") return . deserializeKey ++parseKey :: MonadFail m => String -> m Key ++parseKey = maybe (Fail.fail "invalid key") return . deserializeKey + + -- Options to match properties of annexed files. + annexedMatchingOptions :: [GlobalOption] +diff --git a/Command/Expire.hs b/Command/Expire.hs +index 83c38e569..37dc33883 100644 +--- a/Command/Expire.hs ++++ b/Command/Expire.hs +@@ -17,6 +17,7 @@ import Annex.VectorClock + import qualified Remote + import Utility.HumanTime + ++import Control.Monad.Fail as Fail ( MonadFail(..) ) + import Data.Time.Clock.POSIX + import qualified Data.Map as M + +@@ -105,9 +106,9 @@ parseExpire ps = do + Nothing -> giveup $ "bad expire time: " ++ s + Just d -> Just (now - durationToPOSIXTime d) + +-parseActivity :: Monad m => String -> m Activity ++parseActivity :: MonadFail m => String -> m Activity + parseActivity s = case readish s of +- Nothing -> fail $ "Unknown activity. Choose from: " ++ ++ Nothing -> Fail.fail $ "Unknown activity. Choose from: " ++ + unwords (map show [minBound..maxBound :: Activity]) + Just v -> return v + +diff --git a/Command/Init.hs b/Command/Init.hs +index db6cb14fb..879a1110f 100644 +--- a/Command/Init.hs ++++ b/Command/Init.hs +@@ -13,6 +13,7 @@ import Annex.Version + import Types.RepoVersion + import qualified Annex.SpecialRemote + ++import Control.Monad.Fail as Fail ( MonadFail(..) ) + import qualified Data.Map as M + + cmd :: Command +@@ -33,14 +34,14 @@ optParser desc = InitOptions + <> help "Override default annex.version" + )) + +-parseRepoVersion :: Monad m => String -> m RepoVersion ++parseRepoVersion :: MonadFail m => String -> m RepoVersion + parseRepoVersion s = case RepoVersion <$> readish s of +- Nothing -> fail $ "version parse error" ++ Nothing -> Fail.fail $ "version parse error" + Just v + | v `elem` supportedVersions -> return v + | otherwise -> case M.lookup v autoUpgradeableVersions of + Just v' -> return v' +- Nothing -> fail $ s ++ " is not a currently supported repository version" ++ Nothing -> Fail.fail $ s ++ " is not a currently supported repository version" + + seek :: InitOptions -> CommandSeek + seek = commandAction . start +diff --git a/Utility/HumanTime.hs b/Utility/HumanTime.hs +index 01fbeacfb..d2e70f332 100644 +--- a/Utility/HumanTime.hs ++++ b/Utility/HumanTime.hs +@@ -19,6 +19,7 @@ module Utility.HumanTime ( + import Utility.PartialPrelude + import Utility.QuickCheck + ++import Control.Monad.Fail as Fail ( MonadFail(..) ) + import qualified Data.Map as M + import Data.Time.Clock + import Data.Time.Clock.POSIX (POSIXTime) +@@ -44,7 +45,7 @@ daysToDuration :: Integer -> Duration + daysToDuration i = Duration $ i * dsecs + + {- Parses a human-input time duration, of the form "5h", "1m", "5h1m", etc -} +-parseDuration :: Monad m => String -> m Duration ++parseDuration :: MonadFail m => String -> m Duration + parseDuration = maybe parsefail (return . Duration) . go 0 + where + go n [] = return n +@@ -55,7 +56,7 @@ parseDuration = maybe parsefail (return . Duration) . go 0 + u <- M.lookup c unitmap + go (n + num * u) rest + _ -> return $ n + num +- parsefail = fail "duration parse error; expected eg \"5m\" or \"1h5m\"" ++ parsefail = Fail.fail "duration parse error; expected eg \"5m\" or \"1h5m\"" + + fromDuration :: Duration -> String + fromDuration Duration { durationSeconds = d } +-- +2.25.1 +