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.
This commit is contained in:
Peter Simons 2020-02-28 11:56:48 +01:00 committed by Joey Hess
parent c257951b85
commit 73cf523a4b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 13 additions and 9 deletions

View file

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