Skip to content

Instantly share code, notes, and snippets.

@blippy
Created December 6, 2015 11:17
Show Gist options
  • Save blippy/ef8b81e9e0bbff4018df to your computer and use it in GitHub Desktop.
Save blippy/ef8b81e9e0bbff4018df to your computer and use it in GitHub Desktop.
Embed cabal package version in Haskell code
module ExampleVersion where
{-
links:
http://stackoverflow.com/questions/9857710/haskell-correct-practice-to-specify-%5Cversion-in-source
Be sure to put Paths_packagename in your Other-Modules section of the cabal file.
-}
import Paths_mypackage (version) -- replace 'mypackage' with you nnn.cabal 'name' tag
import Data.Version (showVersion)
printVersion :: IO ()
printVersion = putStrLn (showVersion version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment