fancadescala/core/src/main/scala/tf/bug/fancadetagless/Pin.scala

30 lines
733 B
Scala

package tf.bug.fancadetagless
import cats.effect.Sync
import cats.implicits._
import io.chrisdavenport.fuuid.FUUID
case class Pin(uuid: FUUID, tpe: PinType, dir: PinDirection)
object Pin {
def fromMake[F[_]](tpe: PinType, dir: PinDirection)(implicit s: Sync[F]): F[Pin] = {
val uuid: F[FUUID] = FUUID.randomFUUID[F]
uuid.map(Pin(_, tpe, dir))
}
}
sealed trait PinType
object PinType {
case object Pull extends PinType
case object Number extends PinType
case object Truth extends PinType
case class Quoted[T <: PinType](v: T) extends PinType
}
sealed trait PinDirection
object PinDirection {
case object Inward extends PinDirection
case object Outward extends PinDirection
}