cartesian package:nonempty-containers

Calculate the Cartesian product of two sets.
cartesianProduct xs ys = fromList $ liftA2 (,) (toList xs) (toList ys)
Example:
cartesianProduct (fromList (1:|[2])) (fromList ('a':|['b'])) =
fromList ((1,'a') :| [(1,'b'), (2,'a'), (2,'b')])