Skip to content

README corrections #70

Open
Open
@george-hawkins

Description

@george-hawkins

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 })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions