All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.kodeworks.kvarg.model.FlattenDomains.scala Maven / Gradle / Ivy

There is a newer version: 0.7
Show newest version
package no.kodeworks.kvarg.model

import shapeless._
import shapeless.ops.hlist.FlatMapper

trait FlattenDomains[Domains] {
  type Out <: HList
}

object FlattenDomains {
  type Aux[Domains <: HList, Out0 <: HList] = FlattenDomains[Domains] {type Out = Out0}

  def apply[Domains <: HList](implicit fd: FlattenDomains[Domains]): fd.type = fd

  implicit def flatten[Domains <: HList, Out0 <: HList]
  (implicit flatMap: FlatMapper.Aux[flat.type, Domains, Out0])
  : FlattenDomains.Aux[Domains, Out0] = new FlattenDomains[Domains] {
    override type Out = Out0
  }

  private object flat extends Poly1 {
    implicit def apply[F]: Case.Aux[F, F] = at[F](identity)
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy