tags:

views:

65

answers:

2
putStrLn "Enter the Artist Name"
    art <- getLine
putStrLn "Enter the Number of CD's"
    num <- getLine

let test= buyItem currentStockBase art num
    printListIO (showcurrentList test)

the values i have to pass for buyItem is

buyItem currentStockBase "Akon" 20

but i want to send "Akon" to art and for 20 i want to send num

it gives me this error

ERROR file:.\Project2.hs:126 - Type error in application
*** Expression     : buyItem currentStockBase art num
*** Term           : num
*** Type           : [Char]
*** Does not match : Int

please help me

+1  A: 

Is it because num is a string? Try parsing it with read:

let test= buyItem currentStockBase art (read num)
Jason
+4  A: 

num is a String. buyItem is expecting an Int. You need to convert the String into an Int, for example by using read.

buyItem currentStockBase art (read num)

Edit: String means [Char] --- hopefully this means the error message makes more sense to you now.

Dave Hinton