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
commitca87352723bc2f36c8e37df6b50e310a1a38054d (patch)
tree0e570846ac2e42859b74d7eda85191f08097c736
parent9e6ad8f3f05010a40802aa7579547c76c65e5b63 (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