A possible Haskell translation of the following C++ type hackery
template<typename Pair>
struct inv_pair
{
typedef std::pair<
typename Pair::second_type,
typename Pair::first_type
> type;
};
typedef std::pair<int, std::string> pair_t1;
typedef inv_pair<pair_t1>::type inv_pair_t1;
could be the following
{-# LANGUAGE TypeFamilies #-}
type family Swap t
type instance Swap (a,b) = (b,a)
type Pair_t1 = (Int, String)
type Inv_Pair_t1 = Swap Pair_t1
I am not so sure this would be useful in practice, though.