Monads As Programmable Semicolons

Here is my version of “yet another monad tutorial”. In this tutorial I will not cover specific examples of Monad implementations in detail since I think that this distracts from the goal of understanding the overall abstraction. I will also not cover some of the simpler type classes such as Functor and Monoid in detail, since these aren’t really that important for understanding Monad.

Read More

Continuous Approximations of Logical Functions

Logical functions are critical parts of almost every computer program. However, optimization problems are often solved over the set of real numbers, which does not fit nicely into this rigid binary logic. In many cases, we’d like to take advantage of applying logical operations, which includes their use in things like deep neural networks. How to describe these discrete functions in terms of a continuous function seems challenging. In this post I will show how we can apply the rules of logic to arrive at concise functions.

Read More

Type Inference by Solving Constraints

Type inference is used in functional programming languages to automatically deduce the type of expressions based on how the expression is used. Inference reduces the burden on the programmer who would otherwise have to write all the types manually. Anyone who uses an imperative statically typed programming language knows how quickly explicit type annotations can become burdensome. Type inference is slowly permeating non-functional languages such as C++ and C#, which widens the potential use of inference.

Read More