質問

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