o-clock icon indicating copy to clipboard operation
o-clock copied to clipboard

Use type aliases inside 'UnitName' instances

Open chshersh opened this issue 7 years ago • 6 comments

It allows to write instances like this:

instance ShowUnit WorkDayUnit where showUnit = "wd"

chshersh avatar Jan 10 '18 17:01 chshersh

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.

chshersh avatar Jan 10 '18 19:01 chshersh

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.

chshersh avatar Jan 10 '18 22:01 chshersh

We need to create GHC proposal to allow type family applications inside instancec. cc @int-index

chshersh avatar Jan 10 '18 22:01 chshersh

https://ghc.haskell.org/trac/ghc/ticket/13773

int-index avatar Feb 21 '18 13:02 int-index

Okay, I can comment there.

chshersh avatar Feb 21 '18 13:02 chshersh

I commented. But people want proposal...

chshersh avatar Feb 23 '18 11:02 chshersh