question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding .map and .flatMap to trait Binding

See original GitHub issue

Map and FlatMap are now classes inside com.thoughtworks.binding.Binding which makes them a little bit difficult to use.

And Scala compiler also fails to do the type inference because upstream & f param are inside the same pair of parentheses.

So currently I have some code like this:

inkBar(new BMap[(Int, Int), Int](offsetWidth, _._1), new BMap[(Int, Int), Int](offsetWidth, _._2)).bind

Is it possible to add .map and .flatMap to trait Binding?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Atrycommented, Mar 6, 2019
  1. Try import com.thoughtworks.binding.Binding.BindingInstances.monadSyntax._ instead of import scalaz.syntax.all._.
  2. There is no implicit conversion from Binding[T] to BindingSeq[T].
1reaction
Atrycommented, Jan 25, 2019

Try import scalaz.syntax.all._

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to implement flatMap for Option - scala - Stack Overflow
I'm trying to implement map and flatMap as an extension/enrichment for Option , without cheating and looking at how it was implemented in...
Read more >
Implementing flat_map in Rust - Elton Pinto
To compute a flat_map , first map the collection, and then flatten it. ... This trait bound makes sense: we must only be...
Read more >
Demystifying the Monad in Scala - Medium
We will model a monad with a generic trait that provides methods unit() and flatMap(). We can call it M instead of Monad...
Read more >
add and_then as an alias for flat_map · Issue #2569 - GitHub
This RFCs proposal is simple, make one an alias for the other. And/or introduce a trait that encapsulates this generic behaviour. Benefits.
Read more >
FlatMap - Scala 3 - EPFL
Applies a function f to each element of the iterable collection and returns a pair of iterable collections: the first one made of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found