-
Notifications
You must be signed in to change notification settings - Fork 348
/
embedded.scala
33 lines (27 loc) · 1.45 KB
/
embedded.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2013-2018 Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT
package doobie.postgres.free
import cats.free.Free
import copyin.CopyInIO
import copymanager.CopyManagerIO
import copyout.CopyOutIO
import fastpath.FastpathIO
import largeobject.LargeObjectIO
import largeobjectmanager.LargeObjectManagerIO
import pgconnection.PGConnectionIO
// A pair (J, Free[F, A]) with constructors that tie down J and F.
sealed trait Embedded[A]
object Embedded {
final case class CopyIn[A](j: org.postgresql.copy.CopyIn, fa: CopyInIO[A]) extends Embedded[A]
final case class CopyManager[A](j: org.postgresql.copy.CopyManager, fa: CopyManagerIO[A]) extends Embedded[A]
final case class CopyOut[A](j: org.postgresql.copy.CopyOut, fa: CopyOutIO[A]) extends Embedded[A]
final case class Fastpath[A](j: org.postgresql.fastpath.Fastpath, fa: FastpathIO[A]) extends Embedded[A]
final case class LargeObject[A](j: org.postgresql.largeobject.LargeObject, fa: LargeObjectIO[A]) extends Embedded[A]
final case class LargeObjectManager[A](j: org.postgresql.largeobject.LargeObjectManager, fa: LargeObjectManagerIO[A]) extends Embedded[A]
final case class PGConnection[A](j: org.postgresql.PGConnection, fa: PGConnectionIO[A]) extends Embedded[A]
}
// Typeclass for embeddable pairs (J, F)
trait Embeddable[F[_], J] {
def embed[A](j: J, fa: Free[F, A]): Embedded[A]
}