Skip to content

Instantly share code, notes, and snippets.

View yasuabe's full-sized avatar

Yasuyuki Abe yasuabe

View GitHub Profile
@yasuabe
yasuabe / Chapter13.scala
Created December 15, 2017 19:00
ch14 make it
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Arbitrary, Gen, Properties}
object Chapter13 extends Properties("Ch13") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter12.scala
Created December 15, 2017 18:36
ch12 addition finally
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Arbitrary, Gen, Properties}
object Chapter12 extends Properties("Ch12") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter10.scala
Last active December 15, 2017 22:00
ch10 interesting times- ch11 the root of all evil
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Arbitrary, Gen, Properties}
object Chapter10 extends Properties("Ch10") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter09.scala
Last active December 15, 2017 22:00
ch09 times we're living in
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Arbitrary, Gen, Properties}
object Chapter09 extends Properties("Ch09") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter08.scala
Created December 15, 2017 18:11
ch08 makin' objects
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Arbitrary, Gen, Properties}
object Chapter08 extends Properties("Ch08") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter07.scala
Last active December 15, 2017 22:01
ch07 apples and oranges
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Gen, Prop, Properties}
object Chapter07 extends Properties("Ch07") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter06.scala
Created December 15, 2017 17:49
ch06 equality for all, redux
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Gen, Prop, Properties}
/*
* Dollar と Franc で共通の Money クラスを作り equalsを引き上げた
* テストコードのは変更はなし
@yasuabe
yasuabe / Chapter05.scala
Created December 15, 2017 16:11
ch5 franc-ly speaking
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Gen, Prop, Properties}
object Chapter05 extends Properties("Ch05") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter04.scala
Created December 15, 2017 15:39
ch04 privacy
package fp_tdd
import cats.Apply
import cats.syntax.apply._
import org.scalacheck.Prop.forAll
import org.scalacheck.{Gen, Properties}
object Chapter04 extends Properties("Ch04") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
@yasuabe
yasuabe / Chapter03.scala
Created December 15, 2017 15:12
ch03 equality for all
package fp_tdd
import org.scalacheck.Prop.forAll
import org.scalacheck.{Gen, Properties}
object Chapter03 extends Properties("Ch03") {
// ======== TODO ========
// $5 + 10 CHF = $10 if rate is 2:1
// Make "amount" private
// Money rounding?