module IOActionModule
( askForLocation,
askForActor,
askToSelectMovie,
printCinemas,
printMovies,
) where
import DataStructures
askForLocation :: IO String
askForLocation = do
putStrLn "Please enter your location: "
getLine
askForActor :: IO String
askForActor = do
putStrLn "Please enter the actor name you want to search for: "
getLine
askToSelectMovie :: IO Int
askToSelectMovie = do
putStrLn "Please select a movie from the List: "
readLn
printCinemas :: [Cinema] -> IO ()
printCinemas c = do
putStrLn "the following cinemas in your area are currently showing the film: "
printCinemas' c
where
printCinemas' [] = return ()
printCinemas' (x:xs) = do
print x
printCinemas' xs
printMovies :: [Movie] -> IO()
printMovies x = do
putStrLn "The given actor plays in the following movies"
printMoviesHelper x 1
where
printMoviesHelper :: [Movie] -> Int -> IO()
printMoviesHelper [] _ = return ()
printMoviesHelper (x:xs) i = do
putStrLn ("(" ++ show i ++ ") " ++ show x)
printMoviesHelper xs (i + 1)