o-clock
o-clock copied to clipboard
Use type aliases inside 'UnitName' instances
It allows to write instances like this:
instance ShowUnit WorkDayUnit where showUnit = "wd"
Also, maybe we should change ShowUnit name? This type class is used not only in Show instances, but in Read. And if it's named as ShowUnit it means that it shows units while in reality it just contains unit suffix. I propose to use UnitName instead.
We decided to not go with type class approach because our initial problem wasn't solved by moving to this approach (as @vrom911 discovered). So this approach currently doesn't have any benefits from current one. Thus @vrom911 did only renaming.
We need to create GHC proposal to allow type family applications inside instancec. cc @int-index
https://ghc.haskell.org/trac/ghc/ticket/13773
Okay, I can comment there.
I commented. But people want proposal...