Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created March 31, 2012 17:06
Show Gist options
  • Save missingfaktor/2266798 to your computer and use it in GitHub Desktop.
Save missingfaktor/2266798 to your computer and use it in GitHub Desktop.
scala> trait TF {
| type ![A]
| }
defined trait TF
scala> type Curried2[F[_, _]] = TF {
| type ![X] = TF {
| type ![Y] = F[X, Y]
| }
| }
defined type alias Curried2
scala> "a".pure[Curried2[State] # ![Int] # !]
res0: scalaz.State[Int,java.lang.String] = scalaz.States$$anon$1@6e375e
@mergeconflict
Copy link

Note: I'm a moron.

def stateMonad[S] = {
  type `State[S]`[A] = State[S, A]
  new Monad[`State[S]`] { ... }
}

Duh... No need for the type lambda trick here at all. Or rather, since we have our enclosing scope with S defined, we're sort of "inside" the type lambda already.

@missingfaktor
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment