How to flatten a nested tuple?

zjffdu picture zjffdu · Dec 4, 2012 · Viewed 13.4k times · Source

I have a nested tuple structure like (String,(String,Double)) and I want to transform it to (String,String,Double). I have various kinds of nested tuple, and I don't want to transform each manually. Is there any convenient way to do that?

Answer

xiefei picture xiefei · Dec 4, 2012

If you use shapeless, this is exactly what you need, I think.