Reputation: 31526
With cats library. I can easily do
1.pure[List]
but how do I do create a list with multiple items using pure?
Upvotes: 2
Views: 128
Reputation: 28680
A monad M
must obey some laws. One of them is
pure[M](x).flatMap(f) = f(x)
for arbitrary functions f: A -> M[A]
.
With the common implementation of List.flatMap
, this leaves not much room for different implementations of pure[List]
.
Upvotes: 1