随笔分类 - Javascript
摘要:Proxies allow you to use functions that haven't yet been defined on an object. This means that you can invoke a function then create that function if
阅读全文
摘要:Among the features introduced to the language of JavaScript in ES2019 is Array.prototype.flat. In this lesson we'll see just how easy the flat method
阅读全文
摘要:The typical Redux Reducer is function that takes in the previous state and an action and uses a switch case to determine how to transition the provide
阅读全文
摘要:By using the State ADT to define how our application state transitions over time, we clear up the need for a some of the boilerplate that we typically
阅读全文
摘要:When we start to accumulate functions that all work on a given datatype, we end up creating a bunch of boilerplate code in almost every function to ha
阅读全文
摘要:When building our stateful computations, there will come a time when we’ll need to combine two or more state transactions at the same time to come up
阅读全文
摘要:We explore a means to represent the combination of our stateful computations using familiar composition. We dive into what makes this possible by talk
阅读全文
摘要:The true power of the State ADT really shows when we start combining our discrete, stateful transactions. We start looking at another construction hel
阅读全文
摘要:Recentlly, I am learning crocks.js ADT libaray. In the beginning, it is hard to understand when to use 'runWith', 'evalWith', 'execWith'. Until I went
阅读全文
摘要:Using put to update our state for a given state transaction can make it difficult to modify a given state based on its previous value. In this lesson
阅读全文
摘要:Stateful computations require the ability for their state to change overtime. We take a look on one way to replace the state portion of our stateful d
阅读全文
摘要:We take a closer look at the get construction helper and see how we can use it to lift a function that maps the state portion and updates the resultan
阅读全文
摘要:When you need to generate a data set, a generator function is often the correct solution. A generator function is defined with function* and then you
阅读全文
摘要:A Javascript Proxy object is a very interesting es6 feature, that allows you to determine behaviors whenever a property is accessed in a target object
阅读全文
摘要:As a beginner of Crocks.js, it was a problem for we to figure out when to use .map() and when to use .chain(). Of course, using the docs help: map: St
阅读全文
摘要:We have the ability to select a single random card from a pile of twelve cards, but we would like to pull a total of nine. Not only that, we would lik
阅读全文
摘要:Functor composition is a powerful concept that arises when we have one Functor nested in another Functor. It becomes even more powerful when both of t
阅读全文
摘要:We want to be able to pick nine random cards from an array of twelve cards, but can run into problems of keeping both the cards already draw and the c
阅读全文
摘要:Just like the State ADT an Array is also an Applicative Functor. That means we can do the same tricks with liftA2 with Array that we have been doing w
阅读全文
摘要:In JavaScript, we often end up composing one object out of several other objects. Luckily there's a convenient spread operator which allows us to spre
阅读全文