packages feed

fb-persistent 0.2.1 → 0.3

raw patch · 2 files changed

+16/−8 lines, 2 filesdep ~persistentPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: persistent

API changes (from Hackage documentation)

+ Facebook.Persistent: instance AccessTokenKind kind => PersistFieldSql (AccessToken kind)
+ Facebook.Persistent: instance PersistFieldSql Action
+ Facebook.Persistent: instance PersistFieldSql Id

Files

fb-persistent.cabal view
@@ -1,5 +1,5 @@ name:              fb-persistent-version:           0.2.1+version:           0.3 license:           BSD3 license-file:      LICENSE author:            Felipe Lessa@@ -32,7 +32,7 @@   build-depends:       base       >= 4     && < 5     , fb         >= 0.13-    , persistent >= 0.7   && < 1.2+    , persistent == 1.2.*     , cereal     == 0.3.*     , time       == 1.4.*     , text
src/Facebook/Persistent.hs view
@@ -16,11 +16,13 @@ module Facebook.Persistent () where  import Control.Applicative ((<$>), (<*>))+import Control.Monad (liftM) import Data.String (fromString) import Data.Text (Text) import Data.Int (Int64) import Data.Word (Word8) import Database.Persist+import Database.Persist.Sql import Facebook import qualified Data.Serialize as S import qualified Data.Text.Encoding as TE@@ -36,10 +38,12 @@           Right _  -> Left "fromPersistValue[Facebook.Action]: \                            \Could not parse action"           Left err -> Left err-    sqlType = sqlType . show-    isNullable _ = False +-- | From @fb-persistent@.  Since 0.3.+instance PersistFieldSql Action where+    sqlType = sqlType . liftM show + -- | From @fb-persistent@.  Since 0.1.2. -- -- We use 'ByteString' for historical purposes in order to@@ -47,10 +51,12 @@ instance PersistField Id where     toPersistValue = toPersistValue . TE.encodeUtf8 . idCode     fromPersistValue v = Id . TE.decodeUtf8 <$> fromPersistValue v-    sqlType = sqlType . TE.encodeUtf8 . idCode-    isNullable _ = False +-- | From @fb-persistent@.  Since 0.3.+instance PersistFieldSql Id where+    sqlType = sqlType . liftM (TE.encodeUtf8 . idCode) + -- | From @fb-persistent@.  Since 0.1.3.  Note that your fields -- should either be of type 'UserAccessToken' or -- 'AppAccessToken', not a polymorphic @'AccessToken' kind@.@@ -61,8 +67,10 @@     fromPersistValue v = do       bs <- fromPersistValue v       either (Left . fromString) Right (S.runGet accessTokenGet bs)-    sqlType = sqlType . S.runPut . accessTokenPut-    isNullable _ = False++-- | From @fb-persistent@.  Since 0.3.+instance AccessTokenKind kind => PersistFieldSql (AccessToken kind) where+    sqlType = sqlType . liftM (S.runPut . accessTokenPut)   -- | Since 'AccessToken' is a GADT, our 'S.get' function needs a