From 16dc7bc596c0ea4fa4466b12f474b1abfa72c885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20G=C3=A9lineau?= Date: Tue, 3 Nov 2020 09:13:28 -0500 Subject: [PATCH] support MonadFail fixes #33 --- System/Console/Docopt/Public.hs | 2 +- System/Console/Docopt/QQ.hs | 4 +++- docopt.cabal | 2 +- stack.yaml | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/System/Console/Docopt/Public.hs b/System/Console/Docopt/Public.hs index f9dfd34..cf6d059 100644 --- a/System/Console/Docopt/Public.hs +++ b/System/Console/Docopt/Public.hs @@ -190,7 +190,7 @@ isPresentM :: Monad m => Arguments -> Option -> m Bool isPresentM args o = return $ isPresent args o {-# DEPRECATED getFirstArg "Use 'getAllArgs' instead" #-} -getFirstArg :: Monad m => Arguments -> Option -> m String +getFirstArg :: MonadFail m => Arguments -> Option -> m String getFirstArg args opt = let failure = fail $ "no argument given: " ++ show opt in case opt `M.lookup` args of diff --git a/System/Console/Docopt/QQ.hs b/System/Console/Docopt/QQ.hs index 81027fb..a468231 100644 --- a/System/Console/Docopt/QQ.hs +++ b/System/Console/Docopt/QQ.hs @@ -56,7 +56,9 @@ docopt = QuasiQuoter { quoteExp = docoptExp , quotePat = unsupported "Pattern" , quoteType = unsupported "Type" } - where unsupported = fail . (++ " context unsupported") + where unsupported :: String -> String -> Q a + unsupported qqType _ = do + fail $ (qqType ++ " context unsupported") -- | Same as 'docopt', but parses the given file instead of a literal -- string. diff --git a/docopt.cabal b/docopt.cabal index 5e043d6..32f2c06 100644 --- a/docopt.cabal +++ b/docopt.cabal @@ -43,7 +43,7 @@ library System.Console.Docopt.OptParse System.Console.Docopt.Public - build-depends: base >= 4.0 && < 5.0, + build-depends: base >= 4.9 && < 5.0, parsec >= 3.1.0, containers diff --git a/stack.yaml b/stack.yaml index e689536..39ae7e3 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,7 @@ # For advanced use and comprehensive documentation of the format, please see: # http://docs.haskellstack.org/en/stable/yaml_configuration/ -resolver: lts-7.4 +resolver: lts-16.20 packages: - '.'