Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show unit types on frontend components #3331

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

michaeldickens
Copy link
Contributor

@michaeldickens michaeldickens commented Jul 22, 2024

Note: The base should be type-checking but that branch only exists on my fork, not on quantified-uncertainty/squiggle. The actual diff for this PR is: https://github.com/quantified-uncertainty/squiggle/pull/3331/files/88342c0d4186264e5c7eddad5594b12c5cdbfadc..f8a27ba36221ca116d5a3ca85604e5a6bd6a725f

This PR sets explicit and inferred unit types onto variables as decorators and displays unit types on the SquigglePlayground component.

The UI currently looks like this:
sq :: closed

With expanded display:
sq :: open

With multiple variables:
sq multi vars ::

Copy link

changeset-bot bot commented Jul 22, 2024

⚠️ No Changeset found

Latest commit: 0865846

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jul 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ❌ Failed (Inspect) Jul 23, 2024 4:37pm
quri-ui ✅ Ready (Inspect) Visit Preview Jul 23, 2024 4:37pm
squiggle-components ✅ Ready (Inspect) Visit Preview Jul 23, 2024 4:37pm
squiggle-website ✅ Ready (Inspect) Visit Preview Jul 23, 2024 4:37pm

Copy link

vercel bot commented Jul 22, 2024

@michaeldickens is attempting to deploy a commit to the Quantified Uncertainty Team on Vercel.

A member of the Team first needs to authorize it.

@berekuk
Copy link
Collaborator

berekuk commented Jul 23, 2024

Thoughts on this PR:

  • storing types in decorators instead of AST is a nice trick
  • unfortunately it breaks the prettier plugin
  • there are workarounds, like flagging decorators with implicit boolean prop, but that seems hacky
  • so I'd like to postpone this until we get the actual "typed AST" exposed to the frontend; then we will obtain this information from AST by going through SqValueContext.valueAst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 To prioritize
Development

Successfully merging this pull request may close these issues.

2 participants