From befb118bff8227df7fdc6e3481fef0e539efa051 Mon Sep 17 00:00:00 2001 From: Daniel Urban Date: Wed, 19 Jul 2023 21:40:48 +0200 Subject: [PATCH] Axn.unit --- .../src/main/scala/dev/tauri/choam/core/Axn.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/shared/src/main/scala/dev/tauri/choam/core/Axn.scala b/core/shared/src/main/scala/dev/tauri/choam/core/Axn.scala index 614930845..59878a44b 100644 --- a/core/shared/src/main/scala/dev/tauri/choam/core/Axn.scala +++ b/core/shared/src/main/scala/dev/tauri/choam/core/Axn.scala @@ -28,14 +28,17 @@ final object Axn { final def pure[A](a: A): Axn[A] = Rxn.pure(a) + final def unit: Axn[Unit] = + pure(()) + final object unsafe { - def delay[A](da: => A): Axn[A] = + final def delay[A](da: => A): Axn[A] = Rxn.unsafe.delay[Any, A](_ => da) - def suspend[A](daa: => Axn[A]): Axn[A] = // TODO: optimize + final def suspend[A](daa: => Axn[A]): Axn[A] = // TODO: optimize this.delay(daa).flatten - def context[A](uf: Mcas.ThreadContext => A): Axn[A] = + final def context[A](uf: Mcas.ThreadContext => A): Axn[A] = Rxn.unsafe.context(uf) - def suspendContext[A](uf: Mcas.ThreadContext => Axn[A]): Axn[A] = + final def suspendContext[A](uf: Mcas.ThreadContext => Axn[A]): Axn[A] = Rxn.unsafe.suspendContext(uf) } }