X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent24%2FMain.hs;h=b33b2f3daf9fce3232424acc03f2688e84ffb964;hb=a7b02636b8045a73a4dff090c1b932cfa1afd9bd;hp=4e9cc78125986cf5e24cb80d1ef965e972b74fff;hpb=7ac14791ee38965b8b82f761de68c33a2809e7ec;p=advent-of-code-23.git diff --git a/advent24/Main.hs b/advent24/Main.hs index 4e9cc78..b33b2f3 100644 --- a/advent24/Main.hs +++ b/advent24/Main.hs @@ -115,12 +115,14 @@ stoneP :: Parser Hailstone vertexP :: Parser (V3 Rational) stonesP = stoneP `sepBy` endOfLine -stoneP = Hailstone <$> (vertexP <* symbolP "@") <*> vertexP -vertexP = vecify <$> signed decimal <*> (symbolP "," *> signed decimal) <*> (symbolP "," *> signed decimal) +stoneP = Hailstone <$> vertexP <* symbolP "@" <*> vertexP +vertexP = vecify <$> signed decimal <* symbolP "," + <*> signed decimal <* symbolP "," + <*> signed decimal where vecify x y z = V3 (x % 1) (y % 1) (z % 1) symbolP :: Text -> Parser Text -symbolP s = (skipSpace *> string s) <* skipSpace +symbolP s = skipSpace *> string s <* skipSpace successfulParse :: Text -> [Hailstone] successfulParse input =