
On Fri, 20 Feb 2004, Matthew Morvant wrote:
I am trying (and have been for quite some time) to repair a broken Haskell script.� I keep getting stuck on �Last generator in do {...} must be an expression�.� I am betting that this is not uncommon.� Can someone please help me understand?
code5 :: Parser code5 = do dd <- code3 do ddd <- code3 do dddd <- code3 return "ce"
The author appears to want this (braces and semicolons included for clarity): code5 = do { dd <- code3; ddd <- code3; dddd <- code3; return "ce" } which will assign the results of code3 3 times in succession to dd, ddd, and ddd before returning "ce". Of course, you /could/ just write that as: do {code3; code 3; code 3; return "ce"} Unless I misunderstand the intent here?
code4 :: Parser code4 = do ����������� ����������� dd <- code3 ����������������������� do dde <- code3 ����������������������� ����������� digit ����������������������������������� ddd <- many (do digit) ����������������������������������� q <- code5 ����������������������������������� return (q : "ss")
Attempting to grok this suggests I might. Is code3 supposed to take a parser as a parameter? -- flippa@flippac.org