-- | Fetch the top customers in one region (by number of orders)
regionsTopCustomers :: Text -> Integer -> Q [(Text, [Customer])]
regionsTopCustomers rn k =
    [ pair (n_nameQ n)
           (topK k (length . custOrders)
                   [ c | c <- customers, c_nationkeyQ c == n_nationkeyQ n ])
    | r <- regions
    , r_nameQ r == toQ rn
    , n <- regionNations r
    ]
regionsTopCustomers :: Text -> Integer -> Q [(Text, [Customer])]
regionsTopCustomers rn k =
    [ pair (n_nameQ n)
           (topK k (length . custOrders)
                   [ c | c <- customers, c_nationkeyQ c == n_nationkeyQ n ])
    | r <- regions
    , r_nameQ r == toQ rn
    , n <- regionNations r
    ]
regionsTopCustomers rn k =
    [ pair (n_nameQ n)
           (topK k (length . custOrders)
                   [ c | c <- customers, c_nationkeyQ c == n_nationkeyQ n ])
    | r <- regions
    , r_nameQ r == toQ rn
    , n <- regionNations r
    ]