11471 (2) [Avatar] Offline
#1
I am new to scala. I downloaded the code from git and compiled with sbt. I also used the eclipse plugins.sbt to build eclipse code.

How do I run the code? I do not see a main.
Debasish Ghosh (116) [Avatar] Offline
#2
Thanks for reporting. The main idea behind the code fragments are to explore interactively. Since every chapter delas with a lot of topics it's not always practical to have separate main programs for each. The ideal way to explore is to use sbt console and explore. Here's a sample fragment on how to explore the free monad based implementation in chapter 5.

Let me know if this helps and if you need any further guidance on this.


Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import frdomain.ch5.free._
import frdomain.ch5.free._

scala> import Main._
import Main._

scala> import app1._
import app1._

scala> t
res0: scalaz.concurrent.Task[frdomain.ch5.free.Account] = scalaz.concurrent.Task@764e2d3c

scala> t.run
res1: frdomain.ch5.free.Account = Account(a-123,debasish ghosh,Fri Dec 11 21:08:38 IST 2015,None,Balance(17000))

scala> import app2._
import app2._

scala> v
res2: List[String] = List(Storing Account(a-123,John K,Fri Dec 11 21:08:38 IST 2015,None,Balance(1000)), Deleting a-123, Query for a-123)
11471 (2) [Avatar] Offline
#3
Running Code? Thank you for Quick Response
Debasish, Your book, and your approach is wonderful. I agree with you that the purpose is not to produce runnable code but demonstrate architectural and design approaches.

That said, I appreciate your explanation on how I can explore the code.

I intend to continue to use this book as a Architecture/Design Guide.