gpt4 book ai didi

haskell - 从 Hoogle 命令行访问函数的文档

转载 作者:行者123 更新时间:2023-12-04 14:44:05 25 4
gpt4 key购买 nike

the Hoogle website 上搜索功能时,可以看到与之相关的文档,例如:

mod :: a -> a -> a            infixl 7

integer modulus, satisfying

(x `div` y)*y + (x `mod` y) == x

Hoogle 也作为命令行可执行文件存在。据我所知,它只显示函数的签名:

~ ❯❯❯ hoogle --info Prelude.mod
Prelude mod :: Integral a => a -> a -> a

From package base
mod :: Integral a => a -> a -> a

有没有办法像在线版本一样通过命令行获取相关文档?

最佳答案

使用 -i选项。如何获得默认命令的帮助并不明显( search );这是怎么做的:

$ hoogle search --help
Hoogle v4.2.41, (C) Neil Mitchell 2004-2012
http://haskell.org/hoogle

hoogle [search] [OPTIONS] [QUERY]
Perform a search

Flags:
-c --colour --color Use colored output (requires ANSI terminal)
-l --link Give URL's for each result
-i --info Give extended information about the first result
-e --exact Match names exactly when searching
-d --databases=DIR Directories to search for databases
-s --start=INT Start displaying results from this point on (1 based)
-n --count=INT Maximum number of results to return
-w --web[=MODE] Operate as a web tool
-r --repeat=INT Run the search multiple times (for benchmarking)
Common flags:
-? --help Display help message
-V --version Print version information
--numeric-version Print just the version number
-v --verbose Loud verbosity
-q --quiet Quiet verbosity

关于haskell - 从 Hoogle 命令行访问函数的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27341956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com