Skip to content

Instantly share code, notes, and snippets.

@rtitle
Last active August 29, 2015 14:14
Show Gist options
  • Save rtitle/a1b8de7a4254540bb442 to your computer and use it in GitHub Desktop.
Save rtitle/a1b8de7a4254540bb442 to your computer and use it in GitHub Desktop.
Notes: nescala 2015
1. akka-http
akka-http 1.0 coming in Q1 2015, it's essentially spray 2.0 (uses a lot of the spray code base)
Uses the same spray scala APIs
Based on akka-io, akka-stream, akka-http-core (tcp -> http translation)
Reactive stream processing over http, backpressure
Some features are missing, like websockets
One long term goal is to use akka-http in Play instead of Netty
Netty is more proven; akka likely needs some performance tweaks.
2. Tapad microservices
They use finagle (twitter scala based rpc library), thrift protocol
Finagle has built in (application) load balancing
They have independent services that can be deployed independently, for example the bidder -- sounds a lot like RTS
They use some custom sbt plugins, like sbt-release, sbt-native-library (for building rpm's)
3. Functional error handling with Scalactic
Scalactic Or vs scalaz \/ or Validation
Or looks easier to use:
def foo: Int Or String
The return type == Or[Int, String]
No typeclass coherence
He called |@| cinnabon operator, or home alone operator :)
Its ugly to convert between scalaz disjunction and Validation (disjunction returns 1 error, Validation accumulates all errors)
Scalactic has only 1 type. See scaladoc for Or
Fits standard library better than scalaz
Left is right -- scalaz's convention came from haskell laziness which doesn't make sense on the jvm
Scala brings FP into an OO world
Scalactic primary use case is testing
4. Interpreter pattern - Runar
It's a pattern in gang of four book
Went through boolean algebra interpreter
example in scala: case classes for And, Or, Not, Lit, Var, recursive
He showed how to implement it with free monads from scalaz. Cool
5. Scala needs you - Dick Wall
Documentation: scala-internals list to coordinate, JIRA->github migration, activator templates, markdown for activator, missing scaladoc, docs.scala-lang.org, document the documentation process, etc
6. Intervals in spire
Better than scala ranges
Intentional structure, not existential
Intervals are not really sets, since they can contain uncountable values (ie real numbers)
useful for real numbers but can be any types
Can map over endpoints, sort of, with mapBounds
String interpolation for polynomials, can translate intervals through polynomials instead of map, which is more well behaved
7. Demystifying Type Inference
http://rapture.io/talks/inference/london.html
Type system is a constraint system -- takes constraints from different features and fails if over- or under-constrained
Demoed an implementation for default type parameters -- cool
Parameters, expected return type, explicit types, and unique implicit all influence type inference
Different type parameters can be influenced by different means, e.g. CanBuildFrom[-From, -Elem, +To]
Covariance and contravariance examples : Co is +, Contra is -. Invariance is neither co nor contra
Parameters are contravariant in scala, return types are covariant
Still a little mystified
8. Speed, correctness
FpFilter - floating point filter. Used in spire.
Uses macros to inline stuff for speed
Use operators just like primitives
Example1: sign test. initially used doubles, want to make it exact without losing speed
Example2: polynomial root finder. Opposite case: want to make it fast without losing correctness
9. Path Dependent Types
http://wheaties.github.io/Presentations/NEScala2015/looking-glass.html#/
MediaMath guy
Using dependent types implemented dmap, which is automatically map or flatMap depending on types at compile time
Helps avoid for example Future[Future[T]] or Future[Try[T]]. Becomes Future[knot.T] where T is a dependent type.
The dependent type definitions are complex, didn't really understand them
10. F Bounded Polymorphism
https://github.com/marconilanna/NEScala2015
trait T[U <: T[U]]
Recursive type signature. It's in java too, e.g. Enum
It's an OO technique to impose type constraints
Self types:
trait T[U <: T[U]] { self: U => }
Causes the compiler to correctly enforce the types.
11. Macros in data pipelines
Spotify: uses spark, scalding, parquet, avro
Pipeline using scala collection methods -- like stream
Column projection, pushing predicates allows skipping IO, massive speed up. Problem: it's clunky to write.
Macros!
See parquet-avro-extra on github
Missed the remaining talks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment