Skip to content

Commit

Permalink
Merge pull request #717 from obsidiansystems/FromBackendRow-Identity
Browse files Browse the repository at this point in the history
Add FromBackendRow instances for Identity
  • Loading branch information
LaurentRDC authored Oct 7, 2024
2 parents 92a4a50 + 343b5f4 commit cc231b8
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 cc231b8

Please sign in to comment.