Skip to content

Commit

Permalink
Fix to support MonadFail (#34)
Browse files Browse the repository at this point in the history
Fixes #33 to allow library to be used with GHC-8.8.2
  • Loading branch information
gelisam committed Jun 27, 2021
1 parent a099173 commit 7812f0f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion System/Console/Docopt/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion System/Console/Docopt/QQ.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docopt.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# For advanced use and comprehensive documentation of the format, please see:
# http:https://docs.haskellstack.org/en/stable/yaml_configuration/

resolver: lts-7.4
resolver: lts-16.20

packages:
- '.'
Expand Down

0 comments on commit 7812f0f

Please sign in to comment.