It’s there a reason I should expect Defaultable / Applicative (Map Int) to do what it does? I’m looking at the innerJoin and think that without knowing the implementation I don’t know if it’s going to join or zip or do some sort of unique union or… Is the naming here relying on some convention?
(just realised my reaction is opposite to dfa - I see what the SQL does, but no idea what to expect from defaultable)
For the behavior you are interested in, Defaultable’s Applicative instance delegates to the underlying Apply instance, so it comes down to whether or not you trust the underlying Map-like type to have implemented Apply sensibly
I also don’t know how many law-abiding Apply instances that you can write for a Map-like type. I can only think of one at the moment but there could be more.
It’s there a reason I should expect Defaultable / Applicative (Map Int) to do what it does? I’m looking at the innerJoin and think that without knowing the implementation I don’t know if it’s going to join or zip or do some sort of unique union or… Is the naming here relying on some convention? (just realised my reaction is opposite to dfa - I see what the SQL does, but no idea what to expect from defaultable)
For the behavior you are interested in,
Defaultable
’sApplicative
instance delegates to the underlyingApply
instance, so it comes down to whether or not you trust the underlyingMap
-like type to have implementedApply
sensiblyI also don’t know how many law-abiding
Apply
instances that you can write for aMap
-like type. I can only think of one at the moment but there could be more.Interesting article. Very well motivated with the left join example.
I do agree the three-way join example is a bit more intuitive than the equiv sql.
I would guess this gap would widen with more tables in the join (and mixing join types).
Btw, the table schemas are missing a primary key on id :)