Skip to content

Instantly share code, notes, and snippets.

View andyscott's full-sized avatar
🌲

Andy Scott andyscott

🌲
View GitHub Profile
@andyscott
andyscott / hkt.rs
Created January 4, 2018 22:16 — forked from AZaviruha/hkt.rs
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {

Advanced Functional Programming with Scala - Notes

Copyright © 2017 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
@andyscott
andyscott / drop-to-repl-2.9.RC1.scala
Created April 6, 2011 18:39 — forked from retronym/drop-to-repl-2.8.scala
Scala Drop to REPL (like debug break..)
/**
* Originally authored by Jason. Updated by me (Andy) to work in Scala 2.9 RC1
*
* @author Jason Zaugg (aka retronym), Andy Scott
*/
object InterpreterUtil {
import scala.tools.nsc.interpreter._
import scala.tools.nsc.interpreter.Results._
import scala.tools.nsc.Settings