haskell - displaying contents of a list

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2009
Posts: 7
Reputation: applebiz89 is an unknown quantity at this point 
Solved Threads: 0
applebiz89 applebiz89 is offline Offline
Newbie Poster

haskell - displaying contents of a list

 
0
  #1
May 9th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 139
Reputation: thoughtcoder is on a distinguished road 
Solved Threads: 12
thoughtcoder thoughtcoder is offline Offline
Junior Poster

Re: haskell - displaying contents of a list

 
0
  #2
May 9th, 2009
This should be, like, basic recursion.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 7
Reputation: applebiz89 is an unknown quantity at this point 
Solved Threads: 0
applebiz89 applebiz89 is offline Offline
Newbie Poster

Re: haskell - displaying contents of a list

 
0
  #3
May 10th, 2009
any thoughts on going about doing that or?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Legacy and Other Languages Forum


Views: 722 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Legacy and Other Languages
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC