Class System current status

Ben Rudiak-Gould Benjamin.Rudiak-Gould at
Fri May 12 14:24:37 EDT 2006

Johannes Waldmann wrote:
> class ( Show p, ToDoc i, Reader b, ToDoc b, Measure p i b )
>     => Partial p i b | p i -> b  where ...       -- (*)
> (*) A funny visual aspect of FDs is the absurd syntax.
> On the left of "|", the whitespace is (type arg) application,
> but on the right, it suddenly denotes sequencing (tupling)

I think it's fine. The "p i b" on the left is effectively a tuple also. It 
could be a tuple---i.e. the MPTC syntax could be "Partial (p,i,b)" and it 
would still make sense.

The class declaration syntax is totally screwy anyway. Functional 
dependencies are constraints, and should be grouped with the typeclass 
constraints, but instead they're on opposite sides of the head. Plus the => 
implication is backwards. And the method declarations are also constraints. 
We oughta have

     class Partial p i b where
       Foo p
       (p,i) -> b
       grok :: p -> i -> b


     class Partial p i b | Foo p, p i -> b where
       grok :: p -> i -> b

or something. But I'm not proposing anything of the sort. I'm in favor of 
standardizing the syntax we've got. Syntax changes are disruptive, and I 
don't think they're justified unless they free useful syntax for another 
use, which this wouldn't.

-- Ben

More information about the Haskell-prime mailing list