loop -package:pipes-aeson

╭──────────────╮
b │     ╭───╮    │ c
>───┼─────┤   ├────┼───>
│   ┌─┤   ├─┐  │
│ d │ ╰───╯ │  │
│   └───<───┘  │
╰──────────────╯
"for" loop with increment at end of body
A looping operation, where the predicate returns Left as a seed for the next loop or Right to abort the loop.
loop (\x -> if x < 10 then Left $ x * 2 else Right $ show x) 1 == "16"
Combinator for the loop attribute. Example:
div ! loop "bar" $ "Hello."
Result:
<div loop="bar">Hello.</div>
Create a Pipe from a ListT transformation
loop (k1 >=> k2) = loop k1 >-> loop k2

loop return = cat
Loop the supplied stream (first argument) around each element of the input stream (second argument) generating tuples. This is an argument flipped version of cross.
Efficient loop with an accumulator
Create a loop (feedback) from one node to another one. That is, compute the fix point of a process iteration.
Fast loops (for when GHC can't optimize forM_)
loop start end f: Loops from start to end (inclusive), executing f on each iteration. Same as forM_ [start..end] f. Uses succ inside, which does a bounds (overflow) check.
loops the sample (from begin to end) the specified number of times.
I will call the connection from input to output amplitudes of type amp the looping channel. It is essential, that the looping channel decouples output from input amplitude. You can achieve this by inserting one of the forceAmplitude functions somewhere in the looping channel.
A loop with a break command. Run the action repeatedly until the breaking action is called. The action is run in a scope. See also while.
x <- mutable_ x
loop $ \break -> do
iff_ (x %>= 10) break
x @= x + 1
Like cycle, but return an empty list when the source list is empty.
loop allows the construction of recursive queries, using Postgres' WITH RECURSIVE under the hood. The first argument to loop is what the Postgres documentation refers to as the "non-recursive term" and the second argument is the "recursive term", which is defined in terms of the result of the "non-recursive term". loop uses UNION ALL to combine the recursive and non-recursive terms. Denotionally, loop s f is the smallest set of rows r such that
r == s `unionAll` (r >>= f)
Operationally, loop s f takes each row in an initial set s and supplies it to f, resulting in a new generation of rows which are added to the result set. Each row from this new generation is then fed back to f, and this process is repeated until a generation comes along for which f returns an empty set for each row therein.
Type tag for "loopy" trails which return to their starting point.