Example

effects_test.kina

Source

let run = fn(val : tensor<F32, [], @host>) !{State} -> tensor<F32, [], @host> {
  let current = perform State.get() in
  let next = current + val in
  next
} in
handle run(tensor<F32, [], @host>) with {
  return(x) => x,
  State.get(), k => k(tensor<F32, [], @host>)
}