Skip to content

My Haskell (and other) solutions to Advent of Code, adventofcode.com.

Notifications You must be signed in to change notification settings

Prillan/adventofcode-solutions

Repository files navigation

Solutions to Advent of Code problems in Haskell. Some problems have also been solved in other languages. All solutions are noted below.

Completion

2015 2016 2017 2018 2019 2020 2021 2022 2023
ASM 2/25 1/25
Haskell 24/25 11/25 9/25 4/25
Koka 3/25
Nix 1/25

Running the Code

Setting up the environment for a specific language, day and year is as simple as running ./aoc -l LANG DAY YEAR. Day is the only required value, the others default to hs (Haskell) and 2020 respectively.

$ # Haskell
$ ./aoc 23
Setting up day 23 (2020, hs)
Compile and run with:
  ghc -O2 run.hs && time ./run
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.8.4
$ exit
$ # ASM
$ ./aoc -l asm 23
Setting up day 23 (2020, asm)
Compile and run with:
  nasm -felf64 run.asm && ld -o run run.o && time ./run < input.txt
$ nasm -v
NASM version 2.14.02 compiled on Jan  1 1980

Language Completion

ASM

Solved:

Haskell

Day \ Year 2015 2016 2017 2018 2019 2020 2021 2022 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

Koka

Solved:

Nix

Solved:

Notes

  • For 2020's event I (finally) started adding a library for common functions, it can be found here.
  • The correct version of GHC can be pulled in by simply running nix-shell. Of course, that requires that you have Nix installed.
  • I'm not sure what version of GHC (+ libraries) I used for earlier years. I'll try to clean that up.
  • This README is also a WIP...

TODO

  • Use a single cabal project?

About

My Haskell (and other) solutions to Advent of Code, adventofcode.com.

Topics

Resources

Stars

Watchers

Forks