Changeset 15000 for src/Pugs/Prim.hs

Show
Ignore:
Timestamp:
01/05/07 11:51:51 (23 months ago)
Author:
audreyt
Message:

* Pugs.Prim: Now encodeUTF8 autochunks, remove hardcoding in op2Print.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim.hs

    r14997 r15000  
    11621162 
    11631163op2Print :: Bool -> Val -> Val -> Eval Val 
    1164 op2Print newline h v = do 
     1164op2Print wantNewline h v = do 
    11651165    handle <- fromVal h 
    11661166    strs   <- mapM fromVal =<< case v of 
     
    11681168        _         -> return [v] 
    11691169    guardIO $ do 
    1170         forM strs $ \str -> do 
    1171             forM (chunk 4096 str) $ \chunk -> do 
    1172                 hPutStr handle chunk 
    1173         when newline (hPutStr handle "\n") 
     1170        forM_ strs (hPutStr handle . encodeUTF8) 
     1171        when wantNewline (hPutStr handle "\n") 
    11741172        return $ VBool True 
    1175     where 
    1176     chunk :: Int -> [a] -> [[a]] 
    1177     chunk _    [] = [] 
    1178     chunk size xs = case splitAt size xs of (xs', xs'') -> xs' : chunk size xs'' 
    11791173 
    11801174op2Split :: Val -> Val -> Eval Val