【发布时间】:2018-04-03 20:38:29
【问题描述】:
我不确定为什么下面的代码会导致下面的错误。
代码:
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
【问题讨论】:
-
您的代码不完整 -
xs是什么? -
@FrankSchmitt 抱歉打错了,已编辑
标签: haskell types compiler-errors