haskellfunctional-programmingpolymorphismtypeclassassociated-types

Is "Associated Types with Class" known to have some typos in it? Or are associated types far different today than what the paper describes?


I'm reading Associated Types with Class, and I'm running into code that doesn't seem to be compilable. Is it just a typo in the paper, or is that things have changed a lot since 2004, when the paper was published?

I'm referring to page 4, where the following typeclass is presented,

class C a where
  data T a (b :: * -> *)

followed, a few lines later, by an instance for it,

instance C a => C [a] where
  data T [a] b = D [T a] (b a)

which doesn't compile because

• Expecting one more argument to ‘T a’
  Expected a type, but ‘T a’ has kind ‘(* -> *) -> *’
• In the type ‘[T a]’
  In the definition of data constructor ‘D’
  In the data instance declaration for ‘T’ [GHC-83865]

But this makes sense to me, and indeed if I change T a to T a b in the instance definition, the compiler stops complaining.

And so far, I would think it was a typo, 1 single character missing (or two, including the whitespace).

However, a few lines more later, the type of D is claimed to be

D :: C a => [T a] -> (b a) -> T [a]

which also seems to make use of T a and T [a] in a context where a type is expected, but T anything is not a type because T is binary type cosntructor, isn't it?

I'd have expected to read

D :: C a => [T a b] -> (b a) -> T [a] b

but at this point it feels a bit unlikely to me that these are typos too.

In case they are typos, is there a place where errata of papers are available, just as it's easy to find erratas for books?


Solution

  • That's for sure a typo. I don't know of any centralized place for errata, though I have seen such pages on individual authors' pages in some cases. I discovered a mistake in my own published workshop paper, how do I handle errata? on the academia stackexchange seems to agree:

    It is probably impossible to post errata to the paper. I would suggest the following steps:

    • If you put it on arXiv, upload a new corrected version.
    • If you put it on your personal webpage, add the errata there.
    • Make sure that once you sumbit it for journal publication, the mistake is correted.

    So in addition to looking for authors on the web, you might want to look on arXiv or try to find a journal version of the paper.