loop
╭──────────────╮
b │ ╭───╮ │ c
>───┼─────┤ ├────┼───>
│ ┌─┤ ├─┐ │
│ d │ ╰───╯ │ │
│ └───<───┘ │
╰──────────────╯
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"
"for" loop with increment at end of body
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
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.
Repeteadly try to parse raw JSON bytes into
a values,
reporting any
DecodingErrors downstream as they happen.
Note: The JSON RFC-4627 standard only allows arrays or objects
as top-level entities, which is why these functions restrict their
input to them. If you prefer to ignore the standard and encode any
Value, then use
encode from the
Pipes.Aeson.Unchecked module.
Repeteadly try to parse raw JSON bytes into
a values,
reporting any
DecodingErrors downstream as they happen.
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.
Type tag for "loopy" trails which return to their starting point.