Suppose I define a new type class MyClass with some methods
class MyClass a where
-- Basic methods
m :: Some type including a
...
-- Derived Methods
dm :: Some type including a
dm = Definition of dm that depends on m
...
However, I could remove the derived methods from
the class definition:
-- Derived Methods
dm :: (MyClass a) => Some type including a
dm = Definition of dm that depends on m
...
And my question is:
Is it better to type the derived methods inside the class
definition or out? Are there any efficiency penalties
in any of the styles?
In Haskell98 Prelude there is a mixture of both styles, for example,
(>>) is defined inside the Monad class, but (=<<) is left out.
Greetings, Jose E. Labra
http://lsi.uniovi.es/~labra