[Haskell-cafe] Constructor classes implementation
Daniel Fischer
daniel.is.fischer at web.de
Mon Feb 20 07:35:57 EST 2006
Am Freitag, 17. Februar 2006 03:34 schrieb Sean Seefried:
> Hey all,
>
> If you're interested in an implementation of constructor classes
> (type classes which can take constructors as arguments; already
> implemented in Haskell) please see:
>
> http://www.cse.unsw.edu.au/~sseefried/code.html
>
> This should help understanding the paper by Mark P. Jones called "A
> system of constructor classes: overloading and implicit higher-order
> polymorphism" much easier.
>
> The implementation not only infers the type but also prints out a
> trace of the derivation tree for the syntax directed rules.
>
> Cheers,
>
> Sean
>
> p.s. If you find any bugs, please let me know.
Re bugs:
1. printGamma [] would print an unmotivated " }", as witnessed by
typeInf [] term14.
2. the case
unify (ConT c) (AppT t1 t2)
is missing.
3. too many shadowed bindings, this is always dangerous, I believe
4. I'm not sure, the datatypes are appropriate; as far as I know, expressions
have a type and not a kind, which is what the use of the same Var type for
Type and Exp entails.
I have only just glimpsed at Jones' paper, so I don't yet see, what this type
inference algorithm (quite nice, btw) has to do with constructor classes. If
I still don't after reading it, I'll come back to ask.
Cheers,
Daniel
--
"In My Egotistical Opinion, most people's C programs should be
indented six feet downward and covered with dirt."
-- Blair P. Houghton
More information about the Haskell-Cafe
mailing list