Proposal: ContT : add minimal usage example of delimited continuations
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- haskell
- Domain
- documentation
Research direction
Start at the ContT Haddock documentation and review how shiftT and resetT are currently explained. Add the proposed minimal usage example, preserving its demonstration of non-local control flow, and confirm that the documented result makes the single shift/reset pair understandable.
Written by the indexing model from the issue text.
Description
[original issue 80 by @ocramz]
Since shift/reset are not intuitive, I'd like to add at least one example to the ContT haddock, something along the lines of :
-- | demonstration of non-local control flow with a single shift/reset pair
--
-- λ> run t1
-- ('b',"b_a")
t1 :: ContT Char (State [Char]) Char
t1 = resetT $ do
let
x = 'a' -- input
cons w = lift $ modify (w :)
r <- shiftT $ \k -> do
cons x -- initial state uses the input
let x' = succ x -- compute a function of the input
y <- lift $ k x' -- delegate to the continuation k
cons y -- mutate state with the return value of k
pure x'
cons '_'
pure r
- Dominant language
- Haskell
- Stars
- 5
- Forks
- 10
- Avg merge
- 2h 21m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
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 3/5 1-2 days Newbie friendliness 72/100
haskell/transformers#130 · 1 comment ·
-
enhancement good first issue help wanted
haskell/transformers#123 · 20 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 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
haskell/transformers#96 · 1 reaction ·
All issues in haskell/transformers
Similar issues
-
chore
Difficulty 1/5 Under an hour Newbie friendliness 91/100
alunduil/alunduil-chezmoi#792 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
koalaman/shellcheck#3539 ·
-
time-manager-0.4.0 Openfailure: bounds
Difficulty 1/5 Under an hour Newbie friendliness 72/100
commercialhaskell/stackage#8122 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
objectionary/phino#1350 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100