Comments (9)
Honestly it’s not that common to use Operators with Algebird.
I can look into it, but in the meantime I recommend you use Semigroup.plus on the companion.
It is probably an ambiguous implicit somewhere.
from algebird.
In fact, same happens with simple tuples as well:
import com.twitter.algebird.Monoid._
import com.twitter.algebird.Operators._
val x = 1 -> 1
x + x // fails to compile
from algebird.
Huh. This is very strange. Can you make a PR with a test to demonstrate the failure.
We use tuples with Semigroups all the time.
Why are you importing Monoid._
? I wonder if you are setting up a conflicting implicit and scala just silently fails when two implicits can be found.
from algebird.
The Monoid._
is mainly needed because of the ArrayMonoid
from algebird.
Here you go - tovbinm@776cfe1
from algebird.
Also, I think I found what's the problem - import order matters (at least in the test):
This would fail:
import com.twitter.algebird.Monoid._
import com.twitter.algebird.Operators._
This works:
import com.twitter.algebird.Operators._
import com.twitter.algebird.Monoid._
But in my project import order does not matter, so the problem persists.
from algebird.
Here is the failure again in Ammonite:
Welcome to the Ammonite Repl 1.1.0
(Scala 2.12.4 Java 1.8.0_131)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ import $ivy.`com.twitter::algebird-core:0.13.4`
import $ivy.$
@ import com.twitter.algebird.Operators._
import com.twitter.algebird.Operators._
@ import com.twitter.algebird.Monoid._
import com.twitter.algebird.Monoid._
@ Array(1,2) -> Array(1,2) + Array(1,2) -> Array(1,2)
cmd3.sc:1: diverging implicit expansion for type algebra.Monoid[(Array[Int], Array[Int])]
starting with method fromAlgebraAdditiveMonoid in trait FromAlgebraMonoidImplicit1
val res3 = Array(1,2) -> Array(1,2) + Array(1,2) -> Array(1,2)
^
cmd3.sc:1: value + is not a member of (Array[Int], Array[Int])
val res3 = Array(1,2) -> Array(1,2) + Array(1,2) -> Array(1,2)
^
Compilation Failed
from algebird.
from algebird.
Well, it assumes String
in +
operator then:
Welcome to the Ammonite Repl 1.1.0
(Scala 2.12.4 Java 1.8.0_131)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ import $ivy.`com.twitter::algebird-core:0.13.4`
import $ivy.$
@ import com.twitter.algebird._
import com.twitter.algebird._
@ import com.twitter.algebird.Operators._
import com.twitter.algebird.Operators._
@ (Array(1,2) -> Array(1,2)) + (Array(1,2) -> Array(1,2))
cmd3.sc:1: type mismatch;
found : (Array[Int], Array[Int])
required: String
val res3 = (Array(1,2) -> Array(1,2)) + (Array(1,2) -> Array(1,2))
^
Compilation Failed
from algebird.
Related Issues (20)
- Release cadance of algebrid, next planned release? HOT 5
- New point release that includes BigDecimal semigroup HOT 10
- PriorityQueueMonoid- Is it strictly a monoid? HOT 3
- Algebird-spark with Spark 2.{3, 4} and Scala 2.12 HOT 2
- Scala 2.13.x HOT 13
- Idea: BloomFilterAggregator can directly rely on a BitSet instead of a BFMonoid
- use fast immutable bitset for better bloom filter HOT 6
- The GeneratedTupleAggregator is not recognized HOT 2
- Add combinators on Semigroup, Monoid, Aggregator to reverse order. HOT 1
- flakey test: downsiding HLL to 4 bits HOT 1
- investigate flaky test on AdaptiveVector
- Latest version published with `-optimize` HOT 1
- configure mergify.io HOT 1
- H
- Investigate flaky `com.twitter.algebird.CollectionSpecification` test HOT 8
- Possible buffer overflow for lengths over 127. Why are you doing .toByte in order to represent an integer size of 4 bytes? For example item length of 184 will result in -72 and thus in NegativeArraySize Exception when deserializing in fromBytes : 94. HOT 1
- Possible buffer overflow for lengths over 127. HOT 4
- SparseVector monoid flake
- New release? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algebird.