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

Consider deriving more instances. #15

Open
expipiplus1 opened this issue Nov 25, 2015 · 3 comments
Open

Consider deriving more instances. #15

expipiplus1 opened this issue Nov 25, 2015 · 3 comments

Comments

@expipiplus1
Copy link
Contributor

It's unfortunate that often deriving every possible class pulls in the world in (sometimes unnecessary) dependencies. As far as I know the options are:

  • Do nothing and leave creating orphans to the users
  • Publish orphans in a separate package uom-plugin-quickcheck-orphans for example
  • Publish instances in the uom-plugin package, pulling in heaps of dependencies
  • Publish instances in the uom-plugin package compiled conditionally on flags, I'm not sure what cabal's behaviour is when flags conflict between different dependencies on uom-plugin

One package without too many dependencies is random which would make a sensible addition I think.

@expipiplus1 expipiplus1 changed the title Consider deriving more classes. Consider deriving more instances. Nov 25, 2015
@adamgundry
Copy link
Owner

Yes, this is a bit of an annoying issue. How about the compromise solution of a single new package (uom-plugin-orphans) that pulls in all the non-base dependencies and declares all the instances in one place? That saves maintaining lots of tiny packages, and avoids piling too many dependencies on the core library for people who may want to experiment with it.

@ghost
Copy link

ghost commented Nov 27, 2015

This seems reasonable. Actually, I don't think there's any other choice than a) pulling all the dependencies into the base package b) bugging the GHC team to allow multiple standalone deriving clauses in the same code (I guess this should be possible in theory, as the deriving mechanism is surely deterministic, but alas). But I still think that Unbox could be defined in uom-plugin proper. My reasoning is that it's likely that people are going to use both vector and uom-plugin in the same code, given that both are useful for physics-related number crunching, and also that vector is mentioned in https://wiki.haskell.org/Library_submissions even though it's considered non-core.

EDIT: well, if annoying the GHC team is considered a viable option, there's one more choice: ask them to allow declarations like deriving ALL BUT Num, which I think would be fine for Quantity - after all it's exactly the same thing as the underlying type, except for arithmetic operations?

@expipiplus1
Copy link
Contributor Author

Having an 'orphans' package is better than having every dependency piled onto the main package, but it still makes people suffer build times linear in the number of instances available, rather than number of instances used :(

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

No branches or pull requests

2 participants