I have a hard-coded list that I wish to concatenate to a list-of-lists.
import Data.List (nub, sort)
import System.IO
type Title = String
type Director = String
type Year = Int
type Mark = Int
type Rating = (String, Int)
-- Define Film type here
type Film = (Title, Director, Year, [Rating])
-- Define database type here
type Database = [Film]
main = do
addFilm
print testDatabase
testDatabase :: [Film]
testDatabase = [("Casino Royale", "Martin Campbell", 2006, [("Garry", 8)])]
addFilm :: [Film] -> Film -> [Film]
addFilm a b = ("The BFG", "Steven Speilberg", 2016, []) : testDatabase
I get the error
Couldn't match expected type ‘IO a0’
with actual type ‘[Film] -> Film -> [Film]’
Probable cause: ‘addFilm’ is applied to too few arguments
In a stmt of a 'do' block: addFilm
In the expression:
do { addFilm;
print testDatabase }
I feel I am missing something rather simple but for the life of me I can't see it.
My expected output is something like this
[("The BFG","Steven Speilberg",2016,[]),("Casino Royale","Martin Campbell",2006,[("Garry",8)])]
testDatabase : [("The BFG", "Steven Speilberg", 2016, [])](which is indeed ill-typed) does not appear anywhere in the code you posted.