Skip to content

Commit

Permalink
added CpsTryEffectMonad for monads which can be delayed but not async
Browse files Browse the repository at this point in the history
  • Loading branch information
rssh committed Dec 29, 2023
1 parent 7da139a commit d7aecea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 11 additions & 1 deletion shared/src/main/scala/cps/CpsMonad.scala
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,22 @@ trait CpsEffectMonad[F[_]] extends CpsMonad[F] {

}

object CpsEffectMonad {

type Aux[F[_],C<:CpsMonadContext[F]] = CpsEffectMonad[F] { type Context = C }

}

/**
* Effect with Try support
**/
trait CpsTryEffectMonad[F[_]] extends CpsEffectMonad[F] with CpsTryMonad[F]


/**
* Async Effect Monad
*/
trait CpsAsyncEffectMonad[F[_]] extends CpsAsyncMonad[F] with CpsEffectMonad[F]
trait CpsAsyncEffectMonad[F[_]] extends CpsAsyncMonad[F] with CpsTryEffectMonad[F]



Expand Down
8 changes: 0 additions & 8 deletions shared/src/main/scala/cps/CpsMonadContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ trait CpsPureMonadInstanceContext[F[_]] extends CpsMonad[F] {
op(CpsPureMonadInstanceContextBody(this))


///**
//* If is it statically known, that monad is evaluated in this context, then
//* this call is completely eliminated by dotty-cps-async macro
//*@return fa
//**/
//def adoptAwait[A](fa:F[A]):F[A] = fa


}

class CpsThrowMonadInstanceContextBody[F[_]](val m: CpsThrowMonadInstanceContext[F]) extends CpsThrowMonadContext[F] {
Expand Down

0 comments on commit d7aecea

Please sign in to comment.