I have written the following scala script in ammonite shell
#!/usr/bin/env amm
@main
def main() = {
val p = Person("foo")
}
case class Person(name: String)
This compiles and works fine. But I need the class Person to be in a package called com.foo
If I try
#!/usr/bin/env amm
@main
def main() = {
val p = Person("foo")
}
package com.foo {
case class Person(name: String)
}
Now I get a syntax error which is like
Syntax Error: End:7:1 ..."package co"
package com.foo {
I wonder how can I specify the namespace for my case class. Since its a script, I would like to keep everything in the same file.