Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 09 18:15

    fthomas on master

    Update shapeless to 2.3.4 Merge pull request #185 from sc… (compare)

  • Apr 09 18:15
    fthomas closed #185
  • Apr 09 16:33
    codecov[bot] commented #185
  • Apr 09 16:32
    codecov[bot] commented #185
  • Apr 09 16:31
    codecov[bot] commented #185
  • Apr 09 16:26
    scala-steward opened #185
  • Apr 05 06:29

    fthomas on master

    Update sbt to 1.5.0 (#184) (compare)

  • Apr 05 06:29
    fthomas closed #184
  • Apr 05 06:28
    codecov[bot] commented #184
  • Apr 05 06:28
    codecov[bot] commented #184
  • Apr 05 06:27
    codecov[bot] commented #184
  • Apr 05 06:21
    scala-steward synchronize #184
  • Apr 05 04:14

    fthomas on master

    Update build.properties (compare)

  • Apr 04 18:43
    scala-steward opened #184
  • Apr 03 18:53
    valencik starred fthomas/singleton-ops
  • Mar 31 21:27
    tribbloid commented #182
  • Mar 31 19:22

    fthomas on master

    Update sbt-scalajs, scalajs-com… Merge pull request #183 from sc… (compare)

  • Mar 31 19:22
    fthomas closed #183
  • Mar 31 16:49
    codecov[bot] commented #183
  • Mar 31 16:48
    codecov[bot] commented #183
Soren
@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
Soren
@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
Soren
@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.
Soren
@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?
Oron Port
@soronpo
@/all I recommend v0.5.0 https://github.com/fthomas/singleton-ops/releases/tag/v0.5.0
It can potentially save ~20% in compilation time for Scala 2.13.x users (compared to previous versions). Other Scalac versions also get performance bump.
Peng Cheng
@tribbloid
Sorry, is there an easy way to summon value from computed type?
Like in shapeless:
    type T1 = W.`3`.T

    val v1 = implicitly[Witness.Aux[T1]]
    assert(v1 == 3)
the same trick can't deceive the compiler:
    type T2 = T1 + W.`4`.T

    val v2 = implicitly[Witness.Aux[T2]]
    assert(v2 == 7)
could not find implicit value for parameter e: shapeless.Witness.Aux[T2]
one error found
Peng Cheng
@tribbloid
ok found it, much easier than I thought:
    val v2 = implicitly[T2]
    assert(v2.value == 7)
Oron Port
@soronpo
Hi all! After #149 lands, look at the cool stuff you can do. https://twitter.com/soronpo/status/1275014596034809856
Oron Port
@soronpo
If someone is using IntelliJ and is looking for a nice way to contribute, it would be nice if we had a dedicated extension to the IntelliJ scala plugin for singleton-ops.
https://github.com/JetBrains/intellij-scala/wiki/Library-Extensions
This will allow us to get proper error markings within the editor before we even need to compile.
3 replies
Oron Port
@soronpo
@fthomas Do you have an idea why the CI isn't running for #157 ?
Frank S. Thomas
@fthomas
I had similar problems with other projects that still used travis-ci.org. I just migrated it to https://travis-ci.com/github/fthomas/singleton-ops. If you push something now, it should trigger a new build
Oron Port
@soronpo
Yeah, working now. Thanks.
Oron Port
@soronpo
Is anyone using the literal operations for Float and Double? I don't feel like there is a justification enough to continue to include them. There will be a while before I find the time to do some required refactoring of the library, but when I do, I'm strongly considering letting them go. Please speak up if you think otherwise.
Peng Cheng
@tribbloid
Hi @soronpo , I'm the maintainer of shapesafe. Do you know how ops.GetType[Sym] can be used in deduction?
asking because:
  type RequireMsgSym[Cond,Msg,Sym] = OpMacro[OpId.Require, Cond, Msg, GetType[Sym]]
I can only use RequireMsg[Cond,Msg to customise compile-time error message, but once I switch to RequireMsgSym it always fall back to default error message "could not find implicit value for ..."
Oron Port
@soronpo
What do you mean by deduction. The Sym version is for providing the trait that gets the custom implicitNotFound error message. However it's already determined automatically quite well so it's there mainly for legacy and just in case something does not work.
Peng Cheng
@tribbloid
@soronpo I see, that explain it, in the unit test the last arg of RequireMsgSym always has an @implicitNotFound annotation
Peng Cheng
@tribbloid
thanks a lot, but is it really obsolete? RequireMsg only accepts a string literal as the message, while @implicitNotFound message supports interpolation from type parameters:
@implicitNotFound(msg = "Cannot prove that ${From} =:= ${To}.")
sealed abstract class =:=[From, To]
Oron Port
@soronpo
The intended Sym is not for that. It's for tge missed class or trait =:= in your example
The custom message is constructed using type string operations.
Peng Cheng
@tribbloid
That's a very convoluted way of constructing compilation error :)
but very flexible. It definitely fits in my case
Peng Cheng
@tribbloid
I'd like to just add one more feature to better support the RequireMsg case: fthomas/singleton-ops#182 Do you think it is a valid point?
Oron Port
@soronpo
I responded on the issue