Sorry if this is stupid question - I am constantly getting error and can not figure it out. My code below:
data Health = Health [String]
let health = Health ["<3","<3","<3"]
showHealth :: [Health] -> String
showHealth [] = ""
showHealth (x:xs) = "" ++ (showSingleHealth x) ++ (showHealth xs)
showSingleHealth :: Health -> String
showSingleHealth (Health point) = point
And error I am getting is on "showSingleHealth", error say - Couldn't match type ‘[Char]’ with ‘Char’ Expected type: String Actual type: [String] . In the expression: point In an equation for ‘showSingleHealth’: showSingleHealth (Health point) = point
let. This is used in adoblock, or in an expression withlet ... in ..., but not in a declaration. - Willem Van OnsemHealth pointbindspointto a list ofStrings, not a singleString. What isshowSingleHealth heathsupposed to return? What argument do you intend to pass toshowHealth? I wonder if all you really want isshowHealth = concat, to turn["<3", "<3", "<3"]into"<3<3<3". - chepner