summaryrefslogtreecommitdiff
path: root/testsuite/tests/programs/lex/Main.hs
blob: 4c9a44802d50bffae81cda407747f4399f56872b (plain)
1
2
3
4
5
6
7
8
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)