添加到列表,Haskell编译错误

时间:2014-07-17 14:51:55

标签: haskell

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

我收到错误“非法字面输入:”我和我破碎的

1 个答案:

答案 0 :(得分:3)

您需要在定义中使用=

testData :: [Sales]

testData = [("Me and My Broken Heart","Rixton",5),("It’s My Birthday","will.i.am",4),("Problem","Ariana Grande",3)]