How to read the implementation code/source code for inbuilt functions in Haskell?

て烟熏妆下的殇ゞ 提交于 2021-02-19 05:30:02

问题


For instance if I would like to read the source code for the default curry function in Prelude, where do I refer? Is there a way to read it's implementation? I tried to search it in Hoogle, but it doesn't give the exact implementation, just the input and output types. I am using GHCI on stack to run haskell.-

Hoogle curry


回答1:


Like @Lee mentioned in the comments, there is a link for source for many of the functions on hackage.

Following this will take you to the source code for curry:

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


来源:https://stackoverflow.com/questions/42394951/how-to-read-the-implementation-code-source-code-for-inbuilt-functions-in-haskell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!