I want to call Scalaz's pure
method to put a value into the State monad. The following works:
type IntState[A] = State[Int, A]
val a = "a".pure[IntState]
a(1)
(Int, java.lang.String) = (1,a)
I can also eliminate the type alias (thanks Scalaz's Pure.scala):
val a = "a".pure[({type T[A]=State[Int,A]})#T]
a(1)
(Int, java.lang.String) = (1,a)
But that is extremely clunky. Is there a shorter way to synthesize a type like this? Like placeholder syntax for function literals, is there something like:
"a".pure[State[Int, *]]