Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions containers/src/Data/Graph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ import Data.Array.Unboxed ( UArray )
#else
import qualified Data.Array as UA
#endif
import Data.List
import qualified Data.List as L
#if MIN_VERSION_base(4,9,0)
import Data.Functor.Classes
#endif
Expand Down Expand Up @@ -442,7 +442,7 @@ graphFromEdges edges0
where
max_v = length edges0 - 1
bounds0 = (0,max_v) :: (Vertex, Vertex)
sorted_edges = sortBy lt edges0
sorted_edges = L.sortBy lt edges0
edges1 = zipWith (,) [0..] sorted_edges

graph = array bounds0 [(,) v (mapMaybe key_vertex ks) | (,) v (_, _, ks) <- edges1]
Expand Down
9 changes: 8 additions & 1 deletion containers/src/Data/Sequence/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ import Prelude hiding (
null, length, lookup, take, drop, splitAt, foldl, foldl1, foldr, foldr1,
scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3,
unzip, takeWhile, dropWhile, iterate, reverse, filter, mapM, sum, all)
import qualified Data.List
import Control.Applicative (Applicative(..), (<$>), (<**>), Alternative,
liftA2, liftA3)
import qualified Control.Applicative as Applicative
Expand All @@ -212,6 +211,11 @@ import Data.Monoid (Monoid(..))
import Data.Functor (Functor(..))
import Utils.Containers.Internal.State (State(..), execState)
import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr'), toList)
import qualified Data.Foldable as F

#if !(__GLASGOW_HASKELL__ >= 708)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intuitively I'd prefer if CPP for base features was done with MIN_VERSION_base. I find it hard to remember the base version numbers though, so I wouldn't mind if we'd keep using __GLASGOW_HASKELL__.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely should use MIN_VERSION_base for this. Is there any reasonable way to avoid CPP for this altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because he use of Data.List in the file is on __GLASGOW_HASKELL__ >= 708. https://github.com/haskell/containers/blob/master/containers/src/Data/Sequence/Internal.hs#L4388-L4392

I'm not keen to change / audit the CPP usage. __GLASGOW_HASKELL_ >= 708 is as good as MIN_VERSION_base to guard coerce usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear: say how you want this to be changed. I think the only way to make this nice is to drop pre-GHC-7.8 support (i.e. 7.6). But that rather be done in a separate patch going though whole of containers.

import qualified Data.List
#endif

#if MIN_VERSION_base(4,9,0)
import qualified Data.Semigroup as Semigroup
Expand Down Expand Up @@ -2192,6 +2196,9 @@ instance Functor ViewL where
fmap f (x :< xs) = f x :< fmap f xs

instance Foldable ViewL where
foldMap _ EmptyL = mempty
foldMap f (x :< xs) = f x <> foldMap f xs

foldr _ z EmptyL = z
foldr f z (x :< xs) = f x (foldr f z xs)

Expand Down