|
Scala example source code file (MonadTransTest.scala)
The MonadTransTest.scala Scala example source code
package scalaz
import std.AllInstances._
import std.option.some
import syntax.either._
object MonadTransTest extends SpecLite {
"liftM" in {
MonadTrans[OptionT].liftM(List(1, 2, 3)).run must_===(List(some(1), some(2), some(3)))
}
"liftMU" in {
val mt = IndexedStateT.StateMonadTrans[Int]
// Inference of M fails when using liftM with a higher kinded type
mt.liftM[String \/ ?, Int](10.right[String]).run(1) must_===((1, 10).right[String])
mt.liftMU(10.right[String]).run(1) must_===((1, 10).right[String])
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala MonadTransTest.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.