Created
April 17, 2014 20:39
-
-
Save andyscott/11010224 to your computer and use it in GitHub Desktop.
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
trait Magnetic[T] { | |
protected sealed trait TagMag | |
type Magnet = T @@ TagMag | |
protected implicit def tag(value: T) = Tag[T, TagMag](value) | |
def apply(mag: Magnet): T = mag | |
} | |
object CreateDescriptor extends Magnetic[CreateDescriptor] { | |
implicit def default(unit: Unit): Magnet = CreateDescriptor(None, AssetDescriptorRecord()) | |
implicit def fromUser(user: ProfilePair): Magnet = CreateDescriptor(Some(user), AssetDescriptorRecord()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment