-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
17 changed files
with
119 additions
and
205 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
27 changes: 0 additions & 27 deletions
27
modules/cats-effect/src/main/scala/make/cats/effect/implicits.scala
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
package make.ce | ||
|
||
import cats.effect.Resource | ||
import cats.effect.IO | ||
import make.MakeEff | ||
import cats.Applicative | ||
|
||
object resource { | ||
|
||
type IOResource[A] = Resource[IO, A] | ||
|
||
implicit def ceResourceEff[F[_]: Applicative]: MakeEff[Resource[F, ?]] = | ||
new MakeEff[Resource[F, ?]] { | ||
def map[A, B](fa: Resource[F, A])(f: A => B): Resource[F, B] = fa.map(f) | ||
def pure[A](a: A): Resource[F, A] = Resource.pure(a) | ||
def flatMap[A, B](fa: Resource[F, A])(f: A => Resource[F, B]): Resource[F, B] = fa.flatMap(f) | ||
} | ||
} |
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
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
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
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,11 @@ | ||
package make | ||
|
||
trait MakeEff[F[_]] { | ||
def map[A, B](fa: F[A])(f: A => B): F[B] | ||
def pure[A](a: A): F[A] | ||
def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] | ||
} | ||
|
||
object MakeEff { | ||
def apply[F[_]](implicit eff: MakeEff[F]): MakeEff[F] = eff | ||
} |
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 |
---|---|---|
@@ -1,31 +1,30 @@ | ||
package make | ||
|
||
import make.internal.MakeOps | ||
import make.Make.Eff | ||
import make.Make.EffError | ||
import make.MakeEff | ||
|
||
object syntax extends MakeTupleSyntax { | ||
implicit def makeToBasicSyntax[F[_], A](make: Make[F, A]): MakeBasicSyntax[F, A] = | ||
new MakeBasicSyntax(make) | ||
} | ||
|
||
final class MakeBasicSyntax[F[_], A](private val m: Make[F, A]) extends AnyVal { | ||
def map[B: Tag](f: A => B)(implicit F: Eff[F]): Make[F, B] = | ||
def map[B: Tag](f: A => B)(implicit F: MakeEff[F]): Make[F, B] = | ||
MakeOps.map(m)(f) | ||
|
||
def mapF[B: Tag](f: A => F[B])(implicit F: Eff[F]): Make[F, B] = | ||
def mapF[B: Tag](f: A => F[B])(implicit F: MakeEff[F]): Make[F, B] = | ||
MakeOps.mapF(m)(f) | ||
|
||
def ap[B: Tag](mf: Make[F, A => B]): Make[F, B] = | ||
MakeOps.ap(m)(mf) | ||
|
||
def toDag(implicit F: Eff[F]): Either[Conflicts, Dag[F, A]] = | ||
Dag.fromMake(m) | ||
def toGraph(implicit F: MakeEff[F]): Either[Conflicts, Graph[F, A]] = | ||
Graph.fromMake(m) | ||
|
||
def toEff(implicit F: EffError[F]): F[A] = { | ||
toDag match { | ||
case Left(conflicts) => F.raiseConflicts(conflicts) | ||
case Right(dag) => dag.toEff | ||
} | ||
} | ||
// def toEff(implicit F: EffError[F]): F[A] = { | ||
// toDag match { | ||
// case Left(conflicts) => F.raiseConflicts(conflicts) | ||
// case Right(dag) => dag.toEff | ||
// } | ||
// } | ||
} |
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
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
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
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
Oops, something went wrong.