Skip to content

Instantly share code, notes, and snippets.

@emag
Last active December 9, 2024 00:31
Show Gist options
  • Save emag/2438faaee1e72debf77a97dedeab3e9f to your computer and use it in GitHub Desktop.
Save emag/2438faaee1e72debf77a97dedeab3e9f to your computer and use it in GitHub Desktop.
家計簿アプリケーション
package kakeibo
import cats.effect.Async
import cats.effect.kernel.Resource
import cats.effect.std.Console
import fs2.io.net.Network
import natchez.Trace.Implicits.noop
import skunk.Session
final case class Application[F[_]](
balanceSheet: BalanceSheetApp[F]
)
object Application {
def apply[F[_]: Async: Network: Console](): Resource[F, Application[F]] =
for {
pool <- Session.pooled[F](
host = "localhost",
user = "postgres",
password = Some("passwd"),
database = "postgres",
max = 10
)
bsApp <- BalanceSheetApp(pool)
} yield new Application(bsApp)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment