2018 Scala Matsuri

- A Recap -

Singapore Scala Meetup - 28 March 2018

About Me

  • Software Engineer at Standard Chartered Bank

 

  • Currently working in:
    • Scala
    • Kotlin

 

  • Currently 'spiking' in:
    • Elixir
    • Elm
  • Giving back to the community:
    • OSS project maintainer
    • Singapore Scala Meetup group organiser
    • Engineers.SG volunteer

 

               _hhandoko

               hhandoko

               hhandoko

               hhandoko.com

What is it?

  • Largest Scala conference in Asia

 

  • From 2013, around February to March each year

 

  • Some past and recent speakers:
    • Jonas Boner (2013, 2016)
    • Martin Odersky (2014)
    • Daniela Sfregola (2018)
    • etc.

All I Learned While Working on a Scala OSS Project for Over Six Years

Kazuhiro Sera (@seratch)

Impressions

  • Scala has come a long way :)

 

  • Things we take for granted now:
    • IDE integration
    • Named and default arguments
    • Minor ver. binary compatibility
    • String interpolation
    • JavaConver[ters|sions]
    • etc.
Version Release Date
Scala 2.8 2010-07-15
Scala 2.9 2011-05-12
Scala 2.10 2012-12-20
Scala 2.11 2014-05-20
Scala 2.12 2016-10-29
Scala 2.13-M3 2018-01-31
Scala 3.0 (with Dotty) ???

Key Takeaways

  • Consider use of third-party libraries:
    • Minimise Scala third-party library dependencies, or
    • Use Java libraries (and deal with nulls)

 

  • Use CI and test cross-build artifacts

 

  • Support deprecated APIs (Scala or third party libs) via version-specific modules
  • Use "MiMa": Lightbend's Migration Manager

A Pragmatic Introduction to Category Theory

Daniela Sfregola (@DanielaSfregola)

Impressions

  • "Monad is a Monoid in the category of endofunctors"

 

  • Attendees can follow along with "fill in the blanks" examples:
  • Great, guided explanations of:
    • Monoid
    • Functor
    • Applicative
    • Monad

Key Takeaways

  • A fundamental part of Functional Programming (with Type System)

 

  • Category theory, simply the laws of composition and abstraction:
    • Maths of mathematics, or
    • Arrow theory, or
    • Transformation law,
    • etc.
  • Category rules:
    • Identity
    • Composition
    • Associativity

 

  • Category methods (in Scala):
    • `pure` - lifting to a context
    • `flatMap` - fusing context
    • `map` - transform in context

Further Resources

Monad Transformers for the Working Programmer

Gabriele Petronella (@gabro27)

Impressions

  • A practical example of Category Theory

 

  • Procedural shell, functional core: leveraging `for` comprehensions syntactic sugar

 

  • Great example, retrieving a User and their Address in various shapes:
    • From:
      Future[Option[User]]
      Future[Option[Address]]
    • To:
      Monad[FutOpt[User]]
      Monad[FutOpt[Address]]

Key Takeaways

  • Category Theory is a practical solution to everyday problems

 

  • Three functional composition styles and libraries of interest:
    • Free Monad
    • Tagless final
    • Extensible Effects (Eff)
  • Be aware of tradeoffs:
    • Stacking two Monads gets hairy really quickly
    • Keep transformers as internal implementations
    • Wrapping and unwrapping is not cheap
    • Use them as local optimisations

Purely Functional Play Framework Application

Naoki Aoyama (@AoiroAoino)

Impressions

  • Google Guice has been used in Play Framework, since forever ;)

 

  • Application of Free Monad / Tagless final style in Play Framework

 

  • Move away from runtime DI, and make it a compiler error instead of runtime error
  • Separate program and execution:
    • ReaderMonad
    • WriterMonad

 

  • Good example of persisting User record(s), and abstracting away implicits to the interpreter's context (e.g. Future or Task)

Key Takeaways

  • Better support in latest Play Framework (2.6)

 

  • To start with, use an opinionated library?
  • Need more examples, in practice:
    • Stacking Monads
    • Composing concrete types
    • Use natural transformation and mapK

Some other talks?

Extensible Effects in Dotty

Functional Performance

Martin Thompson (@mjpt777)

Thanks!

Made with Slides.com