This file contains 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 Macros.{MyClonable, MyClonableTC} | |
object App { | |
class A(val i: Int)(implicit val myClonableTC: MyClonableTC[A]) extends MyClonable { type Self = A } | |
class B(val s: String)(implicit val myClonableTC: MyClonableTC[B]) extends MyClonable { type Self = B } | |
val a: MyClonable = new A(1) | |
val b: MyClonable = new B("bbb") |
This file contains 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
type T_MAX_LATTICE[T] = T; | |
trait C_TEST_COLL[T_Result, T_T] extends C_TYPE[T_Result] with C_TINY[T_Result] { | |
type T_IntegerMaxLattice; | |
val t_IntegerMaxLattice: C_TYPE[T_IntegerMaxLattice] with C_MAX_LATTICE[T_IntegerMaxLattice, T_Integer]; | |
type T_Integers; | |
val t_Integers: C_TYPE[T_Integers] with C_SET[T_Integers, T_Integer]; | |
} | |
class M_TEST_COLL[T_T](name : String,val t_T : C_TYPE[T_T] with C_TINY[T_T]) |
This file contains 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
object App { | |
sealed trait MyType | |
trait MySubType1 extends MyType | |
// trait MySubType2 extends MyType | |
sealed trait OtherTypeClass[S <: MyType] { | |
type Out <: MyType | |
} | |
object OtherTypeClass { | |
type Aux[S <: MyType, O <: MyType] = TypeClass[S] {type Out = O} |
This file contains 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
{-# LANGUAGE RankNTypes, TypeApplications #-} | |
-- We give a constructive proof that any natural transformation that uses | |
-- a type switch in its implementation can also be implemented without the type switch, | |
-- as long as the domain functor is finitely Traversable (and the argument can easily | |
-- be modified to drop the finiteness property). | |
-- We do this by providing a function `opaquify` which takes an n.t. which may do | |
-- type switches, and returns an equivalent n.t. which does not. |
This file contains 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 scala.reflect.ClassTag | |
object DefaultType extends App { | |
case class AttributeMeasure[T](name: String)(implicit ev: reflect.ClassTag[T]) { | |
def ct: ClassTag[T] = ev | |
} | |
/** This almost works, except for the case: | |
* {{{ |
This file contains 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
// x match { | |
// case _: Box[Square] | _: Box[Circle] => ??? | |
// } | |
[info] matchResult10[Nothing]: | |
[info] { | |
[info] case val x13: Object = App.x() | |
[info] matchAlts1[Unit]: | |
[info] { | |
[info] matchAlts2[Unit]: |
This file contains 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 scala.reflect.ClassTag | |
object Bottom extends App { | |
class C[T](implicit ev: reflect.ClassTag[T]) { | |
def ct: reflect.ClassTag[T] = ev | |
} | |
class X[U, -T] | |
object X { |
This file contains 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 shapeless.{HList, HNil, ::} | |
import shapeless.ops.hlist.{Selector, Prepend} | |
import shapeless.test.illTyped | |
object TypeLevelBacktrack extends App { | |
/** [[Parent]] / [[Child]] relationship, father side. */ | |
trait FatherOf[Parent, Child] | |
/** [[Parent]] / [[Child]] relationship, mother side */ | |
trait MotherOf[Parent, Child] |
This file contains 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
//decompiled from __wrapper$1$a077cb72a4ee423291aac7dfb47454b9$.class | |
package __wrapper$1$a077cb72a4ee423291aac7dfb47454b9; | |
import scala.Option; | |
import scala.Product; | |
import scala.Serializable; | |
import scala.Some; | |
import scala.Tuple4; | |
import scala.collection.Iterator; | |
import scala.runtime.AbstractFunction4; |
This file contains 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 org.apache.spark.sql.{Dataset, Encoder, SparkSession} | |
import scala.reflect.runtime | |
import scala.reflect.runtime.universe._ | |
import scala.tools.reflect.ToolBox | |
object App { | |
lazy val spark = SparkSession.builder | |
.appName(getClass.getName) | |
.master("local") | |
.getOrCreate() |