HigherOrderCO / HigherOrderCO/HVM3
Compilation bug on matches without all the constructor fields
- Dominant language
- Haskell
- Stars
- 303
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
### Reproducing the behavior
```
@Bool__all$(&xs) =
(~xs {
#Nil:1
#Cons:λ&h λ&t @Bool__and$(h @Bool__all$(t))})
@Bool__all$(&xs) =
(~xs {
#Nil:1
#Cons{h t}: @Bool__and$(h @Bool__all$(t))})
// /\
```
The first one is giving error running in compiled mode, because the HVM->C compiler assumes that pattern matches will always have the exact number of fields, even though semantically having a lambda should be the same.
As a compiler optimization we avoid creating an application to apply the matched field and simply substitute instead, but that obviously doesn't work if there is no lambda.
### System Settings
Commit [58c7adc](https://github.com/HigherOrderCO/HVM3/commit/58c7adcf6fe5dadf07885447fdfe78ee1217abec)
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.