Akka来源地图:" ...不符合预期类型T _"

时间:2016-08-20 13:37:50

标签: scala types stream akka

我有以下代码:

  override def factors: Source[MarketFactors, NotUsed] = {
    Source(Stream.continually(generator)).map(random => {
      val correlated = currentFactors.keys zip random.nextVector()

      val generatedPrice: Map[Equity, Double] = correlated.toSeq.map({
        case (equity, randomValue) =>
          (equity, currentFactors(equity).price + randomValue * currentFactors(equity).volatility)
      })(scala.collection.breakOut)

      GeneratedMarketFactors(generatedPrice)
    })
 }

它应该从随机生成器获取值并创建新价格。 给map的函数的类型为CorrelatedRandomVectorGenerator => MarketFactorsGeneratedMarketFactors被声明为内部案例类并扩展MarketFactors

但是,我收到错误Expression of type FactorsGenerator.GeneratedMarketFactors doesn't conform to expected type T_。我做错了什么?

我对Scala和Akka流之间的混合感到不满意,是Stream.continually(generator)的替换吗?

0 个答案:

没有答案