Advent of code: day 1
Personally I'd prefer to write this as an explicit fold. IMO that's somewhat cleaner and significantly easier to grasp when skimming

result :: [Char] -&gt; Int
result cs@(c:_) = go $ cs ++ [c]
  where
  go :: [Char] -&gt; Int
  go (c1:chars@(c2:_)) = (if c1 == c2 then digitToInt(c1) else 0) + (go chars)
  go _ = 0
result = 0


This removes a lot of text that I consider pretty confusing to read.