View match-types.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
miles@tarski:~% cs launch scala3-repl | |
scala> trait A | |
| trait B | |
| type M[X] = X match | |
| case A => Int | |
| case B => String | |
| | |
// defined trait A | |
// defined trait B |
View trait-instances-2.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.{Applicative, Monad} | |
import cats.implicits._ | |
abstract class Foo[+M[_[_]], F[_]](implicit val M: M[F]) | |
trait Bar[F[_]] extends Foo[Applicative, F] { def bar = Applicative[F] } | |
trait Baz[F[_]] extends Foo[Monad, F] { def baz = Monad[F] } | |
class User[F[_]: Monad] extends Bar[F] with Baz[F] | |
object Test { |
View trait-instances.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.{Applicative, Monad} | |
import cats.implicits._ | |
abstract class Foo[+M[_[_]], F[_]](implicit val M: M[F]) | |
trait Bar[F[_]] extends Foo[Applicative, F] { def bar = Applicative[F] } | |
trait Baz[F[_]] extends Foo[Monad, F] { def baz = Monad[F] } | |
class User[F[_]: Monad] extends Bar[F] with Baz[F] | |
object Test { |
View match-types.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Miles Sabin | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
View tupletype.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tupleType(tpes: List[Type]): Type = { | |
val PairType = typeOf[_ *: _] match { | |
case Type.IsAppliedType(tp) => tp.tycon | |
} | |
@tailrec | |
def nestedPairs(tpes: List[Type], acc: Type): Type = tpes match { | |
case Nil => acc | |
case hd :: tail => nestedPairs(tail, Type.AppliedType(PairType, List(hd, acc))) | |
} |
View ambiguous.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Utils { | |
type Id[t] = t | |
type Const[c] = [t] => c | |
} | |
import Utils._ | |
class Instances[F[_[_]], T[_]] | |
trait Functor[F[_]] |
View LocalTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// local/localtests/test/localtests/LocalTests.scala | |
package localtests | |
import java.nio.file._ | |
import java.util.stream.{ Stream => JStream } | |
import org.junit.{ AfterClass, Test } | |
import scala.collection.JavaConverters._ | |
import scala.concurrent.duration._ |
View gist:5385e70f9bbf2f613dd62ffb5f8adf25
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
miles@tarski:perf_tester (topic/miles-byname-implicits)% java -jar target/scala-2.12/perf_tester-assembly-0.1.jar -s /home/miles/projects/scala -r results -a corpus/scala-library -c miles-byname-implicits --user miles -i 50 -p 3 | |
Output logging to /home/miles/projects/perf_tester/results/miles/miles-byname-implicits | |
ALL | |
Run Name Cycle samples Wall time (ms) All Wall time (ms) CPU(ms) Idle time (ms) Allocated(MBs) | |
pre-pr 1 50 9,332.00 [-10.92% +203.33%] 9,332.00 [-10.92% +203.33%] 9,188.06 [-10.64% +196.26%] 0.00 [ NaN% NaN%] 2,743.61 [-0.38% +6.58%] | |
pre-pr 2 50 9,088.94 [-10.42% +192.67%] 9,088.94 [-10.42% +192.67%] 8,959.18 [-10.03% +185.47%] 0.00 [ NaN% NaN%] 2,745.65 [-0.51% +6.81%] | |
pre-pr 3 50 9,176.00 [-9.87% +199.00%] 9,176.00 [-9.87% |
NewerOlder