Proposal : ContT : minimal usage example of shift/reset
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haskell/transformers
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
haskell/transformers#21 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
haskell/transformers#130 · 1 comment ·
-
Strictness testing of transformersMay be free again @ynishiza claimed this 112 days ago, and no pull request is open. Openenhancement good first issue help wanted
haskell/transformers#123 · 21 comments · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
haskell/transformers#100 · 2 comments ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
haskell/transformers#98 · 4 comments · 1 reaction ·
All issues in haskell/transformers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
halogenandtoast/ArkhamHorror#5805 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
objectionary/phino#1724 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
tomjaguarpaw/bluefin#108 ·
-
infrastructure
Difficulty 1/5 Under an hour Newbie friendliness 92/100
alunduil/collection-json.hs#373 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
digital-asset/daml#23439 ·
Maintainers usually reply within 1 day