X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fmisc%2Fexamples%2Fposix%2Fpo007%2FMain.hs;fp=ghc%2Fmisc%2Fexamples%2Fposix%2Fpo007%2FMain.hs;h=0000000000000000000000000000000000000000;hb=47bd40986ff3c7e94ff76ab5c0e632d8fead9a39;hp=3a37dc7545df078d85fd88ea1650441a991deb4e;hpb=71130e6906dd3c673acd6b96220f4931451a3cc6;p=ghc-hetmet.git diff --git a/ghc/misc/examples/posix/po007/Main.hs b/ghc/misc/examples/posix/po007/Main.hs deleted file mode 100644 index 3a37dc7..0000000 --- a/ghc/misc/examples/posix/po007/Main.hs +++ /dev/null @@ -1,31 +0,0 @@ -import Posix - -main = - installHandler keyboardSignal (Catch doCtrlC) Nothing >> - getTerminalAttributes stdInput >>= \ ta -> - case (controlChar ta Interrupt) of - Nothing -> fixMe ta - Just x -> continue x - -fixMe ta = - putStr "Oops...no interrupt character?\nI can fix that...\n" >> - setTerminalAttributes stdInput (withCC ta (Interrupt, '\ETX')) Immediately >> - getTerminalAttributes stdInput >>= \ ta -> - case (controlChar ta Interrupt) of - Nothing -> putStr "...Then again, maybe I can't\n" - Just x -> continue x - -continue x = - putStr "Press '" >> - putStr (ccStr x) >> - putStr "'.\n" >> - awaitSignal Nothing >> - putStr "How did I get here?\n" - -doCtrlC = - putStr "Caught an interrupt.\n" - -ccStr '\DEL' = "^?" -ccStr x - | x >= ' ' = [x] - | otherwise = ['^', (toEnum (fromEnum x + fromEnum '@'))]