| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
System.FS.Sim.Stream
Description
Possibly infinite streams of s.Maybe a
Synopsis
- data Stream a
- runStream :: Stream a -> (Maybe a, Stream a)
- always :: a -> Stream a
- empty :: Stream a
- mkInfinite :: [Maybe a] -> Stream a
- repeating :: [Maybe a] -> Stream a
- unsafeMkFinite :: [Maybe a] -> Stream a
- null :: Stream a -> Bool
- genFinite :: Int -> Gen (Maybe a) -> Gen (Stream a)
- genInfinite :: Gen (Maybe a) -> Gen (Stream a)
- genMaybe :: Int -> Int -> Gen a -> Gen (Maybe a)
- genMaybe' :: Int -> Gen a -> Gen (Maybe a)
- shrinkStream :: Stream a -> [Stream a]
Streams
A Stream is a stream of s, which is possibly infinite or
definitely finite.Maybe a
Finiteness is tracked internally and used for shrinking and the Show
instance.
Running
Construction
unsafeMkFinite :: [Maybe a] -> Stream a Source #
Query
Generation and shrinking
Arguments
| :: Int | Requested size of finite stream. Tip: use |
| -> Gen (Maybe a) | |
| -> Gen (Stream a) |
Generate a finite Stream of length n.
Generate an infinite Stream.
shrinkStream :: Stream a -> [Stream a] Source #
Shrink a stream like it is an InfiniteList.
Possibly infinite streams are shrunk differently than lists that are definitely finite, which is to ensure that shrinking terminates. * Possibly infinite streams are shrunk by taking finite prefixes of the argument stream. As such, shrinking a possibly infinite stream creates definitely finite streams. * Definitely finite streams are shrunk like lists are shrunk normally, preserving that the created streams are still definitely finite.