https codereview stackexchange com questions 178959 haskell-todo-list

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
https://codereview.stackexchange.com/questions/178959/haskell-todo-list
-----------------------------------------------------------------------
import Data.Char (toUpper)
type Todo = String
type TodoList = [Todo]
numberList :: TodoList -> [String]
numberList = zipWith (\a b -> show a ++ ". " ++ b) [1..]
removeElem :: Int -> [a] -> [a]
removeElem i xs = let (as, bs) = splitAt i xs
in as ++ drop 1 bs
printStrs :: [String] -> IO ()
printStrs = mapM_ putStrLn
showTodoList :: TodoList -> String
showTodoList [] = "No entries"
showTodoList xs = unlines . numberList --> ERROR