David Raab · Blogging about programming

Continuations and foldBack

comments
In From mutable loops to immutable folds we implemented foldBack through rev and fold. In this post I show you how you can implement foldBack by using a continuation function. Functions Before we see how to implement foldBack, I want to give you analogy first. This analogy helped me in...

Continue reading ...

Sequence and Traverse

comments
One problem that appears from time to time is that we we have some kind of collection (I use list here) and we want to map every element with a monadic function 'a -> M<'b>. This then returns a list<M<'a>>. But often we want a M<list<'a>>. To be more concrete....

Continue reading ...

Applicative: Lists

comments
In Understanding apply I primarily used the Option type to show how you implement and use an Applicative Functor. But the concept also works for any other type. This time I want to show you the idea of an Applicative with a list, what it means, what you can do...

Continue reading ...

Optionals

comments
In this post I want to talk about Optionals more deeply. I already wrote about null, but I noticed that it is still not immediately clear on why Optionals are better. Instead of focusing why null is bad, this time I want to focus why Optionals are good. For this...

Continue reading ...

From mutable loops to immutable folds

comments
When we ask of key-features of functional programming, you will probably hear two things most often. Immutability and recursion. But why is that so? As Immutability also becomes more important in OO languages you will probably find a lot of reason for that one, but why are recursive functions so...

Continue reading ...

Understanding bind

comments
In Understanding map we learned that implementing a map function is what we call a Functor. In Understanding apply we extended that idea with the return and apply function and we call the result an Applicative Functor. The next important function in our toolset is the bind function. Monads The...

Continue reading ...

Understanding apply

comments
In my previous blog "Understanding map" I introduced the map function and described that implementing map and fulfilling two laws we get what we call a Functor. In this Post we discuss the apply function that we can view as an extension to the map function. Problem with map It...

Continue reading ...

Understanding map

comments
One important function in functional programming is the map function. When I learned F# I must admit that I had some problems first, understanding it. The problem was, I already knew the map function from dozens of other languages. Or to say it correctly, I mostly learned a wrong explanation...

Continue reading ...

Exceptions are Evil

comments
Most people today agree that null is evil, and they try to get rid of them. One technique that most people prefer is to throw an exception in the case of an error, or if we cannot return a valid value from a function. The problem is, exceptions are not...

Continue reading ...

Higher-kinded Polymorphism: What is it, why you want it

comments
One aspect of a programming language that is often noted as important is the idea of Polymorphism. But there doesn't exists just one type of polymorphism. In functional languages Parametric Polymorphism (aka Generics) is often used. Haskell was the first language that introduced "Higher-kinded polymorphism". Sadly, F# don't support this...

Continue reading ...