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
import std/core/listpubeffectyield<a>ctlyield(elem : a) :()// You can override handlers with the override keyword. This uninstalls the original// handler and forwards any effect operation calls to the new effect.fundouble(inner :()-><yield<a>|e>()) :<yield<a>|e>()with overridectlyield(elem)
yield(elem) // Forward the yield to our new yield operation
yield(elem) // Forward the yield to our new yield operation
inner()
// But it doesn't seem to work when the type arguments are differentfunflatten(yield-lists :()-><yield<list<a>>|e>()) :<yield<a>|e>()with overridectlyield(elems)
elems.list/foreach fn(elem)
yield(elem) // Forward the yield to our new yield operation
yield-lists()
Error:
repro.kk(18, 3): type error: types do not match (due to an infinite type)
context : with override ctl yield(elems)
elems.list/foreach fn(elem)
yield(elem)
term : with override ctl yield(elems)
elems.list/foreach fn(elem)
yield(elem)
inferred effect: <yield<list<_a>>,yield<list<_a>>|_e1>
expected effect: <yield<list<_a>>,yield<_a>|_e>
hint : give a type to the function definition?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Error:
Beta Was this translation helpful? Give feedback.
All reactions