Commit 9036da3d authored by Andrew Gibiansky's avatar Andrew Gibiansky

made stdin work

parent 699e292b
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// Only load this script once. // Only load this script once.
var kernel = IPython.notebook.kernel; var kernel = IPython.notebook.kernel;
var initialized = kernel !== undefined && kernel != null; var initialized = kernel !== undefined && kernel != null;
console.log("Initialized", initialized);
if (initialized && window.parsecWidgetRegistered === undefined) { if (initialized && window.parsecWidgetRegistered === undefined) {
// Do not load this script again. // Do not load this script again.
......
...@@ -141,7 +141,6 @@ executable IHaskell ...@@ -141,7 +141,6 @@ executable IHaskell
directory -any, directory -any,
ghc ==7.6.*, ghc ==7.6.*,
ihaskell -any, ihaskell -any,
ipython-kernel -any,
MissingH >=1.2, MissingH >=1.2,
text -any, text -any,
unix >= 2.6 unix >= 2.6
...@@ -173,7 +172,6 @@ Test-Suite hspec ...@@ -173,7 +172,6 @@ Test-Suite hspec
hspec -any, hspec -any,
HTTP -any, HTTP -any,
HUnit -any, HUnit -any,
ipython-kernel -any,
MissingH >=1.2, MissingH >=1.2,
mtl >=2.1, mtl >=2.1,
parsec -any, parsec -any,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"metadata": { "metadata": {
"language": "haskell", "language": "haskell",
"name": "", "name": "",
"signature": "sha256:a97e75023c94aa5ee7bcd22c902e508c1e4d91e89ccea56df5c4fec8f369f94a" "signature": "sha256:e714927a2d2b479853e19f3784692d8043ea0de9bcba6778363470d13d4f3f85"
}, },
"nbformat": 3, "nbformat": 3,
"nbformat_minor": 0, "nbformat_minor": 0,
...@@ -44,8 +44,7 @@ ...@@ -44,8 +44,7 @@
"metadata": {}, "metadata": {},
"output_type": "display_data" "output_type": "display_data"
} }
], ]
"prompt_number": 2
}, },
{ {
"cell_type": "code", "cell_type": "code",
...@@ -84,17 +83,8 @@ ...@@ -84,17 +83,8 @@
" return (read (value ++ \".\" ++ after) :: Float)\n", " return (read (value ++ \".\" ++ after) :: Float)\n",
" \n", " \n",
" -- Parse any whitespace\n", " -- Parse any whitespace\n",
" whitespace = many $ oneOf \" \\t\"" " whitespace = many $ oneOf \" \\t\"\n",
], "\n",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"parser" "parser"
], ],
"language": "python", "language": "python",
...@@ -111,6 +101,7 @@ ...@@ -111,6 +101,7 @@
"// Only load this script once.\n", "// Only load this script once.\n",
"var kernel = IPython.notebook.kernel;\n", "var kernel = IPython.notebook.kernel;\n",
"var initialized = kernel !== undefined && kernel != null;\n", "var initialized = kernel !== undefined && kernel != null;\n",
"console.log(\"Initialized\", initialized);\n",
"if (initialized && window.parsecWidgetRegistered === undefined) {\n", "if (initialized && window.parsecWidgetRegistered === undefined) {\n",
"\n", "\n",
"// Do not load this script again.\n", "// Do not load this script again.\n",
...@@ -194,7 +185,7 @@ ...@@ -194,7 +185,7 @@
"output_type": "display_data" "output_type": "display_data"
} }
], ],
"prompt_number": 9 "prompt_number": 1
}, },
{ {
"cell_type": "code", "cell_type": "code",
......
...@@ -106,7 +106,7 @@ globalImports :: [String] ...@@ -106,7 +106,7 @@ globalImports :: [String]
globalImports = globalImports =
[ "import IHaskell.Display()" [ "import IHaskell.Display()"
, "import qualified IHaskell.Display" , "import qualified IHaskell.Display"
, "import qualified IPython.Stdin" , "import qualified IHaskell.IPython.Stdin"
, "import qualified System.Posix.IO as IHaskellIO" , "import qualified System.Posix.IO as IHaskellIO"
, "import qualified System.IO as IHaskellSysIO" , "import qualified System.IO as IHaskellSysIO"
] ]
...@@ -134,7 +134,7 @@ interpret allowedStdin action = runGhc (Just libdir) $ do ...@@ -134,7 +134,7 @@ interpret allowedStdin action = runGhc (Just libdir) $ do
-- Close stdin so it can't be used. -- Close stdin so it can't be used.
-- Otherwise it'll block the kernel forever. -- Otherwise it'll block the kernel forever.
dir <- liftIO getIHaskellDir dir <- liftIO getIHaskellDir
let cmd = printf "IPython.Stdin.fixStdin \"%s\"" dir let cmd = printf "IHaskell.IPython.Stdin.fixStdin \"%s\"" dir
when allowedStdin $ void $ when allowedStdin $ void $
runStmt cmd RunToCompletion runStmt cmd RunToCompletion
......
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