-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added zio implementation for EffectBackend. Moved htypes to htypes-core
- Loading branch information
Showing
56 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
htypes-zio/src/main/scala/com/svenvandam/htypes/effect/zio/ZIOEffectBackend.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.svenvandam.htypes.effect.zio | ||
|
||
import com.svenvandam.htypes.effect.EffectBackend | ||
import zio.Task | ||
|
||
object ZIOEffectBackend { | ||
|
||
/** | ||
* [[EffectBackend]] instance for [[Task]] | ||
*/ | ||
implicit val zioTaskEffectBackend = new EffectBackend[Task] { | ||
def lift[A](a: => A): Task[A] = Task(a) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
log4j.rootLogger = INFO, CONSOLE | ||
log4j.logger.org.apache = ERROR, CONSOLE | ||
log4j.logger.org.eclipse = WARN, CONSOLE | ||
log4j.logger.org.mortbay = WARN, CONSOLE | ||
log4j.logger.com.svenvandam = DEBUG, CONSOLE | ||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender | ||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.CONSOLE.layout.conversionPattern=%d{HH:mm:ss} %-5p %c - %m%n |
25 changes: 25 additions & 0 deletions
25
htypes-zio/src/test/scala/com/svenvandam/htypes/effect/zio/ZIOEffectBackendTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.svenvandam.htypes.effect.zio | ||
|
||
import com.svenvandam.htypes.effect.EffectUtils | ||
import org.scalatest.FunSuite | ||
import org.scalatest.Matchers._ | ||
import ZIOEffectBackend._ | ||
import zio.DefaultRuntime | ||
|
||
class ZIOEffectBackendTest extends FunSuite { | ||
test("it should delay side effect") { | ||
var x = 0 | ||
|
||
def action = x = 1 | ||
|
||
val io = EffectUtils.lift(action) | ||
|
||
x shouldBe 0 | ||
|
||
val runtime = new DefaultRuntime {} | ||
|
||
runtime.unsafeRun(io) | ||
|
||
x shouldBe 1 | ||
} | ||
} |