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
| trait Merge[LSet, RSet]{ | |
| type Out | |
| } | |
| object Merge extends LowPriorityMerge{ | |
| implicit def left[L, R]: Aux[L, L|R, L|R] = new Merge[L, L|R]{ type Out = L|R } | |
| implicit def right[L, R]: Aux[R, L|R, L|R] = new Merge[R, L|R]{ type Out = L|R } | |
| } |
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
| trait Merge[LSet, RSet]{ | |
| type Out | |
| } | |
| object Merge extends LowPriorityMerge{ | |
| implicit def left[L, R]: Aux[L, L|R, L|R] = new Merge[L, L|R]{ type Out = L|R } | |
| implicit def right[L, R]: Aux[R, L|R, L|R] = new Merge[R, L|R]{ type Out = L|R } | |
| } |
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
| class Contains[Items]{ | |
| def apply[Obj](obj: Obj)(implicit oneOf: OneOf[Obj, Items]) = obj | |
| } | |
| val isd = new Contains[Int|String|Double] | |
| //success test cases | |
| isd(1) | |
| isd(2.0) | |
| isd("hello") |
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
| trait OneOf[Obj, Items] | |
| object OneOf extends LowPriorityOneOf{ | |
| implicit def left[L, R, Obj <: L] = new OneOf[Obj, L | R] | |
| } | |
| protected trait LowPriorityOneOf{ | |
| implicit def right[L, R, Obj <: R] = new OneOf[Obj, L | R] | |
| } |
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
| trait OneOf[Obj, Items] | |
| object OneOf extends LowPriorityOneOf{ | |
| implicit left[L, R] = new OneOf[L, L | R]{} | |
| } | |
| trait LowPriorityOneOf{ | |
| implicit right[L, R] = new OneOf[R, L | R]{} | |
| } |
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
| trait OneOf[Obj, Items] | |
| class Prove[Items]{ | |
| def check[Obj](obj: Obj)(implicit proof: OneOf[Obj, Items]) = obj | |
| } | |
| type |[A, B] = (A, B) |
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
| trait OneOfProof[Obj, Types] { | |
| type Cond <: Bool | |
| } | |
| object OneOfProof extends OneOfProof1{ | |
| implicit def left[Obj, R]: Aux[Obj, Obj | R, True] = new OneOfProof[Obj, Obj | R] { type Cond = True } | |
| } | |
| trait OneOfProof1 extends OneOfProof2{ | |
| implicit def right[Obj, L]: Aux[Obj, L | Obj, True] = new OneOfProof[Obj, L | Obj] { type Cond = True } |
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
| trait OneOf[Obj, Items] | |
| object OneOf extends LowPriorityOneOf{ | |
| implicit def apply[Obj, Items](implicit oneOf: OneOf[Obj, Items]) = oneOf | |
| implicit def left[L, R, Obj <: L] = new OneOf[Obj, L | R]{} | |
| } | |
| protected trait LowPriorityOneOf extends LowPriorityOneOf1{ | |
| implicit def right[L, R, Obj <: R] = new OneOf[Obj, L | R]{} |
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
| 2.10.6 (not working) | |
| ______ | |
| object Triple extends LowerPriorityTriple { | |
| def <init>() = { | |
| super.<init>(); | |
| () | |
| }; | |
| object exports extends scala.AnyRef { | |
| def <init>() = { | |
| super.<init>(); |
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
| 2.10.6 (not working) | |
| ____________ | |
| implicit <macro> def tpedefns$Triple$anonimplicit$0[$41$[$42$, $43$, $44$] >: tpedefns.this.Triple[$42$, $43$, $44$], $45$ >: _root_.scala.Nothing <: _root_.scala.Any, $46$ >: _root_.scala.Nothing <: _root_.scala.Any, $47$ >: _root_.scala.Nothing <: _root_.scala.Any]: export.this.Export5[$41$[$45$, $46$, $47$]] = _root_.export.ExportsImplExpr.exportsImpl000[tpedefns.this.Triple, $45$, $46$, $47$, export.this.Export5] | |
| 2.11.7 (working) | |
| ____________ | |
| implicit <macro> def tpedefns$Triple$anonimplicit$0[fresh$macro$753[fresh$macro$754, fresh$macro$755, fresh$macro$756] >: tpedefns.this.Triple[fresh$macro$754, fresh$macro$755, fresh$macro$756], fresh$macro$757, fresh$macro$758, fresh$macro$759]: export.this.Export5[fresh$macro$753[fresh$macro$757, fresh$macro$758, fresh$macro$759]] = _root_.export.ExportsImplExpr.exportsImpl000[tpedefns.this.Triple, fresh$macro$757, fresh$macro$758, fresh$macro$759, export.this.Export5] | |
| ++++++++ |