bitemyapp / esqueleto

New home of Esqueleto, please file issues so we can get things caught up!
BSD 3-Clause "New" or "Revised" License
370 stars 107 forks source link

TypeError instance for Tuple #269

Open parsonsmatt opened 3 years ago

parsonsmatt commented 3 years ago

A coworker had a bug where they wrote:

from $ 
  Table @Foo
  `InnerJoin`
  Table @Bar
    `on` 
      ( \(foo, bar) -> foo ^. FooId ==. bar ^. BarFooId
      )

The error was pretty gnarly.

Could not deduce (Database.Esqueleto.Experimental.ToInnerJoin
                          Database.Esqueleto.Experimental.NotLateral
                          (E.From (E.SqlExpr (Entity Foo)))
                          (E.From (E.SqlExpr (Entity Bar)))
                          (E.SqlExpr (Entity Foo), E.SqlExpr (Entity Bar)))

If we had a type error instance with ToInnerJoin a b c (d, e) then we may be able to provide a better error mesage.

belevy commented 3 years ago

Probably don't want that at the ToInnerJoin level but rather at the ToFrom level no? Also the lower case version probably has a better error.