小编use*_*072的帖子

派生类型的折叠(!!)

foldr :: (a->b->b)->b->[a]->b
(!!)::[c]->Int->c
Run Code Online (Sandbox Code Playgroud)

从那我们得到a->b->b=[c]->Int->ca=[c],b=Int,b=c.
我们得出结论,foldr(!!)的类型是Int->[[Int]]->Int.
这是对的吗?
WinGHCi告诉我一些不同的东西:

Prelude> :t foldr (!!)
foldr (!!) :: Foldable t => Int -> t [Int] -> Int
Run Code Online (Sandbox Code Playgroud)

haskell types unification ghci

1
推荐指数
1
解决办法
78
查看次数

标签 统计

ghci ×1

haskell ×1

types ×1

unification ×1