makeBound chokes on types containing tuples of constants
- Dominant language
- Haskell
- Stars
- 130
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
The following `makeBound` invocation chokes:
```haskell
{-# LANGUAGE DeriveFunctor, TemplateHaskell #-}
import Bound
import Bound.Name
import Data.Text
type Named b = Name Text b
data Term v
= EVar v
| EApp (Term v) (Term v)
| EAbs (Named ()) (Scope (Named ()) Term v)
deriving (Functor)
makeBound ''Term
```
```
boundbug.hs:1:1: error:
Exception when trying to run compile-time code:
This is bad: AppT (ConT Main.Named) (TupleT 0) False
CallStack (from HasCallStack):
error, called at src/Bound/TH.hs:269:35 in bound-2.0.1-13f2bf83f03b2fd0ec7401893dd97861fab71a8bfa55e6a9cf9d765f1a520a4f:Bound.TH
Code: makeBound ''Term
```
But the following works fine:
```haskell
data MyUnit = MyUnit deriving (Eq)
data Term v
= EVar v
| EApp (Term v) (Term v)
| EAbs (Named MyUnit) (Scope (Named ()) Term v)
deriving (Functor)
makeBound ''Term
```
The problem is that `makeBound` doesn't recognize `()` as a constant because it parses as an empty tuple, and `isKonst` is missing a rule for tuples. The other, remaining occurrence of `Named ()` is okay because it gets handled by `boundInstance` rather than `isKonst`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.