Skip to content

BC fix: libraries -> library/subLibraries (#3574)#3580

Merged
ezyang merged 1 commit intohaskell:masterfrom
ezyang:cabal-convenience-bc
Jul 22, 2016
Merged

BC fix: libraries -> library/subLibraries (#3574)#3580
ezyang merged 1 commit intohaskell:masterfrom
ezyang:cabal-convenience-bc

Conversation

@ezyang
Copy link
Copy Markdown
Contributor

@ezyang ezyang commented Jul 21, 2016

The resulting code is more verbose, but it is more backwards-compatible
and actually is simpler to understand in some cases (because
CLibName uniquely identifies the "public library"; no faffing
about with package names to figure it out.)

Signed-off-by: Edward Z. Yang ezyang@cs.stanford.edu

@ezyang ezyang added this to the Cabal 1.26 milestone Jul 21, 2016
withLib :: PackageDescription -> (Library -> IO ()) -> IO ()
withLib pkg_descr f =
sequence_ [f lib | lib <- libraries pkg_descr, buildable (libBuildInfo lib)]
withLib pkg_descr f = do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do here looks unnecessary.

@ezyang ezyang force-pushed the cabal-convenience-bc branch 5 times, most recently from 6edf9c4 to 50c0522 Compare July 21, 2016 23:25
@ezyang ezyang mentioned this pull request Jul 21, 2016
38 tasks
@ezyang ezyang force-pushed the cabal-convenience-bc branch 3 times, most recently from bfd2e7e to da6ce0d Compare July 22, 2016 00:42
The resulting code is more verbose, but it is more backwards-compatible
and actually is simpler to understand in some cases (because
CLibName uniquely identifies the "public library"; no faffing
about with package names to figure it out.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang ezyang force-pushed the cabal-convenience-bc branch from da6ce0d to c421cb7 Compare July 22, 2016 02:19
@ezyang ezyang merged commit 852dd09 into haskell:master Jul 22, 2016
-- in the top-level directory in dist, so no conflicts either.
libNames = filter (/= unPackageName (packageName pkg)) . map libName $ libraries pkg
-- the same as the package.
subLibNames = catMaybes . map libName $ subLibraries pkg
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be map (fromMaybe (packageName pkg) . libName) $ subLibraries?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm. I guess the invariant is that everything in subLibraries has a non-Nothing package name. I guess we can check that!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was looking for such a check, but it seem we don't have one.

@ezyang ezyang modified the milestones: Cabal 2.0, 2.0 (planned for next feature release) Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants