Commit ae2a6f14 authored by Stian Håklev's avatar Stian Håklev

Ignoring > in front of code lines

Removing dependence on regex, checking that all lines are prefixed by >
parent c324d1a1
......@@ -229,13 +229,23 @@ data EvalOut = EvalOut {
evalComms :: [CommInfo]
}
cleanString :: String -> String
cleanString x = strip $ if allBrackets then clean else x
where
l = lines x
allBrackets = all (fAny [isInfixOf ">", null]) l
fAny fs x = any ($x) fs
clean = unlines $ map removeBracket l
removeBracket (x:xs) = xs
removeBracket [] = []
-- | Evaluate some IPython input code.
evaluate :: KernelState -- ^ The kernel state.
-> String -- ^ Haskell code or other interpreter commands.
-> (EvaluationResult -> IO ()) -- ^ Function used to publish data outputs.
-> Interpreter KernelState
evaluate kernelState code output = do
cmds <- parseString (strip code)
cmds <- parseString (cleanString code)
let execCount = getExecutionCounter kernelState
when (getLintStatus kernelState /= LintOff) $ liftIO $ 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