-
Notifications
You must be signed in to change notification settings - Fork 171
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LensFor: Couldn't match expected type p
#659
Comments
I figured out how to define lenses manually as a workaround:
|
I have also seen this here which uses GHC 9.2: #650 @gelisam helpfully directed me to look more closely at the The snippets rely on it: beam/docs/tutorials/tutorial2.md Lines 237 to 240 in 9446193
This says |
I hit the same issue at 9.2.7. Writing the type signature by hand still (with |
@berberman and @yaitskov Have you tried Module Foo where
import Database.Beam
import Lens.Micro
data FooT f = Foo { _fooInt :: C f Int } deriving (Generic, Beamable)
type Foo = FooT Identity
fooName :: Lens Foo Foo Int Int
Foo (LensFor fooName) = tableLenses |
@arguri, it only works for data with 1 field (i.e. newtype)
|
For more fields you would need to add Signatures for each field and ignore the other fields, e.g. module Foo where
import Database.Beam
import Lens.Micro
data Foo { fooName :: C f Int, fooId :: C f String } deriving (Generic, Beamable)
fooName :: Lens Foo Foo Int Int
fooId :: Lens Foo Foo String String
Foo (LensFor fooName) _ = tableLenses
Foo _ (LensFor fooId) = tableLenses At least that worked for me. |
Thanks, I see - every lens binding should have dedicated expression and they cannot be batched in one data constructor. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
After upgrading GHC version from 8.10.7 to 9.2.4 following snippets fails:
The text was updated successfully, but these errors were encountered: