AOC-2023-3 Gear Ratios

In this problem, we had to parse the input problem and find all the symbols like: #, *, + and $. All numbers that are adjacent to symbols are important for us, and we need to compute the result.

Part 1

In this part we had to compute the sum of numbers adjacent to the symbol decsribed above. To get the results I was going for the graph traversal algorithm, and to do that in haskell I used containers library to get Data.Tree and used State Monad from mtl to keep track of visited nodes using get and put.

To Debug the issue during the development, I used drawForest in the code using Debug.Trace and used the hardcoded input and running the :main in REPL again and again.

Part 2

In this part we had to find the pair of numbers around * and multiply them and sum all the results from that.


So the solution is available at: https://github.com/upendra1997/advent-of-code-2023-hs/blob/main/day3/day3.hs

but please note that helperFunction and main are not that readable :(