summaryrefslogtreecommitdiff
path: root/ghc/misc/examples/cats/hcat5.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/misc/examples/cats/hcat5.hs')
-rw-r--r--ghc/misc/examples/cats/hcat5.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/ghc/misc/examples/cats/hcat5.hs b/ghc/misc/examples/cats/hcat5.hs
new file mode 100644
index 0000000000..0a7a59f6b6
--- /dev/null
+++ b/ghc/misc/examples/cats/hcat5.hs
@@ -0,0 +1,19 @@
+module Main (mainPrimIO) where
+
+import PreludePrimIO
+
+mainPrimIO :: PrimIO ()
+mainPrimIO
+ = _ccall_ stg_getc (``stdin'' :: _Addr)
+ `thenPrimIO` \ (I# ch) ->
+ if ch <# 0# then -- SIGH: ch ==# ``EOF''
+ returnPrimIO ()
+ else
+ _ccall_ stg_putc (C# (chr# ch))
+ (``stdout'' :: _Addr)
+ `seqPrimIO`
+ mainPrimIO
+
+-- 1,737,897 bytes/sec ( 600KB input)
+-- 1,808,993 bytes/sec ( 9.3MB input)
+-- 1,711,850 bytes/sec (25.5MB input)