Skip to content

Begginner problem with error: "Computed type "" and effect "ALL" is not compatible with the annotated type " " effect "Tot"" #2559

Answered by aseemr
alex4482 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @alex4482:

The type clause -> clause -> literal -> guessLevel -> memory -> clause & guessLevel is a shorthand for clause -> clause -> literal -> guessLevel -> memory -> Tot (clause & guessLevel). Notice the Tot annotation at the result type. This means that F* expects the function to be total and without any side-effects.

If you want to write effectful code, e.g. that throws exceptions, you need to annotate the type as such, e.g. you could say: clause -> clause -> literal -> guessLevel -> memory -> ML (clause & guessLevel), where ML is an effect that allows divergence, state, and exception.

There are other refinements of ML you could use, e.g. All that allows for writing pre- and postc…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by alex4482
Comment options

You must be logged in to vote
1 reply
@klinvill
Comment options

Comment options

You must be logged in to vote
1 reply
@alex4482
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants