我不知道为什么下面的代码引起以下错误。
码:
type Symbol = Char
symbols :: [Symbol]
symbols = ['a'..'f']
type Code = [Symbol]
members :: Code -> Bool
members xs = and [ b | x <- xs, b <- map (elem x) symbols ]
编译错误:
Couldn't match type ‘Char’ with ‘t0 Symbol’
Expected type: [t0 Symbol]
Actual type: [Symbol]
• In the second argument of ‘map’, namely ‘symbols’
In the expression: map (elem x) symbols
In a stmt of a list comprehension: b <- map (elem x) symbols