Reputation: 457
In ghci you can run the :info
command to learn about the methods defined on a type class, as well as see instances of that type class.
For example, :info Eq
outputs
class Eq a where
(==) :: a -> a -> Bool
(/=) :: a -> a -> Bool
-- Defined in `GHC.Classes'
as well as many lines of the instances
instance (Eq k, Eq a) => Eq (Map k a)
-- Defined in `containers-0.5.0.0:Data.Map.Base'
instance Eq a => Eq (Maybe a) -- Defined in `Data.Maybe'
...
Is there a way, in ghci, to just output the methods defined in the type class without also outputting all the instances? In other words, I would like a ghci command to output only this:
class Eq a where
(==) :: a -> a -> Bool
(/=) :: a -> a -> Bool
-- Defined in `GHC.Classes'
Upvotes: 10
Views: 403
Reputation: 60463
No, unfortunately. :-/
No you cannot have an answer under 30 characters.
Upvotes: 4