Skip to content

Commit ce17e84

Browse files
committed
dev:fix:Hledger.Data.PeriodData: fix Foldable1, liftA2 build errors with ghc <9.6 [#2395]
1 parent c5d7d54 commit ce17e84

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

hledger-lib/Hledger/Data/PeriodData.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ module Hledger.Data.PeriodData
1919
, tests_PeriodData
2020
) where
2121

22+
#if MIN_VERSION_base(4,18,0)
2223
import Data.Foldable1 (Foldable1(..))
24+
#else
25+
import Control.Applicative (liftA2)
26+
#endif
2327
import qualified Data.IntMap.Strict as IM
2428
import qualified Data.IntSet as IS
2529
#if !MIN_VERSION_base(4,20,0)
@@ -48,10 +52,12 @@ instance Foldable PeriodData where
4852
foldl f z (PeriodData h as) = foldl f (f z h) as
4953
foldl' f z (PeriodData h as) = let fzh = f z h in fzh `seq` foldl' f fzh as
5054

55+
#if MIN_VERSION_base(4,18,0)
5156
instance Foldable1 PeriodData where
5257
foldrMap1 f g (PeriodData h as) = foldr g (f h) as
5358
foldlMap1 f g (PeriodData h as) = foldl g (f h) as
5459
foldlMap1' f g (PeriodData h as) = let fh = f h in fh `seq` foldl' g fh as
60+
#endif
5561

5662
instance Traversable PeriodData where
5763
traverse f (PeriodData h as) = liftA2 PeriodData (f h) $ traverse f as

0 commit comments

Comments
 (0)