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 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))) | |
} |
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
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 |
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
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. |