Reputation: 20873
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]
).
Upvotes: 3
Views: 51
Reputation: 1862
: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 ...
Upvotes: 3