No title

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Main where

main :: IO ()
main = do
    let list = []
    list' <- fillList list
    mapM_ putStrLn list'

fillList :: [String] -> IO [String]
fillList strings = do
    newLine <- getLine
    if newLine == "EOF"
       then return strings
       else fillList (strings ++ [newLine])

-- main :: IO ()
-- main = do
--     line <- getLine
--     putStrLn $ "line: " ++ line
--     let list :: [String]
--         list = []
--     if line == "EOF"
--         then return ()
--         else do
--                 putStrLn $ "list: " ++ show list
--                 let list = list ++ [line]
--                 putStrLn $ "list': " ++ show list
--                 main
-- 
--     printList list
-- 
-- printList list = do
--     if list == []
--         then return ()
--         else do
--             putStrLn (head list)
--             printList (tail list)
-- 
--