This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.scalacheck.{ Properties , Arbitrary , Gen } | |
| import org.scalacheck.Prop.forAll | |
| import play.api.libs.json._ | |
| case class Subdocument(m: String, n: Int, list: List[Int], days: Set[WeekDay.Value]) | |
| case class Document(id: String, n: Int, subDoc: Subdocument) | |
| object WeekDay extends Enumeration { | |
| val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "metadata": { | |
| "name": "" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait MeasureTypeClass[A]{ | |
| def measure(a: A) : Int | |
| } | |
| object TypeClassExample{ | |
| def genericMeasure[A : MeasureTypeClass](value: A): Int = { | |
| val measurer = implicitly[MeasureTypeClass[A]] | |
| measurer.measure(value) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scalaz.contrib.std.FutureInstances // Dependency: scalaz-contrib | |
| import scalaz.{ Monad , OptionT } // Dependency: scalaz | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.concurrent.Future | |
| class FutureAndOptionComposition[A, B, C, D] | |
| extends FutureInstances | |
| // The FutureInstances trait has a method which creates a Monad instance | |
| // for Future which is used implicitly by the OptionT | |
| { |
NewerOlder