Data Types to Session Types Session - a unit of conversation. Session Type - the structure of a conversation, a sequence of interactions in a communication-centric program model. Primitives: sending, receiving, sequence, choice, recursion Scribble language. Slides: http://www.slideshare.net/rolandkuhn/the-newest-in-
"x / y"): a -> b: <number>. a -> b: <number> . b -> a: { ok: b -> a: <number>. end, fail: end } • local projection for a: [b]!<number>. [b]!<number>. [b]? { ok: [b]?<number>. end, fail: end } • local projection for b: [a]?<number>. [a]?<number>. [a]! { ok: [a]!<number>. end, fail: end }
• Iso f: S => A, g: A => S • Prism f: S => Option[A], g: A => S • Lens f: S => A, g: (A, S) => S Introduced a new Optic type: Optional • Optional f: S => Option[A], g: (A, S) => S
a Shapeless-powered library for working with binary protocols. Codec = serializer + deserializer Via Shapeless: automatic codec derivation, cached implicit instances, etc. Slides: https://speakerdeck.com/mpilquist/practical-binary- with-scodec-and-shapeless
SetBuilder[U] = DefaultSetBuilder[U] } class BitSet extends Set[Int] { type BuilderFor[U] <: SetBuilder[U] = U match { case Int => BitSetBuilder case t => super.BuilderFor[t] } } What is valueOf[T match { .... }]
and def Advantage of Eval[T]: you can return a lazy value. By-name params: no memoization, type system doesn't distinguish A and (=> A), (=> A) unconditionally allocates a Function0[A] Abstracting over laziness and eagerness using Type Constructors.
Actors vs Futures for concurrency Premature: Loss of precision, Concretisation, Folding, Compilation, Optimisation. • Reach for the least powerful abstraction • Detonate as late as possible • Premature loss of precision is the root of all evil
talks TODO list: • "A Deep Dive into Scalac...", Chris Birchal. • "Typelevel Programming 101", Joe Barnes. • "Reactive Streams / Akka Stream", Mathias Doenitz & Johannes Rudolph.
Test { def meh[M[_], A](x: M[A]): M[A] = x meh{(x: Int) => x} // should solve ?M = [X] X => X and ?A = Int ... } console>:9: error: no type parameters for method meh: (x: M[A])M[A] exist so that it can be applied to arguments (Int => Int) Workaround from Miles Sabin: continuation passing style on a type level! (check "Kittens - Shapeless Typeclass Derivation for Cats" talk)