Last active
July 11, 2016 06:13
-
-
Save vmarquez/7788a22d937cac52df1d51dae4c75d95 to your computer and use it in GitHub Desktop.
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._ | |
import Scalaz._ | |
import IndexedStateT._ | |
type ParserM[S, A] = EitherT[({ type l[a] = StateT[Trampoline, S, a]})#l, String, A] | |
def getVerbose[S]: ParserM[S, S] = { | |
//https://github.com/scalaz/scalaz/blob/series/7.3.x/core/src/main/scala/scalaz/MonadState.scala | |
val monadState = stateTMonadState[S, Trampoline] | |
val state: StateT[Trampoline, S, S] = monadState.get | |
//use liftM on StateT finding the implicit MonadTrans[EitherT] instance | |
state.liftM[({ type l[a[_], b] = EitherT[a, String, b]})#l] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment