今天开始学习haskell for school,我遇到了功能问题。我不明白为什么它不在范围内..
下面是代码:
ff :: [[Char]] -> [[Char]] -> [Char]
ff A B = [[x !! 0, y !! 1] | x <- A, y <- B, (x !! 1) == (y !! 0)]
错误:
md31.hs:2:4: Not in scope: data constructor `A'
md31.hs:2:6: Not in scope: data constructor `B'
md31.hs:2:38: Not in scope: data constructor `A'
md31.hs:2:46: Not in scope: data constructor `B'
提前致谢:)
答案 0 :(得分:7)
答案 1 :(得分:6)
在Haskell中,大写字母表示值是数据构造函数,如:
data Test = A | B
如果您需要变量使用小写:
ff a b = [[x !! 0, y !! 1] | x <- a, y <- b, (x !! 1) == (y !! 0)]