Skip to content

Instantly share code, notes, and snippets.

@milessabin
Created September 5, 2013 10:19
Show Gist options
  • Save milessabin/6448380 to your computer and use it in GitHub Desktop.
Save milessabin/6448380 to your computer and use it in GitHub Desktop.
def as[B] = new AsAux[B].apply
class AsAux[B] {
def apply[C](implicit gen: Generic.Aux[B, C], ev: A =:= C): Codec[B] = Codec.xmap(this)(gen.from, gen.to(_))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment