Skip to content

Instantly share code, notes, and snippets.

@anelson
Last active June 1, 2016 21:58
Show Gist options
  • Save anelson/40a34045363d4577e2f0441cdfe6d0af to your computer and use it in GitHub Desktop.
Save anelson/40a34045363d4577e2f0441cdfe6d0af to your computer and use it in GitHub Desktop.
//...boilerplate
case class Role(policies: Option[Seq[Policy]]))
case class Policy(statements: Option[Seq[Statement]])
case class Statement(action: String)
val role: Role = ....
/* How do I:
* Set Role.policies to an empty Seq iff it's None
* Get the first Policy in Role.policies, adding a new empty Policy if Role.policies is empty
* Set Policy.statements to an empty Seq iff it's None
* Append a new Statement to Policy.statements
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment