Haskell Puzzles

Some Haskell Puzzles from ZuriHac 2023
Published on June 19, 2023 under the tag haskell

At ZuriHac 2023, I worked on some Haskell Puzzles together with Alex, Francesco, Jussi and Patrick. You are given some Haskell tokens and a goal term, and you need to rearrange the tokens into an expression that produces the goal.

Here a simple warmup exercise just to get an idea of how it works:

Let’s continue with iterate but do a real puzzle next. What Monad are we looking for?

How is e defined again?

let allows us to reuse code. This is very useful if you don’t have enough tokens to make a sensible program.

Here is the final puzzle – but how can we produce a string from a bunch of numbers?

Haskell evaluation powered by tryhaskell.org. UI powered by some messy JavaScript.

We playtested these puzzles with simple pieces of paper during the event. At the final presentation we played a web-based multiplayer version where each player controls only one token.

We actually found the single player to be more fun, and since we already had some client code I decided to clean it up a bit and make a single player version available here.

Thanks for playing!