如何找出类型、数据构造函数或类型类的定义位置?
How can I find out where a type, data constructor or typeclass is defined?
我正在尝试找出为 XMonad 定义 LayoutClass 类型或数据构造函数的位置 https://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t: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
table 中以 LayoutClass
开头的行右侧的 Source
按钮来验证它。例如,这是以 LayoutClass Layout Window
开头的行的第一行代码
instance LayoutClass Layout Window where
这意味着 Layout Window
是 LayoutClass
类型类的实例。
在您 link 编辑的行的右侧有一个 "source" link,在本例中为 https://hackage.haskell.org/package/xmonad-0.12/docs/src/XMonad-Core.html#LayoutClass
Hoogle 通常用于此目的:
http://hoogle.haskell.org/?hoogle=LayoutClass
但它似乎没有索引所有可用的 hackage 包。
上面的类型类被最新的索引(目前在 Alpha 中)Hoogle:
http://hoogle.haskell.org/?hoogle=LayoutClass
您还可以搜索堆叠Hoogle:
https://www.stackage.org/lts-8.11/hoogle?q=LayoutClass
我正在尝试找出为 XMonad 定义 LayoutClass 类型或数据构造函数的位置 https://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t: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
table 中以 LayoutClass
开头的行右侧的 Source
按钮来验证它。例如,这是以 LayoutClass Layout Window
instance LayoutClass Layout Window where
这意味着 Layout Window
是 LayoutClass
类型类的实例。
在您 link 编辑的行的右侧有一个 "source" link,在本例中为 https://hackage.haskell.org/package/xmonad-0.12/docs/src/XMonad-Core.html#LayoutClass
Hoogle 通常用于此目的: http://hoogle.haskell.org/?hoogle=LayoutClass
但它似乎没有索引所有可用的 hackage 包。
上面的类型类被最新的索引(目前在 Alpha 中)Hoogle: http://hoogle.haskell.org/?hoogle=LayoutClass
您还可以搜索堆叠Hoogle: https://www.stackage.org/lts-8.11/hoogle?q=LayoutClass