[Haskell-cafe] Fwd: Increasing Haskell modularity

David Menendez dave at zednenem.com
Wed Oct 1 19:49:05 UTC 2014


On Wed, Oct 1, 2014 at 10:36 AM, Gesh hseG <gesh at gesh.uni.cx> wrote:

> > It seems the first part of your proposal just says
> > "Haskellers can no longer expect class instance coherence."
> > As such, this is a drastic change that would require all Haskell
> > programs to be inspected to see if they crucially rely on coherence
> No. Coherence is preserved, since you always use the unique in-scope
> dictionary. What *is* lost, however, is global uniqueness, which means
> that code that assumes that the same dictionary is used for the same
> type across calls to functions must be modified. Arguably, that code
> is semantically incorrect to begin with, but that's neither here nor
> there.
>

How is that neither here nor there? Haskell says that types belong to
classes, and each (type) instance of a class has a specific implementation.
The fact that GHC implements this using dictionaries is irrelevant. It’s
perfectly valid to implement type classes with partial evaluation, or
matching on type parameters, or even C++-style templates.

In other words: no, coherency is not preserved. You can’t change the
semantics of classes and then say that programs built around the old
semantics were wrong all along.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141001/636bce3b/attachment.html>


More information about the Haskell-Cafe mailing list