These are chat archives for adamw/macwire

9th
Jun 2015
Michael McFarland
@mikedmcfarland
Jun 09 2015 01:39

I'm a little surprised by the following behavior
given a type PlatformsPage with dependencies

class PlatformsPage(platformStore:PlatformStore,platformBackend:(BackendScope[Props,State] => Backend))

I'm trying to create a factory method (platformsBackend) as a def.

trait PlatformsModule {
  lazy val platformsPage = wire[PlatformsPage]
  lazy val platformsStore = wire[PlatformStore]
  def platformsBackend(scope:BackendScope[Props,State]):Backend = new Backend(scope)
}

This results in an error:

Cannot find a value of type: [japgolly.scalajs.react.BackendScope[spatutorial.client.modules.platform.Props,spatutorial.client.modules.platform.State] => spatutorial.client.modules.platform.Backend]

however these versions work

lazy val platformsBackend:BackendScope[Props,State] => Backend = new Backend(_)
type BackendFactory = BackendScope[Props,State] => Backend
lazy val platformsBackend:BackendFactory = new Backend(_)

can function defs not be used to create factory dependencies?

Sorry if that's clearly stated, or I'm missing something obvious. Macwire has been a joy to use
Adam Warski
@adamw
Jun 09 2015 07:23
defs aren't currently automatically converted to function values, but that would be definitely a good feature to add - could you create a GH issue?
Michael McFarland
@mikedmcfarland
Jun 09 2015 20:46
Sure, adamw/macwire#43