Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 18 22:08
    jchapuis starred fthomas/singleton-ops
  • Mar 10 15:48
    fthomas closed #124
  • Mar 10 15:47
    fthomas commented #124
  • Mar 07 12:01

    soronpo on master

    Update sbt-scalajs, scalajs-com… (compare)

  • Mar 07 12:01
    soronpo closed #128
  • Mar 06 22:03
    codecov[bot] commented #128
  • Mar 06 22:02
    codecov[bot] commented #128
  • Mar 06 22:01
    codecov[bot] commented #128
  • Mar 06 21:49
    scala-steward opened #128
  • Feb 11 11:21
    iRhysBradbury starred fthomas/singleton-ops
  • Feb 10 22:44

    fthomas on master

    Delete plugin-scalajs.sbt (compare)

  • Feb 10 22:44

    fthomas on master

    Update sbt-scalajs-crossproject… (compare)

  • Feb 10 22:44
    fthomas closed #127
  • Feb 10 21:48
    codecov[bot] commented #127
  • Feb 10 21:46
    codecov[bot] commented #127
  • Feb 10 21:46
    codecov[bot] commented #127
  • Feb 10 21:28
    scala-steward opened #127
  • Feb 08 16:21

    fthomas on master

    Update sbt-ci-release to 1.5.2 … (compare)

  • Feb 08 16:21
    fthomas closed #126
  • Feb 08 16:12
    codecov[bot] commented #126
Anthony Cerruti
@srnb_gitlab
  def cut[I <: XInt](
      implicit i: SafeInt[I],
      check1: Require[I >= 0],
      check2: Require[I < N],
      check3: Require[N > 0],
      outSize: SafeInt[N - 1]
  ): SizedList[outSize.Out, T] =
    SizedList[outSize.Out, T](unsafe.zipWithIndex.collect {
      case (e, n) if n != i => e
    })
This fails to compile
 Unable to prove type argument is an Int.
[error]     SizedList[outSize.Out, T](unsafe.zipWithIndex.collect {
[error]                              ^
N <: XInt also, with its only check being Require[N >= 0]
Anthony Cerruti
@srnb_gitlab
Also, Require[N > 0] doesn't seem to serve as evidence for Require[{SafeInt[N - 1]}.Out >= 0]
Anthony Cerruti
@srnb_gitlab
@soronpo Pinging you just in case you're like me and don't check a ton of your gitter rooms
Oron Port
@soronpo
I'll busy I'm afraid. If you still have difficulties try me on Wednesday
Anthony Cerruti
@srnb_gitlab
I'm clueless, so I'll ping you in 48 hours o7
Anthony Cerruti
@srnb_gitlab
@soronpo Haven't worked on it but I figure it's a simple solution, right?
Oron Port
@soronpo
@srnb_gitlab what is N?
Again, from what it looks like you're trying to call a "safe" constructor without the proper implicits
I assume SizedLized[]() has implicits....
Anthony Cerruti
@srnb_gitlab
Yeah
package tf.bug.matrix

import singleton.ops._

case class SizedList[N <: XInt, +T](unsafe: List[T])(
    implicit n: SafeInt[N],
    check: Require[N >= 0]
) {

  def apply[I <: XInt](
      i: I
  )(implicit check1: Require[I >= 0], check2: Require[I < N]): T = unsafe(i)

  def cut[I <: XInt](
      i: I
  )(
      implicit check1: Require[I >= 0],
      check2: Require[I < N],
      check3: Require[N > 0],
      outSize: SafeInt[N - 1]
  ): SizedList[outSize.Out, T] =
    SizedList[outSize.Out, T](unsafe.zipWithIndex.collect {
      case (e, n) if n != i => e
    })

}
Why can't SafeInt[T].Out <: T?
sounds like it'd fix a lot of this
and let me mainly write safe code
And why wouldn't N <: XInt prove SafeInt[N - 1].Out <: XInt?
Oron Port
@soronpo
It's not it. It's that you don't have a proof of SafeInt[outSize.Out]
remove the implicit from your case class
make the constructor private
and create a public constructor with the guard
There is no way around this
Anthony Cerruti
@srnb_gitlab
Why doesn't SafeInt[T].Out <: T then?
Like what problems arise if that's assumed
Oron Port
@soronpo
The compiler cannot possibly know this via a macro system
Anthony Cerruti
@srnb_gitlab
Can the macro system not specify that Out <: T in this specific case? Or no because it's just an extension of the Ops thing
Oron Port
@soronpo
All it knows is that Out <: XInt
That's the definition of the Op trait's type
Anthony Cerruti
@srnb_gitlab
Alright
Hopefully by rewriting this project I don't fall into implicits not being resolved like I did last time
Oron Port
@soronpo
I suggest you don't use <: XInt at all. No need for it IMO.
Anthony Cerruti
@srnb_gitlab
Ok
Frank S. Thomas
@fthomas
FYI: operations on singleton types in Dotty: lampepfl/dotty#7628
Oron Port
@soronpo
Nice!!!
I'll dive into that. It is my goal to not require singleton-ops in the future.
Oron Port
@soronpo
@fthomas can you please issue a new release? I fixed an annoying scalac bug via workaround.
Frank S. Thomas
@fthomas
@soronpo Done! 0.4.1 should be on Maven Central soon
Oron Port
@soronpo
Thanks!
Balázs Kossovics
@kosii
Hey! Now that scala 2.13.1 is out, are we still supposed to use typelevel scala?
Oron Port
@soronpo
First, it's actually worked in regular Scala as well, but required extra syntx to express literal types. But now with 2.13.x you can use freely without any special flags hassle.
Balázs Kossovics
@kosii
Cool! I'm just playing around with singleton-ops, cool stuff, but I was wondering, if something like this was possible?
import singleton.ops.{+, ==, Require, XInt}

sealed trait StaticLengthList[L <: XInt]

object StaticLengthList {
  case object Nil extends StaticLengthList[0]

  //Error:(12, 82) type arguments [L + 1] do not conform to trait StaticLengthList's type parameter bounds [L <: singleton.ops.XInt]
  //  final case class Cons[L <: XInt](head: Int, tail: StaticLengthList[L]) extends StaticLengthList[L + 1] {}
  final case class Cons[L <: XInt](head: Int, tail: StaticLengthList[L]) extends StaticLengthList[L + 1] {}

  final case class Cons2[L <: XInt, T <: XInt](head: Int, tail: StaticLengthList[L])(implicit p : Require[L+1 == T]) extends StaticLengthList[T] {}

  //Error:(16, 38) Literal operation has failed.
  //  val myList = StaticLengthList.Cons2(1, StaticLengthList.Nil)
  val myList = StaticLengthList.Cons2(1, StaticLengthList.Nil)
}
Balázs Kossovics
@kosii
oh, actually Cons2[0, 1] works
Oron Port
@soronpo
@kosii
I suggest you remove the implicit from the case class, make the unsafe constructor private and create a public apply method that does the implicit checks.
Oron Port
@soronpo
@fthomas can you please issue a release for 0.4.2? BTW, I don't know how complicated it is to setup for bintray, but the sbt-ci-release plugins for Sonatype is fairly easy to setup so just a push of a tag will issue a release.
Frank S. Thomas
@fthomas
@soronpo Let's set up sbt-ci-release with Sonatype and get rid of Bintray. I'm already using it in a couple of other projects and I'm loving it
Frank S. Thomas
@fthomas
sbt-ci-release is set up now. @soronpo you should be able to release 0.4.2 yourself by running ./scripts/release.sh 0.4.2
Note that the release script does not update the version number in the README
Oron Port
@soronpo
@fthomas I was meaning to mention this to you
Is it possible to add support for Scala Steward to update a readme of a project once its final binaries are available?