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

$instrs - Couldn't match expected type #16

Open
nwtgck opened this issue Feb 8, 2018 · 1 comment
Open

$instrs - Couldn't match expected type #16

nwtgck opened this issue Feb 8, 2018 · 1 comment

Comments

@nwtgck
Copy link
Contributor

nwtgck commented Feb 8, 2018

Hi, developers of llvm-hs-quote

Environment

llvm-hs-quote: 1497273
stack solver: lts-10.3 (this is the same as llvm-hs-quote)

Problem

I'd like use $instrs. However, the following code has a compile error

module11 :: [Either AST.Instruction AST.Terminator] -> AST.Module
module11 instructions = [Quote.LLVM.llmod|
  define void @f() {
  entry:
    $instrs:instructions
    ret void
  }
|]

output

    • Couldn't match expected type ‘Either
                                      AST.Instruction AST.Terminator’
                  with actual type ‘AST.Global.BasicBlock’
    • In the pattern: AST.Global.BasicBlock _ is_an6q t_an6r
      In the pattern: AST.Global.BasicBlock _ is_an6q t_an6r : bbs_an6s
      In a stmt of a 'do' block:
        (AST.Global.BasicBlock _ is_an6q t_an6r : bbs_an6s) <- return
                                                                 (instructions)

If I replaced [Either AST.Instruction AST.Terminator] with [AST.Instruction], the error message looked same like the following.

 Couldn't match expected type ‘AST.Instruction’
                  with actual type ‘AST.Global.BasicBlock’
@nwtgck
Copy link
Contributor Author

nwtgck commented Feb 9, 2018

I also tried to [Either (Named AST.Instruction) (Named AST.Terminator)], but it didn't work.

I think both [Either (Named AST.Instruction) (Named AST.Terminator)] and [Either AST.Instruction AST.Terminator] is better to support for many situations.

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