This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalaVersion := "2.11.7" | |
// For this dependency you have to clone | |
// https://github.com/b-studios/MixinComposition | |
// and run `sbt publishLocal` | |
libraryDependencies += "de.unimarburg" % "mixin-composition_2.11" % "0.2-SNAPSHOT" | |
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value | |
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.0.6" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object freer { | |
trait Functor[F[_]] { | |
def map[A, B](fa: F[A], f: A => B): F[B] | |
} | |
object Functor { | |
@inline | |
def apply[F[_]](implicit f: Functor[F]): Functor[F] = f | |
implicit class FunctorOps[A, F[_]: Functor](fa: F[A]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Default functor and monad TCs | |
trait Functor[F[_]] { | |
def map[A, B](fa: F[A], f: A => B): F[B] | |
} | |
trait Monad[M[_]] { | |
def unit[A](value: A): M[A] | |
def flatMap[A, B](ma: M[A], f: A => M[B]): M[B] | |
def map[A, B](ma: M[A], f: A => B): M[B] = flatMap(ma, f andThen unit) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object stateful { | |
import scala.collection.mutable | |
trait Stateful { | |
private val cache = mutable.HashMap.empty[Int, Any] | |
// TODO use some reasonable HashMap implementation here | |
// TODO how slow is the reflection here, perform microbenchmarks? | |
protected[stateful] def getStateOrElseUpdate(d: Decorate[_])(s: => d.State): d.State = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Nat | |
trait Succ[T <: Nat] <: Nat | |
trait Zero <: Nat | |
sealed trait Bool { type Not <: Bool } | |
trait True <: Bool { type Not = False } | |
trait False <: Bool { type Not = True } | |
trait Foldable[Base] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object tl_church { | |
trait Booleans { | |
type Bool <: { type Not <: Bool } | |
type True <: Bool | |
type False <: Bool | |
} | |
trait Nats { | |
type Nat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object monadicOA { | |
type ??? = Any | |
trait Monad[M[+_]] { | |
def unit[A]: A => M[A] | |
def bind[A, B]: M[A] => (A => M[B]) => M[B] | |
def map[A, B]: M[A] => (A => B) => M[B] | |
} | |
object Monad { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object monadicOA { | |
type ??? = Any | |
trait Monad[M[+_]] { | |
def unit[A]: A => M[A] | |
def bind[A, B]: M[A] => (A => M[B]) => M[B] | |
def map[A, B]: M[A] => (A => B) => M[B] | |
} | |
object Monad { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file contains some notes taken while reading: | |
* | |
* Comparing Object Encodings | |
* Kim B. Bruce, Luca Cardelli and Benjamin C. Pierce | |
*/ | |
package object encodings { | |
// Library Stuff | |
trait Fix[F[_]] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(00.000084) Added /sys/fs/cgroup/cpuset:/sys/fs/cgroup/cpuset ext mount mapping | |
(00.000136) Added /sys/fs/cgroup/cpu:/sys/fs/cgroup/cpu ext mount mapping | |
(00.000143) Added /sys/fs/cgroup/cpuacct:/sys/fs/cgroup/cpuacct ext mount mapping | |
(00.000149) Added /sys/fs/cgroup/memory:/sys/fs/cgroup/memory ext mount mapping | |
(00.000155) Added /sys/fs/cgroup/devices:/sys/fs/cgroup/devices ext mount mapping | |
(00.000172) Added /sys/fs/cgroup/freezer:/sys/fs/cgroup/freezer ext mount mapping | |
(00.000178) Added /sys/fs/cgroup/blkio:/sys/fs/cgroup/blkio ext mount mapping | |
(00.000184) Added /sys/fs/cgroup/perf_event:/sys/fs/cgroup/perf_event ext mount mapping | |
(00.000200) Added /sys/fs/cgroup/hugetlb:/sys/fs/cgroup/hugetlb ext mount mapping | |
(00.000206) Added /sys/fs/cgroup/systemd:/sys/fs/cgroup/systemd ext mount mapping |