繁体   English   中英

我如何找出类型,数据构造函数或类型类的定义位置?

[英]How can I find out where a type, data constructor or typeclass is defined?

我试图弄清楚为XMonad https://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t:LayoutClass定义LayoutClass类型或数据构造函数的位置。

我也尝试使用ghci失败:

Prelude> import XMonad.Core
Prelude XMonad.Core> :t LayoutClass

<interactive>:1:1: error:
    Data constructor not in scope: LayoutClass
Prelude XMonad.Core>

LayoutClass不是数据类型或类型构造函数。 它是一个类型类。 您可以通过单击文档的Instances表中以LayoutClass开头的行右侧的Source按钮来验证它。 例如,这是从LayoutClass Layout Window开始的行的第一行代码

instance LayoutClass Layout Window where

这意味着“ Layout WindowLayoutClass类型类的实例。

在您链接的行的右边有一个“源”链接,在本例中为https://hackage.haskell.org/package/xmonad-0.12/docs/src/XMonad-Core.html#LayoutClass

Hoogle通常用于此目的: http ://hoogle.haskell.org/?hoogle=LayoutClass

但是它似乎并没有索引所有可破解的软件包。

上面的类型类由最新(现在在Alpha中)Hoogle索引: http ://hoogle.haskell.org/?hoogle=LayoutClass

您还可以搜索堆栈Hoogle: https ://www.stackage.org/lts-8.11/hoogle?q = LayoutClass

暂无
暂无

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

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