If I have a plain scala List[A] (i.e. scala.collection.immutable.List) and I have some state monad State[S,B]. I'd like to use Scalaz's specialized traverseS ala:

val stuff: scala.collection.immutable.List[Int] = List(1,2,3)
val state: State[S,A]
stuff.traverseS(i => modify { ... })

What do I need to import to convert scala.collection.immutable.List to Scalaz's List? I couldn't find searching through GitHub and I wasn't able to get it working with trying to import carte blanche. Perhaps I'm missing something obvious.

Thanks for your help.

有帮助吗?

解决方案

scalaz doens't have its own list implementation. Likely you just need to import the list typeclass instances with import scalaz.std.list._ and the traverse syntax with import scalaz.syntax.traverse._

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top