Skip to content

Instantly share code, notes, and snippets.

View jdegoes's full-sized avatar

John A. De Goes jdegoes

View GitHub Profile
@gfixler
gfixler / lofp_rank
Last active April 2, 2024 20:17
Current placement on the Standardized Ladder of Functional Programming
Standardized Ladder of Functional Programming
http://lambdaconf.us/downloads/documents/lambdaconf_slfp.pdf
Level Key
0: I've never heard of this
1: I've heard of this
2: I've looked into this, but don't get it yet
3. I have a basic understanding/am using this
4. I've used this for a while/feel pretty solid on
5. I could comfortably teach this to others
@runarorama
runarorama / Adjunctions.scala
Last active December 2, 2019 19:58
Free/forgetful adjunctions
import scalaz._, Scalaz._
// Adjunction between `F` and `G` means there is an
// isomorphism between `A => G[B]` and `F[A] => B`.
trait Adjunction[F[_],G[_]] {
def leftAdjunct[A, B](a: A)(f: F[A] => B): G[B]
def rightAdjunct[A, B](a: F[A])(f: A => G[B]): B
}
// Adjunction between free and forgetful functor.
@iravid
iravid / FreeState.scala
Created January 11, 2018 20:42
Experimenting with hand-rolled interpreters for free structures
package freestate
sealed abstract class FreeState[S, A] { self =>
def tag: Int
final def map[B](f: A => B): FreeState[S, B] = self match {
case FreeState.Pure(a) => FreeState.Pure(f(a))
case _ =>
FreeState.FlatMap(self, (a: A) => FreeState.Pure(f(a)))
}