随笔分类 - Javascript
摘要:We annihilate the need for the ol' nested for loop using Applicatives. For example we have this kind of nested loop code: We can refactor it by using
阅读全文
摘要:Working our way backwards from solution to problem, we define an applicative functor, then use it to apply a function of multiple arguments. For examp
阅读全文
摘要:We refactor a standard node callback style workflow into a composed task-based workflow. Original Code: Using Task: Using Async:
阅读全文
摘要:Let's examine a pointfree way to write these applicative calls. Since we know map is equal to of/ap, we can write generic functions that will ap as ma
阅读全文
摘要:We examine the data structure Task, see some constructors, familiar methods, and finally how it captures side effects through laziness. We are going t
阅读全文
摘要:We rewrite the Box example using lazy evaulation. Here is Box example: So how to make it as Lazy Box? The Answer is instead of passing a value to the
阅读全文
摘要:Previously we have seen how to use Concat with reduce: To simply this, we can use 'fold': Javascript arrray doesn't have 'fold' so we use immutable-ex
阅读全文
摘要:What is applicative functor: the ability to apply functors to each other. For example we have tow functors: Container(2), Container(3) We cannot just
阅读全文
摘要:monoids is a semi-group with a neutral element. A semigroup, it does not have an element to return so it's not a safe operation, whereas with the mono
阅读全文
摘要:Before we introduce what is Monad, first let's recap what is a pointed functor: A pointed functor is a Functor with .of() method Why pointed Functor i
阅读全文
摘要:In this post, we are going to see how to use Ramda Lens. For example, we have data: R.lens: R.lens takes a getter and a setter: R.lensProp: There is a
阅读全文
摘要:A pointed functor is a functor with an of method What's important here is the ability to drop any value in our type and start mapping away. The benifi
阅读全文
摘要:We will see a peculiar example of a pure function. This function contained a side-effect, but we dubbed it pure by wrapping its action in another func
阅读全文
摘要:An introduction to concatting items via the formal Semi-group interface. Semi-groups are simply a type with a concat method that are associative. We d
阅读全文
摘要:It is really important to understand function signature in functional programming. The the code example below: 'map' is pointfree version of any founc
阅读全文
摘要:Transducers are composable algorithmic transformations. They are independent from the context of their input and output sources and specify only the e
阅读全文
摘要:Maybe has two types: Just / Nothing. Just() will just return the value that passed in. Nothing returns nothing... Just/ Nothing are both functors, the
阅读全文
摘要:We refactor a function that uses try/catch to a single composed expression using Either. We then introduce the chain function to deal with nested Eith
阅读全文
摘要:We would like the ability to group a series of actions to be dispatched with single dispatching functions used as handlers in various parts of our gam
阅读全文
摘要:We only have a few dispatching functions that need to be known by our React Application. Each one actually has multiple actions that need to be dispat
阅读全文

浙公网安备 33010602011771号