简体   繁体   English

如何查看Monad Reader的代码?

[英]How to see code of Monad Reader?

I am a beginner in Haskell, and I want to understand Reader Monad. 我是Haskell的初学者,我想了解Reader Monad。 I know how to use this monad. 我知道如何使用这个monad。 But I want to see the implementation of monad (particularly code of function "return"). 但我希望看到monad的实现(特别是函数代码“return”)。 How can I see this code? 我怎么能看到这段代码?

Answered in the comments by pdexter : pdexter 在评论中回答:

The definition is here but I would recommend reading the simplified version here . 定义在这里,但我建议在这里阅读简化版本。

I have downloaded the ghc source from here It contains the definition of all the base functions Then I open the folder in Sublime text editor which will index the source files. 我从这里下载了ghc源它包含了所有基本函数的定义然后我在Sublime文本编辑器中打开文件夹,它将索引源文件。 Then you can type F12 on a function or Ctrl+Shift+F to find the implementation. 然后,您可以在函数上键入F12 ,或者Ctrl+Shift+F来查找实现。 You can jump back with Alt+- . 你可以用Alt+-跳回来。

I actually downloaded many other Haskell libraries for easy reference. 我实际上下载了许多其他Haskell库以便于参考。

与Haskell源代码文件夹一起升华

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM