This is just a typo. Notice resolveDescendingIInterval
is a different function from resolveDescendingInterval
. Get rid of that extra I
.
EDIT: Consider the following slightly unsafe code:
resolveDecendingInterval interval note = toEnum (fromEnum note - interval)
This is a partial function - it will fail when the interval is too large and we call toEnum
on something out of range. You can clamp the range via code such as max (fromEnum (minBound :: Note)) . min (fromEnum (maxBound :: Note))
. But there's probably a smarter way I'm just not thinking off immediately.
One alternative would be to clamp the interval
via rem interval (fromEnum note)
but then you'll need to handle the case when note is minBound separately.