Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.48 KB | None | 0 0
  1. // long
  2. sealed trait Foo
  3. case class Bar(x: Int) extends Foo
  4. case class Baz(y: String) extends Foo
  5. case object Quux extends Foo
  6. case object Bah extends Foo
  7.  
  8. // short
  9. data Foo {
  10.   Bar(x: Int)
  11.   Baz(y: String)
  12.   Quux
  13.   Bah
  14. }
  15.  
  16. // alterantively:
  17. data Foo {
  18.   class Bar(x: Int)
  19.   class Baz(y: String)
  20.   object Quux
  21.   object Bah
  22. }
  23.  
  24. // also
  25. data Foo { Bar(x: Int); Bax(y: String); Quux; Bah }
  26. data Foo { class Bar(x: Int); class Bax(y: String); object Quux; object Bah }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement