-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
badde05
commit b9ee6f4
Showing
1 changed file
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package aquascape | ||
|
||
import cats.effect.* | ||
import aquascape.drawing.Config | ||
import doodle.java2d.* | ||
import doodle.syntax.all.* | ||
import doodle.core.format.* | ||
|
||
object AquascapeApp { | ||
trait Core { | ||
def config: Config = Config.default | ||
|
||
def stream(using Stage[IO]): IO[Unit] | ||
} | ||
|
||
trait Simple extends IOApp.Simple with Core { | ||
def run: IO[Unit] = Stage | ||
.unchunked[IO] | ||
.flatMap { case t @ given Stage[IO] => | ||
stream(using t).draw() | ||
} | ||
.flatMap(_.drawToIO()) | ||
} | ||
object Simple { | ||
abstract class File(name: String) extends IOApp.Simple with Core { | ||
def run: IO[Unit] = Stage | ||
.unchunked[IO] | ||
.flatMap { case t @ given Stage[IO] => | ||
stream(using t).draw() | ||
} | ||
.flatMap(_.writeToIO[Png](s"$name.png")) | ||
} | ||
} | ||
|
||
trait Chunked extends IOApp.Simple with Core { | ||
def run: IO[Unit] = Stage | ||
.unchunked[IO] | ||
.flatMap { case t @ given Stage[IO] => | ||
stream(using t).draw() | ||
} | ||
.flatMap(_.drawToIO()) | ||
} | ||
|
||
object Chunked { | ||
abstract class File(name: String) extends IOApp.Simple with Core { | ||
def run: IO[Unit] = Stage | ||
.chunked[IO] | ||
.flatMap { case t @ given Stage[IO] => | ||
stream(using t).draw() | ||
} | ||
.flatMap(_.writeToIO[Png](s"$name.png")) | ||
} | ||
} | ||
} |