forked from japgolly/scalajs-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added liftR to functions as a workaround for Scala's poor type inference
- Loading branch information
Showing
5 changed files
with
51 additions
and
6 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
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
31 changes: 31 additions & 0 deletions
31
test/src/test/scala/japgolly/scalajs/react/ScalazTest.scala
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,31 @@ | ||
package japgolly.scalajs.react | ||
|
||
import utest._ | ||
import scalaz.{~>, StateT, Monad} | ||
import scalaz.effect.IO | ||
import ScalazReact._ | ||
|
||
/** | ||
* Scala's type inference can be pretty weak sometimes. | ||
* Successful compilation will suffice as proof for most of these tests. | ||
*/ | ||
object ScalazTest extends TestSuite { | ||
|
||
def test[A] = new { | ||
def apply[B](f: A => B) = new { | ||
def expect[C](implicit ev: B =:= C): Unit = () | ||
} | ||
} | ||
|
||
trait M[A] | ||
implicit val mMonad = null.asInstanceOf[Monad[M] with (M ~> IO)] | ||
trait S | ||
trait A | ||
trait B | ||
val c = null.asInstanceOf[ComponentScopeM[Unit, S, Unit]] | ||
|
||
val tests = TestSuite { | ||
"runState(StateT.liftR)" - test[StateT[M,S,A] ](s => c.runState(s.liftR) ).expect[IO[A]] | ||
"_runState((I→StateT).liftR)" - test[B => StateT[M,S,A]](s => c._runState(s.liftR)).expect[B => IO[A]] | ||
} | ||
} |