
10 Jun
2016
10 Jun
'16
10:37 a.m.
Hello I want to define some parser such way: myParser = tryA <|> tryB <|> fail "input must be either A or B" It works. But then I want to rewrite it with asum: myParser = asum [tryA, tryB, fail "must be A or B"] It works, but the wrong way. Instead of my error it writes "empty". Just "empty". It is so because in base library asum = foldr (<|>) empty What if it was defined asum [] = empty asum [x:xs] = x <|> asum xs It would help me with my parser. But what can this break? Why isn't this done yet? -- Yuriy Syrovetskiy, http://cblp.su