remove trailing CR from fgetline

This commit is contained in:
darkf 2013-10-23 23:36:24 -07:00
parent 36290dcc65
commit cf36d6da11
1 changed files with 3 additions and 1 deletions

View File

@ -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