Non-exhaustive patterns [closed]

陌路散爱 提交于 2019-12-02 13:19:22

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!