Skip to content

Minor type class cleanup #2487

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

Merged
merged 2 commits into from
Mar 26, 2015
Merged

Minor type class cleanup #2487

merged 2 commits into from
Mar 26, 2015

Conversation

edsko
Copy link
Contributor

@edsko edsko commented Mar 21, 2015

This pull request is the first of a set of pull requests working towards an implementation of setup dependencies.

This PR moves installedPackageId out of PackageInstalled into a new superclass HasInstalledPackageId, and moves the PackageFixedDeps class from Cabal to cabal-install.

/cc @dcoutts @kosmikus

edsko added 2 commits March 21, 2015 12:37
The fundamental difference between Cabal and cabal-install is that the former
deals with installed libraries, and -- in principle -- knows about _library_
dependencies only, whereas the latters deals with setup, executable, test-suite
and benchmark dependencies in addition to library dependencies. Currently we
classify all of these simply as 'dependencies' but that will change shortly.

In this commit we take a first step towards this by moving the PackageFixedDeps
class, which deals with dependencies of packages rather than installed
libraries, from Cabal to cabal-install.

The commit is pretty simple; we just move the type class and update import
statements where necessary.
Introduce a new superclass HasInstalledPackageId:

    class Package pkg => HasInstalledPackageId pkg where
      installedPackageId :: pkg -> InstalledPackageId

    class HasInstalledPackageId pkg => PackageInstalled pkg where
      installedDepends :: pkg -> [InstalledPackageId]

Most functions that deal with the package index now just require
HasInstalledPackageId; only the functions that actually require the
dependencies still rely on PackageInstalled.

The point is that a ConfiguredPackage/ReadyPackage/PlanPackage can reasonably
be made an instance of HasInstalledPackageId, but not of PackageInstalled; that
will be the topic of the next, much larger, pull request.
@kosmikus
Copy link
Contributor

This is ok with me.

@23Skidoo
Copy link
Member

This seems to be noncontroversial, so merging.

23Skidoo added a commit that referenced this pull request Mar 26, 2015
@23Skidoo 23Skidoo merged commit 6a40009 into haskell:master Mar 26, 2015
@edsko edsko deleted the pr/typeclasses branch March 27, 2015 16:17
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

Successfully merging this pull request may close these issues.

3 participants