0
data Film = Film String String Int [String] deriving (Eq, Ord, Show, Read)
--that's my custom data type, (Film *filmname, director, year of release, fans)
addFilm :: Film -> [Film] -> [Film]
addFilm newFilm filmList = filmList ++ [newFilm]
--this is for adding a new film to the list, but without the fans string array
該模塊正在加載到WinGHCi沒有錯誤,但我不知道如何代替filmList。作爲filmList參數的值,輸入什麼?
---
<interactive>:63:30:
Couldn't match type `Char' with `Film'
Expected type: [Film]
Actual type: [Char]
In the second argument of `addFilm', namely `"Jordan Vogt-Roberts"'
In the expression:
addFilm "Kong: Skull Island" "Jordan Vogt-Roberts" 2017
In an equation for `it':
it = addFilm "Kong: Skull Island" "Jordan Vogt-Roberts" 2017
*Main> addFilm "Kong: Skull Island" "Jordan Vogt-Roberts" 2017 filmList
<interactive>:64:57: Not in scope: `filmList' --- that's what I input.
我想我的意思是空串的粉絲,而不是「沒有它」。對不起,謝謝。 – Saad