Commit e3bba7e4 authored by Micha Wiedenmann's avatar Micha Wiedenmann Committed by Marge Bot

users guide: Motivation of DefaultSignatures

parent d46a72e1
Pipeline #13640 passed with stages
in 534 minutes and 18 seconds
......@@ -6139,11 +6139,14 @@ a class: ::
enum = []
The type of the ``enum`` method is ``[a]``, and this is also the type of
the default method. You can lift this restriction and give another type
to the default method using the extension :extension:`DefaultSignatures`. For
instance, if you have written a generic implementation of enumeration in
a class ``GEnum`` with method ``genum`` in terms of ``GHC.Generics``,
you can specify a default method that uses that generic implementation: ::
the default method. You can change the type of the default method by
requiring a different context using the extension
:extension:`DefaultSignatures`. For instance, if you have written a
generic implementation of enumeration in a class ``GEnum`` with method
``genum``, you can specify a default method that uses that generic
implementation. But your default implementation can only be used if the
constraints are satisfied, therefore you need to change the type of the
default method ::
class Enum a where
enum :: [a]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment