Replies: 1 comment 5 replies
-
Good point. In general you cannot say anything about termination of the So the question is, do we go for the safe annotation, or for the annotation that reflects what grammars should be designed for. In this case Daan chose the second, which I'm inclined to agree with for a few reasons:
So the intent of the claim that the My suggested resolution to this issue (which definitely could lead to a real problem when working on a parser - though not a problem that wouldn't also exist in a language without effect types) would be to create an linter that checks for the more specific invariant that Koka's automatic divergence removal understands that basic structural recursion terminates, and recognizes where things could diverge through handlers or references in the heap, but doesn't try to do much more than that. It is then up to the user where to judiciously use Personally I think that the |
Beta Was this translation helpful? Give feedback.
-
The
std/text/parse/many
parser combinator can diverge, along with itsmany1
variant.This is pretty easily observable by passing in a parser which matches zero characters of a string yet succeeds, for example,
whitespace0
on a string which contains non-whitespace characters.Should the
div
effect be added to the effect annotation on the function?Beta Was this translation helpful? Give feedback.
All reactions