Skip to content

Commit

Permalink
Merge pull request #201 from andreasabel/issue199
Browse files Browse the repository at this point in the history
Fix #199: support GHC 9.2 (base 4.16) by putting Option under #if
  • Loading branch information
snoyberg authored Sep 24, 2021
2 parents 0cf6736 + d0d1dc3 commit 224e4c0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
5 changes: 5 additions & 0 deletions mono-traversable/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChangeLog for mono-traversable

## 1.0.15.3

* Compile with GHC 9.2 (`Option` removed from `base-4.16`)
[#199](https://github.com/snoyberg/mono-traversable/issues/199)

## 1.0.15.2

* Support transformers 0.6.0.0 [#196](https://github.com/snoyberg/mono-traversable/issues/196)
Expand Down
2 changes: 1 addition & 1 deletion mono-traversable/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mono-traversable
version: 1.0.15.2
version: 1.0.15.3
synopsis: Type classes for mapping, folding, and traversing monomorphic containers
description: Please see the README at <https://www.stackage.org/package/mono-traversable>
category: Data
Expand Down
1 change: 0 additions & 1 deletion mono-traversable/src/Data/Containers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Data.Hashable (Hashable)
import qualified Data.Set as Set
import qualified Data.HashSet as HashSet
import Data.Monoid (Monoid (..))
import Data.Semigroup (Semigroup)
import Data.MonoTraversable (MonoFunctor(..), MonoFoldable, MonoTraversable, Element, GrowingAppend, ofoldl', otoList)
import Data.Function (on)
import qualified Data.List as List
Expand Down
23 changes: 20 additions & 3 deletions mono-traversable/src/Data/MonoTraversable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import Data.Traversable
import Data.Word (Word8)
import Data.Int (Int, Int64)
import GHC.Exts (build)
import GHC.Generics ((:.:), (:*:), (:+:)(..), K1(..), M1(..), Par1(..), Rec1(..), U1(..), V1(..))
import GHC.Generics ((:.:), (:*:), (:+:)(..), K1(..), M1(..), Par1(..), Rec1(..), U1(..), V1)
import Prelude (Bool (..), const, Char, flip, IO, Maybe (..), Either (..),
(+), Integral, Ordering (..), compare, fromIntegral, Num, (>=),
(==), seq, otherwise, Eq, Ord, (-), (*))
Expand Down Expand Up @@ -90,7 +90,14 @@ import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Storable as VS
import qualified Data.IntSet as IntSet
import Data.Semigroup (Semigroup, Option (..), Arg)
import Data.Semigroup
( Semigroup
-- Option has been removed in base-4.16 (GHC 9.2)
#if !MIN_VERSION_base(4,16,0)
, Option (..)
#endif
, Arg
)
import qualified Data.ByteString.Unsafe as SU
import Control.Monad.Trans.Identity (IdentityT)

Expand All @@ -111,7 +118,9 @@ type instance Element (ViewL a) = a
type instance Element (ViewR a) = a
type instance Element (IntMap a) = a
type instance Element IntSet = Int
#if !MIN_VERSION_base(4,16,0)
type instance Element (Option a) = a
#endif
type instance Element (NonEmpty a) = a
type instance Element (Identity a) = a
type instance Element (r -> a) = a
Expand Down Expand Up @@ -184,7 +193,9 @@ instance MonoFunctor (Seq a)
instance MonoFunctor (ViewL a)
instance MonoFunctor (ViewR a)
instance MonoFunctor (IntMap a)
#if !MIN_VERSION_base(4,16,0)
instance MonoFunctor (Option a)
#endif
instance MonoFunctor (NonEmpty a)
instance MonoFunctor (Identity a)
instance MonoFunctor (r -> a)
Expand Down Expand Up @@ -352,7 +363,7 @@ class MonoFoldable mono where
-- /See 'Data.NonNull.ofoldMap1' from "Data.NonNull" for a total version of this function./
ofoldMap1Ex :: Semigroup m => (Element mono -> m) -> mono -> m
ofoldMap1Ex f = fromMaybe (Prelude.error "Data.MonoTraversable.ofoldMap1Ex")
. getOption . ofoldMap (Option . Just . f)
. ofoldMap (Just . f)

-- | Right-associative fold of a monomorphic container with no base element.
--
Expand Down Expand Up @@ -630,7 +641,9 @@ instance MonoFoldable (Seq a) where
instance MonoFoldable (ViewL a)
instance MonoFoldable (ViewR a)
instance MonoFoldable (IntMap a)
#if !MIN_VERSION_base(4,16,0)
instance MonoFoldable (Option a)
#endif
instance MonoFoldable (NonEmpty a)
instance MonoFoldable (Identity a)
instance MonoFoldable (Map k v) where
Expand Down Expand Up @@ -1009,7 +1022,9 @@ instance MonoTraversable (Seq a)
instance MonoTraversable (ViewL a)
instance MonoTraversable (ViewR a)
instance MonoTraversable (IntMap a)
#if !MIN_VERSION_base(4,16,0)
instance MonoTraversable (Option a)
#endif
instance MonoTraversable (NonEmpty a)
instance MonoTraversable (Identity a)
instance MonoTraversable (Map k v)
Expand Down Expand Up @@ -1135,7 +1150,9 @@ instance MonoPointed TL.Text where
-- Applicative
instance MonoPointed [a]
instance MonoPointed (Maybe a)
#if !MIN_VERSION_base(4,16,0)
instance MonoPointed (Option a)
#endif
instance MonoPointed (NonEmpty a)
instance MonoPointed (Identity a)
instance MonoPointed (Vector a)
Expand Down
1 change: 0 additions & 1 deletion mono-traversable/src/Data/MonoTraversable/Unprefixed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module Data.MonoTraversable.Unprefixed where

import Data.Int (Int64)
import Data.MonoTraversable
import Data.Semigroup (Semigroup)
import Data.Monoid (Monoid)
import Control.Applicative (Applicative)

Expand Down
1 change: 0 additions & 1 deletion mono-traversable/src/Data/NonNull.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import qualified Data.List.NonEmpty as NE
import Data.Maybe (fromMaybe)
import Data.MonoTraversable
import Data.Sequences
import Data.Semigroup (Semigroup (..))
import Control.Monad.Trans.State.Strict (evalState, state)

data NullError = NullError String deriving (Show, Typeable)
Expand Down

0 comments on commit 224e4c0

Please sign in to comment.