Scroll to see more

Elm

4 min read – Elm, Functional

Mapping more than lists

Using the function map to change the elements of a list has become a common pattern in modern programming languages. It is often used in Elm and map is also used in Elm for the Maybe and Result types.

7 min read – Elm

Fixing a performance problem in Elm using Html.Lazy

How you can increase the performance of your Elm application using Html.Lazy, and why that motivated me to look into elm-css.

2 min read – Elm

Log Off and Read Some Docs

Wow! It's Christmas Eve, and elm.christmas is drawing to a close. We've published 24 articles, and I want to thank you for visiting our advent calendar, regardless of whether you've read all 24 articles, or if this is the first one you've read. This last article won't be long, as I just want to highlight a neat tool that you might not have used for your Elm project.

3 min read – Elm

When it comes to ports, three's a crowd.

Now that you've learned how to define both incomming and outgoing ports, you might wonder how many of them you need. It might seem reasonable to require two ports for each javascript function you wish to call, but what if I told you'll need, at most, two for the entire application?

2 min read – Elm

Outbound ports

In yesterday's post, we learned about inbound ports in Elm. Today, instead of receiving a message, we want to send a message from our Elm application to the outside world that is JavaScript.

2 min read – Elm

Inbound ports

What if your elm program needs to communicate with the JavaScript enclosing your application? Maybe you need some kind of messages flowing into the elm lifecycle and need to act on such events? To receive messages from JavaScript we can make use of inbound ports🌈

5 min read – Elm

Remote Data

4 min read – Elm

Let's talk about TEA - The Elm Architecture!

Elm and other functional programming languages might look weird and scary to newcomers. Once you get to know them, however, functional languages becomes very clear and satisfying to work with Let's look at the MVU - Model, View, Update - architecture. The architecture is also known as TEA - The Elm Architecture - but is useful in other languages as well

4 min read – Elm

The Builder Pattern

Elm doesn't have a concept of required and optional arguments. Every function takes all the arguments they specify, no more, no less. But sometimes we want to be able to specify only some arguments to a function, and use default values for the rest. The builder pattern is one solution to that challenge.

3 min read – Elm

Greater type safety with opaque types!

It may become tedious to always check if a value in your records is on the supposed format. To be absolutely certain that a value correctly represents a property in your records, we can use opaque types!

2 min read – Elm

A Bunch of Nothing

One of the great advantages of Elm is its strong runtime guarantees, and one important technique it uses to achieve this is using data types such as Maybe and Result to handle errors, instead of having values like null or undefined in the language. These structures are very nice to work with, but if you don't know the tools at your disposal, they can be tricky.

2 min read – Elm

Reducing boilerplate code in Elm with Maybe.andThen

Working with the Maybe type in Elm may result in excessive pattern matching because Elm forces us to handle all possible outcomes. In this article, we investigate how the Maybe.andThen function can be used to improve readability by reducing unnecessary pattern matching and boilerplate code.

2 min read – Elm

Combining Maybes in Elm

Have you ever needed to combine different Maybe-values to produce another value? In this article, we explore just that.

3 min read – Elm

What do we do with what's inside the box?

Elm doesn't have nulls or undefineds, it has a Maybe type. While it's a pleasent type to work with, it might take some getting used to if you're coming from a language like Java or Python. Let's take a look at how we perform some basic operations over the Maybe type.

2 min read – Elm

Operators are functions, too

Much of Elm's power stems from the fact that most things are just functions. So how do operators fit in?

3 min read – Elm

Lord of the pipes

If the bulk of your programming experience comes from C-like languages, there’s a chance you find pipes, |>and <| some of the most distinct features of Elm. Roll up your sleeves, it's time to master the art of piping.

2 min read – Elm

Partial application of functions!

Currying (👈 which you read about in yesterday's post) enables partial application, which lets us split up functions into small logical building blocks which are easier to both read and work with.

2 min read – Elm

Hurry, curry!

Today we'll look at an interesting property of Elm known as currying. We will only explain the principle today, then spend the next two days seeing how it can be useful in practise.

3 min read – Elm

Peeking Inside Lists

Working with lists in Elm is nice, but getting a sense of what’s inside a list can be tricky. In this article we will look at a techinque that allows us to get access to the elements inside a list.

1 min read – Elm

Simplify your code with ad hoc tuples

With Elm's strong types, we must be precise when writing our business code. Precision is a good thing, but it often has the drawback of being verbose. Ad hoc tuples can save the day with clear and precise syntax!

2 min read – Elm

Climbing trees

Custom types are powerful data structures that might seem somewhat complicated to work with, at least if they are nested. Let's take a look at how we can deal with nested custom types in a simple way! 🍊

2 min read – Elm

Letting functions in

3 min read – Elm

The power of let expressions

In the previous christmas articles we have seen how to destructure tuples, records, and single-value custom types in the function arguments. Today we take a look at how to destructure values in let expressions, along with some of the use-cases where I find this the most helpful.

4 min read – Elm

Single-Constructor Custom Types

2 min read – Elm

Unpacking Records

Records in Elm are quite like JavaScript objects. In ES6, destructuring objects can produce compact and concise code. This article explores some techniques that Elm offers to the same effect.

2 min read – Elm

Once, twice, three times a value

Welcome to the Elm christmas calendar, and to the first of 24 articles that will teach you some tricks and useful concepts you might not already know. Today we are discussing Tuples. It is perhaps Elm's simplest way of structuring data. We also introduce a concept recurring across several days; pattern matching, or destructuring. The first use-case is pattern matching of tuples in function declarations.