streams 3.3.2 → 3.3.3
raw patch · 8 files changed
+22/−139 lines, 8 filesdep −semigroupsdep ~base
Dependencies removed: semigroups
Dependency ranges changed: base
Files
- CHANGELOG.markdown +4/−0
- src/Data/Stream/Future.hs +2/−32
- src/Data/Stream/Future/Skew.hs +0/−33
- src/Data/Stream/Infinite.hs +1/−15
- src/Data/Stream/Infinite/Functional/Zipper.hs +0/−9
- src/Data/Stream/Infinite/Skew.hs +0/−6
- src/Data/Stream/Supply.hs +4/−25
- streams.cabal +11/−19
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+3.3.3 [2024.12.06]+------------------+* Drop support for pre-8.0 versions of GHC.+ 3.3.2 [2023.03.12] ------------------ * Support building with `semigroupoids-6`.
src/Data/Stream/Future.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Stream.Future@@ -23,13 +21,7 @@ , index ) where -#if MIN_VERSION_base(4,8,0) import Prelude hiding (tail)-#else-import Control.Applicative-import Prelude hiding (tail, length)-import Data.Foldable-#endif import Control.Comonad import Data.Functor.Alt@@ -40,32 +32,14 @@ #endif import Data.Semigroup.Foldable import Data.Semigroup.Traversable--#ifdef LANGUAGE_DeriveDataTypeable import Data.Data-#endif--#if MIN_VERSION_base(4,7,0) import GHC.Exts as Exts-#endif + infixr 5 :< data Future a = Last a | a :< Future a deriving- ( Eq, Ord, Show, Read-#ifdef LANGUAGE_DeriveDataTypeable- , Data, Typeable-#endif- )--#if __GLASGOW_HASKELL__ < 710-length :: Future a -> Int-length = go 1- where- go !n (Last _) = n- go !n (_ :< as) = go (n + 1) as-{-# INLINE length #-}-#endif+ (Eq, Ord, Show, Read, Data) tail :: Future a -> Maybe (Future a) tail (Last _) = Nothing@@ -88,14 +62,12 @@ instance Foldable Future where foldMap = foldMapDefault-#if __GLASGOW_HASKELL__ >= 710 length = go 1 where go !n (Last _) = n go !n (_ :< as) = go (n + 1) as {-# INLINE length #-} null _ = False-#endif instance Traversable Future where traverse f (Last a) = Last <$> f a@@ -151,7 +123,6 @@ (<* ) = (<. ) ( *>) = ( .>) -#if MIN_VERSION_base(4,7,0) instance Exts.IsList (Future a) where type Item (Future a) = a @@ -164,4 +135,3 @@ go y (z:zs) = y :< go z zs fromListN _ = Exts.fromList-#endif
src/Data/Stream/Future/Skew.hs view
@@ -1,8 +1,6 @@ {-# LANGUAGE PatternGuards, BangPatterns, TypeFamilies #-} {-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |@@ -51,22 +49,14 @@ import Control.Comonad import Data.Functor.Alt import Data.Functor.Extend-#if MIN_VERSION_base(4,8,0) import Prelude hiding (tail, drop, dropWhile, last, span, repeat, replicate, break) import Data.Foldable (toList)-#else-import Data.Foldable-import Data.Traversable (Traversable, traverse)-import Prelude hiding (null, tail, drop, dropWhile, length, foldr, last, span, repeat, replicate, break)-#endif #if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup hiding (Last) #endif import Data.Semigroup.Foldable import Data.Semigroup.Traversable-#if MIN_VERSION_base(4,7,0) import qualified GHC.Exts as Exts-#endif infixr 5 :<, <| @@ -93,11 +83,9 @@ foldMap f (Bin _ a l r) = f a `mappend` foldMap f l `mappend` foldMap f r foldr f z (Tip a) = f a z foldr f z (Bin _ a l r) = f a (foldr f (foldr f z r) l)-#if MIN_VERSION_base(4,8,0) length Tip{} = 1 length (Bin n _ _ _) = n null _ = False-#endif instance Foldable1 Complete where foldMap1 f (Tip a) = f a@@ -179,11 +167,9 @@ foldMap f (Last t) = foldMap f t foldr f z (t :< ts) = foldr f (foldr f z ts) t foldr f z (Last t) = foldr f z t-#if MIN_VERSION_base(4,8,0) length (Last t) = weight t length (t :< ts) = weight t + length ts null _ = False-#endif instance Foldable1 Future where foldMap1 f (t :< ts) = foldMap1 f t <> foldMap1 f ts@@ -242,13 +228,6 @@ singleton a = Last (Tip a) {-# INLINE singleton #-} -#if !(MIN_VERSION_base(4,8,0))--- | /O(log n)/.-length :: Future a -> Int-length (Last t) = weight t-length (t :< ts) = weight t + length ts-#endif- -- | /O(1)/ cons (<|) :: a -> Future a -> Future a a <| (l :< Last r)@@ -382,7 +361,6 @@ | w <- f r, p w, (ts, fs) <- splitCompleteW p l (:< w) = (a:ts, fs) | (ts, fs) <- splitCompleteW p r f = (a:foldr (:) ts l, fs) -#if MIN_VERSION_base(4,7,0) instance Exts.IsList (Future a) where type Item (Future a) = a toList = Data.Foldable.toList@@ -390,21 +368,10 @@ fromList (x:xs) = go x xs where go a [] = singleton a go a (b:bs) = a <| go b bs-#else-fromList :: [a] -> Future a-fromList [] = error "fromList: empty list"-fromList (x:xs) = go x xs- where go a [] = singleton a- go a (b:bs) = a <| go b bs-#endif toFuture :: [a] -> Maybe (Future a) toFuture [] = Nothing-#if MIN_VERSION_base(4,7,0) toFuture xs = Just (Exts.fromList xs)-#else-toFuture xs = Just (fromList xs)-#endif -- /O(n)/ insert :: Ord a => a -> Future a -> Future a
src/Data/Stream/Infinite.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Stream.Infinite@@ -77,18 +75,12 @@ , splitAt, foldr, concat ) -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative-#endif import Control.Comonad import Data.Char (isSpace) import Data.Data import Data.Functor.Apply import Data.Functor.Extend import Data.Functor.Rep-#if !(MIN_VERSION_base(4,8,0))-import Data.Traversable-#endif import Data.Foldable hiding (concat) import Data.Distributive #if !(MIN_VERSION_base(4,11,0))@@ -100,11 +92,7 @@ import Data.Boring (Boring (..), Absurd (..)) data Stream a = a :> Stream a deriving- ( Show-#ifdef LANGUAGE_DeriveDataTypeable- , Data, Typeable-#endif- )+ (Show, Data) infixr 5 :> @@ -169,10 +157,8 @@ fold (m :> ms) = m `mappend` fold ms foldMap f (a :> as) = f a `mappend` foldMap f as foldr f0 _ = go f0 where go f (a :> as) = f a (go f as)-#if __GLASGOW_HASKELL__ > 710 length _ = error "infinite length" null _ = False-#endif instance Traversable Stream where traverse f ~(a :> as) = (:>) <$> f a <*> traverse f as
src/Data/Stream/Infinite/Functional/Zipper.hs view
@@ -1,7 +1,4 @@ {-# LANGUAGE CPP, PatternGuards, BangPatterns #-}-#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Stream.Infinite.Functional.Zipper@@ -56,9 +53,6 @@ import Control.Applicative #endif import Control.Comonad-#ifdef LANGUAGE_DeriveDataTypeable-import Data.Data-#endif import Data.Functor.Extend import Data.Functor.Apply #if !(MIN_VERSION_base(4,11,0))@@ -66,9 +60,6 @@ #endif data Zipper a = !Integer :~ !(Integer -> a)-#ifdef LANGUAGE_DeriveDataTypeable- deriving Typeable-#endif toSequence :: (Integer -> a) -> Zipper a toSequence = (0 :~)
src/Data/Stream/Infinite/Skew.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE PatternGuards, BangPatterns #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Stream.Infinite.Skew@@ -83,11 +81,9 @@ foldMap f (Bin _ a l r) = f a `mappend` foldMap f l `mappend` foldMap f r foldr f z (Tip a) = f a z foldr f z (Bin _ a l r) = f a (foldr f (foldr f z r) l)-#if __GLASGOW_HASKELL__ >= 710 length Tip{} = 1 length (Bin n _ _ _) = fromIntegral n null _ = False-#endif instance Foldable1 Complete where foldMap1 f (Tip a) = f a@@ -157,10 +153,8 @@ instance Foldable Stream where foldMap f (t :< ts) = foldMap f t `mappend` foldMap f ts foldr f z (t :< ts) = foldr f (foldr f z ts) t-#if __GLASGOW_HASKELL__ >= 710 length _ = error "infinite length" null _ = False-#endif instance Foldable1 Stream where foldMap1 f (t :< ts) = foldMap1 f t <> foldMap1 f ts
src/Data/Stream/Supply.hs view
@@ -1,7 +1,6 @@-{-# LANGUAGE CPP, FlexibleContexts #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Stream.Supply@@ -42,18 +41,12 @@ , split4 ) where -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative-#endif import Control.Comonad+import Data.Data import Data.Functor.Apply import Data.Functor.Extend import Data.Functor.Rep import Data.IORef(newIORef, atomicModifyIORef)-#if !(MIN_VERSION_base(4,8,0))-import Data.Foldable-import Data.Traversable-#endif #if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup #endif@@ -62,24 +55,10 @@ import System.IO.Unsafe (unsafeInterleaveIO) import Data.Stream.Infinite import qualified Data.Stream.Infinite.Skew as Skew--#ifdef LANGUAGE_DeriveDataTypeable-import Data.Data-#endif--#if __GLASGOW_HASKELL__ >= 608 import GHC.IO(unsafeDupableInterleaveIO)-#else-unsafeDupableInterleaveIO :: IO a -> IO a-unsafeDupableInterleaveIO = unsafeInterleaveIO-#endif data Supply a = Supply a (Supply a) (Supply a) deriving- ( Show, Read, Eq, Ord-#ifdef LANGUAGE_DeriveDataTypeable- , Data, Typeable-#endif- )+ (Show, Read, Eq, Ord, Data) instance Functor Supply where fmap f (Supply a l r) = Supply (f a) (fmap f l) (fmap f r)
streams.cabal view
@@ -1,6 +1,6 @@ name: streams category: Control, Comonads-version: 3.3.2+version: 3.3.3 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -20,18 +20,19 @@ README .gitignore .vim.custom-tested-with: GHC == 7.4.2- , GHC == 7.6.3- , GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2- , GHC == 9.2.2+ , GHC == 9.2.8+ , GHC == 9.4.8+ , GHC == 9.6.6+ , GHC == 9.8.4+ , GHC == 9.10.1+ , GHC == 9.12.1 description: Various Haskell 2010 stream comonads. * "Data.Stream.Future" provides a coinductive anti-causal stream, or non-empty 'ZipList'. The comonad provides access to only the@@ -78,21 +79,14 @@ BangPatterns build-depends:- base >= 4 && < 5,+ base >= 4.9 && < 5, adjunctions >= 4.0.1 && < 5, boring >= 0.2 && < 0.3, comonad >= 4 && < 6, distributive >= 0.2.1 && < 1, semigroupoids >= 4 && < 7 - if impl(ghc < 8.0)- build-depends:- semigroups >= 0.8.3.1 && < 1-- default-extensions: CPP- if impl(ghc)- cpp-options: -DLANGUAGE_DeriveDataTypeable- default-extensions: FlexibleContexts, DeriveDataTypeable+ default-extensions: CPP, FlexibleContexts, DeriveDataTypeable exposed-modules: Data.Stream.Future@@ -103,8 +97,6 @@ Data.Stream.Supply hs-source-dirs: src- ghc-options: -Wall- if impl(ghc >= 7.10)- ghc-options: -fno-warn-trustworthy-safe+ ghc-options: -Wall -Wno-trustworthy-safe default-language: Haskell2010