[Hackage] #823: Accessing the package version from within the package
Hackage
cvs-ghc at haskell.org
Sat Mar 26 00:24:44 CET 2011
#823: Accessing the package version from within the package
----------------------------+-----------------------------------------------
Reporter: basvandijk | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Cabal library | Version: 1.8.0.6
Severity: normal | Keywords:
Difficulty: unknown | Ghcversion:
Platform: |
----------------------------+-----------------------------------------------
Just like you can [http://haskell.org/cabal/release/cabal-latest/doc
/users-guide/authors.html#paths-module 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 [http://haskell.org/cabal/release/cabal-latest/doc/API/Cabal
/Distribution-Version.html#t%3AVersion 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.
--
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/823>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects
More information about the cabal-devel
mailing list