Skip to content

Instantly share code, notes, and snippets.

Long Cao longcao

Block or report user

Report or block longcao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
noelmarkham /
Last active Jan 5, 2017
Cats imports cheat sheet
import... What it imports
cats.std.type Typeclass instances for standard library type (think List, Option)
cats.syntax.type “Enhanced” methods for type (.toRightXor etc) Imports a type not part of the standard library (think Xor, Kleisli) and its typeclass instances
View sbt_options.txt
scalacOptions ++= Seq(
// "-Xprint:typer", // Turn this on if WartRemover acts up, to see full syntax tree
"-encoding", "UTF-8", // yes, this is 2 args
"-Xfatal-warnings", // Treat Warnings as Errors
"-Ywarn-dead-code", // N.B. doesn't work well with the ??? hole
cvogt / gist:9239494
Last active Sep 9, 2019
Slick app architecture cheat sheet
View gist:9239494
// Please comment in case of typos or bugs
import scala.slick.driver.H2Driver._
val db = Database.for...(...)
case class Record( ... )
class Records(tag: Tag) extends Table[Record](tag,"RECORDS"){
def * = ... <> (Record.tupled,Record.unapply)
// place additional methods here which return values of type Column
You can’t perform that action at this time.