-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add @ktrans for creating new interpreters using natural transformatio…
…ns (#8)
- Loading branch information
Showing
17 changed files
with
694 additions
and
18 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
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,12 @@ | ||
package diesel | ||
|
||
import cats._ | ||
import scala.language.higherKinds | ||
|
||
object Conversions { | ||
|
||
def funKToFunK[F[_], G[_]](functionK: F ~> G) = new FunK[F, G] { | ||
def apply[A](fa: F[A]): G[A] = functionK(fa) | ||
} | ||
|
||
} |
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,13 @@ | ||
package diesel | ||
|
||
import cats._ | ||
|
||
import scala.language.implicitConversions | ||
import scala.language.higherKinds | ||
|
||
package object implicits { | ||
|
||
implicit def functionKToFunK[F[_], G[_]](f: F ~> G): FunK[F, G] = | ||
Conversions.funKToFunK(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package diesel | ||
|
||
object Defaults { | ||
val OpsName: String = "ops" | ||
val TransKMethodName: String = "transformK" | ||
} |
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,14 @@ | ||
package diesel | ||
|
||
import scala.language.higherKinds | ||
|
||
/** | ||
* Lite version of FunctionK (Cats) or NaturalTransformation (Scalaz). | ||
* | ||
* Conversions from either of those exist in diesel-cats or diesel-scalaz, | ||
* | ||
*/ | ||
trait FunK[F[_], G[_]] { | ||
|
||
def apply[A](fa: F[A]): G[A] | ||
} |
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.