| Copyright | (C) 2012 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | provisional |
| Portability | Rank-2 Types |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Machine.Source
Contents
Description
- type Source b = forall k. Machine k b
- type SourceT m b = forall k. MachineT m k b
- source :: Foldable f => f b -> Source b
- repeated :: o -> Source o
- cycled :: Foldable f => f b -> Source b
- cap :: Process a b -> Source a -> Source b
- iterated :: (a -> a) -> a -> Source a
- replicated :: Int -> a -> Source a
- enumerateFromTo :: (Enum a, Eq a) => a -> a -> Source a
- unfold :: (r -> Maybe (a, r)) -> r -> Source a
- unfoldT :: Monad m => (r -> m (Maybe (a, r))) -> r -> SourceT m a
Sources
type SourceT m b = forall k. MachineT m k b Source #
A SourceT never reads from its inputs, but may have monadic side-effects.
iterated :: (a -> a) -> a -> Source a Source #
iterated f x returns an infinite source of repeated applications
of f to x
replicated :: Int -> a -> Source a Source #
replicated n x is a source of x emitted n time(s)
enumerateFromTo :: (Enum a, Eq a) => a -> a -> Source a Source #
Enumerate from a value to a final value, inclusive, via succ