Scala Type Study Questions

疑问区

Q: 集论为什么重要?
A: 集论成为了所有数学分支的基础.

Q: 为什么我们会忘记捕捉异常?
A: 因为在每个人的意识里,不管是自己写的函数还是系统提供的函数, 发生函数异常的地方都是不需要指明的

Q: 什么是Modifier?
A: Modifier就是一个函数,在unit调用时生效,参数为monad & 输入, 意味着我可以对函数调用做手脚

Q: 什么是Turn Based Processing?
A: 像Node那样的单线程队列机制

Q: 都说scala跟haskell的类型系统比java高级,但是实际上高级在哪里?

Q: 什么是Monadic Comprehension? 为什么他能减少boiler-plate code?

Q: Can Turn Based Processing replace Concurrency?

Q: 我如何用Modifier制作一个Writer Monad?

Q: Promise跟普通Monad的区别?

Q: Writer Monad违背了Monad的本质吗?


20200402 继续研读

Q: 类型是如何解决集论悖论的?

Q: 类型系统和数学中的类型又有什么本质共通之处?

Q: 文章目录结构?
A:

1
2
3
4
5
6
7
8
9
- 类型的由来
+ 类型,直觉
- In scala
- Type inference and Least Upper Bounds
- 代数数据类型
- Compound and intersection types
- Classes
- Unit
- Summary

Q: 什么是Least Upper Bounds?
A: 像最小公倍数一样的东西, 对于Some[Int]和None来说就是Option[Int]

Q: 什么是Zermelo–Fraenkel axioms(公理)?
A: 利用 1. power set永远比original set大 2. set of all set应该包含所有的集,包括自己的super set 构成矛盾来证明set of all set不可构造

Q: Bertrand Russell是怎么回避悖论的?

笔记区

An example of Monad.

1
2
3
4
5
6
7
8
9
10
11
12
function MONAD(){
return function unit(v){
var monad = Object.create(null)
monad.bind = function(f){
return f(v)
}
return monad
}
}
const identity = MONAD();
const monad = identity('Hello Monad');
monad.bind(alert);