Q:

Doobie with Hikari setup

Hey guys trying to get the hikari transactor setup to act just like the standard transactor
val xa = HikariTransactor.newHikariTransactor[IO](
  "com.mysql.jdbc. Driver",
  JdbcUrl,
  Username,
  Password
)

sql"""select DISTINCT gcpProject FROM JobStatus"""
     .query[String]    // Query0[String]
     .stream           // Stream[ConnectionIO, String]
     .take(5)          // Stream[ConnectionIO, String]
     .compile.toList   // ConnectionIO[List[String]]
     .transact(xa)     // IO[List[String]]
     .unsafeRunSync    // List[String]
     .foreach(println) // Unit

Unfortunately this gives me: 
Type mismatch, expected: tansactor. Transactor[NotInferedM], actual: IO[hikari. HikariTransactor[IO]]

Any ideas on how can can get this working properly? 
Just a note that the previous solution used a single connection each time and works correctly:
val xa = Transactor.fromDriverManager[IO](
  "com.mysql.jdbc. Driver",
  JdbcUrl,
  Username,
  Password
)

But I could really use a connection pool

A:

Okay after a bunch of testing I finally worked it out! 
I'll post my solution here just in case someone else finds this helpful:
val config = new HikariConfig()
config.setJdbcUrl(JdbcUrl)
config.setUsername(Username)
config.setPassword(Password)
config.setMaximumPoolSize(databaseConnectionPoolSize)

val DbTransactor: IO[HikariTransactor[IO]] =
  IO.pure(HikariTransactor.apply[IO](new HikariDataSource(config)))

sql"""select DISTINCT gcpProject FROM JobStatus"""
     .query[String]
     .stream
     .take(5)
     .compile.toList

val prog = for {
  xa <- transactor
  result <- query.transact(xa)
} yield result
prog.unsafeRunSync()

