-- eg. myzip [’a’, ’b’, ’c’] [1, 2, 3, 4] -> [(’a’, 1), (’b’, 2), (’c’, 3)]
myzip :: Ord a => [a] -> [a] -> [(a,a)]
myzip list1 list2 = [(x,y) | [x, _] <-list1, [y,_] <-list2 ]
我收到此錯誤信息:我在Haskell中對Zip的定義有什麼問題?
Occurs check: cannot construct the infinite type: a = [a]
When generalising the type(s) for `myzip'
Failed, modules loaded: none.
應該指出,並行列表解析不是標準的haskell(這就是爲什麼它們必須作爲ghc擴展來使能)。 – sepp2k 2010-03-30 21:35:19