[Haskell-cafe] Increasing Haskell modularity
gesh at gesh.uni.cx
Wed Oct 1 13:14:49 UTC 2014
Edward Yang recently wrote about the non-modularity of the current semantics
for typeclasses and open type families.
Given these problems, we can either try to work around the problem, or
whether these features are worth the problems.
The specific pair of proposals I am making are the following:
* Give up on global uniqueness of typeclass instances.
Oleg discusses adding local typclass instances without losing
coherence in his
reflection paper. If we adopt his proposal, and weaken global
instances to local uniqueness, we can then say that typeclass
instances in a
module are considered more local than imported instances, and therefore
Since instances will be locally unique, we don't have to pass around
dictionaries. Data types that expect globally unique instances, such
will have to store dictionaries, however.
* Give up on non-associated open type families.
This I have researched less well, but it seems to me that these have
case. Since one can make whatever instances one wishes for these type
families, one can't do anything useful with values of their instances.
In other words, values of type F a are morally of type (forall a. a).
Thus, the only way I can see these being useful is if anyone creating an
instance of the family must also provide functions that can work with
instances, which brings us back to the case of associated types.
As far as I can see, these two features are useless and impeding the
make Haskell more modular. Therefore, my questions for you are twofold:
* Is there a reason to keep these features?
* If not, why don't we drop them?
Awaiting your criticism and ire,
 - http://blog.ezyang.com/2014/09/open-type-families-are-not-modular/
 - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.112.7819
More information about the Haskell-Cafe