Skip to content

Instantly share code, notes, and snippets.

@simonmichael
Created December 10, 2018 12:36
Show Gist options
  • Save simonmichael/677fdf7df3a20067612b3e625d4888c1 to your computer and use it in GitHub Desktop.
Save simonmichael/677fdf7df3a20067612b3e625d4888c1 to your computer and use it in GitHub Desktop.
parsing with scanf
parsePoints s = s
& lines
& map (SC.scanf [SC.fmt|position=<%d, %d> velocity=<%d, %d>|])
& catMaybes
& map (SC.printf [SC.fmt|((%d,%d), (%d,%d))|])
& map read :: [Point]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment