Idris2Doc : FS.Chunk

FS.Chunk

(source)
Utilities for working with chunks of data.

It is suggested to import this qualified `import FS.Chunk as C` or
via the catch-all module `FS` and use qualified names such
as `C.filter` for those functions that overlap with the ones
from `FS.Pull`.

Definitions

recordChunkSize : Type
  Pulls and streams produce their output in chunks (lists of value)
for reasons of efficiency, because the whole streaming machinery
comes with quite a bit of a performance overhead.

Many functions for generating pure streams
and pulls therefore take an auto-implicit value of type `ChunkSize`.
If not provided explicitly, this defaults to 128.

Totality: total
Visibility: public export
Constructor: 
CS : (size : Nat) -> {auto0_ : IsSuccsize} ->ChunkSize

Projections:
0.prf : ({rec:0} : ChunkSize) ->IsSucc (size{rec:0})
.size : ChunkSize->Nat

Hints:
ChunkSize
EqChunkSize
OrdChunkSize
ShowChunkSize
.size : ChunkSize->Nat
Totality: total
Visibility: public export
size : ChunkSize->Nat
Totality: total
Visibility: public export
0.prf : ({rec:0} : ChunkSize) ->IsSucc (size{rec:0})
Totality: total
Visibility: public export
0prf : ({rec:0} : ChunkSize) ->IsSucc (size{rec:0})
Totality: total
Visibility: public export
fromInteger : Integer->ChunkSize
Totality: total
Visibility: export
defaultChunkSize : ChunkSize
Totality: total
Visibility: public export
dataSplitRes : Type->Type
Totality: total
Visibility: public export
Constructors:
Middle : c->c->SplitResc
All : Nat->SplitResc
interfaceChunk : Type->Type->Type
  A `Chunk c o` is a container type `c` holding elements of type `o`.

Examples include `List a` with element type `a` and `ByteString` with
element type `Bits8`.

Parameters: c, o
Constraints: Monoid c
Methods:
unfoldChunk : ChunkSize=> (s->Eitherr (o, s)) ->s->UnfoldResrsc
replicateChunk : ChunkSize=>o->c
isEmpty : c->Bool
unconsChunk : c->Maybe (o, Maybec)
splitChunkAt : Nat->c->SplitResc
breakChunk : BreakInstruction-> (o->Bool) ->c->BreakResc
filterChunk : (o->Bool) ->c->Maybec

Implementations:
Chunk (Lista) a
ChunkByteStringBits8
unfoldChunk : Chunkco=>ChunkSize=> (s->Eitherr (o, s)) ->s->UnfoldResrsc
Totality: total
Visibility: public export
replicateChunk : Chunkco=>ChunkSize=>o->c
Totality: total
Visibility: public export
isEmpty : Chunkco=>c->Bool
Totality: total
Visibility: public export
unconsChunk : Chunkco=>c->Maybe (o, Maybec)
Totality: total
Visibility: public export
splitChunkAt : Chunkco=>Nat->c->SplitResc
Totality: total
Visibility: public export
breakChunk : Chunkco=>BreakInstruction-> (o->Bool) ->c->BreakResc
Totality: total
Visibility: public export
filterChunk : Chunkco=> (o->Bool) ->c->Maybec
Totality: total
Visibility: public export
nonEmpty : Chunkco=>c->Maybec
Totality: total
Visibility: export
unfold : ChunkSize=>Chunkco=>s-> (s->Eitherr (o, s)) ->Pullfcesr
  Like `unfold` but generates chunks of values of up to the given size.

Totality: total
Visibility: export
fill : ChunkSize=> (0c : Type) ->Chunkco=>o->Pullfces ()
  Like `P.fill` but generates chunks of values of up to the given size.

Totality: total
Visibility: export
iterate : ChunkSize=> (0c : Type) ->Chunkco=>o-> (o->o) ->Pullfces ()
  Like `P.iterate` but generates chunks of values of up to the given size.

Totality: total
Visibility: export
replicate : ChunkSize=> (0c : Type) ->Chunkco=>Nat->o->Streamfesc
  Like `P.replicate` but generates chunks of values of up to the given size.

Totality: total
Visibility: export
uncons : Chunkco=>Pullfcesr->Pullfqes (Eitherr (o, Pullfcesr))
  Splits the very first element from the head of a `Pull`

Totality: total
Visibility: export
splitAt : Chunkco=>Nat->Pullfcesr->Pullfces (Pullfcesr)
  Emits the first `n` elements of a `Pull`, returning the remainder.

Totality: total
Visibility: export
take : Chunkco=>Nat->Pullfcesr->Pullfces ()
  Emits the first `n` elements of a `Pull`, returning the remainder.

Totality: total
Visibility: export
limit : Chunkco=>Hasees=> Lazy e->Nat->Pullfcesr->Pullfcesr
  Like `take` but limits the number of emitted values.

This fails with the given error in case the limit is exceeded.

Totality: total
Visibility: export
drop : Chunkco=>Nat->Pullfcesr->Pullfcesr
  Drops the first `n` elements of a `Pull`, returning the
remainder.

Totality: total
Visibility: export
head : Chunkco=>Pullfcesr->Pullfces ()
  Emits the first element of a `Pull`, returning the remainder.

Totality: total
Visibility: export
tail : Chunkco=>Pullfcesr->Pullfcesr
  Discards the first element of a `Pull`.

Totality: total
Visibility: export
breakFull : Chunkco=> (r->Pullfcesr) ->BreakInstruction-> (o->Bool) ->Pullfcesr->Pullfces (Pullfcesr)
  Breaks a pull as soon as the given predicate returns `True` for
an emitted element.

`orElse` determines what to do if the pull is exhausted before any
splitting of output occurred.

The `BreakInstruction` dictates, if the value, for which the
predicate held, should be emitted as part of the prefix or the
suffix, or if it should be discarded.

Totality: total
Visibility: export
forceBreakFull : Chunkco=>Hasees=> Lazy e->BreakInstruction-> (o->Bool) ->Pullfcesr->Pullfces (Pullfcesr)
  Like `breakFull` but fails with an error if the `Pull` is
exhausted before the prediate returns `True`.

Totality: total
Visibility: export
takeUntil : Chunkco=>BreakInstruction-> (o->Bool) ->Pullfcesr->Streamfesc
  Emits values until the given predicate returns `True`.

The `BreakInstruction` dictates, if the value, for which the
predicate held, should be emitted as part of the prefix or not.

Totality: total
Visibility: export
takeWhile : Chunkco=> (o->Bool) ->Pullfcesr->Streamfesc
  Emits values until the given predicate returns `False`,
returning the remainder of the `Pull`.

Totality: total
Visibility: export
takeThrough : Chunkco=> (o->Bool) ->Pullfcesr->Streamfesc
  Like `takeWhile` but also includes the first failure.

Totality: total
Visibility: export
dropUntil : Chunkco=>BreakInstruction-> (o->Bool) ->Pullfcesr->Pullfcesr
  Discards values until the given predicate returns `True`.

The `BreakInstruction` dictates, if the value, for which the
predicate held, should be emitted as part of the remainder or not.

Totality: total
Visibility: export
dropWhile : Chunkco=> (o->Bool) ->Pullfcesr->Pullfcesr
  Drops values from a stream while the given predicate returns `True`,
returning the remainder of the stream.

Totality: total
Visibility: export
dropThrough : Chunkco=> (o->Bool) ->Pullfcesr->Pullfcesr
  Like `dropWhile` but also drops the first value where
the predicate returns `False`.

Totality: total
Visibility: export
split : Chunkco=> (o->Bool) ->Pullfcesr->Pullf (Listc) esr
  Splits a stream of chunks whenever an element fulfills the given
predicate.

Totality: total
Visibility: export
mapMaybe : (o->Maybep) ->Pullf (Listo) esr->Pullf (Listp) esr
  Maps elements of output via a partial function.

Totality: total
Visibility: export
filter : Chunkco=> (o->Bool) ->Pullfcesr->Pullfcesr
  Element-wise filtering of a stream of chunks.

Totality: total
Visibility: export
filterNot : Chunkco=> (o->Bool) ->Pullfcesr->Pullfcesr
  Element-wise filtering of a stream of chunks.

Totality: total
Visibility: export
mapOutput : Functort=> (o->p) ->Pullf (to) esr->Pullf (tp) esr
  Maps a function over all elements emitted by a pull.

Totality: total
Visibility: export
fold : Foldablet=> (p->o->p) ->p->Pullf (to) esr->Pullfpesr
Totality: total
Visibility: export
foldPair : Foldablet=> (p->o->p) ->p->Pullf (to) esr->Pullfqes (p, r)
  Like `fold` but instead of emitting the result as a single
value of output, it is paired with the `Pull`s result.

Totality: total
Visibility: export
foldGet : Foldablet=> (p->o->p) ->p->Streamfes (to) ->Pullfqesp
  Convenience version of `foldPair` for working on streams.

Totality: total
Visibility: export
fold1 : Foldablet=>Chunk (to) o=> (o->o->o) ->Pullf (to) esr->Pullfoesr
  Like `foldC` but will not emit a value in case of an empty pull.

Totality: total
Visibility: export
all : Foldablet=> (o->Bool) ->Pullf (to) esr->StreamfesBool
  Returns `True` if all emitted values of the given stream fulfill
the given predicate

Totality: total
Visibility: export
any : Foldablet=> (o->Bool) ->Pullf (to) esr->StreamfesBool
  Returns `True` if any of the emitted values of the given stream fulfills
the given predicate

Totality: total
Visibility: export
sum : Foldablet=>Numo=>Pullf (to) esr->Pullfoesr
  Emits the sum over all elements emitted by a `Pull`.

Totality: total
Visibility: export
count : Foldablet=>Pullf (to) esr->PullfNatesr
  Emits the number of elements emitted by a `Pull`.

Totality: total
Visibility: export
maximum : Foldablet=>Chunk (to) o=>Ordo=>Pullf (to) esr->Pullfoesr
  Emits the largest output encountered.

Totality: total
Visibility: export
minimum : Foldablet=>Chunk (to) o=>Ordo=>Pullf (to) esr->Pullfoesr
  Emits the smallest output encountered.

Totality: total
Visibility: export
mappend : Foldablet=>Chunk (to) o=>Semigroupo=>Pullf (to) esr->Pullfoesr
  Emits the smallest output encountered.

Totality: total
Visibility: export
foldMap : Foldablet=>Monoidm=> (o->m) ->Pullf (to) esr->Pullfmesr
  Accumulates the emitted values over a monoid.

Note: This corresponds to a left fold, so it will
run in quadratic time for monoids that are
naturally accumulated from the right (such as List)

Totality: total
Visibility: export
interfaceScan : (Type->Type) ->Type
Parameters: f
Constraints: Functor f
Methods:
scanChunk : (s->o-> (p, s)) ->s->fo-> (fp, s)

Implementation: 
ScanList
scanChunk : Scanf=> (s->o-> (p, s)) ->s->fo-> (fp, s)
Totality: total
Visibility: public export
scan : Scant=>s-> (s->o-> (p, s)) ->Pullf (to) esr->Pullf (tp) esr
  Computes a stateful running total over all elements emitted by a
pull.

Totality: total
Visibility: export
zipWithScan : Scant=>p-> (p->o->p) ->Pullf (to) esr->Pullf (t (o, p)) esr
  Zips the input with a running total according to `s`, up to but
not including the current element. Thus the initial
`vp` value is the first emitted to the output:

Totality: total
Visibility: export
zipWithScan1 : Scant=>p-> (p->o->p) ->Pullf (to) esr->Pullf (t (o, p)) esr
  Like `zipWithScan` but the running total is including the current element.

Totality: total
Visibility: export
zipWithIndex : Scant=>Pullf (to) esr->Pullf (t (o, Nat)) esr
  Pairs each element in the stream with its 0-based index.

Totality: total
Visibility: export
zipWithCount : Scant=>Pullf (to) esr->Pullf (t (o, Nat)) esr
  Pairs each element in the stream with its 1-based count.

Totality: total
Visibility: export
runningCount : Scant=>Pullf (to) esr->Pullf (tNat) esr
  Emits the count of each element.

Totality: total
Visibility: export
dataZipRes : Type->Type->Type->Type
Totality: total
Visibility: public export
Constructors:
ZB : Listc->ZipResabc
ZL : Lista->Listc->ZipResabc
ZR : Listb->Listc->ZipResabc
zipAllWith : o1->o2-> (o1->o2->o3) ->Streamfes (Listo1) ->Streamfes (Listo2) ->Streamfes (Listo3)
  Determinsitically zips elements with the specified function, terminating
when the ends of both branches are reached naturally, padding the left
branch with `pad1` and padding the right branch with `pad2` as necessary.

Totality: total
Visibility: export
zipAll : o1->o2->Streamfes (Listo1) ->Streamfes (Listo2) ->Streamfes (List (o1, o2))
  `zipAllWith` specialized to returning a pair of values

Totality: total
Visibility: export
zipWith : (o1->o2->o3) ->Streamfes (Listo1) ->Streamfes (Listo2) ->Streamfes (Listo3)
  Deterministically zips elements, terminating when the end
of either branch is reached naturally.

Totality: total
Visibility: export
zip : Streamfes (Listo1) ->Streamfes (Listo2) ->Streamfes (List (o1, o2))
  `zipAll` specialized to returning a pair of values

Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 6
zipRight : Streamfes (Listo1) ->Streamfes (Listo2) ->Streamfes (Listo2)
Totality: total
Visibility: export
zipLeft : Streamfes (Listo1) ->Streamfes (Listo2) ->Streamfes (Listo1)
Totality: total
Visibility: export