Skip to content

Instantly share code, notes, and snippets.

View vil1's full-sized avatar
❤️
Speading love

Valentin Kasas vil1

❤️
Speading love
  • 47degrees
  • between a chair and a keyboard
View GitHub Profile

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

@jto
jto / matching.scala
Last active February 27, 2016 13:57
sealed class Match[A, B] { type τs <: HList }
object Match {
type Aux[A0, B0, τ0 <: HList] = Match[A0, B0] { type τs = τ0 }
sealed trait τ
sealed trait τ1[A]
implicit def matchEq[A0]: Aux[A0, A0, HNil] =
new Match[A0, A0]{
type τs = HNil
@propensive
propensive / illtyped2.scala
Last active August 29, 2015 14:24
Alternative implementation of ill-type checker
// Example usages:
// Returns true
checkTypeMismatch {
import deferTypeErrors._
7: String
}
// Returns false
checkTypeMismatch {
@runarorama
runarorama / gist:33986541f0f1ddf4a3c7
Created May 7, 2015 14:06
Higher-kinded types encoded as path-dependent types
trait λ {
type α
}
trait Functor extends λ {
type α <: λ
def map[A,B](x: α { type α = A })(f: A => B): α { type α = B }
}