software is fun

Recent content on software is fun
https://blog.drewolson.org/ (RSS)
visit blog
Gleam is Pragmatic
5 Oct 2024 | original ↗

I’ve spent the past several years working with functional programming languages in my free time – primarily Haskell and OCaml. I love both languages but also find aspects of each frustrating. Haskell is terse and elegant with type classes providing a powerful mechanism for ad-hoc polymorphism. However, it can also be confusingly implicit and I...

Hello World Haskell
16 Sept 2022 | original ↗

Teacher: Hello class! Welcome to your first day of functional programming. Today, we’re going to be talking about how to write the classic “Hello, World!” program in Haskell. It’ll be slightly more involved as we’ll ask for the user’s name and then greet them. I’m sure many of you have heard scary things about Haskell, but I promise you it’ll be...

Easy JSON in Haskell
12 Sept 2022 | original ↗

So you’ve learned some basic Haskell and you’re feeling really good about yourself. You sit down the write some code and you’re presented with a deeply nested JSON structure: { "foo": "Hello", "bar": 1, "baz": "More stuff", "people": [ { "name": "Drew", "hobbies": [ { "name": "bridge" }, { "name": "haskell"...

Parsing Permutations
18 Nov 2021 | original ↗

My favorite game is bridge. It’s an excellent test of cooperation and strategy. I’m in a discord chat devoted mostly to the game and folks often share interesting bridge hands with one another. I decided it would be fun to build a program that parsed a simply-formatted bridge hand and produced a plain text bridge diagram. Here’s a defensive...

Adventures in Looping
29 Sept 2021 | original ↗

I was recently building a Slack bot in Haskell. The core of the Slack integration was a never-ending loop that read messages from a web socket and performed actions based on the message. But how should I go about looping forever in Haskell? My first pass was to use the aptly-named forever function. My understanding of forever was that it ran a...

Declarative Validation
27 Apr 2021 | original ↗

In the past two years I’ve become reasonably comfortable with both PureScript and Haskell. I’ve learned so many new things while diving into the pure functional programming ecosystem and many of these techniques can be applied to other paradigms. Unfortunately, the pure FP world can feel a bit like another dimension – where many programming...

PureScript and Haskell
24 Feb 2021 | original ↗

Two years ago, I starting learning PureScript. I had been intrigued by purely functional programming for some time but had failed to learn Haskell once or twice. PureScript seemed to be a kinder, gentler introduction to this world while retaining the fundamental properties of pureness that made Haskell intriguing to me. As part of my learning...

Parsing Untrusted Input with Elixir
23 Aug 2020 | original ↗

I’ve spent a lot of time in the past year learning PureScript and it has drastically changed the way I think about programming in general. The biggest change in my thinking is described by the excellent blog post Parse, don’t validate. The most important passage in the post, I think, is this: Consider: what is a parser? Really, a parser is just a...

Drawing Fractals with PureScript
3 Jun 2020 | original ↗

Recently, for no good reason, I added an easter egg to my personal website. I love fractals and decided to add a visualization of the dragon curve. Here were the requirements: Every 10 seconds, a new iteration of the dragon curve would be drawn. If the user clicked anywhere within the drawing area, a new iteration would be drawn and the 10 second...

Parser Combinators in Elixir
14 Mar 2020 | original ↗

Delving into the world of pure functional programming caused me to learn about parser combinators. Upon returning to Elixir, I was excited to see that nimble_parsec is a great example of a parser combinator library for the Elixir ecosystem. Parser combinators can be notoriously confusing when first learned. In this post I’ll provide a gentle...

Building a Slack Bot in PureScript
31 Jan 2020 | original ↗

I recently open sourced my first large PureScript project. It’s a slack bot that allows searching for cards from the Epic Card Game. In this post, I’ll discuss the process of writing the application, what went well and what went poorly. An Overview of the Slack Bot I was excited about building this project in PureScript because it was complicated...

PureScript Async FFI
4 Jan 2020 | original ↗

I recently posted about using Aff for asynchronous effects in PureScript. In this follow-up post, I’m going to discuss using JavaScript FFI in conjuction with Aff. Aff and FFI PureScript gives us very nice FFI utilities to call JavaScript code. Aff provides a function called fromEffectFnAff that lets us turn asynchronous JavaScript behavior into...

Asynchronous PureScript
17 Dec 2019 | original ↗

One of my favorite features of PureScript is its ability to work with asynchronous effects. While learning the language, I struggled to find any beginner material that introduced the relevant topics and included small examples. This post hopes to fill that gap. Getting Started with Aff PureScript’s built-in type for effects is called Effect....

Laziness in PureScript
19 Jun 2019 | original ↗

I’ve been learning PureScript for the past few months and really enjoying it. PureScript is a Haskell dervied language that compiles to JavaScript. You can target node for the backend or the browser for frontend code. One of my favorite features of PureScript is its fantastic interop with JavaScript. This makes the language very pragmatic –...

Go Dependency Injection with Wire
7 Apr 2019 | original ↗

Several months ago I wrote a blog post about dependency injection in go. In the time since that post was written, Google has released a fantastic new dependency injection container for go called wire. I much prefer wire to other containers in the go ecosystem. This post will explain why. A (Very) Brief Primer on Dependency Injection Dependency...

Concurrent Ruby with Tasks
29 Oct 2018 | original ↗

Yes, you read the title correctly. And yes, ruby still has a GIL. However, ruby has long been able to support concurrency for IO-bound calls. Ruby will not block the current thread if it is waiting on IO. In practice, this means that many of our ruby programs (like web applications) can use ruby’s threads to concurrently serve multiple requests....

So You Bought a Pixelbook
16 Jun 2018 | original ↗

Initial Setup First, follow the Quickstart instructions here. You now have two things set up – a VM called termina and a container inside of that VM called penguin. This VM and container are “special” – files within penguin are accessible via the Files app and any GUI applications installed inside of penguin will be accessible via the launcher....

Lazy Providers in Dig
25 May 2018 | original ↗

If you haven’t yet read my previous post on depedency injection in Go, please do so first. This post describes a simple technique to make dig’s DI container even more powerful. All values provided by dig’s container are singletons. The provider is called the first time the value is required and the result is cached. All subsequent providers that...

Dependency Injection in Go
15 May 2018 | original ↗

Update - you should probably read my more recent post about dependency injection with wire. I recently built a small project in Go. I’ve been working with Java for the past few years and was immediately struck by the lack of momentum behind Dependency Injection (DI) in the Go ecosystem. I decided to try building my project using Uber’s dig...

Promises as Values
13 Jul 2017 | original ↗

I was recently working on a small JavaScript project in which I needed to perform several asynchronous operations sequentially. I had a collection of images on a page and I needed to fade each of them out one at a time. I ended up with a nice technique using Promises. Let’s suppose we have a function that fades out an image given a selector and a...

Elixir's Secret Weapon
12 May 2017 | original ↗

I recently began using a new(ish) feature of Elixir that completely transformed the way I build programs. I’m talking about the special form with. It can feel unfamiliar at first, but it is extremely powerful and flexible. This article will explain how with works and how it can be used to make your code more robust to errors. First, though, let’s...

Another Perspective on Promises
28 Dec 2016 | original ↗

I spent 9 months of this year working on a project using Java 8 and enjoyed it much more than I expected. Specifically, the addition of Optional made my code feel cleaner, more functional and less error prone. I had Java 8 on the brain when I tackled a small JavaScript project a few weeks ago. After finishing it, I decided to go back and try it...

Specify Your API
5 Aug 2016 | original ↗

Much of the past 6 years of my professional life has been spent designing, implementing and maintaining APIs. I’ve learned many things to avoid as well as a handful of good techniques. However, it wasn’t until 3 months ago that I was exposed to a practice I consider the most important thing you can do while building APIs. Every production-quality...

Extensible Design with Protocols
19 Mar 2016 | original ↗

I wrote some code this week that reinforced the power of protocols as a tool for software design. The term “protocol” can mean many things in the world of software. Let me clarify that I’m using protocol to mean the mechanism used by some languages (Elixir, Clojure, etc) to achieve polymorphism. Used properly, protocols allow you the provide...

Elixir Streams
8 Jun 2015 | original ↗

I previously wrote about explicitness in Elixir. One of my favorite ways the language embraces explicitness is in its distinction between eager and lazy operations on collections. Any time you use the Enum module, you’re performing an eager operation. Your collection will be transformed/mapped/enumerated immediately. When you use the Stream...

Sanity Tests
29 May 2015 | original ↗

It is common for test “classifications” to have a plethora of definitions. Sanity tests are no different. Wikipedia says the following on the subject: the sanity test […] determines whether it is possible and reasonable to proceed with further testing. This implies that a sanity test is some sort of “pre-test” to determine if further testing even...

The Value of Explicitness
3 Apr 2015 | original ↗

Elixir is often compared to Ruby. It’s true that Elixir takes inspiration from Ruby’s syntax. One of Elixir’s core tenets is “metaprogramming”, something often associated with Ruby and its ecosystem. That said, after using Elixir for a small amount of time it is immediately obvious that the semantics of the languages are very different. More...

An Empathetic Functional Language
20 Mar 2015 | original ↗

I’ve been writing Elixir code for over a year. Never have I been more excited about the prospects of the language and its community. The language is young but very promising. Many smart people are getting involved. There’s a hell of a trajectory here for a language that released 1.0 merely 6 months ago. I’ve been wondering what is it specifically...

Pagination with Phoenix & Ecto
20 Feb 2015 | original ↗

I’ve been working on a web application built in Elixir. I’m using Phoenix as the web framework and Ecto to talk to my database. As the amount of data in the application grew, I needed to paginate some of the views. I wasn’t able to find an existing pagination solution for these tools so I ended up building my own. This post will discuss what I...

Composable Queries with Ecto
23 Jan 2015 | original ↗

In my previous post I briefly covered some lessons I’d learned while building a (kind of real) web app in Elixir. Today, I’d like to take an in-depth look at composable queries in Ecto. First, a brief introduction to Ecto. What is Ecto? I think of Ecto as a light-weight ORM. Ecto uses Elixir structs to represent database tables and provides a DSL...

Building an Elixir Web App
19 Jan 2015 | original ↗

Over the past few months I’ve been building a small internal application at work. I’ve been using Elixir, Ecto and Phoenix and it’s been an absolute blast. I thought it would be useful to put together a “lessons learned” blog post about the techniques I’ve found helpful using these tools to build a database-backed web app. This post is not...

Good Software Developers
1 Nov 2014 | original ↗

I’m approaching 8 years as a professional software developer. I’ve written a lot of code, worked on a few teams and helped build a team from 4 developers to ~60. Now, more than ever, I find myself thinking about what it means to be a good software developer. Not good as in “good is the enemy of great”, but good as in “I want to work with this...

Node Streams for APIs
4 Jan 2014 | original ↗

Node streams are a fantastic abstraction for evented programming. They’re also notoriously hard to implement. In this post, I’d like to walk through implementing a streams2 Readable stream to wrap an API. The API Suppose we have a web service that returns a list of customers. There might be a large number of customers, so this service paginates...

Understanding gen_server with Elixir and Ruby
25 Oct 2013 | original ↗

Recently, I’ve been spending some time working in Erlang and Elixir. I had tried to break into Erlang in the past but I was always stymied by the steep learning curve of OTP. gen_server in particular always seemed like black magic to me. However, after attending an Erlang workshop at Lambda Jam this year it finally clicked for me. After I finally...

Clojure core.async and Go: A Code Comparison
4 Jul 2013 | original ↗

Last week, Rich Hickey announced Clojure core.async in a blog post. As mentioned in the post, the new core.async library has a lot in common with Go. In this post, I’ll compare the fundamental building blocks of concurrency in core.async and Go with code examples. Note: Clojure core.async provides two sets of operations on channels. The blocking...

↑ these items are from RSS. Visit the blog itself at https://blog.drewolson.org/ to find other articles and to appreciate the author's digital home.