purescript-selda icon indicating copy to clipboard operation
purescript-selda copied to clipboard

Type error message in nested aggregate query with missing `aggregate` call

Open Kamirus opened this issue 4 years ago • 0 comments

selectFrom_
  (selectFrom table \{ id } → do -- missing `aggregate $` before selectFrom
      pid ← groupBy id
      pure { pid })
  pure

results in an unclear error message

The inferred type

∀ t39 t62 t78
. Mapping OuterCols (Aggr (Inner t39) Int) t62
⇒ FoldingWithIndex ExtractCols (SProxy "pid") (Array (Tuple String ...)) t62 (Array (Tuple String ...))
⇒ MappingWithIndex SubQueryResult (SProxy "pid") t62 t78
⇒ FullQuery t39 { pid ∷ t78 }

has type variables which are not mentioned in the body of the type.
Consider adding a type annotation.

in value declaration ...
PureScript(AmbiguousTypeVariables)

Kamirus avatar Sep 25 '19 15:09 Kamirus