sbt-assembly: deduplication found error
Add the following code to your build.sbt file: assemblyMergeStrategy in assembly := { case PathList(“META-INF”, _*) => MergeStrategy.discard case _ => MergeStrategy.first }
Add the following code to your build.sbt file: assemblyMergeStrategy in assembly := { case PathList(“META-INF”, _*) => MergeStrategy.discard case _ => MergeStrategy.first }
Right click on your project, “Add Framework support” and choose Scala framework, then by right click on the packages you can create Scala Class. After this, right click on src > Mark directory as > Sources Root. Doing both of these should fix your problem!
I will attempt one myself. I will gladly accept a better answer from Travis Brown or Miles Sabin. Nat can currently not be used to represent large numbers In the current implementation of Nat, the value corresponds to the number of nested shapeless.Succ[] types: scala> Nat(3) res10: shapeless.Succ[shapeless.Succ[shapeless.Succ[shapeless._0]]] = Succ() So to represent the number … Read more
We’re using Maven to build Scala projects at work because it integrates well with our CI server. We could just run a shell script to kick off a build, of course, but we’ve got a bunch of other information coming out of Maven that we want to go into CI. That’s about the only reason … Read more
Addressing questions one to three: one of the main applications for HLists is abstracting over arity. Arity is typically statically known at any given use site of an abstraction, but varies from site to site. Take this, from shapeless’s examples, def flatten[T <: Product, L <: HList](t : T) (implicit hl : HListerAux[T, L], flatten … Read more
Try File -> Settings… -> Code Style -> Scala There are lots of settings to customize your code formatting in there. In the “Wrapping and Braces” tab, under “Method declaration parameters”: check “use normal indent for parameters” uncheck “Align when multiline” This will change it to the example you provided. If you want it to … Read more
Resources are meant to be accessed using the special getResource style methods that Java provides. Given your example of data.xml being in $SBT_PROJECT_HOME/src/test/resources/, you can access it in a test like so: import scala.io.Source // The string argument given to getResource is a path relative to // the resources directory. val source = Source.fromURL(getClass.getResource(“/data.xml”)) Of … Read more
I ran into the same issue on upgrade, just use colon q. :q Additionally, exit was deprecated in 2.10.x with sys.exit suggested instead, so this works as well: sys.exit As a side note, I think they did this so you can distinguish between exiting the scala console in sbt and exiting sbt itself, though I … Read more
There may be the obvious way of changing the sign, if you sort by some numeric value list.sortBy(- _.size) More generally, sorting may be done by method sorted with an implicit Ordering, which you may make explicit, and Ordering has a reverse (not the list reverse below) You can do list.sorted(theOrdering.reverse) If the ordering you … Read more
Type lambdas are vital quite a bit of the time when you are working with higher-kinded types. Consider a simple example of defining a monad for the right projection of Either[A, B]. The monad typeclass looks like this: trait Monad[M[_]] { def point[A](a: A): M[A] def bind[A, B](m: M[A])(f: A => M[B]): M[B] } Now, … Read more