Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Dec 12, 2023
1 parent d9a87b9 commit d38650b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions kyo-core/shared/src/main/scala/kyo/joins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import kyo.core._
import kyo.ios._
import kyo.aborts._
import kyo.envs._
import kyo.lists.Lists
import kyo.seqs._
import izumi.reflect._
import kyo.resources.Resources

Expand Down Expand Up @@ -34,12 +34,12 @@ object joins {
l: Seq[T > (E with S)]
)(implicit
f: Flat[T > (E with S)]
): List[M[T]] > (S with IOs) =
Lists.traverse(l.toList)(handle(s, _))
): Seq[M[T]] > (S with IOs) =
Seqs.traverse(l.toList)(handle(s, _))

def resume[T, S](l: Seq[M[T] > S]): Seq[T] > (E with S with IOs) =
Lists.collect(l.toList).map { ls =>
Lists.traverse(ls)(resume)
Seqs.collect(l.toList).map { ls =>
Seqs.traverse(ls)(resume)
}

def andThen[E2](j: Joins[E2]): Joins[E with E2] =
Expand Down Expand Up @@ -105,18 +105,17 @@ object joins {
v
}

implicit val lists: Joins[Lists] =
new Joins[Lists] {
implicit val lists: Joins[Seqs] =
new Joins[Seqs] {
type State = Unit
type M[T] = List[T]
type M[T] = Seq[T]

def save = ()
def handle[T, S](s: Unit, v: T > (Lists & S))(implicit f: Flat[T > (Lists & S)]) =
Lists.run(v)
def resume[T, S](v: List[T] > S): T > (Lists & S) =
Lists.foreach(v)
def handle[T, S](s: Unit, v: T > (Seqs & S))(implicit f: Flat[T > (Seqs & S)]) =
Seqs.run(v)
def resume[T, S](v: Seq[T] > S): T > (Seqs & S) =
Seqs.get(v)
}


}
}
2 changes: 1 addition & 1 deletion kyo-llm/shared/src/main/scala/kyo/llm/ais.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ object ais {
} yield r
}

object AIs {
object AIs {

type Effects = Sums[State] with Requests

Expand Down

0 comments on commit d38650b

Please sign in to comment.