Use Paths_ihaskell provided by cabal to get IHaskell version number

This commit is contained in:
Nicholas Luo 2016-02-13 14:58:05 +08:00
parent b2c8b1f059
commit ed3b892e02

View File

@ -28,6 +28,7 @@ import System.Posix.Signals
import qualified Data.Map as Map
import qualified Data.Text.Encoding as E
import Data.List (break, last)
import Data.Version (showVersion)
-- IHaskell imports.
import IHaskell.Convert (convert)
@ -46,6 +47,9 @@ import IHaskell.IPython.Types
import qualified IHaskell.IPython.Message.UUID as UUID
import qualified IHaskell.IPython.Stdin as Stdin
-- Cabal imports.
import Paths_ihaskell(version)
-- GHC API imports.
import GHC hiding (extensions, language)
@ -86,7 +90,7 @@ showDefault :: String -> [Argument] -> IO ()
showDefault helpStr flags =
case find (== Version) flags of
Just _ ->
putStrLn VERSION_ipython_kernel
putStrLn (showVersion version)
Nothing ->
putStrLn helpStr
@ -248,9 +252,9 @@ replyTo _ KernelInfoRequest{} replyHeader state =
(state, KernelInfoReply
{ header = replyHeader
, protocolVersion = "5.0"
, banner = "IHaskell " ++ VERSION_ipython_kernel ++ " GHC " ++ VERSION_ghc
, banner = "IHaskell " ++ (showVersion version) ++ " GHC " ++ VERSION_ghc
, implementation = "IHaskell"
, implementationVersion = VERSION_ipython_kernel
, implementationVersion = showVersion version
, languageInfo = LanguageInfo
{ languageName = "haskell"
, languageVersion = VERSION_ghc