Closed TimWhiting closed 7 months ago
It doesn't happen when I remove the effect annotation on the function.
pub fun partition( xs : list<a>, pred : a -> bool ) : (list<a>,list<a>)
fun iter(ys, acc1, acc2)
match ys
Nil -> (acc1 ++. Nil, acc2 ++. Nil)
Cons(x,xx) -> if pred(x)
then iter(xx,acc1 ++ ctx Cons(x,_),acc2)
else iter(xx,acc1,acc2 ++ ctx Cons(x,_))
iter(xs, ctx _, ctx _)
Also it would be useful to be able to annotate pred as ^pred: (^a -> bool)
, which would allow this function to be fip(1)
.
I just was switching the partition function in the core library to use constructor contexts, but ran into the following error: (It doesn't happen if I copy the definitions to my own file, and compile it, so it has something to do with it being in core.kk)
*** internal compiler error: Backend.C.genLambda: std/core/partition-acc. has multiple value type fields that each contain both raw types and regular types.
hint: use 'box' on either field to make it a non-value type