[hs] Rename dayParser to dayParse
This commit is contained in:
parent
9d02c4344d
commit
6ad7c5108d
2 changed files with 4 additions and 4 deletions
|
|
@ -4,7 +4,7 @@ module Aoc.Day
|
||||||
, dayFile
|
, dayFile
|
||||||
, dayString
|
, dayString
|
||||||
, dayText
|
, dayText
|
||||||
, dayParser
|
, dayParse
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|
@ -31,8 +31,8 @@ dayString name f = dayFile name $ f <=< readFile
|
||||||
dayText :: String -> (T.Text -> IO ()) -> Day
|
dayText :: String -> (T.Text -> IO ()) -> Day
|
||||||
dayText name f = dayFile name $ f <=< T.readFile
|
dayText name f = dayFile name $ f <=< T.readFile
|
||||||
|
|
||||||
dayParser :: String -> Parser a -> (a -> IO ()) -> Day
|
dayParse :: String -> Parser a -> (a -> IO ()) -> Day
|
||||||
dayParser name p f = dayFile name $ \path -> do
|
dayParse name p f = dayFile name $ \path -> do
|
||||||
text <- T.readFile path
|
text <- T.readFile path
|
||||||
case parse p path text of
|
case parse p path text of
|
||||||
Right a -> f a
|
Right a -> f a
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,4 @@ solver values = do
|
||||||
putStrLn $ show y1 ++ " * " ++ show y2 ++ " * " ++ show y3 ++ " = " ++ show (y1 * y2 * y3)
|
putStrLn $ show y1 ++ " * " ++ show y2 ++ " * " ++ show y3 ++ " = " ++ show (y1 * y2 * y3)
|
||||||
|
|
||||||
day :: Day
|
day :: Day
|
||||||
day = dayParser "2020_01" parser solver
|
day = dayParse "2020_01" parser solver
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue