
23 Aug
2009
23 Aug
'09
3:28 a.m.
Yeah, it's broken in windows. Here's the workaround courtesy of Alistar Bayley. (ticket 2189) {-# LANGUAGE ForeignFunctionInterface #-} import Data.Char import Control.Monad (liftM, forever) import Foreign.C.Types getHiddenChar = liftM (chr.fromEnum) c_getch foreign import ccall unsafe "conio.h getch" c_getch :: IO CInt main = do forever $ do c <- getHiddenChar putStrLn $ show (fromEnum c)