Skip to content

Commit

Permalink
Add FromBackendRow instances for Identity
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantrinkle committed Oct 6, 2024
1 parent 92a4a50 commit 343b5f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions beam-core/Database/Beam/Backend/SQL/Row.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class BeamBackend be => FromBackendRow be a where
valuesNeeded :: Proxy be -> Proxy a -> Int
valuesNeeded _ _ = 1

deriving instance FromBackendRow be a => FromBackendRow be (Identity a)

class GFromBackendRow be (exposed :: Type -> Type) rep where
gFromBackendRow :: Proxy exposed -> FromBackendRowM be (rep ())
gValuesNeeded :: Proxy be -> Proxy exposed -> Proxy rep -> Int
Expand All @@ -117,6 +119,9 @@ instance (GFromBackendRow be aExp a, GFromBackendRow be bExp b) => GFromBackendR
instance FromBackendRow be x => GFromBackendRow be (K1 R (Exposed x)) (K1 R x) where
gFromBackendRow _ = K1 <$> fromBackendRow
gValuesNeeded be _ _ = valuesNeeded be (Proxy @x)
instance FromBackendRow be x => GFromBackendRow be (K1 R (Exposed x)) (K1 R (Identity x)) where
gFromBackendRow _ = K1 <$> fromBackendRow
gValuesNeeded be _ _ = valuesNeeded be (Proxy @x)
instance FromBackendRow be (t Identity) => GFromBackendRow be (K1 R (t Exposed)) (K1 R (t Identity)) where
gFromBackendRow _ = K1 <$> fromBackendRow
gValuesNeeded be _ _ = valuesNeeded be (Proxy @(t Identity))
Expand Down

0 comments on commit 343b5f4

Please # to comment.