MonadTrans

MonadTrans is a typeclass that abstracts lifting arbitray monadic computations in another context.

import arrow.mtl.extensions.optiont.monadTrans.monadTrans
import arrow.core.extensions.id.monad.monad
import arrow.core.extensions.*
import arrow.core.*
import arrow.mtl.*

OptionT.monadTrans().run {
  Id.just("hello").liftT(Id.monad())
}
// OptionT(value=Id(Some(hello)))

Laws

Arrow provides MonadTransLaws in the form of test cases for internal verification of lawful instances and third party apps creating their own MonadTrans instances.

Creating your own MonadTrans instances

Arrow already provides MonadTrans instances for OptionT. See the implementation and accompanying testcases for reference.

See Deriving and creating custom typeclass

Data types

Module Data types
arrow.mtl AccumT, OptionT

Type Class Hierarchy

Do you like Arrow?

Arrow Org
<