haskell-persistent

Couldn't match type ‘PersistEntityBackend (Entity a)’ with ‘SqlBackend’

谁都会走 提交于 2021-01-28 12:37:24
问题 I've got the following: asSqlBackendReader :: ReaderT SqlBackend m a -> ReaderT SqlBackend m a asSqlBackendReader = id insertEnt :: (Entity a) -> IO (Key (Entity a)) insertEnt x = runWithDb $ do insert $ x where runWithDb = runSqlite "test.db" . asSqlBackendReader The purpose of the asSqlBAckendReader is due to Persistent selectList causing error of "Couldn't match type ‘BaseBackend backend0’ with ‘SqlBackend’". I'm running into an error of: • Couldn't match type ‘PersistEntityBackend (Entity

Couldn't match type ‘PersistEntityBackend (Entity a)’ with ‘SqlBackend’

落爺英雄遲暮 提交于 2021-01-28 12:32:40
问题 I've got the following: asSqlBackendReader :: ReaderT SqlBackend m a -> ReaderT SqlBackend m a asSqlBackendReader = id insertEnt :: (Entity a) -> IO (Key (Entity a)) insertEnt x = runWithDb $ do insert $ x where runWithDb = runSqlite "test.db" . asSqlBackendReader The purpose of the asSqlBAckendReader is due to Persistent selectList causing error of "Couldn't match type ‘BaseBackend backend0’ with ‘SqlBackend’". I'm running into an error of: • Couldn't match type ‘PersistEntityBackend (Entity

Persistent selectList causing error of “Couldn't match type ‘BaseBackend backend0’ with ‘SqlBackend’”

故事扮演 提交于 2019-12-11 01:06:29
问题 I'm running into the below compile error: • Couldn't match type ‘BaseBackend backend0’ with ‘SqlBackend’ arising from a use of ‘runSqlite’ The type variable ‘backend0’ is ambiguous • In the expression: runSqlite ":memory:" In the expression: runSqlite ":memory:" $ do { records <- selectList [UserUsername ==. "abc"] [LimitTo 10]; liftIO $ print (records :: [Entity User]) } In an equation for ‘selectAll’: selectAll = runSqlite ":memory:" $ do { records <- selectList [UserUsername ==. "abc"]