fixup subselectUnsafe test because inference engine doesnt work for it so good

This commit is contained in:
belevy 2021-01-31 16:46:29 -06:00
parent 65ac3c7e5a
commit 6a420273c0
2 changed files with 10 additions and 4 deletions

View File

@ -55,6 +55,12 @@ type instance MaybeValueTyToMaybeEntityTy (Aggregate (Value (Maybe val))) ent =
type instance UnMaybeTy (Aggregate (Value (Maybe val))) = Aggregate (Value val)
type instance UnMaybeTy (Aggregate (Maybe (Entity ent))) = Aggregate (Entity ent)
test :: (PersistEntity ent, PersistField a, Integral n)
=> SqlExpr (Maybe (Entity ent))
-> EntityField ent a
-> SqlExpr (Value b)
-> SqlExpr (Value c)
-> SqlQuery (SqlExpr (Value (Maybe a)), SqlExpr (Value b), SqlExpr (Value n), SqlExpr (Value Int))
test ent field y other = do
groupBy (ent, y) $ \(ent', y') ->
pure (ent' ?. field, y', sum_ other, countRows_)

View File

@ -454,10 +454,10 @@ testSubSelect run = do
eres <- try $ run $ do
setup
bad <- select $
from $ \n -> do
from $ \(n :: SqlExpr (Entity Numbers)) -> do
pure $ (,) (n ^. NumbersInt) $
subSelectUnsafe $
from $ \n' -> do
from $ \(n' :: SqlExpr (Entity Numbers)) -> do
pure (just (n' ^. NumbersDouble))
good <- select $
from $ \n -> do
@ -480,10 +480,10 @@ testSubSelect run = do
eres <- try $ run $ do
setup
select $
from $ \n -> do
from $ \(n :: SqlExpr (Entity Numbers)) -> do
pure $ (,) (n ^. NumbersInt) $
subSelectUnsafe $
from $ \n' -> do
from $ \(n' :: SqlExpr (Entity Numbers)) -> do
where_ $ val False
pure (n' ^. NumbersDouble)
case eres of