Hello,
Hi, I have a script here
interleave :: [Integer] -> [Strings] -> [String] interleave (x:xs) (y:ys) = words [a | a <- (unwords [(show x), (filter (/= 1) y), "+"])]
Firstly, "Strings" is not a standard type. I suspect you mean "String" so the type signature is interleave :: [Integer] -> [String] -> [String] Now consider your sub-expression
filter (/= 1) y
y is a string (as it is the first element of a list of strings) filter will use it as a list of characters though because String == [Char] in haskell and filter expects a list. 1 is a number; the haskell type is Num a => a which means: 1 is of type a provided that it is an instance of class Num (that is: provided that it is a number) All usual number types are instance of class Num: Int, Integer, Double, Float Filter will compare 1 against each element of the character list, using /=. Let's say: y = "abc". In list notation: y = ['a', 'b', 'c'] now filter will attempt three comparisons 1 /= 'a' 1 /= 'b' 1 /= 'c' However, the compiler detects that characters ('a', 'b' and 'c' here) are not numbers, so this comparison is invalid. Conclusion: If you try to compare an expression which yields a number with some expression which doesn't yield a number, hugs will tell you that the second expression "Char is not an instance of class Num" or "instance of Num Char required" which you should read: "Char is not a number and it needs to be in order to be compared with a number".