How to query the type of a default method?

Viewed 46

The GHC extension DefaultSignatures allows to change the type of a default method:

class Enum a where
  enum :: [a]
  default enum :: (Generic a, GEnum (Rep a)) => [a]
  enum = map to genum

Is it possible to ask the compiler for the type of the default method? What is the syntax to do so? :t enum is not enough (since it obviously reports enum :: Enum a => [a]).

1 Answers

:info Enum will do it.

For your example, this will produce the output

class Enum a where
  enum :: [a]
  default enum :: (Generic a, GEnum (Rep a)) => [a]
        -- Defined at ...
Related