Commit e6fb0fe0 authored by Tom McLaughlin's avatar Tom McLaughlin

Tweaks

parent c7a167a3
...@@ -22,5 +22,4 @@ cabal.sandbox.config ...@@ -22,5 +22,4 @@ cabal.sandbox.config
.tmp1 .tmp1
.tmp2 .tmp2
.tmp3 .tmp3
.stack-work .stack-work
ghc-parser/* \ No newline at end of file
\ No newline at end of file
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
module IHaskell.Display.Diagrams (diagram, animation) where module IHaskell.Display.Diagrams (diagram, animation) where
import System.Directory
import qualified Data.ByteString.Char8 as Char import qualified Data.ByteString.Char8 as Char
import System.Directory
import System.IO.Unsafe import System.IO.Unsafe
import Diagrams.Prelude
import Diagrams.Backend.Cairo import Diagrams.Backend.Cairo
import Diagrams.Prelude
import IHaskell.Display import IHaskell.Display
import IHaskell.Display.Diagrams.Animation import IHaskell.Display.Diagrams.Animation
...@@ -20,6 +20,7 @@ instance IHaskellDisplay (QDiagram Cairo V2 Double Any) where ...@@ -20,6 +20,7 @@ instance IHaskellDisplay (QDiagram Cairo V2 Double Any) where
diagramData :: Diagram Cairo -> OutputType -> IO DisplayData diagramData :: Diagram Cairo -> OutputType -> IO DisplayData
diagramData renderable format = do diagramData renderable format = do
putStrLn "About to switch to tmp dir!"
switchToTmpDir switchToTmpDir
-- Compute width and height. -- Compute width and height.
...@@ -29,12 +30,17 @@ diagramData renderable format = do ...@@ -29,12 +30,17 @@ diagramData renderable format = do
imgHeight = 300 imgHeight = 300
imgWidth = aspect * imgHeight imgWidth = aspect * imgHeight
putStrLn "Going to do renderCairo!"
-- Write the image. -- Write the image.
let filename = ".ihaskell-diagram." ++ extension format let filename = ".ihaskell-diagram." ++ extension format
renderCairo filename (mkSizeSpec2D (Just imgWidth) (Just imgHeight)) renderable renderCairo filename (mkSizeSpec2D (Just imgWidth) (Just imgHeight)) renderable
putStrLn "Did renderCairo, about to readFile"
-- Convert to base64. -- Convert to base64.
imgData <- Char.readFile filename imgData <- Char.readFile filename
putStrLn "Did readFile"
let value = let value =
case format of case format of
PNG -> png (floor imgWidth) (floor imgHeight) $ base64 imgData PNG -> png (floor imgWidth) (floor imgHeight) $ base64 imgData
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- the low-level 0MQ interface. -- the low-level 0MQ interface.
module IHaskell.IPython.Message.Parser (parseMessage) where module IHaskell.IPython.Message.Parser (parseMessage) where
import Control.Applicative ((<|>), (<$>), (<*>)) -- import Control.Applicative ((<|>), (<$>), (<*>))
import Data.Aeson ((.:), (.:?), decode, Result(..), Object, Value(..)) import Data.Aeson ((.:), (.:?), decode, Result(..), Object, Value(..))
import Data.Aeson.Types (parse, parseEither) import Data.Aeson.Types (parse, parseEither)
import Data.ByteString hiding (unpack) import Data.ByteString hiding (unpack)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module IHaskell.IPython.Message.UUID (UUID, random, randoms, uuidToString) where module IHaskell.IPython.Message.UUID (UUID, random, randoms, uuidToString) where
import Control.Monad (mzero, replicateM) import Control.Monad (mzero, replicateM)
import Control.Applicative ((<$>)) -- import Control.Applicative ((<$>))
import Data.Text (pack) import Data.Text (pack)
import Data.Aeson import Data.Aeson
import Data.UUID.V4 (nextRandom) import Data.UUID.V4 (nextRandom)
......
...@@ -7,12 +7,12 @@ module IHaskell.IPython.Message.Writer (ToJSON(..)) where ...@@ -7,12 +7,12 @@ module IHaskell.IPython.Message.Writer (ToJSON(..)) where
import Data.Aeson import Data.Aeson
import Data.Map (Map) import Data.Map (Map)
import Data.Monoid (mempty) -- import Data.Monoid (mempty)
import Data.Text (Text, pack) import Data.Text (Text, pack)
import qualified Data.ByteString as B -- import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L -- import qualified Data.ByteString.Lazy as L
import Data.Text.Encoding -- import Data.Text.Encoding
import IHaskell.IPython.Types import IHaskell.IPython.Types
......
...@@ -34,13 +34,13 @@ module IHaskell.IPython.Types ( ...@@ -34,13 +34,13 @@ module IHaskell.IPython.Types (
extractPlain, extractPlain,
) where ) where
import Control.Applicative ((<$>), (<*>)) -- import Control.Applicative ((<$>), (<*>))
import Data.Aeson import Data.Aeson
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import Data.List (find) import Data.List (find)
import Data.Map (Map) import Data.Map (Map)
import Data.Serialize import Data.Serialize
import qualified Data.String as S -- import qualified Data.String as S
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as Text import qualified Data.Text as Text
import qualified Data.Text.Encoding as Text import qualified Data.Text.Encoding as Text
......
...@@ -18,9 +18,9 @@ import Control.Concurrent ...@@ -18,9 +18,9 @@ import Control.Concurrent
import Control.Exception import Control.Exception
import Control.Monad import Control.Monad
import Data.Aeson import Data.Aeson
import qualified Data.ByteString.Lazy as LBS
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as Char import qualified Data.ByteString.Char8 as Char
import qualified Data.ByteString.Lazy as LBS
import Data.Char import Data.Char
import Data.Digest.Pure.SHA as SHA import Data.Digest.Pure.SHA as SHA
import Data.Monoid ((<>)) import Data.Monoid ((<>))
...@@ -28,16 +28,16 @@ import qualified Data.Text.Encoding as Text ...@@ -28,16 +28,16 @@ import qualified Data.Text.Encoding as Text
import System.ZMQ4 as ZMQ4 hiding (stdin) import System.ZMQ4 as ZMQ4 hiding (stdin)
import Text.Read (readMaybe) import Text.Read (readMaybe)
import IHaskell.IPython.Types
import IHaskell.IPython.Message.Parser import IHaskell.IPython.Message.Parser
import IHaskell.IPython.Message.Writer import IHaskell.IPython.Message.Writer ()
import IHaskell.IPython.Types
-- | The channel interface to the ZeroMQ sockets. All communication is done via Messages, which are -- | The channel interface to the ZeroMQ sockets. All communication is done via Messages, which are
-- encoded and decoded into a lower level form before being transmitted to IPython. These channels -- encoded and decoded into a lower level form before being transmitted to IPython. These channels
-- should functionally serve as high-level sockets which speak Messages instead of ByteStrings. -- should functionally serve as high-level sockets which speak Messages instead of ByteStrings.
data ZeroMQInterface = data ZeroMQInterface =
Channels Channels
{ {
-- | A channel populated with requests from the frontend. -- | A channel populated with requests from the frontend.
shellRequestChannel :: Chan Message shellRequestChannel :: Chan Message
-- | Writing to this channel causes a reply to be sent to the frontend. -- | Writing to this channel causes a reply to be sent to the frontend.
......
flags:
ipython-kernel:
examples: false
packages:
- '.'
extra-deps: []
resolver: nightly-2015-08-15
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