Skip to content

Instantly share code, notes, and snippets.

Avatar

Erik Osheim non

  • Providence / Philly
View GitHub Profile
@non
non / JavapPlugin.scala
Created Jan 29, 2018
Slouching toward a functioning SBT plugin.
View JavapPlugin.scala
package sbtjavap
import sbt._
import Keys._
import complete.DefaultParsers.StringBasic
import scala.sys.process.Process
object Plugin extends AutoPlugin {
object autoImport {
@non
non / analysis.md
Last active Jan 2, 2018
Some notes about the interaction of SIP-23 with specialization.
View analysis.md

introduction

I was asked to consider how specialization should interact with SIP-23. Here is a quick test I did with some thoughts on where we are now versus where we should be.

See tlc.scala for the code and tlc.bytecode for the Java bytecode that code produced (using Typelevel Scala with the -Yliteral-types flag enabled).

View sipzz.md

SIP-ZZ - NewType Classes

Introduction

This is a proposal to introduce syntax for classes in Scala that can get completely inlined, so operations on these classes have zero overhead compared to external methods. Some use cases for inlined classes are:

  • Inlined implicit wrappers. Methods on those wrappers would be
@non
non / builtins.txt
Last active May 12, 2017
List of classes/traits in Scala's standard library that are probably worth supporting via type classes. The implication being that other types (e.g. GenSeq) are not worth supporting directly. Suggested additions welcome!
View builtins.txt
scala
Array
BigDecimal
BigInt
Boolean
Byte
Char
Double
Float
FunctionN...
View NotFantastic.scala
// this code demonstrates unsoundness in scala (tested in 2.11 and 2.12)
//
// it seems like scala is checking that the return type is a Pipe[_]
// but not a Pipe[E]; maybe due to erasure?
sealed abstract class Pipe[E]
case class Single[E](elem: E) extends Pipe[E]
case class Double[A, B](a: Pipe[A], b: Pipe[B]) extends Pipe[(A, B)]
object Pipe {
@non
non / laws.md
Last active Feb 2, 2019
I feel like conversations around laws and lawfulness in Scala are often not productive, due to a lack of rigor involved. I wanted to try to be as clear and specific as possible about my views of lawful (and unlawful) behavior, and what I consider a correct and rigorous way to think about laws (and their limits) in Scala.
View laws.md

Laws

A law is a group of two or more expressions which are required to be the same. The expressions will usually involve one or more typed holes ("inputs") which vary.

Some examples:

x.map(id)                 === x
@non
non / mark.scala
Created Jan 3, 2017
Scala solver for Mark Dominus' arithmetic puzzle (http://blog.plover.com/math/17-puzzle.html).
View mark.scala
package mark
import spire.math.{ Rational => Q }
object Solver2 {
case class Op(name: String, run: (Q, Q) => Option[Q])
val ops: List[Op] = List(
Op("+", (x, y) => Some(x + y)),
View gist:ee5eb4ae64125b60ddc794742e0fc7e5
### higher profile independent games
868-hack: really fun glitchy hacking game
diaries of a spaceport janitor: meditative weirdness, cryptic walking sim
ftl: roguelike space adventure game #1
out there: rogulike space exploration game #2
hadean lands: alechmical exploration text adventure
sunless sea: steampunk underground sailing game
this war of mine: too real refugee-during-wartime sim
vvvvvv: light-hearted/abstract platform puzzle game
View twine-games.txt
## ELEVEN TWINE GAMES
16 Ways To Kill A Vampire At McDonalds
by @AbigailMoment (Abigail Corfman)
https://ifcomp.org/1553/content/16%20Ways%20To%20Kill%20A%20Vampire%20At%20McDonalds.html
humorous game about a vampire killer's night off
My Father's Long, Long Legs
@WarrenIsDead (Michael Lutz)
http://correlatedcontents.com/misc/Father.html
@non
non / beala.scala
Created May 9, 2016
Demo using Cats/Dogs to implement lazy memoization, similar to this Haskell gist: https://gist.github.com/beala/d871ae8397167e7035f218a25ddf87dd
View beala.scala
package beala
import dogs._
object Beala {
// ironically dogs doesn't support unsafe operations by default,
// so we have to build them ourselves (since we know our stream
// is infinite and will always have elements).
def head[A](as: Streaming[A]): A =