diff --git a/2023/haskell/aoc2023.cabal b/2023/haskell/aoc2023.cabal index cd16626..dbd2a27 100644 --- a/2023/haskell/aoc2023.cabal +++ b/2023/haskell/aoc2023.cabal @@ -85,7 +85,8 @@ executable aoc2023 main-is: Main.hs -- Modules included in this executable, other than Main. - -- other-modules: + other-modules: + Utils -- LANGUAGE extensions used by modules in this package. -- other-extensions: @@ -93,6 +94,7 @@ executable aoc2023 -- Other library packages from which modules are imported. build-depends: base ^>=4.17.2.0, + text ^>=2.1, aoc2023 -- Directories containing source files. diff --git a/2023/haskell/app/Main.hs b/2023/haskell/app/Main.hs index a4d7240..539c72d 100644 --- a/2023/haskell/app/Main.hs +++ b/2023/haskell/app/Main.hs @@ -1,8 +1,12 @@ module Main where -import qualified Day01 (someFunc) +import qualified Data.Text as T +import Utils (readInput) + +import qualified Day01 +import qualified Day02 main :: IO () main = do - putStrLn "Hello, Haskell!" - MyLib.someFunc + text <- readInput 1 + putStrLn $ T.unpack text diff --git a/2023/haskell/app/Utils.hs b/2023/haskell/app/Utils.hs new file mode 100644 index 0000000..bc706af --- /dev/null +++ b/2023/haskell/app/Utils.hs @@ -0,0 +1,10 @@ +module Utils (readInput) where + +import Prelude hiding (readFile) +import Text.Printf (printf) +import qualified Data.Text as T +import Data.Text.IO (readFile) + + +readInput :: Int -> IO T.Text +readInput = readFile . printf "../.inputs/%02d" diff --git a/2023/haskell/src/Day01.hs b/2023/haskell/src/Day01.hs index fdce4b5..6beb0c4 100644 --- a/2023/haskell/src/Day01.hs +++ b/2023/haskell/src/Day01.hs @@ -1,4 +1,5 @@ module Day01 (someFunc) where someFunc :: IO () -someFunc = putStrLn "someFunc" +someFunc = putStrLn "someFunc22" +