git.iko.soy/typeable/postgresql-simple
on master help sign in
Documented FromField instances
commita11e8c6ea918e6cb536cbcbf5531d4a83ed01121 authorLeon P Smith <leon@melding-monads.com> dateWed 8 May 2013, 06:12 (13 years ago) parentb37a6b5
2 files changed+5
src/Database/PostgreSQL/Simple/FromField.hs+3 src/Database/PostgreSQL/Simple/HStore/Implementation.hs+2
src/Database/PostgreSQL/Simple/FromField.hs+3
@@ -404,6 +404,9 @@ ff pgType hsType parse f mstr =
404404 msg
405405{-# INLINE ff #-}
406406
407+-- | Compatible with both types. Conversions to type @b@ are
408+-- preferred, the conversion to type @a@ will be tried after
409+-- the 'Right' conversion fails.
407410instance (FromField a, FromField b) => FromField (Either a b) where
408411 fromField f dat = (Right <$> fromField f dat)
409412 <|> (Left <$> fromField f dat)
src/Database/PostgreSQL/Simple/HStore/Implementation.hs+2
@@ -115,12 +115,14 @@ instance ToField HStoreBuilder where
115115
116116newtype HStoreList = HStoreList [(Text,Text)] deriving (Typeable, Show)
117117
118+-- | hstore
118119instance ToHStore HStoreList where
119120 toHStore (HStoreList xs) = mconcat (map (uncurry hstore) xs)
120121
121122instance ToField HStoreList where
122123 toField xs = toField (toHStore xs)
123124
125+-- | hstore
124126instance FromField HStoreList where
125127 fromField f mdat = do
126128 typ <- typename f