Created
November 25, 2017 22:15
-
-
Save macalinao/77bcf333ab480fb3996a37658ce347cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] Compiling 1 Scala source to /Users/ian/proj/asunaio/alexandria/target/scala-2.12/classes... | |
[error] /Users/ian/proj/asunaio/alexandria/src/main/scala/asuna/alexandria/transforms/StatsAndPopGenerator.scala:73: ambiguous implicit values: | |
[error] both value scgen in object StatsAndPopGenerator of type => shapeless.Generic[asuna.proto.league.monoids.all_champions_sums.Scalars]{type Repr = scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: scala.collection.immutable.Map[Int,asuna.proto.league.monoids.match_sum.Moments] :: shapeless.HNil} | |
[error] and value cgen in object StatsAndPopGenerator of type => shapeless.Generic[asuna.proto.league.derived.all_champions_statistics_data.Scalars]{type Repr = Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: Option[asuna.proto.league.derived.all_champions_statistics_data.Stat] :: shapeless.HNil} | |
[error] match expected type T | |
[error] ] = genericGenerator(scgen, cgen, pgen, implicitly) | |
[error] ^ | |
[warn] /Users/ian/proj/asunaio/alexandria/src/main/scala/asuna/alexandria/transforms/StatsAndPopGenerator.scala:5: Unused import | |
[warn] import asuna.proto.league.derived.all_champions_statistics_data.{ AllChampionsStatisticsData, Stat, Population } | |
[warn] ^ | |
[warn] one warning found | |
[error] one error found | |
[error] (compile:compileIncremental) Compilation failed | |
[error] Total time: 0 s, completed Nov 25, 2017 4:15:34 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package asuna.alexandria.transforms | |
import asuna.proto.league.monoids.match_sum.Moments | |
import asuna.proto.league.derived.all_champions_statistics_data | |
import asuna.proto.league.derived.all_champions_statistics_data.{ AllChampionsStatisticsData, Stat, Population } | |
import shapeless._ | |
import asuna.proto.league.monoids.all_champions_sums | |
trait StatsAndPopGenerator[M, S, P] { | |
def generate(in: M): (S, P) | |
} | |
object StatsAndPopGenerator { | |
import StatsAndPopComputations._ | |
def apply[M, S, P](fn: M => (S, P)): StatsAndPopGenerator[M, S, P] = { | |
new StatsAndPopGenerator[M, S, P] { | |
def generate(in: M): (S, P) = { | |
fn(in) | |
} | |
} | |
} | |
implicit val hnilGenerator: StatsAndPopGenerator[HNil, HNil, HNil] = | |
apply(_ => (HNil, HNil)) | |
implicit def hlistGenerator[ | |
M <: HList, S <: HList, P <: HList, | |
]( | |
implicit tailSPG: StatsAndPopGenerator[M, Map[Int, S], P], | |
): StatsAndPopGenerator[ | |
Map[Int, Moments] :: M, | |
Map[Int, Option[Stat] :: S], | |
Population :: P, | |
] = apply { case (moments :: rest) => | |
val (statsHead, popHead) = computeStatsAndPopulation(moments) | |
val (statsTail, popTail) = tailSPG.generate(rest) | |
( | |
statsTail.transform { case (key, value) => | |
statsHead.get(key) :: value | |
}, | |
popHead :: popTail, | |
) | |
} | |
def genericGenerator[ | |
MG, SG, PG, | |
M <: HList, S <: HList, P <: HList, | |
]( | |
implicit genm: Generic.Aux[MG, M], | |
gens: Generic.Aux[SG, S], | |
genp: Generic.Aux[PG, P], | |
generator: StatsAndPopGenerator[M, S, P], | |
): StatsAndPopGenerator[ | |
MG, SG, PG, | |
] = apply { m => | |
val (statsL, popL) = generator.generate(genm.to(m)) | |
( | |
gens.from(statsL), | |
genp.from(popL), | |
) | |
} | |
implicit val scgen = Generic[all_champions_sums.Scalars] | |
implicit val cgen = Generic[all_champions_statistics_data.Scalars] | |
implicit val pgen = Generic[all_champions_statistics_data.ScalarsPop] | |
val acsdGenerator: StatsAndPopGenerator[ | |
all_champions_sums.Scalars, | |
all_champions_statistics_data.Scalars, | |
all_champions_statistics_data.ScalarsPop, | |
] = genericGenerator(scgen, cgen, pgen, implicitly) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment