packages feed

tilia-0.2.0.0: corpora/vendored/cpp/comment/comment-at-the-end-of-a-branch-above-code-copied-into-it-out.hs

{-# LANGUAGE CPP #-}

module Queue.MichaelScott where

pop queue = do
  next <- readNext queue
#ifdef RECHECK_ASSUMPTIONS
  if consistent next
    then pop queue
    else do
      -- Only a consistent snapshot is worth finishing.
      finish next
#else
  do
    finish next
#endif

push queue x =
#ifdef RECHECK_ASSUMPTIONS
  if full queue
    then push queue x
    else
      -- A full queue is retried as it stands.
      store queue x
#else
  store queue x
#endif

peek :: Queue -> IO (Maybe Int)
peek queue =
#ifdef RECHECK_ASSUMPTIONS
  mfilter (not . stale)
    -- What is stale goes, whatever the head says.
    <$> readHead queue
#else
  readHead queue
#endif