dev: fix liftA2, Foldable1 build errors with ghc <9.6 [#2395]
This commit is contained in:
parent
4f03d22501
commit
bc55e1c58f
@ -19,7 +19,11 @@ module Hledger.Data.PeriodData
|
|||||||
, tests_PeriodData
|
, tests_PeriodData
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,18,0)
|
||||||
import Data.Foldable1 (Foldable1(..))
|
import Data.Foldable1 (Foldable1(..))
|
||||||
|
#else
|
||||||
|
import Control.Applicative (liftA2)
|
||||||
|
#endif
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import qualified Data.IntSet as IS
|
import qualified Data.IntSet as IS
|
||||||
#if !MIN_VERSION_base(4,20,0)
|
#if !MIN_VERSION_base(4,20,0)
|
||||||
@ -48,10 +52,12 @@ instance Foldable PeriodData where
|
|||||||
foldl f z (PeriodData h as) = foldl f (f z h) as
|
foldl f z (PeriodData h as) = foldl f (f z h) as
|
||||||
foldl' f z (PeriodData h as) = let fzh = f z h in fzh `seq` foldl' f fzh as
|
foldl' f z (PeriodData h as) = let fzh = f z h in fzh `seq` foldl' f fzh as
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,18,0)
|
||||||
instance Foldable1 PeriodData where
|
instance Foldable1 PeriodData where
|
||||||
foldrMap1 f g (PeriodData h as) = foldr g (f h) as
|
foldrMap1 f g (PeriodData h as) = foldr g (f h) as
|
||||||
foldlMap1 f g (PeriodData h as) = foldl g (f h) as
|
foldlMap1 f g (PeriodData h as) = foldl g (f h) as
|
||||||
foldlMap1' f g (PeriodData h as) = let fh = f h in fh `seq` foldl' g fh as
|
foldlMap1' f g (PeriodData h as) = let fh = f h in fh `seq` foldl' g fh as
|
||||||
|
#endif
|
||||||
|
|
||||||
instance Traversable PeriodData where
|
instance Traversable PeriodData where
|
||||||
traverse f (PeriodData h as) = liftA2 PeriodData (f h) $ traverse f as
|
traverse f (PeriodData h as) = liftA2 PeriodData (f h) $ traverse f as
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
@ -33,6 +34,9 @@ module Hledger.Reports.MultiBalanceReport (
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
#if !MIN_VERSION_base(4,18,0)
|
||||||
|
import Control.Applicative (liftA2)
|
||||||
|
#endif
|
||||||
import Control.Monad (guard)
|
import Control.Monad (guard)
|
||||||
import Data.Foldable (toList)
|
import Data.Foldable (toList)
|
||||||
import Data.List (sortOn)
|
import Data.List (sortOn)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user