diff --git a/.travis.yml b/.travis.yml index 7e9ea09..15b6e98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,9 @@ before_cache: - rm -rfv $CABALHOME/packages/head.hackage matrix: include: + - compiler: ghc-8.8.1 + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}} + env: GHCHEAD=true - compiler: ghc-8.6.5 addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}} - compiler: ghc-8.4.4 @@ -46,6 +49,8 @@ matrix: addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.2.2","cabal-install-2.4"]}} - compiler: ghc-7.0.4 addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.0.4","cabal-install-2.4"]}} + allow_failures: + - compiler: ghc-8.8.1 before_install: - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') - HCPKG="$HC-pkg" @@ -99,6 +104,17 @@ install: echo " prefix: $CABALHOME" >> $CABALHOME/config echo "repository hackage.haskell.org" >> $CABALHOME/config echo " url: http://hackage.haskell.org/" >> $CABALHOME/config + - | + if $GHCHEAD; then + echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config + echo "repository head.hackage" >> $CABALHOME/config + echo " url: http://head.hackage.haskell.org/" >> $CABALHOME/config + echo " secure: True" >> $CABALHOME/config + echo " root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740" >> $CABALHOME/config + echo " 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb" >> $CABALHOME/config + echo " 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e" >> $CABALHOME/config + echo " key-threshold: 3" >> $CABALHOME/config + fi - cat $CABALHOME/config - rm -fv cabal.project cabal.project.local cabal.project.freeze - travis_retry ${CABAL} v2-update -v diff --git a/HaskellNet.cabal b/HaskellNet.cabal index 92775c6..17a0562 100644 --- a/HaskellNet.cabal +++ b/HaskellNet.cabal @@ -26,6 +26,7 @@ Tested-with: || ==8.2.2 || ==8.4.4 || ==8.6.5 + || ==8.8.1 Extra-Source-Files: CHANGELOG @@ -64,7 +65,7 @@ Library Text.Packrat.Parse Build-Depends: - base >= 4.3 && < 4.13, + base >= 4.3 && < 4.14, network >= 2.6.3.1 && < 3.2, mtl, bytestring >=0.10.2, @@ -76,6 +77,9 @@ Library mime-mail >= 0.4.7 && < 0.6, text + if !impl(ghc >= 8.0) + Build-depends: fail >= 4.9.0.0 && <4.10 + if flag(network-bsd) Build-Depends: network-bsd >=2.7 && <2.9, network >=2.7 diff --git a/src/Text/Packrat/Parse.hs b/src/Text/Packrat/Parse.hs index 241e1fe..44b2830 100644 --- a/src/Text/Packrat/Parse.hs +++ b/src/Text/Packrat/Parse.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} -- | Packrat parsing: Simple, Powerful, Lazy, Linear time by Bryan -- Ford. This module achieves monadic parsing library similar to -- Parsec. @@ -14,6 +15,8 @@ import Control.Monad import Control.Applicative (Applicative(..)) import qualified Control.Applicative as A +import qualified Control.Monad.Fail as Fail + -- Data types data Message = Expected String @@ -62,6 +65,12 @@ instance Derivs d => Monad (Parser d) where second err1 (NoParse err) = NoParse (joinErrors err1 err) return = pure + +#if !(MIN_VERSION_base(4,13,0)) + fail = Fail.fail +#endif + +instance Derivs d => Fail.MonadFail (Parser d) where fail msg = Parser (\dvs -> NoParse (msgError (dvPos dvs) msg)) instance Derivs d => A.Alternative (Parser d) where