haskell-beam / haskell-beam/beam
insertExpressions cannot `val_` lexical captures
- Dominant language
- Haskell
- Stars
- 635
- Forks
- 193
- PR merge metrics
- No merged PRs in 30d
Description
Maybe I'm coming at this the wrong way, but the following does not work:
```haskell
insertStuff :: Text -> [(Address, Text)] -> Pg ()
insertStuff name addresses = runInsert $ insert (tableSelector db) $ do
let modelize (addr, url) = Model
default_ -- UUID
default_ -- LocalTime
default_ -- LocalTime
(val_ $ addressToText addr)
(val_ name)
(val_ url)
(val_ Nothing)
insertExpressions $ modelize <$> addresses
```
It fails with:
```
Couldn't match type ‘Columnar
f0 uuid-types-1.0.3:Data.UUID.Types.Internal.UUID’
with ‘QGenExpr ctxt0 be0 s0 a1’
Expected type: C f0 uuid-types-1.0.3:Data.UUID.Types.Internal.UUID
Actual type: QGenExpr ctxt0 be0 s0 a1
The type variables ‘f0’, ‘ctxt0’, ‘be0’, ‘s0’, ‘a1’ are ambiguous
...
|
178 | default_
| ^^^^^^^^
```
But if I rid myself of lexical captures, it is happy:
```haskell
insertStuff :: Text -> [(Address, Text)] -> Pg ()
insertStuff name addresses = runInsert $ insert (tableSelector db) $ do
let modelize name' (addr, url) = Model
default_
default_
default_
(val_ $ addressToText addr)
(val_ name')
(val_ url)
(val_ Nothing)
insertExpressions $ modelize name <$> addresses
```
Should this be the case? What am I encountering?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.