on master help sign in
Fix reading files
ef18fedDavid Christiansen
src/Core/Execute.hs+1−4
@@ -149,7 +149,6 @@ execute :: Term -> Idris Term
149execute tm = do est <- initState
149execute tm = do est <- initState
150 ctxt <- getContext
150 ctxt <- getContext
151 res <- lift $ flip runExec est $ do res <- doExec [] ctxt tm
151 res <- lift $ flip runExec est $ do res <- doExec [] ctxt tm
152− trace ("Result: " ++ show res) $ return ()
153 toTT res
152 toTT res
154 case res of
153 case res of
155 Left err -> fail err
154 Left err -> fail err
@@ -225,9 +224,7 @@ execApp' env ctxt (EP _ (UN "unsafePerformIO") _) (ty:action:rest) | (prim__IO,
225 execApp' env ctxt v rest
224 execApp' env ctxt v rest
226
225
227execApp' env ctxt (EP _ (UN "io_bind") _) args@(_:_:v:k:rest) | (prim__IO, [_, v']) <- unApplyV v =
226execApp' env ctxt (EP _ (UN "io_bind") _) args@(_:_:v:k:rest) | (prim__IO, [_, v']) <- unApplyV v =
228− trace ("io_bind " ++ take 1000 (show args)) $
229 do res <- execApp' env ctxt k [v'] >>= tryForce
227 do res <- execApp' env ctxt k [v'] >>= tryForce
230− trace ("io_bind result was " ++ take 1000 (show res)) $ return ()
231 execApp' env ctxt res rest
228 execApp' env ctxt res rest
232
229
233-- Special cases arising from not having access to the C RTS in the interpreter
230-- Special cases arising from not having access to the C RTS in the interpreter
@@ -299,7 +296,7 @@ execApp' env ctxt f@(EP _ n _) args =
299 getOp (UN "prim__readString") [ptr] =
296 getOp (UN "prim__readString") [ptr] =
300 Just $ do h <- unHandle ptr
297 Just $ do h <- unHandle ptr
301 contents <- execIO $ hGetLine h
298 contents <- execIO $ hGetLine h
302− return $ ioWrap (EConstant (Str contents))
299+ return (EConstant (Str contents))
303 getOp _ _ = Nothing
300 getOp _ _ = Nothing
304execApp' env ctxt bnd@(EBind n b body) (arg:args) = do ret <- body arg
301execApp' env ctxt bnd@(EBind n b body) (arg:args) = do ret <- body arg
305 let (f', as) = unApplyV ret
302 let (f', as) = unApplyV ret