Skip to content

Instantly share code, notes, and snippets.

View eparejatobes's full-sized avatar

Eduardo Pareja Tobes eparejatobes

View GitHub Profile
@brendanzab
brendanzab / weird-core-language.md
Last active June 25, 2021 21:16
🚧 A graph-based core for a dependently typed language. 🚧

A graph-based core for a dependently typed language

Abstract

An overly-ambitious attempt to re-think the core calculus of dependent type theory by basing it on graphs as opposed to lambdas, Π-types, Σ-types, etc. The hope is that this might allow us to investigate dependency more closely, and allow us to refine programs to target different environments in an easier way than with traditional programming representations.

Introduction

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@newlandsvalley
newlandsvalley / index.scala.html
Created March 7, 2016 19:18
Simple integration of elm with the Play Framework (Scala)
@*
* This template takes a single argument, a String containing a
* message to display.
*@
@(message: String)
@main("The Interactive ABC Tutorial", "abc", "Main") {
<h1>The Interactive ABC Tutorial</h1>
@smarter
smarter / projection-proposal.md
Created January 5, 2016 12:49
Type projection proposal

NOTE: This is a sketch of the proposal, many details need to be filled out and the scheme hasn't been implemented yet.

G |- T <: S
--------------------
G |- T#L <: S#L

------------------------------
G |- {L: X..Y, ...}#L <: Y
@rmmeans
rmmeans / DynamoJson.scala
Created October 19, 2015 16:29
Play Framework DynamoDB Json
object DynamoReader {
def typeReader[A](f: (JsObject => JsResult[A])) = new Reads[A] {
def reads(json: JsValue): JsResult[A] = json match {
case obj: JsObject => f(obj)
case _ => JsError(Seq(JsPath() -> Seq(ValidationError("error.expected.jsobject"))))
}
}
}
object DynamoString {
@knshiro
knshiro / release.sbt
Last active June 1, 2016 22:08
Make sbt-release work with sbt-git versioning.
import sbtrelease._
import ReleaseKeys._
import Utilities._
import ReleaseStateTransformations._
val gitVersionString = """enablePlugins(GitVersioning)
git.baseVersion := "%s""""
def writeVersion(st: State, versionString: String) {
@laughedelic
laughedelic / Readme.md
Last active August 29, 2015 14:23
Typing unicode symbols in Atom (temporary solution)

Temporary solution for typing unicode symbols in Atom

Usage

  1. Install autocomplete-plus and autocomplete-snippets plugins
  2. Add these snippets to your snippets.cson
  3. Try typing u and the LaTeX name of the symbol you want and you should get autocompletetion with a preview of the symbol

Notes

@arturmkrtchyan
arturmkrtchyan / ObjectHeader32.txt
Last active April 8, 2024 02:03
Java Object Header
|----------------------------------------------------------------------------------------|--------------------|
| Object Header (64 bits) | State |
|-------------------------------------------------------|--------------------------------|--------------------|
| Mark Word (32 bits) | Klass Word (32 bits) | |
|-------------------------------------------------------|--------------------------------|--------------------|
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal |
|-------------------------------------------------------|--------------------------------|--------------------|
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased |
|-------------------------------------------------------|--------------------------------|--------------------|
|
@non
non / transducers.scala
Created October 30, 2014 00:39
Slightly simpler example of typed transducers in Scala. See http://blog.podsnap.com/ducers2.html for more context.
object Transducer {
type RF[R, A] = (R, A) => R
def apply[A, B](f: A => B) =
new Transducer[B, A] {
def apply[R](rf: RF[R, B]) = (r, a) => rf(r, f(a))
}
}
import Transducer.RF
@non
non / cost.md
Last active January 16, 2019 17:12
Basic explanation of the difference between Machinist's macros and value classes.

Introduction

Machinist Issue #2 asks:

Is it correct, that this stuff is completely obsolete now due to value classes or are there still some use cases? An example of using value class for zero-cost implicit enrichment: [...]

The short answer is that Machinist is not obsolete: value classes existed before the Machinist macros were implemented, and they do not solve the