Add the relevant webjars to your build file:
libraryDependencies += "org.webjars.bower" % "angular" % "1.3.15"
Add the resources to your server definition:
unfiltered.netty.Server
case class Foo[T](x: T) { | |
def map[B](f: T => B) = Foo(f(x)) | |
} | |
object OldWay { | |
def combineLatest[T1, T2](e1: Foo[T1], e2: Foo[T2]): Foo[(T1, T2)] = Foo((e1.x, e2.x)) | |
def combineLatest[T1, T2, T3](e1: Foo[T1], e2: Foo[T2], e3: Foo[T3]): Foo[(T1, T2, T3)] = | |
combineLatest(combineLatest(e1, e2), e3) map { |
miles@frege:~$ scala | |
Welcome to Scala version 2.11.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import scala.language.dynamics | |
import scala.language.dynamics | |
scala> case class Assoc[K, V](value: V) | |
defined class Assoc |
Add the relevant webjars to your build file:
libraryDependencies += "org.webjars.bower" % "angular" % "1.3.15"
Add the resources to your server definition:
unfiltered.netty.Server
object Tuples { | |
import HLists._ | |
implicit def tuple1ToHList[A](t : Product1[A]) = new { def hlisted : A :: HNil = t._1 :: HNil } | |
implicit def tuple2ToHList[A, B](t : Product2[A, B]) = new { def hlisted : A :: B :: HNil = t._1 :: t._2 :: HNil } | |
implicit def tuple3ToHList[A, B, C](t : Product3[A, B, C]) = new { def hlisted : A :: B :: C :: HNil = t._1 :: t._2 :: t._3 :: HNil } | |
implicit def hListToTuple1[A](h : A :: HNil) = new { def tupled : Tuple1[A] = Tuple1(h.head) } | |
implicit def hListToTuple2[A, B](h : A :: B :: HNil) = new { def tupled : (A, B) = (h.head, h.tail.head) } | |
implicit def hListToTuple3[A, B, C](h : A :: B :: C :: HNil) = new { def tupled : (A, B, C) = (h.head, h.tail.head, h.tail.tail.head) } |
web: target/start -Dhttp.port=${PORT} -Dconfig.resource=prod.conf ${JAVA_OPTS} |
import shapeless._ | |
// if there's only one element, return it | |
trait ToTuple2 extends Poly1 { | |
implicit def h2[T] = at[T :: HNil] { case t :: HNil => t } | |
} | |
// if there are at least 2 elements, tuple them | |
trait ToTuple1 extends ToTuple2 { | |
implicit def h1[T1, T2, L <: HList, T <: T1 :: T2 :: L](implicit tupler: Tupler[T1 :: T2 :: L]) = at[T1 :: T2 :: L] { | |
case l @ (t1 :: t2 :: rest) => l.tupled |
/** | |
* Digging through arbitrarily nested case classes, tuples, and lists | |
* by Travis Brown | |
* | |
* In response to this question by Channing Walton on the Shapeless dev list: | |
* | |
* https://groups.google.com/d/msg/shapeless-dev/hn7_U21tupI/Zm9h3uNb51gJ | |
* | |
* Tested with Scala 2.9.2 and Shapeless 1.2.3. Should work on 1.2.2 with minor edits. | |
*/ |
package example | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.ConcurrentLinkedQueue | |
import com.typesafe.config.Config | |
import com.typesafe.config.ConfigFactory | |
import akka.actor.Actor | |
import akka.actor.ActorContext | |
import akka.actor.ActorRef | |
import akka.actor.ActorSystem |
// Author: Olivier Chafik (http://ochafik.com) | |
// Feel free to modify and reuse this for any purpose ("public domain / I don't care"). | |
package scalaxy.pretyping.example | |
import scala.reflect.internal._ | |
import scala.tools.nsc.CompilerCommand | |
import scala.tools.nsc.Global | |
import scala.tools.nsc.Phase | |
import scala.tools.nsc.plugins.Plugin | |
import scala.tools.nsc.plugins.PluginComponent |
package play.api.libs.ws | |
import play.api.libs.iteratee.{Enumeratee, Concurrent, Enumerator} | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import com.ning.http.client._ | |
import com.ning.http.client.AsyncHandler.STATE | |
import play.api.Logger | |
import scala.concurrent.{Future, Promise} |