Jichao Ouyang

Results 48 comments of Jichao Ouyang

应该是可以的 按照官网安装 - https://www.gnu.org/software/emacs/ - https://github.com/cask/cask/ 这是生成pdf的命令 如果只是想跑例子只需要切到 source branch https://github.com/jcouyang/clojure-flavored-javascript/tree/source 只需要有node就可以跑

> 单子不是用来剥离副作用的吗?怎么个剥离呢? 是的 至于怎么剥,有很多种,有一个叫Free Monad的东西,Scala 的 [cats有实现](http://typelevel.org/cats/datatypes/freemonad.html),让你剥所有特别的副作用,还有 Eff, [scala也有](https://github.com/atnos-org/eff) 这种模式也叫interpreter模式,跟那个简单的例子一样,把业务逻辑中的纯的部分都抽象成free monad/DSL,再由带副作用的interpreter来解析,interpreter毫无逻辑,只有真正的IO操作 这时 interpreter不需要怎么测,因为没有逻辑,只要简单的 integration 测下IO就好 free monad是纯的,所以业务逻辑也非常好测 如果是一些通用的副作用,已经有现成剥好的monad可以直接用,比如Haskell里面的IO,不知道对应到scala是啥,还有什么Reader Writer State monad

> `winnerMsg(p:Option[player]) :Unit` 这个返回值应该是String类型吧 这个例子确实没有Monad,应该只是介绍如何分离纯与不纯的部分 如果硬要说用monad抽象了什么,用Option封装了if-else逻辑 IO的意思应该只是类似interpreter,也就是不纯的部分

由于篇幅和JS没有类型系统的原因,可能没有介绍范畴论基础是我的失误,如果感兴趣不知道我这篇博客有没有能对理解帮到一些忙 https://blog.oyanglul.us/grokking-monad/ 但是这句话的理解应该是 `Monad 就是自函子范畴` 说明monad是自函子上的东西,所以它还是自函子functor `上的含幺半群`只是在这个范畴上也能找到自函子的自然变换符合二元操作和幺元并且符合monid的法则而已 感觉说的越多,兔子洞会越深,大概的意思理解就好了,其实对用起来没什么太大的帮助 flat是二元是没错的,这不能对应到函数来理解,因为是范畴上的自然变换,flat是自然变换,monad是东西,flat把两个m变换成一个m

hi, @boboyada 你的这个monid的定义是对的,`.`代表composition Maybe(* -> *) Maybe . Maybe -> Maybe[Maybe[*]] (* -> *) flat是functor范畴上的二元操作 flat(Maybe . Maybe) -> Maybe[] 而且这句话只是个比喻,并不是说monad会实现monoid,说的是functor范畴(`*->*`),实例Maybe并不能concat

多谢支持 😹 不怎么逛论坛,多看博客和书,国内就更不知道了,顶多闲时刷刷知乎

it's blocked by vimium, try using . instead

sorry i dont quite get what do you mean `subscribes past event`. if you want to control the display of a component, it sounds like a toggle state to me....

ah, I got what you mean here, replay maybe probably `multicast` in most(but probably won't work here). but the current behavior actually make sense to me, if the component if...

if you see a react component as a function, it won't be called until it's mount if a function is not called, why it should subscribe to a stream and...