Last active
February 22, 2016 14:09
-
-
Save wheaties/d5daacb9305c8f6533ec to your computer and use it in GitHub Desktop.
Single level merge
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 } | |
| } | |
| trait LowPriorityMerge{ | |
| type Aux[L, R, O] = Merge[L, R]{ type Out = O } | |
| implicit def none[S, T]: Aux[S, T, S|T] = new Merge[S, T]{ type Out = S|T } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment