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| // 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 { |
| 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)), |
| ### 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 |
| ## 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 |
| 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 = |
| package modulus | |
| import spire.algebra.{ Eq, Field } | |
| import spire.math.Polynomial | |
| class Mod(val residue: Long, val modulus: Long) { lhs => | |
| def +(rhs: Mod): Mod = { | |
| require(lhs.modulus == rhs.modulus) | |
| Mod(lhs.residue + rhs.residue, modulus) |
| package array | |
| class Test { | |
| def callSize(arr: Array[Int]): Int = arr.size | |
| def callLength(arr: Array[Int]): Int = arr.length | |
| } |
| package du | |
| import cats._ | |
| import cats.implicits._ | |
| import cats.data.Streaming | |
| import java.io.File | |
| /** | |
| * This is a port of this Haskell code to Scala using Cats. | |
| * |
| package zg | |
| import spire.random.Generator | |
| /** | |
| * ImGen is an immutable RNG. | |
| * | |
| * It "hides" Generator's mutability through next. | |
| */ | |
| class ImGen[G <: Generator](gen: G) { |