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
The only change is the line collided <- collidedTask |> Task.await to Task.await collidedTask \collided ->
List.walk collisionPoints (Task.okBool.false) \collidedTask, { x, y } ->
collided <- collidedTask |>Task.awaitif collided thenTask.okBool.trueelse
point = {
x: Num.toU8 (playerX + x),
y: Num.toU8 (playerY + y),
}
color = W4.getPixel! point
Task.ok (color != Color1)
List.walk collisionPoints (Task.okBool.false) \collidedTask, { x, y } ->
Task.await collidedTask \collided ->
if collided thenTask.okBool.trueelse
point = {
x: Num.toU8 (playerX + x),
y: Num.toU8 (playerY + y),
}
color = W4.getPixel! point
Task.ok (color != Color1)
── TYPE MISMATCH in examples/rocci-bird.roc ────────────────────────────────────
This expression is used in an unexpected way:
407│> List.walk collisionPoints (Task.ok Bool.false) \collidedTask, { x, y } ->
408│> Task.await collidedTask \collided ->
409│> if collided then
410│> Task.ok Bool.true
411│> else
412│> point = {
413│> x: Num.toU8 (playerX + x),
414│> y: Num.toU8 (playerY + y),
415│> }
416│> color = W4.getPixel! point
417│> Task.ok (color != Color1)
This walk call produces:
InternalTask.Task Bool *
But you are trying to use it as:
{}a
Tip: Type comparisons between an opaque type are only ever equal if
both types are the same opaque type. Did you mean to create an opaque
type by wrapping it? If I have an opaque type Age := U32 I can create
an instance of this opaque type by doing @Age 23.
── TYPE MISMATCH in examples/rocci-bird.roc ────────────────────────────────────
Something is off with the body of the onScreenCollided definition:
This Task.ok call produces:
Task {} []
But the type annotation on onScreenCollided says it should be:
Task Bool []
────────────────────────────────────────────────────────────────────────────────
The text was updated successfully, but these errors were encountered:
lukewilliamboswell
changed the title
Investigate Task.await behaviour in bocci-bird
Investigate Task.await behaviour in rocci-bird
Apr 21, 2024
Update - as a workaround in bocci-bird I've pull the closure out into a helper and that has resolved the issue. But this still seems like an interesting edge case.
Investigate why the two below are not equal.
The only change is the line
collided <- collidedTask |> Task.await
toTask.await collidedTask \collided ->
The text was updated successfully, but these errors were encountered: