Data dodania Pytanie
2017-09-17 16:09 Scala - function which takes a type composition of 2 traits »
I want my function to receive a type which implements 2 traits. Is it possible to create an "adhoc" trait type like that? For instance: trait t1 { ...
(1) odpowiedzi
2017-09-17 14:09 Higher-order unification for type constructor inference »
def meh[M[_], A](x: M[A]): M[A] = x meh((x: Int) => "") After SI-2712 (https://issues.scala-lang.org/browse/SI-2712) fix type A is inferred to th...
(1) odpowiedzi
2017-09-17 14:09 Scala's TreeSet `min` operation performance »
When exploring Scala's standard library, I found out, that TreeSet doesn't override min operation at all, so this operation is derived from Traversabl...
(0) odpowiedzi
2017-09-17 04:09 Filtering list of tuples - better readability »
What is a good way( read better readability) to filter a list of tuples. I'm using tupleList.filter(_._2).map(_._1) But this does not feel readable...
(3) odpowiedzi
2017-09-16 23:09 Scala objects and thread safety »
I am new to Scala. I am trying to figure out how to ensure thread safety with functions in a Scala object (aka singleton) From what I have read so ...
(3) odpowiedzi
2017-09-16 15:09 How can I obtain the DAG of an Apache Spark job without running it? »
I have some Scala code that I can run with Spark using spark-submit. From what I understood, Spark creates a DAG in order to schedule the operation. ...
(1) odpowiedzi
2017-09-16 12:09 How to Inject() into a class with constructor parameters? »
I have a WebSocket controller which creates per connection actor handler: class WebSocketController @Inject()(cc: ControllerComponents)(implicit exc:...
(2) odpowiedzi
2017-09-15 11:09 Scala: implicitly converted type as implicit param of a method »
I have a method that expects some implicit param of type String. I have an object of class MyClass which I want to pass to that method implicitly. Fi...
(1) odpowiedzi
2017-09-15 08:09 Find wrapped array entry that is not empty »
I´m new with spark. My problem is that I have to find in a list, these which are not empty. When I use the filter function is not null, than I get a...
(2) odpowiedzi
2017-09-15 03:09 sbt corrupts terminal display »
This is a head scratcher for me; I'm on Mac OS 10.11.6 and I recently started using sbt for scala. I'm running into the situation that every time I r...
(1) odpowiedzi
2017-09-14 13:09 Play Framework Stop responding after 2-3 days »
I am using play framework and it stops responding after 2-3 days and when I restart server then everything works fine. Please let me know what I am...
(1) odpowiedzi
2017-09-14 13:09 Prepend to vector scala »
Newbie to scala, im finding the symbolic notation for dealing with collections confusing. To append an item to a list or vector i can use: List(1, 2,...
(1) odpowiedzi
2017-09-14 09:09 Scalatest building and running in Intellij, but not building the project when run on the command line with maven »
I'm able to run my tests in a spec file individually when using intellij, however when I try running with Maven on the command line the project will n...
(1) odpowiedzi
2017-09-12 23:09 Scala: Function0 vs by-name parameters »
Can anyone give a definitive answer on how by-name parameters => T and Function0 parameters () => T are transformed into one another by the Scal...
(1) odpowiedzi
2017-09-12 18:09 Get type of a "singleton type" »
We can create a literal types via shapeless: import shapeless.syntax.singleton._ var x = 42.narrow // x: Int(42) = 42 But how can I operate with In...
(2) odpowiedzi
2017-09-12 16:09 Spark Dataframe Group by having New Indicator Column »
I need to group by "KEY" Column and need to check whether "TYPE_CODE" column has both "PL" and "JL" values , if so then i need to add a Indicator Colu...
(2) odpowiedzi
2017-09-11 20:09 Unwrap/strip Shapeless Coproduct objects »
I have a domain that looks like this: package object tryme { type ALL = AlarmMessage :+: PassMessage :+: HeyMessage :+: CNil } import com.tryme._ ...
(2) odpowiedzi
2017-09-11 18:09 is it possible to implement flip as a Scala function (and not a method) »
As a part of learning Scala I try to implement Haskell's flip function (a function with signature (A => B => C) => (B => A => C)) in Scala - and imple...
(1) odpowiedzi
2017-09-11 11:09 What is Applicative Builder »
I am scala and functional newbie and trying to learn applicatives. val o1 = Some(1) val o2 = Some(2) val o3 = Some(3) val result = (o1 |@| o2 |@| o3)...
(1) odpowiedzi
2017-09-10 22:09 With a Scala Either, how do you stop at the first error, but gets the already computed values »
For example, let say I have a function def foo(): Either[String, Int] = ??? I want to call this function 3 times. If all the values are Right, I wa...
(3) odpowiedzi
2017-09-10 21:09 Decoding structured JSON arrays with circe in Scala »
Suppose I need to decode JSON arrays that look like the following, where there are a couple of fields at the beginning, some arbitrary number of homog...
(1) odpowiedzi
2017-09-10 16:09 Scala can't infer type arguments of Java method »
I have the following sophisticated type hierarchy in Java: // the first type interface Element<Type extends Element<Type>> { Type foo...
(1) odpowiedzi
2017-09-09 21:09 How to properly pass many dependencies (external APIs) to a class in Scala? »
How to properly pass many dependencies (external APIs) to a class in Scala? I'm working on the application that uses many APIs to collect data. For A...
(1) odpowiedzi
2017-09-09 12:09 How to create a custom Seq with bounded type parameter in Scala? »
Consider the following working custom Seq: class MySeq[B](val s: Seq[B]) extends Seq[B] with GenericTraversableTemplate[B, MySeq] with SeqLike[B, My...
(2) odpowiedzi
2017-09-09 03:09 Scala way to remove duplicate in an Array »
I want to learn how to write for loop functions without declear "var" at the front of the code. For example, I want to remove duplicates in an interge...
(3) odpowiedzi
2017-09-08 16:09 Load performance testing with Gatling and Content-Type »
I am using gatling for load performance testing on a brand new API. It seems fairly easy and well documented but I am facing an issue as simple as POS...
(1) odpowiedzi
2017-09-08 15:09 Is there a way to specify the return type of an Scala function literal? »
I was wondering if it is possible to specify the return type of a function literal. For example I have (x:Int) => x * 2 // scala infers the type ...
(0) odpowiedzi
2017-09-08 14:09 Why can't a value class wrap another value class? »
Is there a reason for the restriction that one value class can't wrap another value class? It seems an obvious thing to want to do, and extends the b...
(1) odpowiedzi
2017-09-07 20:09 S3 SlowDown error in Spark on EMR »
I am getting this error when writing a parquet file, this has started to happen recently com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3...
(1) odpowiedzi
2017-09-07 18:09 Using Scala Sys Process »
is there a way to retrieve the actual java inputStream that correspond to the stdout of the java process being executed, when using ProcessBuilder or ...
(1) odpowiedzi
2017-09-07 09:09 java.lang.reflect.Method#getModifiers returns flag outside valid range? »
The following code: Class.forName("java.lang.String") .getDeclaredMethods .find(_.getName == "join") .get .getModifiers & ~(j...
(1) odpowiedzi
2017-09-06 23:09 How to automatically generate a function to match a sealed case class family with implicit instances? »
I have a sealed case class family that specify some rules, which are deserialized from an external source. I also have a typeclass with a few instance...
(1) odpowiedzi
2017-09-06 23:09 Reverse Cartesian Product »
Given the data set below: a | b | c | d 1 | 3 | 7 | 11 1 | 5 | 7 | 11 1 | 3 | 8 | 11 1 | 5 | 8 | 11 1 | 6 | 8...
(0) odpowiedzi
2017-09-06 11:09 Cartesian builder for OptionT »
I want to join 2 Future[Option[_]]: def foo: Future[Option[Int]] = ??? def baz: Future[Option[Int]] = ??? It is possible to join pair of Future: f...
(1) odpowiedzi
2017-09-05 11:09 Scala map and groupby a Map to another Map, with a smaller keyset »
Lets say there is a Scala Map, eg: val map:Map[String, List[String]= Map("Apple" -> List("Red", "Tasty"), "Orange" -> List("Sour", "Orange"), ...
(4) odpowiedzi