Skip to content

Commit 41b4e15

Browse files
committed
Bug identified
1 parent fc5dec4 commit 41b4e15

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

database-generic/src/Database/Generic/Entity/DbTypes.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ data DbT f
1919

2020
type F :: forall f a b. (f :: Type) -> (a :: Type) -> (b :: Type)
2121
type family F f a where
22-
F Id a = a
23-
F Unit _ = Unit
22+
F Id a = a
23+
F Unit _ = Unit
2424

2525
data Unit = Unit deriving (Aeson.FromJSON, Eq, Generic, Show)
2626
type DbType = DbT Unit

database-generic/src/Database/Generic/Entity/ToDb.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class ToDbValue a where
1818
instance {-# OVERLAPPABLE #-} From a DbValue => ToDbValue a where
1919
toDbValue = Just . from
2020

21-
instance {-# OVERLAPPABLE #-} From a DbValue => ToDbValue (Maybe a) where
22-
toDbValue = fmap from
23-
2421
-- | Values that can be converted into a list of 'DbValue'.
2522
class ToDbValues a where
2623
toDbValues :: a -> [DbValueN]
2724

25+
instance {-# OVERLAPPABLE #-} ToDbValue (Maybe a) => ToDbValues (Maybe a) where
26+
toDbValues = (:[]) . toDbValue
27+
2828
instance {-# OVERLAPPABLE #-}
2929
( G.HasEot a
3030
, GToDbValues (G.Eot a)

0 commit comments

Comments
 (0)