随笔分类 -  Compose

摘要:Let's say we have two fucntions: const toUpper = s => s.toUpperCase(); const exclaim = s => `${s}!`; We want to combine those. But function itself doe 阅读全文
posted @ 2020-03-13 03:39 Zhentiw 阅读(142) 评论(0) 推荐(0) 编辑
摘要:We want to write a Monoid, which able to take function called 'run', therefore we able to run a serial of functions together to get a combined result. 阅读全文
posted @ 2020-03-10 18:09 Zhentiw 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Much of our code in real life is full of if statements that check the validity of a given input to see if a given computation should be performed. Usi 阅读全文
posted @ 2020-02-14 03:22 Zhentiw 阅读(119) 评论(0) 推荐(0) 编辑
摘要:For example we have a feature reducer like this: First of all, we can replace 'swtich' statement with normal Object: In case of ´actionReducer[type]´ 阅读全文
posted @ 2019-09-02 16:27 Zhentiw 阅读(187) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-08-08 02:53 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:Sometimes I am confused with 'liftA2' and 'converge' functions. Main difference between those is that: liftA2 takes applicative functor as second and 阅读全文
posted @ 2019-08-06 14:04 Zhentiw 阅读(154) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-07-12 02:19 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:We have State like this: We want to validate user's input is the same as 'hint' and it matchs 'id' in cards array. Then we want to set 'isCorrect' to 阅读全文
posted @ 2019-07-09 13:52 Zhentiw 阅读(143) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-06-27 03:29 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-06-26 04:17 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-06-25 02:44 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-06-25 02:22 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-06-13 03:06 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:ReaderT is a Monad Transformer that wraps a given Monad with a Reader. This allows the interface of a Reader that enables the composition of computati 阅读全文
posted @ 2019-05-31 22:08 Zhentiw 阅读(217) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-05-20 01:25 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Crocks.js has the implementation, no need to do it yourself. https://evilsoft.github.io/crocks/docs/functions/logic-functions.html#implies 阅读全文
posted @ 2019-05-17 23:00 Zhentiw 阅读(175) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-05-15 00:34 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:succ :: Doing N + 1 times fn. add :: Doing N times succ, based on K mult :: is B pow :: or Thrush, is flip isZero :: return just T otherwise K(F) , K 阅读全文
posted @ 2019-05-13 04:57 Zhentiw 阅读(173) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-05-09 02:02 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
摘要:/** * When */ const _branch = (x) => { const result = (x && x.isPublic) ? dissoc('private', x) : x; console.log(result); return assoc('result', 'done', result); } const ... 阅读全文
posted @ 2019-05-07 13:54 Zhentiw 阅读(140) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示