Ticket #823 (closed enhancement: worksforme)
Accessing the package version from within the package
| Reported by: | basvandijk | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Cabal library | Version: | 1.8.0.6 |
| Severity: | normal | Keywords: | |
| Cc: | Difficulty: | unknown | |
| GHC Version: | Platform: |
Description
Just like you can access data files from a package, it would be useful to retrieve the current version of your package from within your program.
This is useful when you want to print the current version of your program when the user issues a --version flag for example.
More specifically I would like the following module to be generated automatically:
module Version_pkgname where import Distribution.Version (Version) version :: Version version = <the current package version>
where Version is from the Cabal library.
Having just a String for the version type is also OK and maybe even preferable because otherwise a dependency on the Cabal library is required.
Change History
Note: See
TracTickets for help on using
tickets.
