Commit 5dc11f2f authored by Andrew Gibiansky's avatar Andrew Gibiansky

mostly working, it not being updated

parent 957de8ff
......@@ -43,6 +43,4 @@ chartData renderable format = do
imgData <- readFile $ fpFromString filename
return $ case format of
PNG -> png width height $ base64 imgData
SVG -> html $ makeSvgImg $ base64 imgData
where
makeSvgImg base64data = Char.unpack $ "<img src=\"data:image/svg+xml;base64," ++ base64data ++ "\"/>"
SVG -> svg $ Char.unpack imgData
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -145,10 +145,8 @@ interpret allowedStdin action = runGhc (Just libdir) $ do
initializeImports :: Interpreter ()
initializeImports = do
-- Load packages that start with ihaskell-*, aren't just IHaskell,
-- and depend directly on the right version of the ihaskell library
--
-- XXX this will try to load broken packages, provided they depend
-- on the right ihaskell version
-- and depend directly on the right version of the ihaskell library.
-- Also verify that the packages we load are not broken.
dflags <- getSessionDynFlags
broken <- liftIO getBrokenPackages
displayPackages <- liftIO $ do
......@@ -157,7 +155,8 @@ initializeImports = do
packageNames = map (packageIdString . packageConfigId) db
initStr = "ihaskell-"
-- "ihaskell-1.2.3.4"
-- Name of the ihaskell package, e.g. "ihaskell-1.2.3.4"
iHaskellPkgName = initStr ++ intercalate "." (map show (versionBranch version))
dependsOnRight pkg = not $ null $ do
......@@ -172,8 +171,8 @@ initializeImports = do
-- ihaskell-0.2.0.5-ce34eadc18cf2b28c8d338d0f3755502 installed.
iHaskellPkg = case filter (== iHaskellPkgName) packageNames of
[x] -> x
[] -> error ("cannot find required haskell library: "++iHaskellPkgName)
_ -> error ("multiple haskell packages "++iHaskellPkgName++" found")
[] -> error ("cannot find required haskell library: " ++ iHaskellPkgName)
_ -> error ("multiple haskell packages " ++ iHaskellPkgName ++ " found")
displayPkgs = [ pkgName
| pkgName <- packageNames,
......@@ -194,8 +193,6 @@ initializeImports = do
displayImports = map toImportStmt displayPackages
liftIO $ print displayImports
-- Import implicit prelude.
importDecl <- parseImportDecl "import Prelude"
let implicitPrelude = importDecl { ideclImplicit = True }
......
......@@ -21,11 +21,13 @@ import qualified Data.Map as Map
-- IHaskell imports.
import IHaskell.Eval.Completion (complete)
import IHaskell.Eval.Evaluate
import IHaskell.Display
import IHaskell.Eval.Info
import IHaskell.Flags
import IHaskell.IPython
import IHaskell.Types
import IPython.ZeroMQ
import IPython.Types
import qualified Data.ByteString.Char8 as Chars
import qualified IPython.Message.UUID as UUID
import qualified IPython.Stdin as Stdin
......@@ -270,7 +272,11 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
sendOutput (ManyDisplay manyOuts) = mapM_ sendOutput manyOuts
sendOutput (Display outs) = do
header <- dupHeader replyHeader DisplayDataMessage
send $ PublishDisplayData header "haskell" outs
send $ PublishDisplayData header "haskell" $ map convertSvgToHtml outs
convertSvgToHtml (DisplayData MimeSvg svg) = html $ makeSvgImg $ base64 svg
convertSvgToHtml x = x
makeSvgImg base64data = Chars.unpack $ "<img src=\"data:image/svg+xml;base64," ++ base64data ++ "\"/>"
publish :: EvaluationResult -> IO ()
publish result = do
......
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