Interfaces

Representing Interfaces when you have no Interfaces.

I was chatting with someone about Interfaces/Type-classes and how in their language of choice you do not get default functions. It reminded me of a little implementation trick I used in my thesis to hot swap model implementations in an evaluator I wrote.

I will show this trick using the dependently typed language Idris but make not that I don’t see any real reason why this cannot be achieved in a language that supports polymorphism and indexed data types.