Skip to content

effect cannot be subsumed in recursive function call #397

Answered by anfelor
chtenb asked this question in Q&A
Discussion options

You must be logged in to vote

This error happens due to effect inference. The compiler first encounters parse(input, p) which the effect e introduced by p : parser<e,a>. Koka then tries to unify e with the effect of the function <div,parse|e>. But clearly, they can not be unified: Remember that Koka functions can have the same effect multiple times and so <div,parse|e> is strictly bigger than e.

Here is how to fix it: Remove the parse effect from many-rec since there are no parsing combinators in this function. You can mask the div effect so that it does not apply to parse(input, p):

fun many-rec(p : parser<e,a>, input : sslice, acc : list<a>) : <div|e> (list<a>, sslice)
  match mask<div>
      parse(input, p)
    Par…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@chtenb
Comment options

@anfelor
Comment options

@chtenb
Comment options

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