我可以从前言中获得函数的源代码:
lambdabot> src foldr
foldr f z [] = z
foldr f z (x:xs) = f x (foldr f z xs)但我无法从其他模块获取源代码:
lambdabot> src flatten
Source not found. Maybe if you used more than just two fingers...
lambdabot> hoogle flatten
Data.Tree flatten :: Tree a -> [a]
Data.Graph flattenSCC :: SCC vertex -> [vertex]
Data.Graph flattenSCCs :: [SCC a] -> [a]
lambdabot> src Data.Tree flatten
Source not found. Just try something else.
lambdabot> src Data.Tree.flatten
Source not found. Have you considered trying to match wits with a rutabaga?
lambdabot> src Tree flatten
Source not found. And you call yourself a Rocket Scientist!
lambdabot> src Tree.flatten
Source not found. Just try something else.我该怎么做呢?
发布于 2013-01-21 11:46:30
你不能真的这么做。lambdabot使用一个充满名称->源映射的硬连接文件;它不会以一种特别有原则的方式查找标识符的源。
一般情况下,最好的方法是在ghci中使用:i foo来找出标识符来自哪个模块,然后查找该模块的源代码(比如使用Hoogle,它通常会链接到带有源代码链接的页面)。
https://stackoverflow.com/questions/14431444
复制相似问题