-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi, developers of llvm-hs-quote.
Environment
llvm-hs-quote: 1497273
stack solver: lts-10.3 (this is the same as llvm-hs-quote)
Proposal
Allow library users to use $bbs with empty [BasicBlock].
My concern
module11 [bBlock] has no error in the following code. However, module11 [] has a runtime error.
module11 :: [AST.Global.BasicBlock] -> AST.Module
module11 basicBlocks = [Quote.LLVM.llmod|
define void @myfunc(i32 %a, i32 %b) {
$bbs:basicBlocks
ret void
}
|]runtime error message
Pattern match failure in do expression at ...To avoid the empty-list problem, I should write the following. In the code, betterModule11 [] has no error, but it is redundant.
betterModule11 :: [AST.Global.BasicBlock] -> AST.Module
betterModule11 basicBlocks =
if Prelude.null basicBlocks
then
[Quote.LLVM.llmod|
define void @myfunc(i32 %a, i32 %b) {
ret void
}
|]
else
[Quote.LLVM.llmod|
define void @myfunc(i32 %a, i32 %b) {
$bbs:basicBlocks
ret void
}
|]The code is just an example. In actual program using this library, allowing empty list is more convenient. I was wondering whether you allow to us use $bbs with empty [BasicBlock].
Metadata
Metadata
Assignees
Labels
No labels