John Cowan on Comparators: A Dynamic Type Class for Scheme

Haskell type classes such as Eq and Ord provide an escape hatch from ML-style polymorphic static typing, allowing ad-hoc polymorphism of the functions defined in a type class.  They are implemented by GHC using a record of functions, one for each function declared in the type class.  While developing Scheme libraries for the ongoing R7RS-large standard, I found a need to parameterize collections such as sets and hash tables with appropriate monomorphic procedures applicable to their elements.  The implementation method evolved over time to converge on the same solution, made directly accessible to the Scheme programmer using a new data type: comparators, which are a dynamically typed equivalent of type class Ord.

Join or login to comment.

  • John C.

    Looking at the above, it looks pretty opaque and daunting. The talk won't be, so Don't Panic!

    2 · July 23, 2014

  • John C.

    And now (thanks to Raymond Lacaze and Jeff Parker) with extra added musical entertainment! Be there or be a prime number!

    1 · August 11, 2014

Our Sponsors


    Colocation and hosting in downtown Manhattan

People in this
Meetup are also in:

Create a Meetup Group and meet new people

Get started Learn more

Meetup has allowed me to meet people I wouldn't have met naturally - they're totally different than me.

Allison, started Women's Adventure Travel

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy