AdventOfCode2023-Haskell/day3/app/Main.hs

22 lines
556 B
Haskell
Raw Permalink Normal View History

2024-01-26 13:17:27 +01:00
module Main where
import Data.Char (isDigit)
import qualified Data.HashSet as HashSet
import Data.List.Split (splitOn)
getSeparators :: String -> [Char]
getSeparators = filter checkSeparator
checkSeparator :: Char -> Bool
checkSeparator c = not (isDigit c) && (c /= '.')
main :: IO ()
main = do
content <- readFile "sample.txt"
let fileContent = (concat . lines) content
let symbols = (HashSet.fromList . getSeparators) fileContent
let test = (filter (/= "") . splitOn ".") fileContent
print symbols
print test
putStrLn "Hello, Haskell!"