Search code examples
haskellxmonad

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.

I've also tried using ghci with no success:

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

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

Solution

  • LayoutClass is not a data type or a type constructor. 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. For example, this is the first line of code for row starting with LayoutClass Layout Window

    instance LayoutClass Layout Window where
    

    This means that Layout Window is an instance of the LayoutClass typeclass.