Advent of Code solutions
at main 11 lines 452 B view raw
1rotate (count, rot) ('L' : dist) = rotate_ count rot (-read dist) 2rotate (count, rot) ('R' : dist) = rotate_ count rot (read dist) 3 4rotate_ count rot dist = (count2, rot2) 5 where 6 rotations = abs dist `div` 100 7 crossed = not $ (rot + dist `rem` 100) `elem` [0 .. 99] 8 count2 = count + rotations + if crossed then 1 else 0 9 rot2 = (rot + (dist `rem` 100) + 100) `rem` 100 10 11main = getContents >>= print . fst . foldl rotate (0, 50) . lines