如何阅读Haskell中内置函数的实现代码/源代码?

时间:2017-02-22 14:57:09

标签: haskell

例如,如果我想阅读Prelude中默认curry函数的源代码,我在哪里可以参考?有没有办法阅读它的实现?我试图在Hoogle中搜索它,但它没有给出确切的实现,只是输入和输出类型。我在堆栈上使用GHCI来运行haskell .-

Hoogle curry

1 个答案:

答案 0 :(得分:8)

与评论中提到的@Lee一样,有许多关于hackage功能的source链接。 enter image description here

在此之后,您将转到curry的源代码:

-- | 'curry' converts an uncurried function to a curried function.
curry                   :: ((a, b) -> c) -> a -> b -> c
curry f x y             =  f (x, y)