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 scala.language.higherKinds | |
object Example { | |
// demo version of the Option type for example use | |
sealed trait Maybe[+A] | |
case class Just[+A](value: A) extends Maybe[A] | |
case object Niente extends Maybe[Nothing] | |
trait Functor[F[A]] { |
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
/* | |
Ammonite script | |
http://ammonite.io | |
*/ | |
import $ivy.{ | |
`org.json4s:json4s-ext_2.12:3.5.0`, | |
`org.json4s:json4s-jackson_2.12:3.5.0`, | |
`org.json4s:json4s-native_2.12:3.5.0`, | |
`org.scalaj:scalaj-http_2.12:2.3.0`, |
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
// ammonite import | |
import $ivy.`com.chuusai:shapeless_2.12:2.3.3` | |
import shapeless.{Generic, ::, HList, HNil} | |
// part 1: define the type class | |
trait RandomData[A] { | |
def random: A | |
} |