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

dev*_*ssh 2 haskell

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

霍格咖喱

jke*_*len 8

与评论中提到的@Lee一样,hackage上的许多函数都有一个源代码链接. 在此输入图像描述

接下来将带您到以下源代码curry:

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