Skip to content

Instantly share code, notes, and snippets.

@Odomontois
Created September 25, 2020 11:48
Show Gist options
  • Select an option

  • Save Odomontois/736c72e192cbbf2105b02b85f1f8b1ae to your computer and use it in GitHub Desktop.

Select an option

Save Odomontois/736c72e192cbbf2105b02b85f1f8b1ae to your computer and use it in GitHub Desktop.
import playground.chat.whatType
class BuznesErar
class ServesErar
def buznes: BiDyrka[BuznesErar, String] = BiDyrka.impl
def serves(s: String): BiDyrka[ServesErar, Int] = BiDyrka.impl
val x : BiDyrka[ServesErar | BuznesErar, Int] =
for
str <- buznes
int <- serves(str)
str2 <- buznes
int2 <- serves(str2)
yield int + int2
@main def bydyrka = println(whatType(x))
enum BiDyrka[+E, +A]:
case impl
def flatMap[E1, B](f: A => BiDyrka[E1, B]): BiDyrka[E | E1, B] = impl
def map[B](f: A => B): BiDyrka[E, B] = impl
package playground.chat
import scala.quoted._
def printType[T : Type](using QuoteContext): Expr[String] =
val t = summon[Type[T]].unseal.show
Expr(t)
inline def whatType[T](x : T): String = ${ printType[T] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment