monad-persist > configure
monad-persist > Configuring monad-persist-0.0.3.0...
monad-persist > build
monad-persist > Preprocessing library for monad-persist-0.0.3.0..
monad-persist > Building library for monad-persist-0.0.3.0..
monad-persist > [1 of 2] Compiling Control.Monad.Persist
monad-persist >
monad-persist > /run/user/1000/stack-62874c5080fdde7f/monad-persist-0.0.3.0/library/Control/Monad/Persist.hs:435:31: error:
monad-persist > • Could not deduce (Sql.OnlyOneUniqueKey record)
monad-persist > arising from a use of ‘Sql.upsert’
monad-persist > from the context: MonadBaseControl IO m
monad-persist > bound by the instance declaration
monad-persist > at library/Control/Monad/Persist.hs:415:10-75
monad-persist > or from: (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend)
monad-persist > bound by the type signature for:
monad-persist > upsert :: forall record.
monad-persist > (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend) =>
monad-persist > record -> [Update record] -> PersistT backend m (Entity record)
monad-persist > at library/Control/Monad/Persist.hs:435:3-8
monad-persist > Possible fix:
monad-persist > add (Sql.OnlyOneUniqueKey record) to the context of
monad-persist > the type signature for:
monad-persist > upsert :: forall record.
monad-persist > (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend) =>
monad-persist > record -> [Update record] -> PersistT backend m (Entity record)
monad-persist > • In the second argument of ‘($)’, namely ‘Sql.upsert a b’
monad-persist > In the expression: liftPersistT $ Sql.upsert a b
monad-persist > In an equation for ‘upsert’:
monad-persist > upsert a b = liftPersistT $ Sql.upsert a b
monad-persist > |
monad-persist > 435 | upsert a b = liftPersistT $ Sql.upsert a b
monad-persist > | ^^^^^^^^^^^^^^
monad-persist >
monad-persist > /run/user/1000/stack-62874c5080fdde7f/monad-persist-0.0.3.0/library/Control/Monad/Persist.hs:436:33: error:
monad-persist > • Could not deduce (Sql.AtLeastOneUniqueKey record)
monad-persist > arising from a use of ‘Sql.getByValue’
monad-persist > from the context: MonadBaseControl IO m
monad-persist > bound by the instance declaration
monad-persist > at library/Control/Monad/Persist.hs:415:10-75
monad-persist > or from: (PersistUniqueRead backend,
monad-persist > PersistRecordBackend record backend)
monad-persist > bound by the type signature for:
monad-persist > getByValue :: forall record.
monad-persist > (PersistUniqueRead backend, PersistRecordBackend record backend) =>
monad-persist > record -> PersistT backend m (Maybe (Entity record))
monad-persist > at library/Control/Monad/Persist.hs:436:3-12
monad-persist > Possible fix:
monad-persist > add (Sql.AtLeastOneUniqueKey record) to the context of
monad-persist > the type signature for:
monad-persist > getByValue :: forall record.
monad-persist > (PersistUniqueRead backend, PersistRecordBackend record backend) =>
monad-persist > record -> PersistT backend m (Maybe (Entity record))
monad-persist > • In the second argument of ‘($)’, namely ‘Sql.getByValue a’
monad-persist > In the expression: liftPersistT $ Sql.getByValue a
monad-persist > In an equation for ‘getByValue’:
monad-persist > getByValue a = liftPersistT $ Sql.getByValue a
monad-persist > |
monad-persist > 436 | getByValue a = liftPersistT $ Sql.getByValue a
monad-persist > | ^^^^^^^^^^^^^^^^
monad-persist >
monad-persist > /run/user/1000/stack-62874c5080fdde7f/monad-persist-0.0.3.0/library/Control/Monad/Persist.hs:437:31: error:
monad-persist > • Could not deduce (Sql.AtLeastOneUniqueKey record)
monad-persist > arising from a use of ‘Sql.insertBy’
monad-persist > from the context: MonadBaseControl IO m
monad-persist > bound by the instance declaration
monad-persist > at library/Control/Monad/Persist.hs:415:10-75
monad-persist > or from: (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend)
monad-persist > bound by the type signature for:
monad-persist > insertBy :: forall record.
monad-persist > (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend) =>
monad-persist > record -> PersistT backend m (Either (Entity record) (Key record))
monad-persist > at library/Control/Monad/Persist.hs:437:3-10
monad-persist > Possible fix:
monad-persist > add (Sql.AtLeastOneUniqueKey record) to the context of
monad-persist > the type signature for:
monad-persist > insertBy :: forall record.
monad-persist > (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend) =>
monad-persist > record -> PersistT backend m (Either (Entity record) (Key record))
monad-persist > • In the second argument of ‘($)’, namely ‘Sql.insertBy a’
monad-persist > In the expression: liftPersistT $ Sql.insertBy a
monad-persist > In an equation for ‘insertBy’:
monad-persist > insertBy a = liftPersistT $ Sql.insertBy a
monad-persist > |
monad-persist > 437 | insertBy a = liftPersistT $ Sql.insertBy a
monad-persist > | ^^^^^^^^^^^^^^
monad-persist >
monad-persist > /run/user/1000/stack-62874c5080fdde7f/monad-persist-0.0.3.0/library/Control/Monad/Persist.hs:440:33: error:
monad-persist > • Could not deduce (Sql.OnlyOneUniqueKey record)
monad-persist > arising from a use of ‘Sql.onlyUnique’
monad-persist > from the context: MonadBaseControl IO m
monad-persist > bound by the instance declaration
monad-persist > at library/Control/Monad/Persist.hs:415:10-75
monad-persist > or from: (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend)
monad-persist > bound by the type signature for:
monad-persist > onlyUnique :: forall record.
monad-persist > (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend) =>
monad-persist > record -> PersistT backend m (Unique record)
monad-persist > at library/Control/Monad/Persist.hs:440:3-12
monad-persist > Possible fix:
monad-persist > add (Sql.OnlyOneUniqueKey record) to the context of
monad-persist > the type signature for:
monad-persist > onlyUnique :: forall record.
monad-persist > (PersistUniqueWrite backend,
monad-persist > PersistRecordBackend record backend) =>
monad-persist > record -> PersistT backend m (Unique record)
monad-persist > • In the second argument of ‘($)’, namely ‘Sql.onlyUnique a’
monad-persist > In the expression: liftPersistT $ Sql.onlyUnique a
monad-persist > In an equation for ‘onlyUnique’:
monad-persist > onlyUnique a = liftPersistT $ Sql.onlyUnique a
monad-persist > |
monad-persist > 440 | onlyUnique a = liftPersistT $ Sql.onlyUnique a
monad-persist > | ^^^^^^^^^^^^^^^^
monad-persist >
When building against stackage lts-18.1 (persistent-2.13.1.1),
monad-persist fails to build with multiple errors similar to the issue title.
These type classes were introduced by
persistent>=2.10.0;my guess is that the breakage was also introduced by this version.
Error when building monad-persist with persistent>=2.10.0
Adding the suggested constraints allows the package to compile (patch).
I don't know the package well-enough so I can't really say whether this fixes
the issue, other than tests pass (patch required to make the tests pass).
PS: lts-16.31 (persistent-2.10.5.3) is also broken.