Monad Reader就是一种函数的组合.在scalaz里函数(function)本身就是Monad,自然也就是Functor和applicative.我们可以用Monadic方法进行函数组合: import scalaz._ import Scalaz._ object decompose { //两个测试函数 val f = (_: Int) + //> f : Int => Int = <function1> val g = (_: Int) * //> g : In…
这是观看Cousera上的课程<Principles of Reactive Programming>中week1里的Monad一节所做的笔记. What is a Monad? What is a Monad? A monad is a parametric type M[T] with two operations, flatMap and unit, that have to satisfy some laws. 这里是说Monad是一类特殊的类型,它有两个方法, flatMap和uni…
monad的特征: 类型转化+添加新的操作. monad RACStream RACSignal RACSubject monad:单一体,(不可分的)个体 以计算为中心的封装. In functional programming, a monad is a design pattern that defines how functions, actions, inputs, and outputs can be used together to build generic types,[1]…