This commit is contained in:
Pcornat 2024-01-26 13:17:27 +01:00
parent 00f7598bee
commit d170aac4aa
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD
5 changed files with 922 additions and 0 deletions

21
day3/app/Main.hs Normal file
View file

@ -0,0 +1,21 @@
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!"