Versionbump: Removed redundant constraints, added missing constraints.
This commit is contained in:
parent
98626ecb4e
commit
38aaed87db
@ -99,7 +99,7 @@ updateGetEntity k = fmap (Entity k) . updateGet k
|
||||
|
||||
-- | insert or replace a record based on a single uniqueness constraint
|
||||
-- this function was meant to be supplied with the uniqueness constraint, but it would be unsafe if the uniqueness constraint would not match the supplied record
|
||||
replaceBy :: (PersistUniqueWrite backend, MonadIO m, OnlyOneUniqueKey record, PersistEntityBackend record ~ BaseBackend backend)
|
||||
replaceBy :: (SafeToInsert record, PersistUniqueWrite backend, MonadIO m, OnlyOneUniqueKey record, PersistEntityBackend record ~ BaseBackend backend)
|
||||
=> record -> ReaderT backend m ()
|
||||
replaceBy r = do
|
||||
u <- onlyUnique r
|
||||
@ -158,6 +158,7 @@ checkUniqueKeys (x:xs) = do
|
||||
put :: ( MonadIO m
|
||||
, PersistUniqueWrite backend
|
||||
, PersistRecordBackend record backend
|
||||
, SafeToInsert record
|
||||
)
|
||||
=> record -> ReaderT backend m (Key record)
|
||||
-- ^ `insert`, but remove all records with matching uniqueness constraints first
|
||||
|
||||
@ -55,7 +55,7 @@ routeToPathPiece
|
||||
. renderRoute
|
||||
|
||||
|
||||
instance (RenderRoute site, ParseRoute site) => PathPiece (Route site) where
|
||||
instance ParseRoute site => PathPiece (Route site) where
|
||||
fromPathPiece = routeFromPathPiece
|
||||
toPathPiece = routeToPathPiece
|
||||
|
||||
@ -71,7 +71,7 @@ instance ParseRoute site => FromJSONKey (Route site) where
|
||||
instance RenderRoute site => ToJSONKey (Route site) where
|
||||
toJSONKey = toJSONKeyText routeToPathPiece
|
||||
|
||||
instance (RenderRoute site, ParseRoute site) => Binary (Route site) where
|
||||
instance ParseRoute site => Binary (Route site) where
|
||||
put = Binary.put . toPathPiece
|
||||
get = Binary.get >>= maybe (fail "Could not parse route") return . fromPathPiece
|
||||
|
||||
|
||||
Reference in New Issue
Block a user