This library defines some macros that provide ad-hoc polymorphism similar to typeclasses, although lacking some of the crucial features of typeclasses such as typeclass constraints. These typeclasses are added entirely through meta-programming.
Declares a new typeclass named class, whose parameter param has type Type. Implementations of this typeclass must define of the methods name ... whose types are t ....
> (typeclass (Eqv (A : Type)) (equal? : (forall (a : A) (b : A) Bool)))
Provides an implementation of the typeclass class for the type param. The defintions defs ... are Cur definitions for each of the methods of the typeclass.
> (impl (Eqv Bool) (define (equal? (a : Bool) (b : Bool)) (if a (if b true false) (if b false true))))
> (impl (Eqv Nat) (define equal? nat-equal?)) > (equal? true true)
> (equal? z z)