Skip to content

Commit

Permalink
Support GHC-8.8.1 (alpha2 atm)
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Jul 2, 2019
1 parent b4dbd1a commit f0a4c7d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion HaskellNet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Tested-with:
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
|| ==8.8.1

Extra-Source-Files:
CHANGELOG
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/Text/Packrat/Parse.hs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f0a4c7d

Please sign in to comment.