Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use type aliases inside 'UnitName' instances #23

Open
chshersh opened this issue Jan 10, 2018 · 6 comments
Open

Use type aliases inside 'UnitName' instances #23

chshersh opened this issue Jan 10, 2018 · 6 comments

Comments

@chshersh
Copy link
Contributor

It allows to write instances like this:

instance ShowUnit WorkDayUnit where showUnit = "wd"
@chshersh
Copy link
Contributor Author

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.

vrom911 added a commit that referenced this issue Jan 10, 2018
vrom911 added a commit that referenced this issue Jan 10, 2018
@chshersh
Copy link
Contributor Author

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 chshersh changed the title Change 'ShowUnit' from 'type family' to 'type class' Use type aliases inside 'UnitName' instances Jan 10, 2018
@chshersh
Copy link
Contributor Author

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

@int-index
Copy link
Member

@chshersh
Copy link
Contributor Author

Okay, I can comment there.

@chshersh
Copy link
Contributor Author

I commented. But people want proposal...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants