Skip to content

Instantly share code, notes, and snippets.

View paulp's full-sized avatar
🤫

Paul Phillips paulp

🤫
  • CAZ, Inc.
  • Cascadia Autonomous Zone
View GitHub Profile
package tuple
import language.experimental.macros
import language.dynamics
import scala.reflect.macros.Context
sealed trait ~[+A, +B]
private[tuple] object TupleMacros {
@paulp
paulp / notes.md
Last active December 26, 2015 18:49 — forked from jrudolph/notes.md
  • Thesis: Problem is the language as much as the implementation of the compiler
    • Big problem is cyclic dependency in the typer where type inference and type-checking and implicit search mutually depend on each other. In other words: Can you write an interpreter without also writing a typer that at least implements type inference and implicit search. Can you do implicit search without implementing all of the type checker? Type inference and implicit search must be disentangled. They know that in scala too, except that it will be close to impossible. Note that disentanglement doesn't preclude interaction, but it has to flow through much narrower, explicit, disciplined channels.
    • Consequence if this is true: If you want to simplify the compiler you would have to identify how to simplify the language to break up those cycles **There are innumerable simplifications available in the compiler which require nothing but sane software engineering. If you want to minimize the ESSENTIAL complexity
@paulp
paulp / package.scala
Created January 16, 2016 23:19 — forked from zraffer/package.scala
a few operations with functors
package object types {
import scala.language.reflectiveCalls
import scala.language.higherKinds
// quantifiers aka (co)ends
type Forall[+F[_]] = { def apply[X]: F[X] }
type Exists[+F[_]] = F[_]
// basic categorical notions
@paulp
paulp / integer-division.z3
Created July 4, 2021 21:13 — forked from Rufflewind/integer-division.z3
Truncated integer division in Z3
(declare-fun a () Int)
(declare-fun b () Int)
(declare-fun c () Int)
;; (assert (= a (div -7 -3)))
;; (assert (= b (div 7 -3)))
;; (assert (= c (div -7 3)))
;; (assert (= a (mod -7 -3)))
;; (assert (= b (mod 7 -3)))
;; (assert (= c (mod -7 3)))