When developing a Finite State Machine, it is often necessary to apply multiple transitions in tandem. To accomplish this in most Redux work flows requires at best, implementing multiple action handlers in separate reducers; or at worse, the need to…
Many times we need to access and transform state, either in part or in full, to be used when calculating other state transitions. We will look at how we can leverage the get function on the State ADT to read and modify portions of our application sta…
When combining multiple State ADT instances that depend on the same input, using chain can become quite burdensome. We end up having to play leapfrog with values inside of nested chain statements. Very reminiscent of the old callback nastiness we had…
We explore a means to represent the combination of our stateful computations using familiar composition. We dive into what makes this possible by talking about what are known as Kleisli Arrows and explore some interesting properties surrounding them.…
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 we will explore a means to lift specialized functions that can be used modify our state’s value. The…
We explore our first stateful transaction, by devising a means to echo our state value into the resultant for independent modification. With our state value in the resultant, we explore using mapto lift functions into our type as a means to modify th…
Recently, I am learning Working with ADT. Got some extra thought about State Monad. Basiclly how to thinking in State. First, we need to know the type of State: State returns Pair with Unit on the left, and state on the right: State(state => Pair(Uni…
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 provided State. We can take advantage of the Action Names being Strings and replace the typical switch case…
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 need for a solid Redux integration. We can keep our action names and creators in the same file as t…
1. Functional programming treats computation as the evaluation of mathematical and avoids state and mutable data. Scala encourages an expression-oriented programming(EOP) 1) In expression-oriented programming every statement is an expression. A state…
In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It is a…
Lifting Now, let's review map from another perspective. map :: (T -> R) -> [T] -> [R] accepts 2 parameters, a function f :: T -> R and a list list :: [T]. [T] is a generic type paramterized by T, it's not the same as T, but definitely shares s…
Functions in Java Prior to the introduction of Lambda Expressions feature in version 8, Java had long been known as a purely object-oriented programming language. "Everything is an Object" is the philosophy deep in the language design. Objects a…
background In pursuit of a real-world application, let’s say we need an e-commerce web applicationfor a mail-order coffee bean company. They sell several types of coffee and in differentquantities, both of which affect the price. Imperative methods F…
A functional programming function is like a mathematical function, which produces an output that typically depends only on its arguments. Each time a functional programming function is called with the same arguments, the same result is achieved. Func…
In this blog post I will talk about the changes coming in Angular 2 that will improve its support for functional programming. Angular 2 is still in active development, so all the examples are WIP. Please focus on the capabilities and ideas, and not t…
It is really important to understand function signature in functional programming. The the code example below: const map = fn => anyFunctor => anyFunctor.map(fn); 'map' is pointfree version of any founctor's map, for example: Maybe.of('maybe').map(t…
When using ADTs in our code base, it can be difficult to use common debugging tools like watches and breakpoints. This is mainly due to the common pattern of using compositions and other ways of manipulating how functions are called. This can cause u…
In functional programming, a monad is a design pattern that defines how functions, actions, inputs, and outputs can be used together to build generic types,[1] with the following organization: Define a data type, and how values of that data type are…