Skip to content

Commit

Permalink
Axn.unit
Browse files Browse the repository at this point in the history
  • Loading branch information
durban committed Jul 19, 2023
1 parent 8c3ab0f commit befb118
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/shared/src/main/scala/dev/tauri/choam/core/Axn.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit befb118

Please sign in to comment.