diff --git a/interp.hs b/interp.hs index 132ee6c..d7eecec 100644 --- a/interp.hs +++ b/interp.hs @@ -95,7 +95,9 @@ _fgetline (StreamV h) = do (handles,_) <- get let handle = handles !! h str <- lift $ hGetLine handle - return $ StrV str + if last str == '\r' then -- remove trailing CR + return . StrV $ init str + else return $ StrV str _fread (TupleV [StreamV h, IntV n]) = do (handles,_) <- get