Skip to content

Instantly share code, notes, and snippets.

@pjrt
Created February 19, 2021 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjrt/b8136d96f68f31f98997ed3528ccfa7d to your computer and use it in GitHub Desktop.
Save pjrt/b8136d96f68f31f98997ed3528ccfa7d to your computer and use it in GitHub Desktop.
final case class Email(name: String, hostname: String)
object Email {
implcit val manualInstance: JsonParser[Email] =
for {
email <- JsonParser.get("email")
(name, hostname) = email.splitAt('@')
} yield Email(name, hostname)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment