scala.rx icon indicating copy to clipboard operation
scala.rx copied to clipboard

README corrections

Open george-hawkins opened this issue 8 years ago • 0 comments

Sorry - normally I'd submit a pull request for this kind of thing but unfortunately I don't have time.

Many people new to the project will start by working through the examples in the README so it's relatively important that it be mistake free. Here are some issues I found:

1. I had to change the following code:

intercept[ArithmeticException]{
  b()
}
assert(b.toTry.isInstanceOf[Failure])

To this:

intercept[ArithmeticException]{
  b.now // Otherwise it complains "No implicit Ctx.Data is available here!"
}
assert(b.toTry.isInstanceOf[Failure[_]])  // Otherwise it complains "class Failure takes type parameters "assert(b.toTry.isInstanceOf[Failure])

2. An unknown function inside is referenced a number of times, e.g. like so:

inside(c.toTry){case Success(0) => () }

I think occurances of inside should be replaced with assertMatch

assertMatch(c.toTry){case Success(0) => ()}

But then it's probably necessary to go on and explain that to use assertMatch you have to extend TestSuite from https://github.com/lihaoyi/utest

import utest._

object XyzTests extends TestSuite {
  val tests = this {
    "pqrTest" - {
      assertMatch(b.toTry){case Success(0)=>}
    }
  }
}

3. In the following code why is a wrapped in another Rx when creating b - isn't a already a perfectly acceptable Rx?

val a = Var(1)
val b = Rx{
    (Rx{ a() }, Rx{ math.random })
}

george-hawkins avatar Sep 06 '16 20:09 george-hawkins