What I want to do is something like this:
Take an arbitrary polymorphic tuple:
x = (((1, \"\"), Nothing), (\'\', 6))
And reorganize wit
I'm still recent to Haskell but I'd do this with a pattern-matching function.
converter :: (((Int, String), Maybe a), (Char, Int)) -> (Int, (Char, Maybe Int, (String, (Int, ()))))
converter (((i1, s), m), (c, i2)) = (i1, (c, (m, (s, (i2, ())))))
You of course could replace all the concrete types with type variables and it would also work.
converter :: (((a, b), c), (d, e)) -> (a, (d, c, (b, (e, ()))))
converter (((i1, s), m), (c, i2)) = (i1, (c, (m, (s, (i2, ())))))
(Obviously you'd want to get the types in the correct order and make sure this all compiles.)