-
Hi again. i have received that error in the title. and i also have a different problem. I 'translated' this function from haskell because i need to and i am still a beginner in F*, but in Haskell you could write 'error "message" ', and if the program would end up on that branch, it would throw an error. Is there and equivalent for this in F*? I am asking because i havent found one yet. (this is why i commented 2 lines in my function) //edit my function is this, it's a bit long and with many branches so i am sorry if its a problem, but maybe you could at least explain what that error means. I've encountered the opposite error (Tot in the place of ALL, and ALL in the place of Tot), but not this one. val resoluteTwoClauses : clause -> clause -> literal -> guessLevel -> memory -> clause & guessLevel |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @alex4482: The type 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: There are other refinements of (Also, I could not run F* on your code snippet to see the actual error. If you could post self-contained examples, or links to them, then we can try to reproduce the error ourselves and provide better feedback.) |
Beta Was this translation helpful? Give feedback.
-
Another tip @alex4482 You can format your code as a literal block in markdown by placing it within a triple quote block.
|
Beta Was this translation helpful? Give feedback.
-
Also, recall that unlike Haskell, total functions in F* are really total mathematical functions: they can't raise errors, do IO etc. This makes "printf-debugging" for total functions a little tricky. |
Beta Was this translation helpful? Give feedback.
Hi @alex4482:
The type
clause -> clause -> literal -> guessLevel -> memory -> clause & guessLevel
is a shorthand forclause -> clause -> literal -> guessLevel -> memory -> Tot (clause & guessLevel)
. Notice theTot
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)
, whereML
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…