Changeset 15000 for src/Pugs/Prim.hs
- Timestamp:
- 01/05/07 11:51:51 (23 months ago)
- Files:
-
- 1 modified
-
src/Pugs/Prim.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim.hs
r14997 r15000 1162 1162 1163 1163 op2Print :: Bool -> Val -> Val -> Eval Val 1164 op2Print newline h v = do1164 op2Print wantNewline h v = do 1165 1165 handle <- fromVal h 1166 1166 strs <- mapM fromVal =<< case v of … … 1168 1168 _ -> return [v] 1169 1169 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") 1174 1172 return $ VBool True 1175 where1176 chunk :: Int -> [a] -> [[a]]1177 chunk _ [] = []1178 chunk size xs = case splitAt size xs of (xs', xs'') -> xs' : chunk size xs''1179 1173 1180 1174 op2Split :: Val -> Val -> Eval Val
