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
scala> implicit class IInt(val value: Int) | |
defined class IInt | |
scala> def something(implicit int: IInt) = s"Deep down, got ${int.value}" | |
something: (implicit int: IInt)String | |
scala> def somethingElse(implicit int: IInt) = something | |
somethingElse: (implicit int: IInt)String | |
scala> somethingElse(5) |
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
{% from 'java/map.jinja' import java with context %} | |
{% import_yaml 'gocd/defaults.yaml' as default_settings %} | |
{% set java_env = salt['pillar.get']('java:env', default='jre7') %} | |
{% do gocd.update({ | |
'server': (gocd.get('server')|default({})).update({ | |
'JAVA_HOME': java[java_env].home | |
}), | |
'agent': (gocd.get('agent')|default({})).update({ | |
'JAVA_HOME': java[java_env].home |
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 Hey @Inject() (val app: Application) { | |
app.configuration // Guaranteed to work, since we can never get here unless we have enough contructor parameters | |
} |
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
package se.hardchee.Pickr | |
import scala.language.higherKinds | |
import scala.language.implicitConversions | |
import scalaz.{ Coproduct, Free, Inject, ~>, \/-, -\/ } | |
package object algebras { | |
implicit def liftFCInj[A, P[_], F[_]](x: P[A])(implicit I: Inject[P, F]): Free.FreeC[F, A] = { | |
Free.liftFC(I.inj(x)) |
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
sealed trait ControlPanel[T] | |
case object ButtonPressed extends ControlPanel[Button] | |
case object StopEnabled extends ControlPanel[Unit] | |
case object StopDisabled extends ControlPanel[Unit] | |
case object CurrentFloor extends ControlPanel[Int] | |
sealed trait ElevatorControl[T] | |
case object GetFloor extends ElevatorControl[Int] | |
case class QueueFloor(x: Int) extends ElevatorControl[Unit] |
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 scala.concurrent.Future | |
object App extends App { | |
val play = new RouteService[PlaySpec] { | |
def handle(req: PlayRequest) = Future.successful(new PlayResponse) | |
def addCookie(request: PlayRequest, cookie: PlayCookieAtom): PlayRequest = request.copy(cookie :: request.cookies) | |
} | |
val akka = new RouteService[AkkaSpec] { | |
def handle(req: AkkaRequest) = Future.successful(new AkkaResponse) |
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
[error] .../App2.scala:9: type mismatch; | |
[error] found : input.type (with underlying type H#Input) | |
[error] required: RouteService.this.Holder.Input | |
[error] def extractFoo(input: H#Input): Foo = Holder.input2Foo(input) | |
[error] ^ | |
[error] one error found | |
[error] (core/compile:compileIncremental) Compilation failed | |
[error] Total time: 0 s, completed Oct 23, 2016 11:15:51 PM |
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
publish: | |
./scripts/publish-to-gollum --prepare-docs-target --overwrite | |
sbt -no-colors tut | |
./scripts/publish-to-gollum --publish-docs --overwrite |
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
scala> Foo.buildBar.baz(_, _) | |
res0: (Int, Int) => Int = <function2> | |
scala> res0(1,2) | |
Hello! | |
res1: Int = 3 | |
scala> res0(1,2) | |
Hello! | |
res2: Int = 3 |
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
> compile | |
[info] Compiling 1 Scala source to /Users/dstewart/Projects/guardrail/modules/codegen/target/scala-2.12/classes... | |
[error] /Users/dstewart/Projects/guardrail/modules/codegen/src/main/scala/com/twilio/guardrail/CLI.scala:17: type mismatch; | |
[error] found : CLICommon.algebra.CoreTerms | |
[error] required: CLICommon.common.A.CoreTerms | |
[error] common.runM(algebra.coreTerm) | |
[error] ^ | |
[error] one error found | |
[error] (codegen/compile:compileIncremental) Compilation failed | |
[error] Total time: 0 s, completed Nov 5, 2018 10:53:10 PM |