-- Sample test data
type Sales = (String, String, Int)
testData :: [Sales]
testData :: [("Me and My Broken Heart","Rixton"),("It’s My Birthday","will.i.am"),("Problem","Ariana Grande")]
-- record a sale of a track
sellTrack :: String String-> [Sales]
sellTrack :: trackName artistName = [Sales] ++ [(trackName, artistName, numberSold)]
我收到错误“非法字面输入:”我和我破碎的
答案 0 :(得分:3)
您需要在定义中使用=
:
testData :: [Sales]
testData = [("Me and My Broken Heart","Rixton",5),("It’s My Birthday","will.i.am",4),("Problem","Ariana Grande",3)]