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

display can omit local definitions and show hash references #5496

Open
ceedubs opened this issue Dec 10, 2024 · 1 comment
Open

display can omit local definitions and show hash references #5496

ceedubs opened this issue Dec 10, 2024 · 1 comment
Labels

Comments

@ceedubs
Copy link
Contributor

ceedubs commented Dec 10, 2024

Describe and demonstrate the bug

fresh/main> builtins.merge

  Done.

The following is a fairly straightforward factorial implementation that recurses into an inner go function.

factorial : Nat -> Nat
factorial =
  go acc n =
    if n <= 1 then acc
    else go (acc * n) (Nat.drop n 1)
  go 1
  Loading changes detected in scratch.u.

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:

    ⍟ These new definitions are ok to `add`:
    
      factorial : Nat -> Nat

Now we display it:

fresh/main> display factorial

  n ->
    (if n <= 1 then 1
    else #o5diegpfvg (1 Nat.* n) (Nat.drop n 1))

There are several weird things about this result:

  1. It doesn't show the definition of go.
  2. It references an unnamed term #o5diegpfvg.
  3. The connection between the displayed and actual implementation isn't clear to me. It looks like it's mixing up n and acc. It might just be that it has been through a reduction/optimization pass, but without knowing what #o5diegpfvg looks like, it's hard to say.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • ucm --version 0.5.29
@ceedubs ceedubs added the bug label Dec 10, 2024
@aryairani
Copy link
Contributor

What about view factorial or view #o5diegpfvg?

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

No branches or pull requests

2 participants