Skip to content

Instantly share code, notes, and snippets.

@vmarquez
Last active July 11, 2016 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmarquez/7788a22d937cac52df1d51dae4c75d95 to your computer and use it in GitHub Desktop.
Save vmarquez/7788a22d937cac52df1d51dae4c75d95 to your computer and use it in GitHub Desktop.
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