Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WithContext instance in applicative-only setup #202

Merged
merged 2 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- name: Check format
run: sbt checkfmt
test:
needs: checkfmt
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
Expand Down Expand Up @@ -74,7 +73,6 @@ jobs:
run: sbt ++${{matrix.scala}} test

docs:
needs: checkfmt
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Publish._, Dependencies._
import com.typesafe.sbt.SbtGit.git

val libVersion = "0.7.2.1"
val libVersion = "0.7.3"

lazy val setMinorVersion = minorVersion := {
CrossVersion.partialVersion(scalaVersion.value) match {
Expand Down
9 changes: 5 additions & 4 deletions concurrent/src/main/scala/tofu/concurrent/ContextT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tofu.concurrent
import cats._
import cats.effect._
import cats.instances.either._
import tofu.{HasContextRun, WithRun}
import tofu.{HasContextRun, WithContext, WithRun}
import tofu.concurrent.impl._
import tofu.syntax.funk.funKFrom
import tofu.syntax.monadic._
Expand Down Expand Up @@ -103,15 +103,16 @@ trait ContextTInstancesS extends ContextTInstancesT {
trait ContextTInstancesR extends ContextTInstancesS {
final implicit def contextTAsync[F[+_]: Async, C[_[_]]]: Async[ContextT[F, C, *]] = new ContextTAsyncI

final def contextTContext[F[+_]: Applicative, C[_[_]]]: ContextTContext[F, C] = new ContextTContext
final implicit def contextTContext[F[+_]: Applicative, C[_[_]]]: ContextTContext[F, C] =
new ContextTContext
}

trait ContextTInstancesQ extends ContextTInstancesR {
final implicit def contextTConcurrent[F[+_]: Concurrent, C[_[_]]]: Concurrent[ContextT[F, C, *]] =
new ContextTConcurrentI

final implicit def contextTRunContext[F[+_]: Applicative: Defer, C[_[_]]]
: WithRun[ContextT[F, C, *], F, C[ContextT[F, C, *]]] = new ContextTRunContext[F, C]
final implicit def contextTRunContext[F[+_]: Applicative: Defer, C[_[_]]]: ContextTRunContext[F, C] =
new ContextTRunContext

final def runContextUnsafe[F[+_]: Applicative, C[_[_]]]: HasContextRun[ContextT[F, C, *], F, C[ContextT[F, C, *]]] =
new ContextTRunContextUnsafe[F, C]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ object ContextTSummonCheck {
implicitly[I2]
implicitly[I2 <:< I1]
}

def check2[F[+_]: Applicative] = {

type I1 = WithContext[ContextT[F, Foo, *], Foo[ContextT[F, Foo, *]]]
implicitly[I1]
}
}