This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.xml.bind.annotation._ | |
@XmlRootElement(name = "person") | |
@XmlAccessorType(XmlAccessType.FIELD) | |
case class Person(fullname: String, username: Option[String], age: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor._ | |
import akka.dispatch._ | |
import akka.stm._ | |
import scalaz._ | |
trait Projection[S, A] { | |
def initialState: S | |
def currentState: S | |
def project: PartialFunction[(S, A), S] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InvoiceService { | |
val invoicesRef = Ref(Map.empty[String, Invoice]) // naive approach | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class InvoiceAddress(street: String, city: String, country: String) | |
case class InvoiceItem(description: String, count: Int, amount: BigDecimal) | |
case class Invoice( | |
id: String, | |
items: List[InvoiceItem] = Nil, | |
discount: Option[BigDecimal] = None, | |
sentTo: Option[InvoiceAddress] = None) extends EventSourced[InvoiceEvent, Invoice] { | |
def addItem(item: InvoiceItem): Update[InvoiceEvent, Invoice] = ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
import Scalaz._ | |
object MonadTransformerExamples { | |
def main(args: Array[String]) = run | |
def run { | |
// ------------------------------------------------------ | |
// Combined Option/Option | |
// ------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.client.methods.HttpPost | |
import org.apache.http.client.params.ClientPNames._ | |
import org.apache.http.client.HttpClient | |
import org.apache.http.entity.StringEntity | |
// other imports omitted ... | |
object GCAuthExample { | |
def main(args:Array[String]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: project/build/Project.scala | |
=================================================================== | |
--- project/build/Project.scala (date 1302329914000) | |
+++ project/build/Project.scala (revision ) | |
@@ -3,9 +3,9 @@ | |
class Project(info: ProjectInfo) extends DefaultProject(info) with IdeaProject with AkkaProject { | |
val ScalazVersion = "5.0" | |
val CamelVersion = "2.7.0" | |
- val AkkaVersion = "1.1-M1" | |
+ val AkkaVersion = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
httpProducer ! Message("test", Map(Message.MessageExchangeId -> 123)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CamelContextManager.init | |
CamelContextManager.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
import Scalaz._ | |
import scalaz.concurrent._ | |
/** | |
* Result type of concurrent functions that may fail. | |
*/ | |
case class PromiseEither[A, B](value: Promise[Either[A, B]]) extends NewType[Promise[Either[A, B]]] | |
/** |