[Haskell-cafe] displaying conetents of a list

applebiz89 applebiz89 at hotmail.com
Sun May 10 10:30:28 EDT 2009


I want to write a function to output the entire contents of a list. not sure
of how to do so...This is my list i want to output

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"]) ]

-------

I know this isnt right but this is what I have so far

listFilms :: [Film] -> [Film]
listFilms (film@(Film title director year fans) : films) = putStrLn . show
film     

I know to use show and putStrLn but I just don't know how to put them into
the function correctly

thank you.
-- 
View this message in context: http://www.nabble.com/displaying-conetents-of-a-list-tp23470633p23470633.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list