[Haskell-cafe] Fwd: Increasing Haskell modularity

Bardur Arantsson spam at scientician.net
Wed Oct 1 20:42:29 UTC 2014


On 2014-10-01 21:49, David Menendez wrote:
> 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.
> 

+1 to this post. -1 to the proposal.

(I say "proposal"... this needs some serious fleshing out and a
semi-formal specification for instance resolution rules &c before it
becomes a proposal. Just "Look at Oleg's paper" is not good enough.)

Regards,



More information about the Haskell-Cafe mailing list