-
Notifications
You must be signed in to change notification settings - Fork 701
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
Replace Boilerplate Monoid/Semigroup instances with generics #3196
Conversation
This is preparatory work for implementing haskell#3169 it's kept in a different commit in order to facilitate comparing code-generation.
Oh, and the instance Semigroup Executable where
a <> b = Executable{
exeName = combine' exeName,
modulePath = combine modulePath,
buildInfo = combine buildInfo
}
where combine field = field a `mappend` field b
combine' field = case (field a, field b) of
("","") -> ""
("", x) -> x
(x, "") -> x
(x, y) -> error $ "Ambiguous values for executable field: '"
++ x ++ "' and '" ++ y ++ "'"
|
This is preparatory work for implementing haskell#3169 it's kept in a different commit in order to facilitate comparing code-generation.
This increases compile-time (until GHC becomes more clever) but the generated code is expected to be at least as good (if not better) than the manually generated code. This addresses haskell#3169
Interesting... the |
This increases compile-time (until GHC becomes more clever) but the generated code is expected to be at least as good (if not better) than the manually generated code. While at it, this removes -XCPP usage from all modules touched. This addresses haskell#3169
Nice! Boolean flags should use |
there are a few cases which have it inverted: instance Semigroup Library where
-- ...
libExposed = libExposed a && libExposed b, -- so False propagates instance Semigroup BuildInfo where
a <> b = BuildInfo {
buildable = buildable a && buildable b,
-- ...
} |
Replace Boilerplate Monoid/Semigroup instances with generics
Merged, thanks! |
@23Skidoo what are your plans re 1.24 branch? I mostly want to know to decide what to do about the nix-local branch |
That shouldn't be too hard: cabal list --simple | awk '{ print $1 }' | uniq gives you a list of all package names, and curl -s --fail http://hackage.haskell.org/package/$PKGNAME/src/Setup.lhs || curl -s --fail http://hackage.haskell.org/package/$PKGNAME/src/Setup.hs tries to retrieve you the latest version of you could also try to be more clever and look at the .cabal files first (e.g. from your 00-index.tar ball) and check for the build-type before downloading the Setup.(l)hs files... |
Yep, that's what I want to do. |
In that case: cd $TMP
tar xf ~/.cabal/packages/hackage.haskell.org/00-index.tar.gz
find -name '*.cabal' | xargs grep -li '^build-type:.*custom' | cut -f2 -d/ | uniq |
@hvr Thanks! That was easier than I expected. Uploaded the results to https://github.com/23Skidoo/all-custom-setups. And it turns out |
@23Skidoo I think that specific case in llvm-general can be made more compatible by providing a function PS: c.f. cabal/Cabal/Distribution/Simple/Configure.hs Lines 690 to 693 in 5a77348
|
Yes, it should work given that the script doesn't use explicit import lists. |
@hvr Just grepped. |
This implements the suggestion from haskell#3196 (comment)
@23Skidoo fwiw, if you're still worried about merging to 1.24, you could try merging only the cabal-install parts, or we could simply back out the |
This implements the suggestion from #3196 (comment) (cherry picked from commit 0077e2c)
@hvr Cherry-picked all your patches into 1.24. |
This implements the suggestion from haskell#3196 (comment)
addresses #3169