Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to infer monad type at nested monad use? "do perror..." #3

Open
bollu opened this issue Oct 5, 2021 · 0 comments
Open

unable to infer monad type at nested monad use? "do perror..." #3

bollu opened this issue Oct 5, 2021 · 0 comments

Comments

@bollu
Copy link
Owner

bollu commented Oct 5, 2021

partial def parse_if (u: Unit) : P Stmt := do
 let p_is_fi_or_elif_or_else : P Bool :=
     por (ppeek_keyword? "fi") (por (ppeek_keyword? "elif") (ppeek_keyword? "else"))

 let rec pelse (u: Unit)  : P  ((List (Expr × List Stmt)) × Option (List Stmt)) := do
   match (<- ppeek_keyword) with
      -- | some "elif" => do
      --        let cond <- parse_expr u
      --        pconsume_keyword "then"
      --        let body <- parse_stmts p_is_fi_or_elif_or_else u
      --        let (elifs, else_) <- pelse u
      --        return ((cond,body)::elifs, else_)
      -- | some "else" =>  do
      --     pconsume_keyword "else"
      --     let stmts <- parse_stmts (ppeek_keyword? "fi") u
      --     pconsume_keyword "fi"
      --     return ([], Option.some stmts)
      -- | some "fi" => 
      --   pconsume_keyword "fi"
      --   return ([], Option.none)
      | _ => perror "expected elif/else/fi at end of if" <- CANNOT INFER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant