AdventOfCode2023-Haskell/day3/app/Main.hs

22 lines
556 B
Haskell

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!"