https://github.com/danvk/aoc2025
Advent of Code 2025, this time in Haskell
https://github.com/danvk/aoc2025
Last synced: 2 months ago
JSON representation
Advent of Code 2025, this time in Haskell
- Host: GitHub
- URL: https://github.com/danvk/aoc2025
- Owner: danvk
- Created: 2025-12-01T13:33:01.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-12-12T15:55:06.000Z (7 months ago)
- Last Synced: 2026-04-17T00:16:59.993Z (3 months ago)
- Language: Haskell
- Size: 222 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Advent of Code 2025 (Haskell)
To run code for a day:
cabal run y2025d01 input/2025/day01/sample.txt
## Day 1
- Haskell's `scanl` is handy for this sort of problem.
- I had a bunch of off-by-ones on part 2, for example if you landed exactly on zero, I'd double-count it.
- Looking at reddit posts, the cleanest solution is to replace the big turns with a bunch of L1s and R1s. Then you can reuse your code from part 1. `replicate` is the function for this.
## Day 2
- Defining local helper functions with `where` is handy, and you don't need to write explicit types for them.
- You can't write `1 / 2` in Haskell, but you can write 1 `div` 2.
- The Haskell equivalent of `str * n` is `concat (replicate n str)`.