patrick-kidger / patrick-kidger/typsy

`safe-state.update` doesn't work with unnamed function

Open
#1 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Typst
Stars
30
Forks
1
PR merge metrics
No merged PRs in 30d

Description

#let a = state("state", 5)
#a.update(n => n + 5)
#context assert.eq(a.get(), 10)

#import "@preview/typsy:0.2.0"
#let a = typsy.safe-state(() => {}, 5)
#(a.update)(n => n + 5)
#context assert.eq((a.get)(), 10) // Failed assertion.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Reproduce the issue with the provided Typst snippet, comparing the working state("state", 5) update with typsy.safe-state and its unnamed function. Trace how safe-state exposes update and get, then verify that applying n => n + 5 makes the final assertion evaluate to 10.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.