# Core


Stream primitives: done/more/fromList/iterate/range/replicate.

## `done`

_done: terminate a stream with a final value; produces a pure `Step` tagged `Done` carrying that value as the stream's result._

```
done : a -> Computation (Step a b)
```

Terminate a stream with a final value. Returns a pure Computation
whose `_tag` is `"Done"` and whose `value` is the supplied result.

## `fromList`

_fromList: convert a Nix list into a stream; emits each element as `More` and terminates with `Done null`._

```
fromList : [a] -> Computation (Step null a)
```

Create a stream from a list. The empty list collapses to `done null`.

## `iterate`

_iterate: build an infinite stream by repeated application: `[x, f x, f (f x), ...]`; must be paired with a limiting combinator to terminate._

```
iterate : (a -> a) -> a -> Computation (Step r a)
```

Create an infinite stream by repeated application:

```
iterate f x = [x, f(x), f(f(x)), ...]
```

Must be consumed with a limiting combinator (`take`, `takeWhile`).

## `more`

_more: yield one head element followed by a continuation stream; produces a pure `Step` tagged `More` with `head` and `tail` fields._

```
more : a -> Computation (Step r a) -> Computation (Step r a)
```

Yield an element and a continuation stream. The `tail` argument is
a Computation, so the rest of the stream stays lazy.

## `range`

_range: build a stream of integers from `start` inclusive to `end` exclusive; empty when `start >= end`._

```
range : Int -> Int -> Computation (Step null Int)
```

Create a stream of integers from `start` (inclusive) to `end`
(exclusive). Empty when `start >= end`.

## `replicate`

_replicate: build a stream of `n` copies of value `x`; empty when `n <= 0`, otherwise emits `n` `More` steps then `Done null`._

```
replicate : Int -> a -> Computation (Step null a)
```

Create a stream of `n` copies of a value. Empty when `n <= 0`.

