capability icon indicating copy to clipboard operation
capability copied to clipboard

Don't export class methods by default

Open aherrmann opened this issue 6 years ago • 4 comments

The methods of the capability type-classes (e.g. put_ from HasState) are not meant to be used directly, currently this is documented in their haddocks. With the separation of user facing modules and internal modules, such as Capability.State and Capability.State.Internal.Class, it is possible to not export them from the user facing modules.

We should consistently separate user facing from internal modules (e.g. Capability.Writer vs Capability.Writer.Internal.Class) and not export class methods in the user facing modules.


cc @mrkkrp

aherrmann avatar Oct 03 '18 07:10 aherrmann

(I don't know what the class would not be in Capability.Writer.Internal)

The class methods are not an internal thing however, they very much matter if you need to define manual instances of the capabilities.

It may be worth it not to export them in main modules because it can be considered avanced usage, and, possibly, it may make the documentation more approachable (though, a typeclass without methods may throw people off as well). But in that case, the type class should be exported in its entirety in some non-internal module (I don't have a name for this module at this point).

aspiwack avatar Oct 03 '18 17:10 aspiwack

For consistency, I'd expect every capability to have an internal module.

mrkkrp avatar Oct 04 '18 03:10 mrkkrp

I don't think internal modules should have any sort of consistency. They are, by definition, not part of my API. Rather, use-at-your-own-risk extras.

aspiwack avatar Oct 04 '18 07:10 aspiwack

Why not have consistency in extras too :-D

mrkkrp avatar Oct 04 '18 08:10 mrkkrp