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

Update the generation of the backward functions so that they don't fail #356

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

sonmarcho
Copy link
Member

@sonmarcho sonmarcho commented Nov 12, 2024

The backward functions now don't use the error monad anymore. For instance, the choose function used to be extracted to:

def choose
  {T : Type} (b : Bool) (x : T) (y : T) :
  Result (T × (T → Result (T × T)))
  :=
  if b
  then let back := fun ret => Result.ok (ret, y)
       Result.ok (x, back)
  else let back := fun ret => Result.ok (x, ret)
       Result.ok (y, back)

Now it gets compiled to:

def choose
  {T : Type} (b : Bool) (x : T) (y : T) :
  Result (T × (T → T × T))
  :=
  if b
  then let back := fun ret =>(ret, y)
       Result.ok (x, back)
  else let back := fun ret => (x, ret)
       Result.ok (y, back)

@sonmarcho sonmarcho merged commit adb3f23 into main Nov 13, 2024
10 checks passed
@sonmarcho sonmarcho deleted the son/backward branch November 13, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant