This file contains 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
val sqrt = math.sqrt _ | |
val acos = math.acos _ | |
val divTen = (x:Double) => x/10.0 | |
sqrt(64.0) | |
divTen(8.0) | |
acos(0.8) |
This file contains 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 language.higherKinds | |
trait Monad1[M[_]] { | |
def id[A](a: A): M[A] | |
def compose[A,B,C](f: A => M[B], g: B => M[C]): A => M[C] | |
def flatMap[A,B](ma: M[A], f: A => M[B]): M[B] = ??? | |
def join[A](mma: M[M[A]]): M[A] = ??? |
This file contains 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 language.higherKinds | |
trait Monad1[M[_]] { | |
def id[A](a: A): M[A] | |
def compose[A,B,C](f: A => M[B], g: B => M[C]): A => M[C] | |
def flatMap[A,B](ma: M[A], f: A => M[B]): M[B] = | |
compose((_:Unit) => ma, f)(()) |
This file contains 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 Module { | |
type shape | |
} |
This file contains 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