ihaskell-hvega 0.2.0.2 → 0.2.1.0
raw patch · 5 files changed
+34/−20 lines, 5 filesdep ~hvega
Dependency ranges changed: hvega
Files
- CHANGELOG.md +18/−0
- default.nix +2/−10
- ihaskell-hvega.cabal +2/−2
- src/IHaskell/Display/Hvega.hs +11/−7
- stack.yaml +1/−1
CHANGELOG.md view
@@ -1,6 +1,24 @@ For the latest version of this document, please see [https://github.com/DougBurke/hvega/blob/master/ihaskell-hvega/CHANGELOG.md](https://github.com/DougBurke/hvega/blob/master/ihaskell-hvega/CHANGELOG.md). +## 0.2.1.0++THe module now exports the `VegaLiteLab` type (provided by Alexey+Kuleshevich (lehins). This type is used to support display in Jupyter+Lab as well as notebooks, and is a somewhat experimental feature.++The module now builds without warnings on GHC 8.8.1.++This release has been marked as compatible with version 0.4 of `hvega`,+but **care should be taken** as it is possible to create visualizations+that either do not display correctly, or do not display at all: these+are visualizations that take advantages of Vega-Lite functionality+not supported by the Javascript display code (presumably because+of our use of an old Vega-Lite mimetype version in IHaskell; this+will hopefuly be addressed once a version of IHaskell is released+with support for+[custom mimetypes](https://github.com/gibiansky/IHaskell/issues/1089)).+ ## 0.2.0.2 Updated the upper bounds of `ihaskell` to allow version 0.10.
default.nix view
@@ -1,10 +1,2 @@-{ mkDerivation, aeson, base, hvega, ihaskell, stdenv, text }:-mkDerivation {- pname = "ihaskell-hvega";- version = "0.2.0.1";- src = ./.;- libraryHaskellDepends = [ aeson base hvega ihaskell text ];- homepage = "https://github.com/DougBurke/hvega";- description = "IHaskell display instance for hvega types";- license = stdenv.lib.licenses.bsd3;-}+{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865" }:+nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./ihaskell-hvega.nix { }
ihaskell-hvega.cabal view
@@ -1,5 +1,5 @@ name: ihaskell-hvega-version: 0.2.0.2+version: 0.2.1.0 synopsis: IHaskell display instance for hvega types. description: Support Vega-Lite visualizations in IHaskell notebooks. homepage: https://github.com/DougBurke/hvega@@ -22,7 +22,7 @@ exposed-modules: IHaskell.Display.Hvega build-depends: base >= 4.7 && < 5 , aeson >= 0.11 && < 1.5- , hvega < 0.4+ , hvega < 0.5 , ihaskell >= 0.9.1 && < 0.11 , text == 1.2.*
src/IHaskell/Display/Hvega.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-|@@ -7,7 +8,7 @@ Maintainer : dburke.gw@gmail.com Stability : unstable-Portability : OverloadedStrings+Portability : CPP, OverloadedStrings Allow VegaLite visualizations to be displayed directly in Jupyter notebooks or Jupyter Lab. For the moment they are handled separately, in that the Jupyter@@ -47,12 +48,15 @@ where @vlShow@ should be imported automatically by IHaskell. -} -module IHaskell.Display.Hvega (vlShow) where+module IHaskell.Display.Hvega (vlShow, VegaLiteLab) where import qualified Data.Text.Lazy as LT import Data.Aeson.Text (encodeToLazyText)++#if !(MIN_VERSION_base(4, 12, 0)) import Data.Monoid ((<>))+#endif import Graphics.Vega.VegaLite (VegaLite, fromVL) @@ -72,8 +76,8 @@ -- since the JavaScript @fs@ module may not be loaded. -- instance IHaskellDisplay VegaLite where- display vl = - + display vl =+ let -- Note: need to look in the package.json files for these packages -- to find the "full name" (the contents of the jsdelivr key), -- since requirejs does seem to like appending .js to everything.@@ -105,7 +109,7 @@ <> "ndiv.innerHTML = " <> "'Awesome Vega-Lite visualization to appear here';" <> "element[0].appendChild(ndiv);"- + js = LT.unpack (encodeToLazyText (fromVL vl)) -- Use the div element we have just created for the plot.@@ -117,9 +121,9 @@ <> "function (error) { ndiv.innerHTML = " <> "'There was an error: ' + error; });" <> "});"- + ds = [javascript (config <> makeDiv <> plot)]- + in pure (Display ds) -- | A wrapper around 'VegaLite' so that we can write a 'Display'
stack.yaml view
@@ -5,4 +5,4 @@ extra-deps: [] -resolver: lts-11.19+resolver: lts-14.18