Skip to content

Instantly share code, notes, and snippets.

@bvenners
Created August 7, 2014 16:23
Show Gist options
  • Save bvenners/2c950912dda72dc58e9b to your computer and use it in GitHub Desktop.
Save bvenners/2c950912dda72dc58e9b to your computer and use it in GitHub Desktop.
case class Plan(estimate: Int, strategy: String)
case class Concept(idea: String)
case class Project(concept: Concept, plan: Plan)
def workOn(project: Project): String =
project match {
case Project(con @ Concept("fool people"), _) =>
"can't fool me with : " + con
case proj @ Project(_, plan @ Plan(len, _)) if len > 10 =>
"that's going to take too long: " + plan
case Project(Concept(idea), Plan(len, strategy)) =>
s"I like your idea, $idea, and your strategy, $strategy, seems sound, but can you really do it in $len months?"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment