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

add-reduct doesn't work with new-state in some cases #846

Open
Necr0x0Der opened this issue Feb 4, 2025 · 0 comments
Open

add-reduct doesn't work with new-state in some cases #846

Necr0x0Der opened this issue Feb 4, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Necr0x0Der
Copy link
Collaborator

Describe the bug
add-reduct doesn't work with (new-state (smth 100)) returning a type error

To Reproduce

!(add-reduct &self
  (= (asset s1) (new-state (smth 100))))

Expected behavior
The same as

!(let $x (new-state (smth 100))
   (add-atom &self (= (asset s1) $x)))

That is, new-state should be executed before the equality is added to &self

Actual behavior
[(Error (State (smth 100)) BadType)]

Additional context
Interestingly that the following works (as well as let-expression above)

!(get-type (add-reduct &self
  (= (asset s1) (new-state (smth 100))))) ; [(->)]
!(add-reduct &self
  (= (asset s1) (new-state 100)))
!(asset s1) ; (State 100)
!(add-reduct &self
  (= (asset s1) (new-state A)))
!(asset s1) ; (State A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants