git.iko.soy/typeable/postgresql-simple
on master help sign in
Merge pull request #86 from basvandijk/selector-functions

Add fromBinary, fromHStoreMap and fromHStoreList

commitc40fa727495dd392b3a80622d243f295cd9508ba authorLeon P Smith <leon@melding-monads.com> dateMon 21 Oct 2013, 05:15 (13 years ago) parent6d6dd3378cb44b
2 files changed+3−3
src/Database/PostgreSQL/Simple/HStore/Implementation.hs+2−2 src/Database/PostgreSQL/Simple/Types.hs+1−1
src/Database/PostgreSQL/Simple/HStore/Implementation.hs+2−2
@@ -112,7 +112,7 @@ instance ToField HStoreBuilder where
112112 toField Empty = toField (BS.empty)
113113 toField (Comma x) = toField (Blaze.toLazyByteString x)
114114
115−newtype HStoreList = HStoreList [(Text,Text)] deriving (Typeable, Show)
115+newtype HStoreList = HStoreList {fromHStoreList :: [(Text,Text)]} deriving (Typeable, Show)
116116
117117-- | hstore
118118instance ToHStore HStoreList where
@@ -139,7 +139,7 @@ instance FromField HStoreList where
139139 Right (Right val) ->
140140 return val
141141
142−newtype HStoreMap = HStoreMap (Map Text Text) deriving (Eq, Ord, Typeable, Show)
142+newtype HStoreMap = HStoreMap {fromHStoreMap :: Map Text Text} deriving (Eq, Ord, Typeable, Show)
143143
144144instance ToHStore HStoreMap where
145145 toHStore (HStoreMap xs) = Map.foldrWithKey f mempty xs
src/Database/PostgreSQL/Simple/Types.hs+1−1
@@ -109,7 +109,7 @@ newtype In a = In a
109109 deriving (Eq, Ord, Read, Show, Typeable, Functor)
110110
111111-- | Wrap binary data for use as a @bytea@ value.
112−newtype Binary a = Binary a
112+newtype Binary a = Binary {fromBinary :: a}
113113 deriving (Eq, Ord, Read, Show, Typeable, Functor)
114114
115115-- | A composite type to parse your custom data structures without