Skip to content

Commit

Permalink
minor syntax update
Browse files Browse the repository at this point in the history
  • Loading branch information
moleike committed Jan 7, 2024
1 parent 19fe4bd commit f2f6185
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/src/main/scala/evidence/effect/Chronicle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ object Chronicle:

private[evidence] final class Ops[A](val dummy: Boolean = true)
extends AnyVal:
def confess[E](a: A)(using Ctx.In[Chronicle[A, *, *], E]): Eff[E, Nothing] =
def confess[E](a: A)(using Chronicle[A, *, *] :? E): Eff[E, Nothing] =
Eff.perform[A, Nothing, E, Chronicle[A, *, *]](
[E, Ans] => (_: Chronicle[A, *, *][E, Ans]).confess
)(a)

def dictate[E](a: A)(using Ctx.In[Chronicle[A, *, *], E]): Eff[E, Unit] =
def dictate[E](a: A)(using Chronicle[A, *, *] :? E): Eff[E, Unit] =
Eff.perform[A, Unit, E, Chronicle[A, *, *]](
[EE, Ans] => (_: Chronicle[A, *, *][EE, Ans]).dictate
)(a)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/evidence/effect/Except.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Except:

private[evidence] final class Ops[A](val dummy: Boolean = true)
extends AnyVal:
def raise[E](a: A)(using Ctx.In[Except[A, *, *], E]): Eff[E, Nothing] =
def raise[E](a: A)(using Except[A, *, *] :? E): Eff[E, Nothing] =
Eff.perform[A, Nothing, E, Except[A, *, *]](
[E, Ans] => (_: Except[A, E, Ans]).raise
)(a)
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/evidence/effect/NonDet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ object NonDet:
[EE, Ans] => (_: NonDet[EE, Ans]).empty
)(())

given [E](using Ctx.In[NonDet, E], Monad[Eff[E, *]]): Alternative[Eff[E, *]]
with {
given [E](using NonDet :? E, Monad[Eff[E, *]]): Alternative[Eff[E, *]] with {
def empty[A]: Eff[E, A] = NonDet.empty
def pure[A](x: A): Eff[E, A] = Monad[Eff[E, *]].pure(x)
def ap[A, B](ff: Eff[E, A => B])(fa: Eff[E, A]): Eff[E, B] =
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/evidence/effect/Reader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Reader:

private[evidence] final class Ops[A](val dummy: Boolean = true)
extends AnyVal:
def ask[E](using Ctx.In[Reader[A, *, *], E]): Eff[E, A] =
def ask[E](using Reader[A, *, *] :? E): Eff[E, A] =
Eff.perform[Unit, A, E, Reader[A, *, *]](
[EE, Ans] => (_: Reader[A, EE, Ans]).ask
)(())
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/evidence/effect/State.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ object State:

private[evidence] final class Ops[A](val dummy: Boolean = true)
extends AnyVal:
def get[E](using Ctx.In[State[A, *, *], E]): Eff[E, A] =
def get[E](using State[A, *, *] :? E): Eff[E, A] =
Eff.perform[Unit, A, E, State[A, *, *]](
[EE, Ans] => (_: State[A, *, *][EE, Ans]).get
)(())

def put[E](a: A)(using Ctx.In[State[A, *, *], E]): Eff[E, Unit] =
def put[E](a: A)(using State[A, *, *] :? E): Eff[E, Unit] =
Eff.perform[A, Unit, E, State[A, *, *]](
[EE, Ans] => (_: State[A, *, *][EE, Ans]).put
)(a)
2 changes: 1 addition & 1 deletion core/src/main/scala/evidence/effect/Writer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Writer:
def apply[A]: Ops[A] = new Ops[A]

final class Ops[A](val dummy: Boolean = true) extends AnyVal:
def tell[E](a: A)(using Ctx.In[Writer[A, *, *], E]): Eff[E, Unit] =
def tell[E](a: A)(using Writer[A, *, *] :? E): Eff[E, Unit] =
Eff.perform[A, Unit, E, Writer[A, *, *]](
[EE, Ans] => (_: Writer[A, EE, Ans]).tell
)(a)
Expand Down

0 comments on commit f2f6185

Please sign in to comment.