I want to write a function that displays the whole contents of a list. But im not sure how to do so. I have displayed my datatype of which i want to print...and at the bottom is the function that I want to print the list with.

Thanks in advance.

- data type
type Title = String
type Director = String
type Year = Int
type Fan = String
data Film = Film Title Director Year [Fan] deriving Show

-- List of films
testDatabase :: [Film]
testDatabase = [(Film "Casino Royale" "Martin Campbell" 2006 ["Garry", "Dave", "Zoe"]) ]
--list of films
listFilms :: [Film] -> [Film]
listFilms (film@(Film title director year fans) : films) = putStrLn . show

Recommended Answers

All 2 Replies

This should be, like, basic recursion.

any thoughts on going about doing that or?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.