Commit 2de73f6e authored by Andrew Gibiansky's avatar Andrew Gibiansky

fixing slow evaluation of displayable data (b/c it was printing)

parent c23435f0
No preview for this file type
{-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-}
{- | Description : generates tab-completion options {- |
Description : Generates tab completion options.
context-insensitive completion for what is probably
the identifier under the cursor. This has a limited amount of context sensitivity. It distinguishes between four contexts at the moment:
- import statements (completed using modules)
[@Known issues@] - identifiers (completed using in scope values)
- extensions via :ext (completed using GHC extensions)
> import Data.Lef<tab> - qualified identifiers (completed using in-scope values)
> System.IO.h<tab>
> Just.he<tab>
The first should not complete to Left. The second should only
include things like System.IO.hPutStrLn, not head. Qualified
names should not be confused by the third option.
-} -}
module IHaskell.Eval.Completion (complete, completionTarget, completionType, CompletionType(..)) where module IHaskell.Eval.Completion (complete, completionTarget, completionType, CompletionType(..)) where
......
...@@ -499,7 +499,7 @@ evalCommand output (Expression expr) state = do ...@@ -499,7 +499,7 @@ evalCommand output (Expression expr) state = do
-- back gives very strange errors - all the types match but it -- back gives very strange errors - all the types match but it
-- refuses to decode back into a [DisplayData]. -- refuses to decode back into a [DisplayData].
-- Suppress output, so as not to mess up console. -- Suppress output, so as not to mess up console.
capturedStatement (const $ return ()) displayExpr out <- capturedStatement (const $ return ()) displayExpr
displayedBytestring <- dynCompileExpr "IHaskell.Display.serializeDisplay it" displayedBytestring <- dynCompileExpr "IHaskell.Display.serializeDisplay it"
case fromDynamic displayedBytestring of case fromDynamic displayedBytestring of
......
...@@ -301,7 +301,13 @@ instance Show ExecuteReplyStatus where ...@@ -301,7 +301,13 @@ instance Show ExecuteReplyStatus where
data ExecutionState = Busy | Idle | Starting deriving Show data ExecutionState = Busy | Idle | Starting deriving Show
-- | Data for display: a string with associated MIME type. -- | Data for display: a string with associated MIME type.
data DisplayData = Display MimeType String deriving (Show, Typeable, Generic) data DisplayData = Display MimeType String deriving (Typeable, Generic)
-- We can't print the actual data, otherwise this will be printed every
-- time it gets computed because of the way the evaluator is structured.
-- See how `displayExpr` is computed.
instance Show DisplayData where
show _ = "Display"
-- Allow DisplayData serialization -- Allow DisplayData serialization
instance Serialize DisplayData instance Serialize DisplayData
......
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