Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Proposal : ContT : minimal usage example of shift/reset

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
haskell
Domain
documentation

Research direction

Start with the ContT Haddocks and the shiftT/resetT entry points mentioned in the issue, then determine where a minimal usage example belongs. Add the proposed example or an equivalent demonstration, and confirm that the Haddocks clearly explain the resulting non-local control flow and output.

Written by the indexing model from the issue text.

Description

[original issue 81 by @ocramz]

Since delimited continuations are far from intuitive, I would like to add at least one usage example to their haddocks, something along these lines :

-- | demonstration of non-local control flow with a single shift/reset pair
--
-- λ> flip runState [] $ evalContT t1
-- (2,[2,0,1])
t1 :: ContT Int (State [Int]) Int
t1 = resetT $ do
  let
    x = 1 -- input
    cons w = lift $ modify (w :)
  r <- shiftT $ \k -> do
    cons x -- initial state uses the input
    let y = succ x -- compute a function of the input
    z <- lift $ k y -- delegate to the continuation k
    cons z -- mutate state with the return value of k
    pure y
  cons 0
  pure r
Dominant language
Haskell
Stars
5
Forks
10
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/transformers

All issues in haskell/transformers

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.