summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-08-07 06:36:34 +0200
committertv <tv@shackspace.de>2014-08-07 06:36:34 +0200
commite502fc1a1d21ad34299094ecc59d974d2457e6c4 (patch)
tree867f885d9556a80da8212a1714da72c1dd7dc852
parent8f5a028df986710b5541a71c561f92da7a0834b7 (diff)
add Scanner.getKey
-rw-r--r--src/Scanner.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Scanner.hs b/src/Scanner.hs
index 780f9f8..9f0b5ed 100644
--- a/src/Scanner.hs
+++ b/src/Scanner.hs
@@ -20,6 +20,14 @@ import Control.Monad.Writer
import Data.Time.Clock
+-- high level interface
+getKey :: IO String
+getKey = do
+ _ <- hLookAhead stdin -- wait for input
+ ((_, raw_s), _) <- runScanner scan
+ return $ map toChar raw_s
+
+
type P = C
type I = C
type F = C