summaryrefslogtreecommitdiff
path: root/testsuite/tests/programs/lex/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/programs/lex/Main.hs')
-rw-r--r--testsuite/tests/programs/lex/Main.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/programs/lex/Main.hs b/testsuite/tests/programs/lex/Main.hs
new file mode 100644
index 0000000000..4c9a44802d
--- /dev/null
+++ b/testsuite/tests/programs/lex/Main.hs
@@ -0,0 +1,9 @@
+module Main where
+
+main = interact ( \ s -> shows (lex' s) "\n")
+ where lex' "" = []
+ lex' s = tok : lex' s' where -- [(tok,s')] = lex s
+ (tok,s') = case lex s of
+ [r] -> r
+ [] -> error ("Empty: " ++ s)
+ other -> error ("Multi: " ++ s)