From cf36d6da11de71e431948d3540a21a29603cb7d9 Mon Sep 17 00:00:00 2001 From: darkf Date: Wed, 23 Oct 2013 23:36:24 -0700 Subject: [PATCH] remove trailing CR from fgetline --- interp.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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