Commit 58401074 authored by Adam Vogt's avatar Adam Vogt

remove template haskell dependency in favor of cabal's CPP macro

It's possible to have gotten the wrong ghc version with the old method,
if somebody does `cabal install IHaskell --with-ghc=/path/to/another/ghc`
parent bd8dd8d9
...@@ -73,8 +73,7 @@ library ...@@ -73,8 +73,7 @@ library
system-filepath, system-filepath,
cereal ==0.3.*, cereal ==0.3.*,
text >=0.11, text >=0.11,
mtl >= 2.1, mtl >= 2.1
template-haskell
exposed-modules: IHaskell.Display, exposed-modules: IHaskell.Display,
Paths_ihaskell, Paths_ihaskell,
IHaskell.Types, IHaskell.Types,
...@@ -132,8 +131,7 @@ executable IHaskell ...@@ -132,8 +131,7 @@ executable IHaskell
system-filepath, system-filepath,
cereal ==0.3.*, cereal ==0.3.*,
text >=0.11, text >=0.11,
mtl >= 2.1, mtl >= 2.1
template-haskell
Test-Suite hspec Test-Suite hspec
Type: exitcode-stdio-1.0 Type: exitcode-stdio-1.0
...@@ -166,8 +164,7 @@ Test-Suite hspec ...@@ -166,8 +164,7 @@ Test-Suite hspec
system-filepath, system-filepath,
cereal ==0.3.*, cereal ==0.3.*,
text >=0.11, text >=0.11,
mtl >= 2.1, mtl >= 2.1
template-haskell
source-repository head source-repository head
type: git type: git
......
{-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} {-# LANGUAGE CPP, NoImplicitPrelude, OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- | Description : @ToJSON@ for Messages -- | Description : @ToJSON@ for Messages
-- --
-- This module contains the @ToJSON@ instance for @Message@. -- This module contains the @ToJSON@ instance for @Message@.
...@@ -11,20 +10,16 @@ import Prelude (read) ...@@ -11,20 +10,16 @@ import Prelude (read)
import ClassyPrelude import ClassyPrelude
import Data.Aeson import Data.Aeson
import Language.Haskell.TH
import Shelly hiding (trace) import Shelly hiding (trace)
import IHaskell.Types import IHaskell.Types
-- | Compute the GHC API version number using Template Haskell. -- | Compute the GHC API version number using the dist/build/autogen/cabal_macros.h
ghcVersionInts :: [Int] ghcVersionInts :: [Int]
ghcVersionInts = ints . map read . words . map dotToSpace $ version ghcVersionInts = ints . map read . words . map dotToSpace $ VERSION_ghc
where dotToSpace '.' = ' ' where dotToSpace '.' = ' '
dotToSpace x = x dotToSpace x = x
version :: String
version = $(runIO (unpack <$> shelly (run "ghc" ["--numeric-version"])) >>= stringE)
-- Convert message bodies into JSON. -- Convert message bodies into JSON.
instance ToJSON Message where instance ToJSON Message where
toJSON KernelInfoReply{} = object [ toJSON KernelInfoReply{} = object [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment