DennisVDB DennisVDB - 3 months ago 18
Scala Question

Could not find implicit [...] parameter F: scalaz.Functor[Iterable] with Scalaz OptionT

I have the following code:

OptionT(currentFactors.values).map(_.priceHistory.toList)



  • currentFactors.values // Iterable[Option[A]]

  • priceHistory // Vector[Double]



However I get this error:
could not find implicit value for parameter F: scalaz.Functor[Iterable]
.

I had the same kind of problem when using
scala.Future
with
OptionT
but solved it by mixing-in
scalaz.std.FutureInstances
.

However, I can't manage to solve this problem. What do I need to do? At the same time, what is a
Functor
of
Iterable
(or
Future
)?

Answer

Scalaz does not provide a Functor instance for Iterable. A simple solution is to change to a List:

OptionT(currentFactors.values.toList).map(_.priceHistory.toList)
Comments