@@ -473,14 +473,6 @@ instance
473-- decoding `Null`s to `Maybe`s. You should not define instances for
473-- decoding `Null`s to `Maybe`s. You should not define instances for
474-- `FromColumnValue`, just use the provided instances.
474-- `FromColumnValue`, just use the provided instances.
475class FromColumnValue (pg :: (Symbol, NullityType)) (y :: (Symbol, Type)) where
475class FromColumnValue (pg :: (Symbol, NullityType)) (y :: (Symbol, Type)) where
476− -- | >>> :set -XTypeOperators -XOverloadedStrings
477− -- >>> newtype Id = Id { getId :: Int16 } deriving Show
478− -- >>> instance FromValue 'PGint2 Id where fromValue = fmap Id . fromValue
479− -- >>> fromColumnValue @("col" ::: 'NotNull 'PGint2) @Id (K (Just "\NUL\SOH"))
482− -- >>> fromColumnValue @("col" ::: 'Null 'PGint2) @(Maybe Id) (K (Just "\NUL\SOH"))
483− -- Just (Id {getId = 1})
484 fromColumnValue
476 fromColumnValue
485 :: K (Maybe Strict.ByteString) pg
477 :: K (Maybe Strict.ByteString) pg
486 -> (Either Strict.Text :.: P) y
478 -> (Either Strict.Text :.: P) y
@@ -512,7 +504,7 @@ class SListI result => FromRow (result :: RelationType) y where
512 -- >>> instance HasDatatypeInfo UserRow
504 -- >>> instance HasDatatypeInfo UserRow
513 -- >>> type User = '["userId" ::: 'NotNull 'PGint2, "userName" ::: 'Null 'PGtext]
505 -- >>> type User = '["userId" ::: 'NotNull 'PGint2, "userName" ::: 'Null 'PGtext]
514 -- >>> fromRow @User @UserRow (K (Just "\NUL\SOH") :* K (Just "bloodninja") :* Nil)
506 -- >>> fromRow @User @UserRow (K (Just "\NUL\SOH") :* K (Just "bloodninja") :* Nil)
515− -- UserRow {userId = UserId {getUserId = 1}, userName = Just "bloodninja"}
507+ -- Right (UserRow {userId = UserId {getUserId = 1}, userName = Just "bloodninja"})
516 fromRow :: NP (K (Maybe Strict.ByteString)) result -> Either Strict.Text y
508 fromRow :: NP (K (Maybe Strict.ByteString)) result -> Either Strict.Text y
518 ( SListI result
510 ( SListI result
@@ -532,7 +524,7 @@ instance
532-- K (Just "foo") :* Nil
524-- K (Just "foo") :* Nil
534-- >>> fromRow @'["fromOnly" ::: 'Null 'PGtext] @(Only (Maybe Text)) (K (Just "bar") :* Nil)
526-- >>> fromRow @'["fromOnly" ::: 'Null 'PGtext] @(Only (Maybe Text)) (K (Just "bar") :* Nil)
535−-- Only {fromOnly = Just "bar"}
527+-- Right (Only {fromOnly = Just "bar"})
536newtype Only x = Only { fromOnly :: x }
528newtype Only x = Only { fromOnly :: x }
537 deriving (Functor,Foldable,Traversable,Eq,Ord,Read,Show,GHC.Generic)
529 deriving (Functor,Foldable,Traversable,Eq,Ord,Read,Show,GHC.Generic)
538instance Generic (Only x)
530instance Generic (Only x)