Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

These functions iteratively produce all race windows in a slot vector.

The first window is produced by `init`

, which unconditionally starts the window at the first slot.
This window can then be passed to `next`

, which starts the new window after the first active slot.

---X--X--X--X-- ... ^ start of window 1 from`init`

^ start of window 2 from`next`

^ start of window 3 from`next`

Valid windows must have `k+1`

active slots.
If the vector doesn't have sufficient slots to meet this condition, `init`

and `next`

return `Nothing`

and we fall back
to `initConservative`

and `nextConservative`

, which return windows truncated at the end of time.

## Synopsis

- newtype Race base where
- UnsafeRace (SomeWindow RaceLbl base SlotE)
- pattern Race ∷ SomeWindow RaceLbl base SlotE → Race base

- data RaceLbl
- init ∷ Kcp → Vector base SlotE S → Maybe (Race base)
- initConservative ∷ Vector base SlotE S → Race base
- next ∷ ∀ base. Vector base SlotE S → Race base → Maybe (Race base)
- nextConservative ∷ ∀ base. Vector base SlotE S → Race base → Maybe (Race base)

# Documentation

A window whose last slot contains the `k+1`

st active slot in it

UnsafeRace (SomeWindow RaceLbl base SlotE) |

pattern Race ∷ SomeWindow RaceLbl base SlotE → Race base |

init ∷ Kcp → Vector base SlotE S → Maybe (Race base) Source #

Yields the race window starting at position 0 of the given
vector if the `k+1`

active slot exists.

initConservative ∷ Vector base SlotE S → Race base Source #

`initConservative`

creates a window for the whole vector.