Closed ChrisEPhifer closed 4 years ago
Per the discussion in #19, I'm going to work on this (plus a couple of other refactors/abstraction efforts) in a new branch, typeclass-refactors
.
Sounds good! Let me know if there's any instances we're missing of functions that you'd like me to write, e.g. invert for chords or transpose for intervals, etc.
Closing since we've merged the other work / are aware of some of the other opportunities for ad hoc abstraction.
I think there are a few places where we might benefit from writing a type class. I have some comments on this in #12, in particular about a proposed
Invertible
type class for objects admitting a sensible notion of inversion (which is... a lot of stuff.)In particular, I would propose that the following type class be defined among our abstractions:
We can get a whole bunch of leverage out of this by defining some instances over data structures we care about, too, eg:
It would be worth thinking about whether or not there are other opportunities for ad hoc polymorphism; this ticket can be used for discussion about that.