You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pub effect yield<a>
ctl yield(elem : a) : ()
pub fun map(it : () -> <yield<a>|e> (), f : a -> b) : <yield<b>|e> ()
with override ctl yield(elem)
yield(f(elem))
resume(())
it()
This does not work
repro.kk(6, 3): type error: abstract types do not match
context : with override ctl yield(elem)
yield(f(elem))
resume(())
term : with override ctl yield(elem)
yield(f(elem))
resume(())
inferred effect: <yield<$a>,yield<$a>|_e1>
expected effect: <yield<$a>,yield<$b>|_e>
hint : an higher-rank type escapes its scope?
If we replace the type b with a, it does work.
I'm unsure why the inferred effect is <yield<$a>,yield<$a>|_e1>, because clearly the result of f is b.
Why does this fail, and how can we make it work?
The text was updated successfully, but these errors were encountered:
Discussed in #600
Originally posted by chtenb October 24, 2024
This does not work
If we replace the type
b
witha
, it does work.I'm unsure why the inferred effect is
<yield<$a>,yield<$a>|_e1>
, because clearly the result off
isb
.Why does this fail, and how can we make it work?
The text was updated successfully, but these errors were encountered: