[英]How can I find out where a type, data constructor or typeclass is defined?
I'm trying to figure out where the LayoutClass type or data constructor is defined for XMonad https://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t:LayoutClass . 我试图弄清楚为XMonad https://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t:LayoutClass定义LayoutClass类型或数据构造函数的位置。
I've also tried using ghci with no success: 我也尝试使用ghci失败:
Prelude> import XMonad.Core
Prelude XMonad.Core> :t LayoutClass
<interactive>:1:1: error:
Data constructor not in scope: LayoutClass
Prelude XMonad.Core>
LayoutClass
is not a data type or a type constructor. LayoutClass
不是数据类型或类型构造函数。 It is a typeclass. 它是一个类型类。 You can verify it by clicking the Source
button to the right of a row starting with LayoutClass
in an Instances
table in the documentation. 您可以通过单击文档的Instances
表中以LayoutClass
开头的行右侧的Source
按钮来验证它。 For example, this is the first line of code for row starting with LayoutClass Layout Window
例如,这是从LayoutClass Layout Window
开始的行的第一行代码
instance LayoutClass Layout Window where
This means that Layout Window
is an instance of the LayoutClass
typeclass. 这意味着“ Layout Window
是LayoutClass
类型类的实例。
在您链接的行的右边有一个“源”链接,在本例中为https://hackage.haskell.org/package/xmonad-0.12/docs/src/XMonad-Core.html#LayoutClass
Hoogle is often used for this purpose: http://hoogle.haskell.org/?hoogle=LayoutClass Hoogle通常用于此目的: http ://hoogle.haskell.org/?hoogle=LayoutClass
But it does not seem to index all available packages on hackage. 但是它似乎并没有索引所有可破解的软件包。
The above typeclass is indexed by the latest (in Alpha for now) Hoogle: http://hoogle.haskell.org/?hoogle=LayoutClass 上面的类型类由最新(现在在Alpha中)Hoogle索引: http ://hoogle.haskell.org/?hoogle=LayoutClass
You can also search the stackage Hoogle: https://www.stackage.org/lts-8.11/hoogle?q=LayoutClass 您还可以搜索堆栈Hoogle: https ://www.stackage.org/lts-8.11/hoogle?q = LayoutClass
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.