Skip to content

Update TodoMvc.scala#431

Open
VzxPLnHqr wants to merge 1 commit intoarmanbilge:mainfrom
VzxPLnHqr:patch-1
Open

Update TodoMvc.scala#431
VzxPLnHqr wants to merge 1 commit intoarmanbilge:mainfrom
VzxPLnHqr:patch-1

Conversation

@VzxPLnHqr
Copy link
Copy Markdown

had this note been in the code, it would have saved me a lot of time :-)

had this note been in the code, it would have saved me a lot of time :-)
li(
// note: the tupling below seems to require explicit type signatures
// for `todo` and `editing` so that the scala compiler can help us along with `mapN`
cls <-- (todo: Signal[IO, Option[Todo]], editing: Signal[IO, Boolean]).mapN { (t, e) =>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe we should just rewrite as map2.

Suggested change
cls <-- (todo: Signal[IO, Option[Todo]], editing: Signal[IO, Boolean]).mapN { (t, e) =>
cls <-- todo.map2(editing) { (t, e) =>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, at least in my code map2 did not work either. For example, I have something like this:

          active.map2(relayUri){
            case (true, theUri) => renderSubscription(theUri,filter)
            case _ => div("")
          }

but that gives me:

No given instance of type cats.Apply[[A] =>> fs2.concurrent.SignallingRef[cats.effect.IO, A]] was found for parameter F of method map2 in class ApplyOps.
I found:

    cats.Invariant.catsApplicativeForArrow[F, A²]

But method catsApplicativeForArrow in trait InvariantInstances2 does not match type cats.Apply[[A] =>> fs2.concurrent.SignallingRef[cats.effect.IO, A]]

where:    A  is a type variable
          A² is a type variable

but this:

          (active : Signal[IO,Boolean] ,relayUri : Signal[IO,Uri]).mapN {
            case (true, theUri) => renderSubscription(theUri,filter)
            case _ => div("")
          }

compiles just fine.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Darn. For the record, here's the relevant issue. I want to take another look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants