Browse files

start progess at 1

  • Loading branch information...
1 parent 40ff780 commit 5cc187284fbd09b280c2f8785f0219961fb5a561 @mikeplus64 committed Jan 28, 2013
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/Language/Haskell/Repl.hs
View
11 src/Language/Haskell/Repl.hs
@@ -82,15 +82,14 @@ prompt r xs x = do
threadDelay p
killThread tr
prog <- readIORef ir
- case take prog lazyResults of
- hs@(_:_) -> all ends (trimLines hs) `seq` putMVar final hs
- _ -> putMVar final []
- _ -> putMVar final (trimLines lazyResults) -- putMVar final (trimLines lazyResults)
+ let hs = trimLines (take prog lazyResults)
+ all ends hs `seq` putMVar final (trimLines hs)
+ _ -> putMVar final (trimLines lazyResults)
fin <- takeMVar final
killThread timeout
killThread attempt
- return (trimLines fin)
+ return fin
promptWith
:: Repl
@@ -108,7 +107,7 @@ ends (_:xs) = ends xs
-- | See 'how far' a lazy list has evaluated.
progress :: [a] -> IO (ThreadId, IORef Int)
progress xs = do
- r <- newIORef 0
+ r <- newIORef 1
let go [] = return ()
go (_:ys) = modifyIORef r (+1) >> go ys
t <- forkIO (go xs)

0 comments on commit 5cc1872

Please sign in to comment.