mmhaskell.com mmhaskell.com

What Makes a Good IDE?

Sometimes in the past I've read articles about people's IDE setups and thought "wow, they spend way too much time thinking about this." Now maybe sometimes people do go overboard. But on the other hand, I think it's fair to say I've been neglecting the importance of my development environment in my own practice. A quick look at some of my videos in the last couple years can show you this fact. This whole playlist is a good...

mmhaskell.com mmhaskell.com

Dijkstra with Monads!

Last time on the blog, we considered this library version of Dijkstra's algorithm that you can find on Hackage. dijkstra :: (Foldable f, Num cost, Ord cost, Ord State) => (state -> f state) -- Function to generate list of neighbors -> (state -> state -> cost) -- Function for cost generation -> (state -> Bool) -- Destination predicate -> state -- Initial state -> Maybe (cost, [state]) -- Solution cost and path, Nothing if...

mmhaskell.com mmhaskell.com

Dijkstra Comparison: Looking at the Library Function

In the last few articles I've gone through my approach for generalizing Dijkstra's algorithm in Haskell. The previous parts of this included: Simple Form of Dijkstra's Algorithm Generalizing with a Multi-Param Typeclass Generalizing with a Type Family A 2D Graph example But of course I wasn't the first person to think about coming up with a general form of Dijkstra's algorithm in Haskell. Today, we'll look at the API for a library...

mmhaskell.com mmhaskell.com

Dijkstra in a 2D Grid

We've now spent the last few articles looking at implementations of Dijkstra's algorithm in Haskell, with an emphasis on how to generalize the algorithm so it works for different graph types. Here's a quick summary in case you'd like to revisit some of this code, (since this article depends on these implementations). Simple Implementation Article GitHub Code Generalized with a Multi-param Typeclass Article GitHub Code Generalized with...

mmhaskell.com mmhaskell.com

Dijkstra with Type Families

In the previous part of this series, I wrote about a more general form of Dijkstra’s Algorithm in Haskell. This implementation used a Multi-param Typeclass to encapsulate the behavior of a “graph” type in terms of its node type and the cost/distance type. This is a perfectly valid implementation, but I wanted to go one step further and try out a different approach to generalization. Type Holes In effect, I view this algorithm as...

mmhaskell.com mmhaskell.com

Dijkstra's Algorithm in Haskell

In some of my recent streaming sessions (some of which you can see on my YouTube chanel), I spent some time playing around with Dijkstra’s algorithm. I wrote my own version of it in Haskell, tried to generalize it to work in different settings, and then used it in some examples. So for the next couple weeks I’ll be writing about those results. Today I’ll start though with a quick overview of a basic Haskell approach to the...

mmhaskell.com mmhaskell.com

What's Your Reading Style?

I’ve been writing about Haskell for almost six years now. I’ve gone through a few different writing styles during that time, but I’m curious which of these most suit you, my readers! So for the first time, I’d like to take a poll and see what you think! Here are four styles I could think of for how I would read an online programming article. Pick one of these to vote in this poll! (I’ll explain each option more below if you...

mmhaskell.com mmhaskell.com

A Brief Look at Asynchronous Exceptions

We've covered a lot of different exception mechanisms this month. Today we'll cover just one more concept that will serve as a teaser for some future exploration of concurrency. All the exception mechanisms we've looked at so are serial in nature. We call a certain IO function from our main thread, and we block the program until that operation finishes. However, exceptions can also happen in an asynchronous way. This can happen in a...

mmhaskell.com mmhaskell.com

Catching Before Production: Assert Statements in Haskell

We've spent a lot of time this month going over exceptions, which are ways to signal within our program that something unexpected has happened. These will often result in an early termination for our program even if we catch them. But by catching them, we can typically provide more helpful error messages and logs. Exceptions are intended for use in production code. You don't want them to ever go off, but they are there . However, there...