Reputation: 10429
A single of code can achieve a lot in Scala.
def -(that: Nat) = if (that.isZero) this else throw new Error("negative number")
However, it is difficult to debug. Any tips?
Upvotes: 2
Views: 89
Reputation: 5176
you can see output of compiler phases, i.e. the AST after desugarings with
scalac -Xprint:typer
scalac -Xprint-types (note hyphen, not colon)
The man page is a little confusing, there's no "typer" phase listed, but it works:
http://www.scala-lang.org/docu/files/tools/scalac.html
Upvotes: -1
Reputation: 62835
Use scala worksheet. That's it: you'll get multiline REPL with your environment in which you can play with your code.
Alternatively, just use REPL bundled with sbt (
sbt console
) with proper imports
Upvotes: 4