Created
September 25, 2020 11:48
-
-
Save Odomontois/736c72e192cbbf2105b02b85f1f8b1ae 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
| 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 | |
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 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