Safe Haskell | None |
---|---|
Language | Haskell2010 |
The Data.Stream.Typed module contains more detailed documenation.
This module simply imports functions from Data.Stream.Typed and modifies them so
inputs and outputs are always of type UnknownStream
, which this
module renames Stream
(yes, this clashes with Stream
in
Data.Stream.Typed).
Because of this, using this module more closely emulates how ordinary lists work, but you miss some of the compile time information you can get using the "typed" module.
- type Stream a = UnknownStream a
- class ToStream a
- toStream :: ToStream a => a -> Stream (Element a)
- runTimeFoldableToStream :: Foldable t => t a -> Stream a
- runTimeFoldableToStreamWithLength :: Foldable t => Int -> t a -> Stream a
- unknownFoldableToStream :: Foldable t => t a -> UnknownStream a
- type family Element mono :: *
- empty :: Stream a
- singleton :: a -> Stream a
- append :: Stream a -> Stream a -> Stream a
- zip :: Stream a -> Stream b -> Stream (a, b)
- zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c
- filter :: (a -> Bool) -> Stream a -> Stream a
- concat :: Stream (Stream a) -> Stream a
- concatMap :: (a -> Stream b) -> Stream a -> Stream b
- replicate :: Integral b => b -> a -> Stream a
- iterate :: (a -> a) -> a -> Stream a
- repeat :: a -> Stream a
- cycle :: Stream a -> Stream a
- null :: Stream a -> Bool
- unfoldr :: (b -> Maybe (a, b)) -> b -> UnknownStream a
- safeLength :: Stream a -> SafeLength
- data SafeLength
- maybeHead :: Stream a -> Maybe a
- memotise :: Stream a -> Stream a
Documentation
type Stream a = UnknownStream a Source #
Add instances to the toStream
class to allow for easy conversion to streams.
Technically you could just use runTimeFoldableToStream
and ,unknownFoldableToStream
to wrap data in
streams, but with this approach you can specialise for particular datatypes if appropriate.
runTimeFoldableToStream :: Foldable t => t a -> Stream a Source #
unknownFoldableToStream :: Foldable t => t a -> UnknownStream a Source #
type family Element mono :: * #
Type family for getting the type of the elements of a monomorphic container.
unfoldr :: (b -> Maybe (a, b)) -> b -> UnknownStream a Source #
safeLength :: Stream a -> SafeLength Source #