From c61006202e3ec861c8037dc82bda0e95540b7eb9 Mon Sep 17 00:00:00 2001 From: Andrew Gibiansky <andrew.gibiansky@gmail.com> Date: Mon, 7 Dec 2015 21:33:22 -0800 Subject: [PATCH] Remove dependence on here, allow haskell-src-exts 1.17 --- html/custom.css | 96 ----------------------------- ihaskell.cabal | 11 ++-- ipython-kernel/ipython-kernel.cabal | 2 +- main/Main.hs | 1 - src/IHaskell/CSS.hs | 96 +++++++++++++++++++++++++++++ src/IHaskell/Eval/Lint.hs | 11 ++-- src/IHaskell/Publish.hs | 7 +-- stack.yaml | 15 +---- 8 files changed, 108 insertions(+), 131 deletions(-) delete mode 100644 html/custom.css create mode 100644 src/IHaskell/CSS.hs diff --git a/html/custom.css b/html/custom.css deleted file mode 100644 index 3cac01e..0000000 --- a/html/custom.css +++ /dev/null @@ -1,96 +0,0 @@ -/* -Custom IHaskell CSS. -*/ - -/* Styles used for the Hoogle display in the pager */ -.hoogle-doc { - display: block; - padding-bottom: 1.3em; - padding-left: 0.4em; -} -.hoogle-code { - display: block; - font-family: monospace; - white-space: pre; -} -.hoogle-text { - display: block; -} -.hoogle-name { - color: green; - font-weight: bold; -} -.hoogle-head { - font-weight: bold; -} -.hoogle-sub { - display: block; - margin-left: 0.4em; -} -.hoogle-package { - font-weight: bold; - font-style: italic; -} -.hoogle-module { - font-weight: bold; -} -.hoogle-class { - font-weight: bold; -} - -/* Styles used for basic displays */ -.get-type { - color: green; - font-weight: bold; - font-family: monospace; - display: block; - white-space: pre-wrap; -} - -.show-type { - color: green; - font-weight: bold; - font-family: monospace; - margin-left: 1em; -} - -.mono { - font-family: monospace; - display: block; -} - -.err-msg { - color: red; - font-style: italic; - font-family: monospace; - white-space: pre; - display: block; -} - -#unshowable { - color: red; - font-weight: bold; -} - -.err-msg.in.collapse { - padding-top: 0.7em; -} - -/* Code that will get highlighted before it is highlighted */ -.highlight-code { - white-space: pre; - font-family: monospace; -} - -/* Hlint styles */ -.suggestion-warning { - font-weight: bold; - color: rgb(200, 130, 0); -} -.suggestion-error { - font-weight: bold; - color: red; -} -.suggestion-name { - font-weight: bold; -} diff --git a/ihaskell.cabal b/ihaskell.cabal index 5561ad9..fb53441 100644 --- a/ihaskell.cabal +++ b/ihaskell.cabal @@ -7,7 +7,7 @@ name: ihaskell -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.8.2.0 +version: 0.8.3.0 -- A short (one-line) description of the package. synopsis: A Haskell backend kernel for the IPython project. @@ -44,7 +44,6 @@ cabal-version: >=1.16 data-files: html/kernel.js - html/custom.css html/logo-64x64.png flag binPkgDb @@ -68,9 +67,8 @@ library ghc-parser >=0.1.7, ghc-paths ==0.1.*, haskeline -any, - here ==1.2.*, hlint >=1.9 && <2.0, - haskell-src-exts ==1.16.*, + haskell-src-exts >=1.16 && < 1.18, http-client == 0.4.*, http-client-tls == 0.2.*, mtl >=2.1, @@ -114,6 +112,7 @@ library IHaskell.Flags IHaskell.Types IHaskell.BrokenPackages + IHaskell.CSS Paths_ihaskell other-modules: IHaskellPrelude @@ -142,7 +141,6 @@ executable ihaskell transformers -any, ghc >=7.6 || < 7.11, process >=1.1, - here ==1.2.*, aeson >=0.7 && < 0.11, bytestring >=0.10, containers >=0.5, @@ -180,9 +178,8 @@ Test-Suite hspec ghc-parser >=0.1.7, ghc-paths ==0.1.*, haskeline -any, - here ==1.2.*, hlint >=1.9 && <2.0, - haskell-src-exts ==1.16.*, + haskell-src-exts >=1.16 && < 1.18, hspec -any, HUnit -any, mtl >=2.1, diff --git a/ipython-kernel/ipython-kernel.cabal b/ipython-kernel/ipython-kernel.cabal index 3c56ed5..4578358 100644 --- a/ipython-kernel/ipython-kernel.cabal +++ b/ipython-kernel/ipython-kernel.cabal @@ -1,5 +1,5 @@ name: ipython-kernel -version: 0.8.2.0 +version: 0.8.3.0 synopsis: A library for creating kernels for IPython frontends description: ipython-kernel is a library for communicating with frontends for the interactive IPython framework. It is used extensively in IHaskell, the interactive Haskell environment. diff --git a/main/Main.hs b/main/Main.hs index 45c3e26..0d646c6 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -26,7 +26,6 @@ import System.Environment (setEnv) #endif import System.Posix.Signals import qualified Data.Map as Map -import Data.String.Here (hereFile) import qualified Data.Text.Encoding as E import Data.List (break) diff --git a/src/IHaskell/CSS.hs b/src/IHaskell/CSS.hs new file mode 100644 index 0000000..4e94151 --- /dev/null +++ b/src/IHaskell/CSS.hs @@ -0,0 +1,96 @@ +module IHaskell.CSS (ihaskellCSS) where + +import IHaskellPrelude + +ihaskellCSS :: String +ihaskellCSS = + unlines [ + -- Custom IHaskell CSS + "/* Styles used for the Hoogle display in the pager */" + , ".hoogle-doc {" + , "display: block;" + , "padding-bottom: 1.3em;" + , "padding-left: 0.4em;" + , "}" + , ".hoogle-code {" + , "display: block;" + , "font-family: monospace;" + , "white-space: pre;" + , "}" + , ".hoogle-text {" + , "display: block;" + , "}" + , ".hoogle-name {" + , "color: green;" + , "font-weight: bold;" + , "}" + , ".hoogle-head {" + , "font-weight: bold;" + , "}" + , ".hoogle-sub {" + , "display: block;" + , "margin-left: 0.4em;" + , "}" + , ".hoogle-package {" + , "font-weight: bold;" + , "font-style: italic;" + , "}" + , ".hoogle-module {" + , "font-weight: bold;" + , "}" + , ".hoogle-class {" + , "font-weight: bold;" + , "}" + , + -- Styles used for basic displays + ".get-type {" + , "color: green;" + , "font-weight: bold;" + , "font-family: monospace;" + , "display: block;" + , "white-space: pre-wrap;" + , "}" + , ".show-type {" + , "color: green;" + , "font-weight: bold;" + , "font-family: monospace;" + , "margin-left: 1em;" + , "}" + , ".mono {" + , "font-family: monospace;" + , "display: block;" + , "}" + , ".err-msg {" + , "color: red;" + , "font-style: italic;" + , "font-family: monospace;" + , "white-space: pre;" + , "display: block;" + , "}" + , "#unshowable {" + , "color: red;" + , "font-weight: bold;" + , "}" + , ".err-msg.in.collapse {" + , "padding-top: 0.7em;" + , "}" + , + -- Code that will get highlighted before it is highlighted + ".highlight-code {" + , "white-space: pre;" + , "font-family: monospace;" + , "}" + , + -- Hlint styles + ".suggestion-warning { " + , "font-weight: bold;" + , "color: rgb(200, 130, 0);" + , "}" + , ".suggestion-error { " + , "font-weight: bold;" + , "color: red;" + , "}" + , ".suggestion-name {" + , "font-weight: bold;" + , "}" + ] diff --git a/src/IHaskell/Eval/Lint.hs b/src/IHaskell/Eval/Lint.hs index 1505adb..a16be12 100644 --- a/src/IHaskell/Eval/Lint.hs +++ b/src/IHaskell/Eval/Lint.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE NoImplicitPrelude, FlexibleContexts, QuasiQuotes, ViewPatterns #-} +{-# LANGUAGE NoImplicitPrelude, FlexibleContexts, ViewPatterns #-} module IHaskell.Eval.Lint (lint) where @@ -12,7 +12,6 @@ import qualified Data.ByteString.Char8 as CBS import Prelude (head, tail, last) import Control.Monad import Data.List (findIndex) -import Data.String.Here import Data.Char import Data.Monoid import Data.Maybe (mapMaybe) @@ -188,16 +187,16 @@ htmlSuggestions = concatMap toHtml _ -> "warning" style :: String -> String -> String - style cls thing = [i| <div class="suggestion-${cls}">${thing}</div> |] + style = printf "<div class=\"suggestion-${cls}\">%s</div>" named :: String -> String - named thing = [i| <div class="suggestion-name" style="clear:both;">${thing}</div> |] + named = printf "<div class=\"suggestion-name\" style=\"clear:both;\">%s</div>" styleId :: String -> String -> String -> String - styleId cls id thing = [i| <div class="${cls}" id="${id}">${thing}</div> |] + styleId = printf "<div class=\"%s\" id=\"%s\">%s</div>" floating :: String -> String -> String - floating dir thing = [i| <div class="suggestion-row" style="float: ${dir};">${thing}</div> |] + floating = printf "<div class=\"suggestion-row\" style=\"float: %s;\">%s</div>" showSuggestion :: String -> String showSuggestion = remove lintIdent . dropDo diff --git a/src/IHaskell/Publish.hs b/src/IHaskell/Publish.hs index 5d91e9c..9b7818c 100644 --- a/src/IHaskell/Publish.hs +++ b/src/IHaskell/Publish.hs @@ -1,18 +1,13 @@ -{-# LANGUAGE QuasiQuotes #-} - module IHaskell.Publish (publishResult) where import IHaskellPrelude -import Data.String.Here (hereFile) import qualified Data.Text as T import qualified Data.Text.Encoding as E import IHaskell.Display import IHaskell.Types - -ihaskellCSS :: String -ihaskellCSS = [hereFile|html/custom.css|] +import IHaskell.CSS (ihaskellCSS) -- | Publish evaluation results, ignore any CommMsgs. This function can be used to create a function -- of type (EvaluationResult -> IO ()), which can be used to publish results to the frontend. The diff --git a/stack.yaml b/stack.yaml index e77081a..8821599 100644 --- a/stack.yaml +++ b/stack.yaml @@ -16,20 +16,6 @@ packages: - ihaskell-display/ihaskell-aeson/ - ihaskell-display/ihaskell-hatex/ extra-deps: -# - active-0.2.0.3 -# - Chart-1.5 -# - Chart-cairo-1.5 -# - diagrams-1.3 -# - diagrams-cairo-1.3.0.2 -# - diagrams-contrib-1.3.0.3 -# - diagrams-core-1.3.0.1 -# - diagrams-lib-1.3.0.1 -# - diagrams-solve-0.1 -# - diagrams-svg-1.3.1.3 -# - force-layout-0.4.0.1 -# - happy-1.19.5 -# - HList-0.4.0.0 -# - lucid-svg-0.5.0.0 - magic-1.1 - Rlang-QQ-0.3.1.0 - static-canvas-0.2.0.2 @@ -38,4 +24,5 @@ extra-deps: - xformat-0.1.2.1 - ratio-int-0.1.2 - friday-0.2.2.0 +- haskell-src-exts-1.17.0 resolver: nightly-2015-08-15 -- 2.21.0