Stream 0.2.1 → 0.2.2
raw patch · 2 files changed
+38/−14 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Stream: interleave :: Stream a -> Stream a -> Stream a
+ Data.Stream: scanl :: (a -> b -> a) -> a -> Stream b -> Stream a
+ Data.Stream: scanl1 :: (a -> a -> a) -> Stream a -> Stream a
Files
- Data/Stream.hs +25/−1
- Stream.cabal +13/−13
Data/Stream.hs view
@@ -14,6 +14,9 @@ -- * Stream transformations , map , intersperse + , interleave+ , scanl+ , scanl1 -- * Building streams , iterate , repeat@@ -48,7 +51,8 @@ ) where -import Prelude hiding (head, tail, map, iterate, take, drop, takeWhile,+import Prelude hiding (head, tail, map, scanl, scanl1,+ iterate, take, drop, takeWhile, dropWhile, repeat, cycle, filter, (!!), zip, unzip, zipWith,words,unwords,lines,unlines, break, span, splitAt) @@ -90,6 +94,13 @@ intersperse :: a -> Stream a -> Stream a intersperse y (Cons x xs) = Cons x (Cons y (intersperse y xs)) +-- | Interleave two Streams @xs@ and @ys@, alternating elements+-- from each list.+--+-- > @[x1,x2,...] `interleave` [y1,y2,...] == [x1,y1,x2,y2,...]@+interleave :: Stream a -> Stream a -> Stream a+interleave (Cons x xs) ys = Cons x (interleave ys xs)+ -- | Apply a function uniformly over all elements of a sequence. map :: (a -> b) -> Stream a -> Stream b map f (Cons x xs) = Cons (f x) (map f xs)@@ -107,6 +118,19 @@ -- > iterate f x = [x, f x, f (f x), ..] iterate :: (a -> a) -> a -> Stream a iterate f x = Cons x (iterate f (f x))++-- | 'scanl' yields a stream of successive reduced values from the+-- | left:+-- +-- > scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]+scanl :: (a -> b -> a) -> a -> Stream b -> Stream a+scanl f z (Cons x xs) = z <:> scanl f (f z x) xs++-- | 'scanl1' is a variant of 'scanl' that has no starting value argument:+--+-- > scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]+scanl1 :: (a -> a -> a) -> Stream a -> Stream a+scanl1 f (Cons x xs) = scanl f x xs -- | 'take' @n@ @xs@ returns the first @n@ elements of @xs@. --
Stream.cabal view
@@ -1,14 +1,14 @@-Name: Stream-Version: 0.2.1-License: BSD3-License-file: LICENSE-Author: Wouter Swierstra-Maintainer: Wouter Swierstra <wss@cs.nott.ac.uk>-Homepage: http://www.cs.nott.ac.uk/~wss/repos/Stream/dist/doc/html/-Synopsis: A library for manipulating infinite lists.-Description: This package implements functions, analogous- to those from Data.List, to create and manipulate infinite lists.-Category: Data-Build-Depends: base-Exposed-modules: Data.Stream+Name: Stream+Version: 0.2.2+License: BSD3+License-file: LICENSE+Author: Wouter Swierstra+Maintainer: Wouter Swierstra <wss@cs.nott.ac.uk>+Homepage: http://www.cs.nott.ac.uk/~wss/repos/Stream/dist/doc/html/+Synopsis: A library for manipulating infinite lists.+Description: This package implements functions, analogous+ to those from Data.List, to create and manipulate infinite lists.+Category: Data+Build-Depends: base+Exposed-modules: Data.Stream