Skip to content

Commit

Permalink
Build with ghc 9.2 (facebook#152)
Browse files Browse the repository at this point in the history
Summary:
Bumps bytestring upper bound to <0.12 and fixes some non-canonical monoid and monad definitions that don't use semigroup/applicative.

Pull Request resolved: facebook#152

Test Plan: sandcastle + CI on github

Reviewed By: josefs

Differential Revision: D36320446

Pulled By: watashi

fbshipit-source-id: 53d82674be0235bf204cd17c9ee6f61d05177143
  • Loading branch information
jmorag authored and facebook-github-bot committed May 12, 2022
1 parent 40d45c1 commit fd017a6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc: ['9.0.1', '8.10.2', '8.8.4', '8.6.5', '8.4.4', '8.2.2']
ghc: ['9.2.2', '9.0.1', '8.10.7', '8.8.4', '8.6.5', '8.4.4', '8.2.2']

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 3 additions & 1 deletion Haxl/Core/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,15 @@ data FailureCount = FailureCount

#if __GLASGOW_HASKELL__ >= 804
instance Semigroup FailureCount where
(<>) = mappend
FailureCount s1 i1 <> FailureCount s2 i2 = FailureCount (s1+s2) (i1+i2)
#endif

instance Monoid FailureCount where
mempty = FailureCount 0 0
#if __GLASGOW_HASKELL__ < 804
mappend (FailureCount s1 i1) (FailureCount s2 i2)
= FailureCount (s1+s2) (i1+i2)
#endif

wrapFetchInStats
:: DataSource u req
Expand Down
6 changes: 4 additions & 2 deletions Haxl/Core/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ toHaxlFmap f (Return i) = f <$> getIVar i
-- Monad/Applicative instances

instance Monad (GenHaxl u w) where
return a = GenHaxl $ \_env -> return (Done a)
return = pure
GenHaxl m >>= k = GenHaxl $ \env -> do
e <- m env
case e of
Expand Down Expand Up @@ -803,7 +803,7 @@ instance Functor (GenHaxl u w) where
return (Blocked ivar (f :<$> cont))

instance Applicative (GenHaxl u w) where
pure = return
pure a = GenHaxl $ \_env -> pure (Done a)
GenHaxl ff <*> GenHaxl aa = GenHaxl $ \env -> do
rf <- ff env
case rf of
Expand Down Expand Up @@ -831,7 +831,9 @@ instance Semigroup a => Semigroup (GenHaxl u w a) where

instance Monoid a => Monoid (GenHaxl u w a) where
mempty = pure mempty
#if __GLASGOW_HASKELL__ < 804
mappend = liftA2 mappend
#endif

blockedBlocked
:: Env u w
Expand Down
6 changes: 4 additions & 2 deletions Haxl/Core/StateStore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ newtype StateStore = StateStore (Map TypeRep StateStoreData)

#if __GLASGOW_HASKELL__ >= 804
instance Semigroup StateStore where
(<>) = mappend
-- Left-biased union
StateStore m1 <> StateStore m2 = StateStore $ m1 <> m2
#endif

instance Monoid StateStore where
mempty = stateEmpty
-- Left-biased union
#if __GLASGOW_HASKELL__ < 804
mappend (StateStore m1) (StateStore m2) = StateStore $ m1 <> m2
#endif

-- | Encapsulates the type of 'StateStore' data so we can have a
-- heterogeneous collection.
Expand Down
8 changes: 5 additions & 3 deletions haxl.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ tested-with:
GHC==8.2.2,
GHC==8.4.4,
GHC==8.6.5,
GHC==8.8.3,
GHC==8.10.1
GHC==8.8.4,
GHC==8.10.7
GHC==9.0.1
GHC==9.2.2

description:
Haxl is a library and EDSL for efficient scheduling of concurrent data
Expand Down Expand Up @@ -46,7 +48,7 @@ library
aeson >= 0.6 && < 2.1,
base >= 4.10 && < 5,
binary >= 0.7 && < 0.10,
bytestring >= 0.9 && < 0.11,
bytestring >= 0.9 && < 0.12,
containers >= 0.5 && < 0.7,
deepseq,
exceptions >=0.8 && <0.11,
Expand Down

0 comments on commit fd017a6

Please sign in to comment.