-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Various Haskell 2010 stream comonads -- -- Various Haskell 2010 stream comonads. -- -- -- --
--   data Stream f a = a :< f (Stream a)
--   
-- -- -- --
--   data Future a = Last a | a :< Future a
--   
-- -- -- --
--   
-- -- -- --
--   data NonEmpty a = a :| [a]
--   
-- -- -- --
--   data Stream a = a :< Stream a
--   
-- -- -- --
--   
-- -- -- --
--   data Zipper a = !Integer :~ (Integer -> a)
--   
-- -- Changes since 0.1: -- -- @package streams @version 0.2 -- | This is an infinite bidirectional zipper module Data.Stream.Infinite.Functional.Zipper data Zipper a (:~) :: !Integer -> !Integer -> a -> Zipper a -- | Move the head of the zipper to the right tail :: Zipper a -> Zipper a -- | Move the head of the zipper to the left untail :: Zipper a -> Zipper a -- | intersperse y xs creates an alternating stream of -- elements from xs and y. intersperse :: a -> Zipper a -> Zipper a -- | Interleave two Zippers xs and ys, alternating -- elements from each list. -- --
--   [x1,x2,...] `interleave` [y1,y2,...] == [x1,y1,x2,y2,...]
--   interleave = (<>) 
--   
interleave :: Zipper a -> Zipper a -> Zipper a -- | transpose computes the transposition of a stream of streams. transpose :: Zipper (Zipper a) -> Zipper (Zipper a) take :: Integer -> Zipper a -> [a] -- | drop n xs drops the first n elements off the -- front of the sequence xs. drop :: Integer -> Zipper a -> Zipper a -- | splitAt n xs returns a pair consisting of the prefix -- of xs of length n and the remaining stream -- immediately following this prefix. -- -- Beware: passing a negative integer as the first argument will -- cause an error if you access the taken portion splitAt :: Integer -> Zipper a -> ([a], Zipper a) -- | reverse xs returns the elements of xs in -- reverse order. xs must be finite. reverse :: [a] -> [a] -- | xs !! n returns the element of the stream xs at -- index n. Note that the head of the stream has index 0. -- -- Beware: passing a negative integer as the first argument will -- cause an error. (!!) :: Zipper a -> Integer -> a -- | The unzip function is the inverse of the zip function. unzip :: Zipper (a, b) -> (Zipper a, Zipper b) toSequence :: (Integer -> a) -> Zipper a -- | Extract the focused element head :: Zipper a -> a -- | Cons before the head of the zipper. The head now points to the new -- element (<|) :: a -> Zipper a -> Zipper a -- | Move the head of the zipper one step to the right, returning the value -- we move over. uncons :: Zipper a -> (a, Zipper a) -- | takeWhile p xs returns the longest prefix of the -- stream xs for which the predicate p holds. takeWhile :: (a -> Bool) -> Zipper a -> [a] -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs. -- -- Beware: this function may diverge if every element of -- xs satisfies p, e.g. dropWhile even (repeat -- 0) will loop. dropWhile :: (a -> Bool) -> Zipper a -> Zipper a -- | span p xs returns the longest prefix of xs -- that satisfies p, together with the remainder of the stream. span :: (a -> Bool) -> Zipper a -> ([a], Zipper a) -- | The break p function is equivalent to span -- not . p. break :: (a -> Bool) -> Zipper a -> ([a], Zipper a) -- | The isPrefix function returns True if the first -- argument is a prefix of the second. isPrefixOf :: Eq a => [a] -> Zipper a -> Bool -- | The findIndex function takes a predicate and a stream and -- returns the index of the first element in the stream that satisfies -- the predicate, -- -- Beware: findIndex p xs will diverge if -- none of the elements of xs satisfy p. findIndex :: (a -> Bool) -> Zipper a -> Integer -- | The elemIndex function returns the index of the first element -- in the given stream which is equal (by ==) to the query -- element, -- -- Beware: elemIndex x xs will diverge if none of -- the elements of xs equal x. elemIndex :: Eq a => a -> Zipper a -> Integer -- | The zip function takes two streams and returns a list of -- corresponding pairs. -- --
--   zip = liftA2 (,)
--   
zip :: Zipper a -> Zipper b -> Zipper (a, b) -- | The zipWith function generalizes zip. Rather than -- tupling the functions, the elements are combined using the function -- passed as the first argument to zipWith. -- --
--   zipWith = liftA2
--   
zipWith :: (a -> b -> c) -> Zipper a -> Zipper b -> Zipper c instance Typeable1 Zipper instance Semigroup (Zipper a) instance Monad Zipper instance Applicative Zipper instance ComonadApply Zipper instance FunctorApply Zipper instance Comonad Zipper instance Functor Zipper -- | Anticausal streams implemented as non-empty skew binary random access -- lists -- -- The Applicative zips streams, the monad diagonalizes module Data.Stream.Infinite.Skew data Stream a -- | O(1) cons (<|) :: a -> Stream a -> Stream a -- | O(log n). (!!) :: Stream a -> Integer -> a -- | O(1) head :: Stream a -> a -- | O(1). tail :: Stream a -> Stream a tails :: Stream a -> Stream (Stream a) -- | O(1). uncons :: Stream a -> (a, Stream a) -- | O(log n). index :: Integer -> Stream a -> a -- | O(log n). drop :: Integer -> Stream a -> Stream a dropWhile :: (a -> Bool) -> Stream a -> Stream a span :: (a -> Bool) -> Stream a -> ([a], Stream a) break :: (a -> Bool) -> Stream a -> ([a], Stream a) split :: (a -> Bool) -> Stream a -> ([a], Stream a) splitW :: (Stream a -> Bool) -> Stream a -> ([a], Stream a) repeat :: a -> Stream a insert :: Ord a => a -> Stream a -> Stream a insertBy :: (a -> a -> Ordering) -> a -> Stream a -> Stream a adjust :: Integer -> (a -> a) -> Stream a -> Stream a update :: Integer -> a -> Stream a -> Stream a fromList :: [a] -> Stream a from :: Num a => a -> Stream a indexed :: Stream a -> Stream (Integer, a) interleave :: Stream a -> Stream a -> Stream a instance Show a => Show (Complete a) instance Monad Stream instance Semigroup (Stream a) instance Traversable1 Stream instance Traversable Stream instance Foldable1 Stream instance Foldable Stream instance FunctorAlt Stream instance Applicative Stream instance ComonadApply Stream instance FunctorApply Stream instance Comonad Stream instance Functor Stream instance Show a => Show (Stream a) instance Traversable1 Complete instance Traversable Complete instance Foldable1 Complete instance Foldable Complete instance Comonad Complete instance Functor Complete -- | Anticausal streams implemented as non-empty skew binary random access -- lists -- -- The Applicative zips streams, but since these are potentially infinite -- this is stricter than would be desired. You almost always want module Data.Stream.Future.Skew data Future a Last :: !Complete a -> Future a (:<) :: !Complete a -> Future a -> Future a -- | O(1) cons (<|) :: a -> Future a -> Future a cons :: a -> Future a -> Future a -- | O(log n). length :: Future a -> Int -- | O(1) head :: Future a -> a -- | O(1). tail :: Future a -> Maybe (Future a) tails :: Future a -> Future (Future a) -- | O(log n). last :: Future a -> a -- | O(1). uncons :: Future a -> (a, Maybe (Future a)) -- | O(log n). index :: Int -> Future a -> a -- | O(log n). drop :: Int -> Future a -> Maybe (Future a) dropWhile :: (a -> Bool) -> Future a -> Maybe (Future a) indexed :: Future a -> Future (Int, a) from :: Num a => a -> Future a break :: (a -> Bool) -> Future a -> ([a], Maybe (Future a)) span :: (a -> Bool) -> Future a -> ([a], Maybe (Future a)) split :: (a -> Bool) -> Future a -> ([a], Maybe (Future a)) splitW :: (Future a -> Bool) -> Future a -> ([a], Maybe (Future a)) repeat :: a -> Future a -- | O(log n) replicate :: Int -> a -> Future a insert :: Ord a => a -> Future a -> Future a insertBy :: (a -> a -> Ordering) -> a -> Future a -> Future a update :: Int -> a -> Future a -> Future a adjust :: Int -> (a -> a) -> Future a -> Future a fromList :: [a] -> Future a toFuture :: [a] -> Maybe (Future a) instance Show a => Show (Complete a) instance Traversable1 Future instance Traversable Future instance Foldable1 Future instance Foldable Future instance FunctorAlt Future instance Applicative Future instance ComonadApply Future instance FunctorApply Future instance Comonad Future instance Functor Future instance Show a => Show (Future a) instance Traversable1 Complete instance Traversable Complete instance Foldable1 Complete instance Foldable Complete instance Comonad Complete instance Functor Complete module Data.Stream.Future data Future a Last :: a -> Future a (:<) :: a -> Future a -> Future a cons :: a -> Future a -> Future a (<|) :: a -> Future a -> Future a head :: Future a -> a tail :: Future a -> Maybe (Future a) length :: Future a -> Int tails :: Future a -> Future (Future a) map :: (a -> b) -> Future a -> Future b index :: Int -> Future a -> a instance Typeable1 Future instance Eq a => Eq (Future a) instance Ord a => Ord (Future a) instance Show a => Show (Future a) instance Read a => Read (Future a) instance Data a => Data (Future a) instance ApplicativeAlt Future instance Applicative Future instance ComonadApply Future instance Semigroup (Future a) instance FunctorAlt Future instance FunctorApply Future instance Comonad Future instance Traversable1 Future instance Foldable1 Future instance Traversable Future instance Foldable Future instance Functor Future -- | A NonEmpty list forms a monad as per list. Unlike Future, the -- ComonadApply instance pairs all positions in both comonads like the -- list monad applicative. module Data.Stream.NonEmpty data NonEmpty a (:|) :: a -> [a] -> NonEmpty a -- | map a function over a NonEmpty stream map :: (a -> b) -> NonEmpty a -> NonEmpty b intersperse :: a -> NonEmpty a -> NonEmpty a -- | scanl is similar to foldl, but returns a stream of -- successive reduced values from the left: -- --
--   scanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...]
--   
-- -- Note that -- --
--   last (scanl f z xs) == foldl f z xs.
--   
scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b -- | scanr is the right-to-left dual of scanl. Note that -- --
--   head (scanr f z xs) == foldr f z xs.
--   
scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b -- | scanl1 is a variant of scanl that has no starting value -- argument: -- --
--   scanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]
--   
scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a -- | scanr1 is a variant of scanr that has no starting value -- argument. scanr1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a -- | Extract the first element of the stream head :: NonEmpty a -> a -- | Extract the possibly empty tail of the stream tail :: NonEmpty a -> [a] -- | Extract the last element of the stream last :: NonEmpty a -> a -- | Extract everything except the last element of the stream init :: NonEmpty a -> [a] -- | cons onto a stream (<|) :: a -> NonEmpty a -> NonEmpty a cons :: a -> NonEmpty a -> NonEmpty a uncons :: NonEmpty a -> (a, Maybe (NonEmpty a)) -- | Sort a stream sort :: Ord a => NonEmpty a -> NonEmpty a -- | reverse a finite NonEmpty reverse :: NonEmpty a -> NonEmpty a -- | The inits function takes a stream xs and returns all -- the finite prefixes of xs. inits :: Foldable f => f a -> NonEmpty [a] -- | The tails function takes a stream xs and returns all -- the suffixes of xs. tails :: Foldable f => f a -> NonEmpty [a] -- | iterate f x produces the infinite sequence of repeated -- applications of f to x. -- --
--   iterate f x = [x, f x, f (f x), ..]
--   
iterate :: (a -> a) -> a -> NonEmpty a -- | repeat x returns a constant stream, where all elements -- are equal to x. repeat :: a -> NonEmpty a -- | cycle xs returns the infinite repetition of -- xs: -- --
--   cycle [1,2,3] = 1 :| [2,3,1,2,3,...]
--   
cycle :: NonEmpty a -> NonEmpty a unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b -- | insert an item into a NonEmpty insert :: Foldable f => Ord a => a -> f a -> NonEmpty a -- | take n xs returns the first n elements of -- xs. -- -- Beware: passing a negative integer as the first argument will -- cause an error. take :: Int -> NonEmpty a -> [a] -- | drop n xs drops the first n elements off the -- front of the sequence xs. -- -- Beware: passing a negative integer as the first argument will -- cause an error. drop :: Int -> NonEmpty a -> [a] -- | splitAt n xs returns a pair consisting of the prefix -- of xs of length n and the remaining stream -- immediately following this prefix. -- -- Beware: passing a negative integer as the first argument will -- cause an error. splitAt :: Int -> NonEmpty a -> ([a], [a]) -- | takeWhile p xs returns the longest prefix of the -- stream xs for which the predicate p holds. takeWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs. dropWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | span p xs returns the longest prefix of -- xs that satisfies p, together with the remainder of -- the stream. span :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | The break p function is equivalent to span -- not . p. break :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | filter p xs, removes any elements from -- xs that do not satisfy p. filter :: (a -> Bool) -> NonEmpty a -> [a] -- | The partition function takes a predicate p and a -- stream xs, and returns a pair of streams. The first stream -- corresponds to the elements of xs for which p holds; -- the second stream corresponds to the elements of xs for which -- p does not hold. partition :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | The group function takes a stream and returns a stream of lists -- such that flattening the resulting stream is equal to the argument. -- Moreover, each sublist in the resulting stream contains only equal -- elements. For example, -- --
--   group $ cycle "Mississippi" = "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ...
--   
group :: (Foldable f, Eq a) => f a -> [NonEmpty a] groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a] group1 :: Eq a => NonEmpty a -> NonEmpty (NonEmpty a) groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | The isPrefix function returns True if the first -- argument is a prefix of the second. isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool -- | xs !! n returns the element of the stream xs at -- index n. Note that the head of the stream has index 0. -- -- Beware: passing a negative integer as the first argument will -- cause an error. (!!) :: NonEmpty a -> Int -> a -- | The zip function takes two streams and returns a list of -- corresponding pairs. zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) -- | The zipWith function generalizes zip. Rather than -- tupling the functions, the elements are combined using the function -- passed as the first argument to zipWith. zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c -- | The unzip function is the inverse of the zip function. unzip :: Functor f => f (a, b) -> (f a, f b) -- | The words function breaks a stream of characters into a stream -- of words, which were delimited by white space. words :: NonEmpty Char -> NonEmpty String -- | The unwords function is an inverse operation to words. -- It joins words with separating spaces. unwords :: NonEmpty String -> NonEmpty Char -- | The lines function breaks a stream of characters into a list of -- strings at newline characters. The resulting strings do not contain -- newlines. lines :: NonEmpty Char -> NonEmpty String -- | The unlines function is an inverse operation to lines. -- It joins lines, after appending a terminating newline to each. unlines :: NonEmpty String -> NonEmpty Char -- | Converts an non-empty list to a stream. fromList :: [a] -> NonEmpty a -- | Convert a stream to a list efficiently toList :: NonEmpty a -> [a] nonEmpty :: [a] -> Maybe (NonEmpty a) instance Typeable1 NonEmpty instance Eq a => Eq (NonEmpty a) instance Ord a => Ord (NonEmpty a) instance Show a => Show (NonEmpty a) instance Read a => Read (NonEmpty a) instance Data a => Data (NonEmpty a) instance Semigroup (NonEmpty a) instance Foldable1 NonEmpty instance Foldable NonEmpty instance Traversable1 NonEmpty instance Traversable NonEmpty instance Monad NonEmpty instance ApplicativeAlt NonEmpty instance Applicative NonEmpty instance ComonadApply NonEmpty instance FunctorAlt NonEmpty instance FunctorApply NonEmpty instance Comonad NonEmpty instance Functor NonEmpty module Data.Stream.Infinite data Stream a (:>) :: a -> Stream a -> Stream a -- | Extract the first element of the sequence. head :: Stream a -> a -- | Extract the sequence following the head of the stream. tail :: Stream a -> Stream a -- | The inits function takes a stream xs and returns all -- the finite prefixes of xs. -- -- Note that this inits is lazier then Data.List.inits: -- --
--   inits _|_ = [] ::: _|_
--   
-- -- while for Data.List.inits: -- --
--   inits _|_ = _|_
--   
inits :: Stream a -> Stream [a] -- | The tails function takes a stream xs and returns all -- the suffixes of xs. tails :: Stream a -> Stream (Stream a) -- | Map a pure function over a stream map :: (a -> b) -> Stream a -> Stream b -- | intersperse y xs creates an alternating stream of -- elements from xs and y. intersperse :: a -> Stream a -> Stream a -- | 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 -- | scanl yields a stream of successive reduced values from: -- --
--   scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
--   
scanl :: (a -> b -> a) -> a -> Stream b -> Stream a -- | scanl yields a stream of successive reduced values from: -- --
--   scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
--   
scanl' :: (a -> b -> a) -> a -> Stream b -> Stream a -- | 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' is a strict scanl that has no starting value. scanl1' :: (a -> a -> a) -> Stream a -> Stream a -- | transpose computes the transposition of a stream of streams. transpose :: Stream (Stream a) -> Stream (Stream a) -- | iterate f x produces the infinite sequence of repeated -- applications of f to x. -- --
--   iterate f x = [x, f x, f (f x), ..]
--   
iterate :: (a -> a) -> a -> Stream a -- | repeat x returns a constant stream, where all elements -- are equal to x. repeat :: a -> Stream a -- | cycle xs returns the infinite repetition of -- xs: -- --
--   cycle [1,2,3] = Cons 1 (Cons 2 (Cons 3 (Cons 1 (Cons 2 ...
--   
cycle :: NonEmpty a -> Stream a -- | The unfold function is similar to the unfold for lists. Note there is -- no base case: all streams must be infinite. unfold :: (a -> (b, a)) -> a -> Stream b -- | take n xs returns the first n elements of -- xs. -- -- Beware: passing a negative integer as the first argument will -- cause an error. take :: Int -> Stream a -> [a] -- | drop n xs drops the first n elements off the -- front of the sequence xs. -- -- Beware: passing a negative integer as the first argument will -- cause an error. drop :: Int -> Stream a -> Stream a -- | splitAt n xs returns a pair consisting of the prefix -- of xs of length n and the remaining stream -- immediately following this prefix. -- -- Beware: passing a negative integer as the first argument will -- cause an error. splitAt :: Int -> Stream a -> ([a], Stream a) -- | takeWhile p xs returns the longest prefix of the -- stream xs for which the predicate p holds. takeWhile :: (a -> Bool) -> Stream a -> [a] -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs. -- -- Beware: this function may diverge if every element of -- xs satisfies p, e.g. dropWhile even (repeat -- 0) will loop. dropWhile :: (a -> Bool) -> Stream a -> Stream a -- | span p xs returns the longest prefix of xs -- that satisfies p, together with the remainder of the stream. span :: (a -> Bool) -> Stream a -> ([a], Stream a) -- | The break p function is equivalent to span -- not . p. break :: (a -> Bool) -> Stream a -> ([a], Stream a) -- | filter p xs, removes any elements from xs -- that do not satisfy p. -- -- Beware: this function may diverge if there is no element of -- xs that satisfies p, e.g. filter odd (repeat -- 0) will loop. filter :: (a -> Bool) -> Stream a -> Stream a -- | The partition function takes a predicate p and a -- stream xs, and returns a pair of streams. The first stream -- corresponds to the elements of xs for which p holds; -- the second stream corresponds to the elements of xs for which -- p does not hold. -- -- Beware: One of the elements of the tuple may be undefined. For -- example, fst (partition even (repeat 0)) == repeat 0; on the -- other hand snd (partition even (repeat 0)) is undefined. partition :: (a -> Bool) -> Stream a -> (Stream a, Stream a) -- | The group function takes a stream and returns a stream of lists -- such that flattening the resulting stream is equal to the argument. -- Moreover, each sublist in the resulting stream contains only equal -- elements. For example, -- --
--   group $ cycle "Mississippi" = "M" ::: "i" ::: "ss" ::: "i" ::: "ss" ::: "i" ::: "pp" ::: "i" ::: "M" ::: "i" ::: ...
--   
group :: Eq a => Stream a -> Stream (NonEmpty a) -- | The isPrefix function returns True if the first -- argument is a prefix of the second. isPrefixOf :: Eq a => [a] -> Stream a -> Bool -- | xs !! n returns the element of the stream xs at -- index n. Note that the head of the stream has index 0. -- -- Beware: passing a negative integer as the first argument will -- cause an error. (!!) :: Stream a -> Int -> a -- | The elemIndex function returns the index of the first element -- in the given stream which is equal (by ==) to the query -- element, -- -- Beware: elemIndex x xs will diverge if none of -- the elements of xs equal x. elemIndex :: Eq a => a -> Stream a -> Int -- | The elemIndices function extends elemIndex, by returning -- the indices of all elements equal to the query element, in ascending -- order. -- -- Beware: elemIndices x xs will diverge -- if any suffix of xs does not contain x. elemIndices :: Eq a => a -> Stream a -> Stream Int -- | The findIndex function takes a predicate and a stream and -- returns the index of the first element in the stream that satisfies -- the predicate, -- -- Beware: findIndex p xs will diverge if -- none of the elements of xs satisfy p. findIndex :: (a -> Bool) -> Stream a -> Int -- | The findIndices function extends findIndex, by returning -- the indices of all elements satisfying the predicate, in ascending -- order. -- -- Beware: findIndices p xs will diverge -- if all the elements of any suffix of xs fails to satisfy -- p. findIndices :: (a -> Bool) -> Stream a -> Stream Int -- | The zip function takes two streams and returns a list of -- corresponding pairs. zip :: Stream a -> Stream b -> Stream (a, b) -- | The zipWith function generalizes zip. Rather than -- tupling the functions, the elements are combined using the function -- passed as the first argument to zipWith. zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c -- | The unzip function is the inverse of the zip function. unzip :: Stream (a, b) -> (Stream a, Stream b) -- | The words function breaks a stream of characters into a stream -- of words, which were delimited by white space. -- -- Beware: if the stream of characters xs does not -- contain white space, accessing the tail of words xs will -- loop. words :: Stream Char -> Stream String -- | The unwords function is an inverse operation to words. -- It joins words with separating spaces. unwords :: Stream String -> Stream Char -- | The lines function breaks a stream of characters into a list of -- strings at newline characters. The resulting strings do not contain -- newlines. -- -- Beware: if the stream of characters xs does not -- contain newline characters, accessing the tail of lines xs -- will loop. lines :: Stream Char -> Stream String -- | The unlines function is an inverse operation to lines. -- It joins lines, after appending a terminating newline to each. unlines :: Stream String -> Stream Char -- | The fromList converts an infinite list to a stream. -- -- Beware: Passing a finite list, will cause an error. fromList :: [a] -> Stream a instance Typeable1 Stream instance Show a => Show (Stream a) instance Data a => Data (Stream a) instance Semigroup (Stream a) instance Monad Stream instance Traversable1 Stream instance Foldable1 Stream instance Traversable Stream instance Foldable Stream instance Applicative Stream instance ComonadApply Stream instance FunctorApply Stream instance Comonad Stream instance Functor Stream module Data.Stream.Branching data Stream f a (:<) :: a -> f (Stream f a) -> Stream f a head :: Stream f a -> a tail :: Stream f a -> f (Stream f a) tails :: Functor f => Stream f a -> Stream f (Stream f a) -- | equivalent to inits sans the initial [] context inits1 :: Functor f => Stream f a -> Stream f (NonEmpty a) scanr :: Functor f => (a -> f b -> b) -> Stream f a -> Stream f b scanl :: Functor f => (a -> b -> a) -> a -> Stream f b -> Stream f a unfold :: Functor f => (b -> (a, f b)) -> b -> Stream f a instance (Ord (f (Stream f a)), Ord a) => Ord (Stream f a) instance (Eq (f (Stream f a)), Eq a) => Eq (Stream f a) instance (Show (f (Stream f a)), Show a) => Show (Stream f a) instance Applicative f => Applicative (Stream f) instance FunctorApply f => ComonadApply (Stream f) instance FunctorApply f => FunctorApply (Stream f) instance Functor f => Comonad (Stream f) instance Functor f => Functor (Stream f)