share [mkPersist sqlSettings] [persistLowerCase|
Person
name String
age Int
deriving Eq Show
|]
query :: SqlPersistM [Entity Person]
query = select $ from \(person :: SqlExpr (Entity Person)) -> do
where_ $ not_ (person.name !=. val "foo" &&. person.age >. val @Int 15)
pure person
produces
SELECT "person"."id", "person"."name", "person"."age" FROM "person" WHERE NOT ("person"."name" != ?) AND ("person"."age" > ?);
expected
SELECT "person"."id", "person"."name", "person"."age" FROM "person" WHERE NOT (("person"."name" != ?) AND ("person"."age" > ?));
produces
expected