0

Is there a reason why the output of :info in ghci is listing the type name after every class it belongs to? For example

Prelude> :info Int` 

prints

...
instance Bounded Int -- Defined in `GHC.Enum'
instance Enum Int -- Defined in `GHC.Enum'
instance Eq Int -- Defined in `GHC.Classes*emphasized text*'
...

What I'd prefer to read is something like:

Prelude> :info Int
...
instance Bounded -- Defined in `GHC.Enum'
instance Enum -- Defined in `GHC.Enum'
instance Eq -- Defined in `GHC.Classes*emphasized text*'
...

or even better would be brief notation like

Prelude> :info Int
...
instance of Bounded, Enum, Eq,...
acorello
  • 4,473
  • 4
  • 31
  • 46

1 Answers1

8

Maybe, a reason would be parameterised types. To illustrate my point, look at this example :

$ ghci -XMultiParamTypeClasses -XFlexibleInstances
-- ...
Prelude> class Klass a b c where {f :: a b c -> c}
Prelude> data Typ b c = Typ b c
Prelude> instance Klass Typ b Integer where { f (Typ _ c) = c + 1 }
Prelude> let x = Typ "a" 3
Prelude> f x
4
Prelude> :info Typ
data Typ b c = Typ b c  -- Defined at <interactive>:3:6
instance Klass Typ b Integer -- Defined at <interactive>:4:10
tomferon
  • 4,993
  • 1
  • 23
  • 44