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 #-}
{- | Description : generates tab-completion options
context-insensitive completion for what is probably
the identifier under the cursor.
[@Known issues@]
> import Data.Lef<tab>
> 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.
{- |
Description : Generates tab completion options.
This has a limited amount of context sensitivity. It distinguishes between four contexts at the moment:
- import statements (completed using modules)
- identifiers (completed using in scope values)
- extensions via :ext (completed using GHC extensions)
- qualified identifiers (completed using in-scope values)
-}
module IHaskell.Eval.Completion (complete, completionTarget, completionType, CompletionType(..)) where
......
......@@ -499,7 +499,7 @@ evalCommand output (Expression expr) state = do
-- back gives very strange errors - all the types match but it
-- refuses to decode back into a [DisplayData].
-- Suppress output, so as not to mess up console.
capturedStatement (const $ return ()) displayExpr
out <- capturedStatement (const $ return ()) displayExpr
displayedBytestring <- dynCompileExpr "IHaskell.Display.serializeDisplay it"
case fromDynamic displayedBytestring of
......
......@@ -301,7 +301,13 @@ instance Show ExecuteReplyStatus where
data ExecutionState = Busy | Idle | Starting deriving Show
-- | 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
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