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 Monadic Try construct to the Stainless library #1515

Merged
merged 9 commits into from
May 3, 2024

Conversation

samuelchassot
Copy link
Collaborator

No description provided.

@samuelchassot
Copy link
Collaborator Author

An inline version of the flatMap function works well, but only with Dotty, not scalac.

inline def flatMap[U](inline f: T => Try[U]): Try[U] = this match {
      case Success(t) => f(t)
      case Failure(exc: Exception) => Failure(exc)
    }

@samuelchassot samuelchassot changed the title Add Monadic Try construct the Stainless library Add Monadic Try construct to the Stainless library May 2, 2024
Copy link
Collaborator

@vkuncak vkuncak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work to remove the BigInt import as BigInt should be visible by default.


import stainless.lang._
import stainless.proof._
import scala.collection.immutable.Range.BigInt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we import scala.collection.immutable.Range.BigInt ? I did not see this in other Stainless programs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, that was imported automatically by metals and I didn't spot it.

@vkuncak vkuncak merged commit 47806ea into epfl-lara:main May 3, 2024
2 checks passed
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.

2 participants