Incorporates strong typing over predicate logic programming, and, conversely, incorporates predicate logic programming into strongly typed functional languages. The style of predicate logic is from Prolog; the strongly typed functional language is Haskell.
October 21st, 2016: You have l1 :: [(v, [(k, x)])] You need the transformation l2 :: [(k, [(v, x)])] Redistribute v and k in one line Props for elegance
Francisco T @aiceou redist xs = fromListWith (++) $ concat $ (map f xs) where f (a,ys) = map (\(x,y) -> (x,[(a,y)])) ys ... but k has to be 'Ord'