Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • 06:26
    jxnu-liguobin commented #9634
  • 03:53

    SethTisue on main

    community page: replace Freenod… Merge pull request #1251 from S… (compare)

  • 03:53
    SethTisue closed #1251
  • 01:15

    SethTisue on 2.12.x

    2.12: new Scala SHA (#1433) (compare)

  • 01:15
    SethTisue closed #1433
  • 01:14
    SethTisue edited #1433
  • Jun 19 18:50
    SethTisue commented #9674
  • Jun 19 18:50
    SethTisue demilestoned #9674
  • Jun 19 16:54
    som-snytt closed #9674
  • Jun 19 16:46
    som-snytt synchronize #9674
  • Jun 19 10:10
    bjornregnell commented #1248
  • Jun 19 10:09
    bjornregnell commented #1248
  • Jun 19 10:08
    bjornregnell commented #1250
  • Jun 19 10:04
    pjfanning synchronize #2086
  • Jun 19 10:00
    bjornregnell commented #1248
  • Jun 19 09:59
    pjfanning opened #2086
  • Jun 19 09:22

    Philippus on main

    Fix typo: eather -> either Merge pull request #2085 from m… (compare)

  • Jun 19 09:22
    Philippus closed #2085
  • Jun 19 08:34
    myyk opened #2085
  • Jun 19 05:03
    scala-jenkins milestoned #9674
Gavin Bisesi
:wave: have a good weekend all :)
not sure if I should trust 3 year old hand-rolled encryption code tbh
I there a way to automatically derive a BsonTransformer for the MongoDB Driver without custom implementation via macros or shapeless?
Martijn Hoekstra
I wouldnt trust machine generated encryption code over hand rolled
At least, I think I wouldnt? How does machine generated encryption code work?
What are other languages with literal types besides Idris?
typescript, i guess
Rob Norris
You can do it in Haskell. And any dependently-typed language, of which Idris is one.
Rob Norris
[error] Multiple repositories are found:
[error] [orgtpolecat-1125] status:open, profile:org.tpolecat(23052d71604fff) description: Implicitly created (auto staging).
[error] [orgtpolecat-1126] status:open, profile:org.tpolecat(23052d71604fff) description: Implicitly created (auto staging).
[error] Specify one of the repository ids in the command line
[error] java.lang.IllegalStateException: Found multiple staging repositories
One of my builds started doing this when doing sonatypeReleaseAll. What have I done and how do I fix it?
I went in and dropped them in the Nexus UI and tried again and it did it again.
Seth Tisue
fwiw: when we're publishing Scala modules we almost always end up with multiple staging repos, a nondeterministic number of them. usually we just release them all at once through the Sonatype web and it's fine. some percentage of time, the files for a single target end up split between two staging repos, which can then neither be closed or released, and we have to run that target (and any targets that ended up mixed up in the affected repos) again
if you're ending up with multiple staging repos when you didn't before, it might be timing related, like maybe your build crossed some sort of threshold on how long it takes between one target and the next
the good news is that it might be fine to just release the multiple repos via the web UI, and not use sonatypeReleaseAll
anyway, I have only very partial understanding of this stuff, so perhaps someone who understands it better will have better advice for you.
Li Haoyi
the multiple staging repos thing is a sbt quirk. Mill creates one staging repo, and always releases just that, without races in the presence of concurrent workflows
not sure what SBT is doing; mill’s code was written just following the sonatype api docs and it seems to do what i’d expect
Rob Norris
Hell. Ok. Is it sbt or sbt-sonatype?
The plugin surely.
Seth Tisue
it seems the ticket of record is xerial/sbt-sonatype#83
that's with +publishSigned though. often the repos I work in aren't using +, they're using the Travis-CI matrix to do the different parts. so idk
Rob Norris
Nexus is the JIRA of package repositories. We need our own, it’s just absolute hell.
who's going to support our version of hell
Rob Norris
Scala Center?
They’re looking for ideas!
This has worked fine for me for many prior releases. It just started happening.
I feel like I’m taking crazy pills. I had a different random automation failure yesterday.
Rob Norris
I need to switch to a language nobody uses so I won’t have to worry about this stuff.
I guess I could try Mill. @lihaoyi is there a way to run paradox and push stuff to gh-pages?
Luis Miguel Mejía Suárez


I have something like this:

trait Factory[F[_]] {
  type R[A]
  def create[A](a: => A): R[A]

object Factory {
  type Aux[F[_], _R[_]] = Factory[F] { type R[A] = _R[A] 

  type Id[A] = A

  implicit val FutureFactory: Factory.Aux[Future, Id] =
    new Factory[Future] {
      override final type R[A] = A
      override final def create[A](a: => A): A = a

object Driver {
  def driver[F[_]]: DriverPartiallyApplied[F] = new DriverPartiallyApplied(dummy = true)

  private final class DriverPartiallyApplied[F[_]](private val dummy: Boolean) extends AnyVal {
    def apply[R[_]](uri: String)(implicit F: Factory.Aux[F, R]): R[Driver[F]] =

Now, on another project I would like to do this:

val driver: Driver[Future] = Driver.driver[Future]("uri")

But that does not compile with this error:

found: [R[_]]R[neotypes.Driver[scala.concurrent.Future]]
required: neotypes.Driver[scala.concurrent.Future]

If I leave out the explicit type signature, it works as expected. The compiler is able to figure out latter that driver is a Driver[Future].

Anyone knows how can I fix that?

Hanns Holger Rutz

Is it possible to define "negative implicits", like

trait Ex[+A]
case class Const[A](value: A) extends Ex[A]

implicit def const[A](x: A): Ex[A] = Const(x)

such that const cannot be called when A <: Ex[_] ? I have no way to put an upper bound on A, e.g. it could be Int, String, java.io.File, ... types over which I have no control.

Luis Miguel Mejía Suárez
@Sciss Can not test it right now, but I believe you can use Shapeless =:!=.
Something like implicit def const[A](x: A)(implicit ev: A =:!= Ex[_]): Ex[A] = Const(x)
Hanns Holger Rutz
sounds good, I wonder how that's implemented. Of course can't google =:!=, any pointer to the relevant documentation?
must be a macro, I guess?

Perhaps easier solution would be if I have

   def runWith(map: Ex[Map[String, _]]) = ???

but I need to restrict the value types in the map, for example by coming with a type class; the problem being that the value types may vary (it's a heterogeneous map, Scala's arch enemy)

Hanns Holger Rutz
So I want a Map[String, Int] to be able to be lifted, but not Map[String, Ex[_]].
So perhaps a simpler question is, "how can I place constraints on the value types of a heterogeneous map", with emphasis on the user being able to type it with literals without the need to use type ascriptions etc.

For instance:

def title: Ex[String]

trait Runner {
  def runWith(attr: Ex[Map[String, _]]): Unit

def r: Runner

r.runWith(Map("foo" -> 123, "bar" -> title))

and what I need to enforce is the expansion

Map(Const("foo") -> Const(123), Const("bar") -> title)

and prevent

Const(Map("foo" -> 123, "bar" -> title /* bad */))
Hanns Holger Rutz
I have the hunch that I should introduce trait ExMap[K, V] extends Ex[Map[K, V]] so that I can restrict lifting from Map constructor.
Hanns Holger Rutz
Like how can I get rid of the : Ex[String] annotations here:
trait ExMapTest3 {
  trait Ex[+A]

  implicit def const[A](in: A): Ex[A]

  implicit def liftMap[K, V](m: Map[Ex[K], Ex[V]]): ExMap[K, V]

  trait ExMap[K, V] extends Ex[Map[K, V]]

  def runWith(m: ExMap[String, Any]): Unit

  def title: Ex[String]

    Map(("foo": Ex[String]) -> ("bar": Ex[String]))  // not nice

    Map(("foo": Ex[String]) -> title)
Hanns Holger Rutz

I guess the best would be to just surrender to

implicit def const[A: Permitted](in: A): Ex[A]

and give dozens of type classes for all primitives etc.; perhaps I could use marker trait scala.Immutable for types I control.

Hanns Holger Rutz

along these lines

  implicit def const[A: Value](x: A): Ex[A] = Const(x)

  object Value {
    implicit object anyVal    extends Value[AnyVal  ]
    implicit object string    extends Value[String  ]
    implicit object file      extends Value[File    ]
    implicit object spanLike  extends Value[SpanLike]

    implicit def tuple  [A: Value, B: Value]: Value[(A, B)] = null

    implicit def option [A: Value]: Value[Option[A]] = null
    implicit def seq    [A: Value]: Value[Seq   [A]] = null
  trait Value[-A]

0: Ex[Int]  // ok
Some("foo"): Ex[Option[String]]  // ok
Some("foo": Ex[String]): Ex[Option[Ex[String]]]   // forbidden

Is there any issue with = null? Would like to avoid instantiations for throw away witnesses.

Luis Miguel Mejía Suárez
@Sciss Sorry, I had to go for a while. I am a little lost right now. What is your ultimate goal?
I think, at the end, you only want that the runWith method only be called with a Map[String, _] where you have a subset of what is valid for the values. Am I right?
Hanns Holger Rutz
Yes. I think I will try with the last approach, even if it means adding a lot of third-party dummy type class instances.
it's just annoying having to add lots of import statements after a while to bring them into scope. I think there is some plan to introduce export primitives or so into Scala in the future.
Luis Miguel Mejía Suárez
Do you expect the Map to always be a literal?
Hanns Holger Rutz
definitely not. There could be other sources producing Ex[Map] which are not constant.
Luis Miguel Mejía Suárez
Uhm, I was about to propose a Macro, but now it does not make sense.