J'ai les suivantes:Impossible type de correspondance « PersistEntityBackend (entité a) » avec « SqlBackend »
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
Le but du asSqlBAckendReader
est due à Persistent selectList causing error of "Couldn't match type ‘BaseBackend backend0’ with ‘SqlBackend’".
Je suis en cours d'exécution dans une erreur de:
• Couldn't match type ‘PersistEntityBackend (Entity a)’
with ‘SqlBackend’
arising from a use of ‘insert’
• In a stmt of a 'do' block: insert $ x
In the second argument of ‘($)’, namely ‘do { insert $ x }’
In the expression: runWithDb $ do { insert $ x }
Oh oui, cette contrainte manquante devrait également faire partie de la signature. Je vais mettre à jour avec une explication. –