Last active
July 31, 2018 20:55
-
-
Save wheaties/17322f3f13e224fd79f3 to your computer and use it in GitHub Desktop.
Revisions
-
wheaties revised this gist
Feb 18, 2016 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ 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]{} } protected trait LowPriorityOneOf1{ implicit def recur[L, R, Obj](implicit oneOf: OneOf[Obj, R]) = new OneOf[Obj, L | R]{} } -
wheaties revised this gist
Feb 18, 2016 . 2 changed files with 4 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ trait OneOf[Obj, Items] object OneOf extends OneOf0{ implicit def apply[Obj, Items](implicit oneOf: OneOf[Obj, Items]) = oneOf implicit def left[L, R, Obj <: L] = new OneOf[Obj, L | R]{ type Cond = True } } protected trait OneOf0 extends OneOf1{ implicit def right[L, R, Obj <: R] = new OneOf[Obj, L | R]{ type Cond = True } } protected trait OneOf1{ implicit def recur[L, R, Obj](implicit oneOf: OneOf[Obj, R]) = new OneOf[Obj, L | R]{ type Cond = oneOf.Cond } } 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +0,0 @@ -
wheaties created this gist
Feb 11, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ trait OneOf[A, Items] object OneOf extends OneOf0{ implicit def apply[Obj, Items](implicit oneOf: OneOf[Obj, Items]) = oneOf implicit def head[A, B, Obj <: A] = new OneOf[Obj, A | B]{ type Cond = True } } protected trait OneOf0 extends OneOf1{ implicit def tail[A, B, Obj <: B] = new OneOf[Obj, A | B]{ type Cond = True } } protected trait OneOf1{ implicit def recur[A, B, Obj](implicit oneOf: OneOf[Obj, B]) = new OneOf[Obj, A | B]{ type Cond = oneOf.Cond } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ type |[A, B] = (A, B)