haskell / haskell/error-messages
"X has fields" error doesn't tell me what the problem is (`-XOverloadedRecordDot`)
- Dominant language
- No language data
- Stars
- 76
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
I have the following:
```haskell
instance HasField x a b => HasField (x :: Symbol) (Behavior a) (Behavior b) where
getField behavior = behavior <&> getField @x
```
Yet when I compile this I get
```
lib/Reactive/Banana/Orphans.hs:36:28: error:
• Illegal instance declaration for
‘HasField x (Behavior a) (Behavior b)’
Behavior has fields
• In the instance declaration for
‘HasField (x :: Symbol) (Behavior a) (Behavior b)’
|
36 | instance HasField x a b => HasField (x :: Symbol) (Behavior a) (Behavior b) where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
which just leaves me confused.
Why is the instance illegal? "Behavior has fields" - yes, and? Is that a problem? Also `Behavior` *doesn't* have even fields - it's an [opaque type](https://hackage.haskell.org/package/reactive-banana-1.3.0.0/docs/Reactive-Banana-Combinators.html#t:Behavior)!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.