标签: haskell types type-signature
说这样的代码:
fun :: (a -> b) -> [a] -> [b] fun f as = someLogic as where someLogic :: [a] -> [b] someLogic xs = map f xs
编译器会抱怨最后一行,“ a”的类型f与“ a”的类型someLogic不同。
a
f
someLogic
那么我该怎么做才能让编译器知道两种类型的a是同一件事?