Skip to content

Commit

Permalink
add module doc for RaceIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Aug 16, 2023
1 parent 65a6953 commit 676b859
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ module Test.Ouroboros.Consensus.ChainGenerator.RaceIterator (
, nextConservative
) where

{- | 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 that isn't the case, 'init' and 'next' return 'Nothing' and we fall back to 'initConservative' and
'nextConservative', which pad the window with only active slots.
-}
import Control.Monad (when)
import Data.Proxy (Proxy (Proxy))
import Prelude hiding (init)
Expand Down Expand Up @@ -56,7 +72,7 @@ init (Kcp k) v = do
kPlus1st

-- | @initConservative@ is like @init@, but assumes that any Race window
-- spilling the vector length has all the excedent slots active.
-- spilling the vector length spans the full stability window (minus delta) and has all the exceeding slots active.
--
-- This function is only safe to call when we know that 'init' would return
-- @Nothing@.
Expand Down

0 comments on commit 676b859

Please sign in to comment.