Skip to content

Instantly share code, notes, and snippets.

🦉

Lukas Rytz lrytz

🦉
Block or report user

Report or block lrytz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scala-bisect.sh
#!/usr/bin/env bash
die () {
echo "$@"
exit 1
}
repo_dir=$(git rev-parse --show-toplevel) || die "Run this script in a Scala git checkout"
current () {
@lrytz
lrytz / usability-summer.md
Last active Jul 11, 2019
Summer of Usability
View usability-summer.md

Summer of Usability

Dear Community

We from the Scala team at Lightbend have decided to take some time this summer to work on usability improvements that are always falling through the cracks while we're busy working on the hard features of the next Scala release. Here is a summary of our project proposals.

REPL usability improvements

@som-snytt already implemented the JLine 3 upgrade (https://github.com/scala/scala/pull/8036) which gives multi-line history and editing. We are planning to add further improvements (many of them pioneered by Ammonite and/or the Dotty REPL) on top of this, for example syntax highlighting and import library dependencies.

View option-methods.txt
scala> println(typeOf[Option[String]].membersBasedOnFlags(0, scala.reflect.internal.Flags.METHOD).toList.sortBy(_.name).mkString("\n"))
method $asInstanceOf
method !=
method :\
method /:
method ==
method ##
method $init$
method $isInstanceOf
constructor Option
View JFunction0$mcV$sp
// class version 52.0 (52)
// access flags 0x601
// signature Ljava/lang/Object;Lscala/Function0<Ljava/lang/Object;>;Ljava/io/Serializable;
// declaration: scala/runtime/java8/JFunction0$mcV$sp extends scala.Function0<java.lang.Object>, java.io.Serializable
public abstract interface scala/runtime/java8/JFunction0$mcV$sp implements scala/Function0 java/io/Serializable {
// compiled from: JFunction0$mcV$sp.scala
@Ljava/lang/FunctionalInterface;()
View asc.scala
import annotation.unchecked.uncheckedVariance
trait Bldr[-A, +To] { self =>
def result(): To
}
trait ItFact[+CC[_]] {
def from[A](source: It[A]): CC[A]
def newBuilder[A]: Bldr[A, CC[A]]
}
View missingOverride.scala
import annotation.unchecked.uncheckedVariance
trait Bldr[-A, +To] { self =>
def result(): To
def mapResult[NTo](f: To => NTo): Bldr[A, NTo] = new Bldr[A, NTo] {
def result(): NTo = f(self.result())
}
}
trait ItFact[+CC[_]] {
View Colls.scala
import annotation.unchecked.uncheckedVariance
trait Bldr[-A, +To] { self =>
def result(): To
def mapResult[NTo](f: To => NTo): Bldr[A, NTo] = new Bldr[A, NTo] {
def result(): NTo = f(self.result())
}
}
trait ItFact[+CC[_]] {
def from[A](source: It[A]): CC[A]
View Test.scala
import annotation.unchecked.uncheckedVariance
trait Builder[-A, +To]
trait IterableFactory[+CC[_]] {
def from[A](source: It[A]): CC[A]
def newBuilder[A]: Builder[A, CC[A]]
}
trait ItOps[+A, +CC[_], +C] {
protected type IterableCC[X] = CC[X] @uncheckedVariance
View Stepper.scala
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
@lrytz
lrytz / Test.scala
Created Dec 7, 2018
Ensure stepper / stream / accumulator / array conversions don't box
View Test.scala
import com.google.monitoring.runtime.instrumentation.AllocationRecorder
import com.google.monitoring.runtime.instrumentation.Sampler
import scala.collection.convert._
import scala.collection.JavaConverters._
// download java-allocation-instrumenter-3.2.0.jar from here:
// http://repo1.maven.org/maven2/com/google/code/java-allocation-instrumenter/java-allocation-instrumenter/3.2.0/
// compile and run with
You can’t perform that action at this time.