Skip to content

Commit c65ed13

Browse files
committed
add lift method for Scala 3
1 parent c7e36cd commit c65ed13

File tree

9 files changed

+42
-0
lines changed

9 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package org.atnos.eff
2+
3+
abstract class AugmentCompanion { self: Augment.type => }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package org.atnos.eff
2+
3+
abstract class TranslateCompanion { self: Translate.type => }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package org.atnos.eff
2+
3+
abstract class WriteCompanion { self: Write.type => }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.atnos.eff
2+
3+
abstract class AugmentCompanion { self: Augment.type =>
4+
final def lift[T[_], O[_]](f: [X] => T[X] => O[Unit]): Augment[T, O] =
5+
new Augment[T, O] {
6+
override def apply[Y](tx: T[Y]): O[Unit] =
7+
f[Y](tx)
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.atnos.eff
2+
3+
abstract class TranslateCompanion { self: Translate.type =>
4+
final def lift[T[_], U](f: [X] => T[X] => Eff[U, X]): Translate[T, U] =
5+
new Translate[T, U] {
6+
override def apply[Y](kv: T[Y]): Eff[U, Y] =
7+
f[Y](kv)
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.atnos.eff
2+
3+
abstract class WriteCompanion { self: Write.type =>
4+
final def lift[T[_], O](f: [X] => T[X] => O): Write[T, O] =
5+
new Write[T, O] {
6+
override def apply[Y](tx: T[Y]): O =
7+
f[Y](tx)
8+
}
9+
}

Diff for: core/shared/src/main/scala/org/atnos/eff/Augment.scala

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ package org.atnos.eff
33
trait Augment[T[_], O[_]] {
44
def apply[X](tx: T[X]): O[Unit]
55
}
6+
7+
object Augment extends AugmentCompanion

Diff for: core/shared/src/main/scala/org/atnos/eff/Translate.scala

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ package org.atnos.eff
66
trait Translate[T[_], U] {
77
def apply[X](kv: T[X]): Eff[U, X]
88
}
9+
10+
object Translate extends TranslateCompanion

Diff for: core/shared/src/main/scala/org/atnos/eff/Write.scala

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ package org.atnos.eff
33
trait Write[T[_], O] {
44
def apply[X](tx: T[X]): O
55
}
6+
7+
object Write extends WriteCompanion

0 commit comments

Comments
 (0)