part2 :: [Step] -> Int
part2 steps =
  let start@(Placement _ startPos) = Placement N (0, 0)
      interpolated []         = []
      interpolated (a:b:rest) = between a b ++ interpolated (b : rest)
      interpolated [a]        = [a]
      positions =
        interpolated $ (\(Placement _ pos) -> pos) <$> scanl step start steps
      endPos = fromMaybe startPos (firstDuplicate positions)
  in distance startPos endPos
part2 :: [Step] -> Int
part2 steps =
  let start@(Placement _ startPos) = Placement N (0, 0)
      interpolated []         = []
      interpolated (a:b:rest) = between a b ++ interpolated (b : rest)
      interpolated [a]        = [a]
      positions =
        interpolated $ (\(Placement _ pos) -> pos) <$> scanl step start steps
      endPos = fromMaybe startPos (firstDuplicate positions)
  in distance startPos endPos
part2 steps =
  let start@(Placement _ startPos) = Placement N (0, 0)
      interpolated []         = []
      interpolated (a:b:rest) = between a b ++ interpolated (b : rest)
      interpolated [a]        = [a]
      positions =
        interpolated $ (\(Placement _ pos) -> pos) <$> scanl step start steps
      endPos = fromMaybe startPos (firstDuplicate positions)
  in distance startPos endPos