ArthurTeisseire/joinable-dict/1.0.1

Dict.Joinable

Let you create any joinable type easily.

This is the api used by Dict.OneToOne and Dict.ManyToOne implementations. A good other container implementation would be a database table with a forward key in addition to the primary key.

To make your container "joinable", you just need to provide a way to convert it into a Dict. Then add a from, innerJoin and (optionally) leftOuterJoin method like this:

import Dict.Joinable


from =
    Dict.Joinable.from convertMyContainerToDict


innerJoin =
    Dict.Joinable.innerJoin convertMyContainerToDict


leftOuterJoin =
    Dict.Joinable.leftOuterJoin convertMyContainerToDict


convertMyContainerToDict : MyContainer a -> Dict comparable a
convertMyContainerToDict =
    ...
(joinable -> Dict comparable a)
-> joinable
-> (a -> result)
-> Dict comparable result

Equivalent to SQL FROM

(joinable -> Dict comparable a)
-> joinable
-> Dict comparable (a -> result)
-> Dict comparable result

Equivalent to SQL INNER JOIN

(joinable -> Dict comparable a)
-> joinable
-> Dict comparable (Maybe a -> result)
-> Dict comparable result

Equivalent to SQL LEFT OUTER JOIN