The Evolution of a Scala Programmer
17 different ways to calculate a factorial.
Disclaimer: this article is a parody inspired by the Haskell version, please don’t take it too seriously. However, I believe that some examples actually have some value and can be used as a reference.
Table of Contents
- Beginner Scala programmer
- Beginner functional Scala programmer
- Scala programmer circa 2011
- Free monadic Scala programmer
- Freak monad Scala programmer
- Tagless Final Scala programmer
- John A De Goes
- Fabio Labella
- Akka Scala programmer
- Spark Scala programmer
- Java Scala programmer
- Trampolined Scala programmer
- Peano ADT Scala programmer
- Type level Scala programmer
- Shapeless Scala programmer
- Fix Scala programmer
- Paramorphism Scala programmer
- Apo-futu-hylomorphism Scala programmer
Beginner Scala programmer
Coming from Java likes the fact that semicolons are optional. And return
. And type declarations.
Beginner functional Scala programmer
Forced by his teammates to use this weird IO
thing. Can’t get approval for his small PR for weeks. Unsure if it was worth quitting his high paying Java position.
Scala programmer circa 2011
Traits and mixins! Believes in OOP and SOLID, likes cakes.
Free monadic Scala programmer
Has a list of his favorite puns around the word Free
, like “reasonably priced monads” or “Free
is not for free”. Read all of Bartosz Milewski’s category theory installments. Favorite phrase: “X
? But it’s just a Y
in the category of Z
!”
Freak monad Scala programmer
Tired of lifting and composing multiple algebras with coproducts, throws some type level magic in there. Spends all that free time (FreeK time?) on figuring out type checker’s cryptic error messages.
Tagless Final Scala programmer
Has (monad) commitment issues. While texting all the words starting with f
are autocorrected to F[_]
. Thinks about switching to Haskell someday.
John A De Goes
Type-safe, composable, asynchronous, concurrent, high performance, resource-safe, testable, functional and resilient factorial.
Fabio Labella
Akka Scala programmer
Hates type checker as it slows down development. Has a huge short term memory capacity to keep track of all those messages.
Spark Scala programmer
Strongly believes that cannons are perfectly fine for killing flies. Doesn’t mess around.
Java Scala programmer
Occasionally sneaks in Java class into a Scala project.
Trampolined Scala programmer
Had a mental breakdown after that StackOverflowError happened in production on Friday evening. Hasn’t recovered to this day.
Peano ADT Scala programmer
Had a bright future but started hanging out with some bad Idris kids. Stopped caring about effects composition or stack safety.
Type level Scala programmer
Spends nights staring at those red squiggly lines, experiences genuine excitement when they disappear. Suffers from massive migraines and bad sleep quality. Favorite nonfiction — the HoTT book.
Shapeless Scala programmer
Wears a beard and round glasses.
Fix Scala programmer
Has a Y-combinator tattoo on his arm. Can stare at romanesco broccoli for hours.
Paramorphism Scala programmer
Actually a Haskell programmer in disguise. Uses vim with an empty .vimrc
. Likes to draw commutative diagrams while listening to odd time signature progressive metal.
Apo-futu-hylomorphism Scala programmer
Has lots of hair. Wrote this on a napkin in a bar while having some beer with Bartosz Milewski and Edward Kmett.
All code examples are available on GitHub: https://github.com/vvviiimmm/scala-evolution
References:
- Free monad 0: https://typelevel.org/cats/datatypes/freemonad.html
- Free monad 1: http://degoes.net/articles/modern-fp
- FreeK monad: https://github.com/ProjectSeptemberInc/freek
- Recursion schemes: free.cofree.io/2017/11/13/recursion
- Fix combinator: https://free.cofree.io/2017/08/28/fixpoint/
- Tagless final 0: http://okmij.org/ftp/tagless-final/course/lecture.pdf
- Tagless final 1: https://typelevel.org/blog/2018/06/27/optimizing-tagless-final-2.html
- ZIO (John A De Goes): https://skillsmatter.com/skillscasts/13247-scala-matters
- ZIO: https://zio.dev
- Shapeless: https://underscore.io/books/shapeless-guide/
- Type level computations: http://slick.lightbend.com/talks/scalaio2014/Type-Level_Computations.pdf
- Peano numbers: https://wiki.haskell.org/Peano_numbers
- Trampoline 0: https://free.cofree.io/2017/08/24/trampoline/
- Trampoline 1: https://medium.com/@olxc/trampolining-and-stack-safety-in-scala-d8e86474ddfa
- Apache Spark: https://spark.apache.org/docs/0.9.1/scala-programming-guide.html
- Akka: https://doc.akka.io/docs/akka/current/index-actors.html?language=scala