Stack Overflow Asked by brahimi haroun on February 27, 2021
i’m working on a Evalexpr in haskell and i get this error :
"Unexpected do block in function application:
do (v1, cs1) <- digitParser cs
You could write it with parentheses
Or perhaps you meant to enable BlockArguments?"
my function :
opperaParser :: String -> Either SyntaxError (Eval, String)
opperaParser cs =
do (v1, cs1) <- digitParser cs
case cs1 of
[] -> return (v1, [])
_ -> do
(plus, cs2) <- findOpperators cs1
(v2, cs3) <- opperaParser cs2
return (plus v1 v2, cs3)
You should indent the statements under the do
, so:
opperaParser :: String -> Either SyntaxError (Eval, String)
opperaParser cs = do -- ← indent lines under the do
(v1, cs1) <- digitParser cs
case cs1 of
[] -> return (v1, [])
_ -> do
(plus, cs2) <- findOpperators cs1
(v2, cs3) <- opperaParser cs2
return (plus v1 v2, cs3)
Correct answer by Willem Van Onsem on February 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP