milessabin/shapeless — pull request #97 by al3xar (2014-06-06 19:30:51+00:00)
Title: Fixes in ToList (fixes https://github.com/milessabin/shapeless/issues/32)

Calling .toList on an HList made of higher kinded types often returns a List[Any] if the toList method is not suggested the right type. See https://github.com/milessabin/shapeless/issues/32.

This PR is a slight modification of the implicits of ToList. They make calling .toList on an HList returning a list with the same type that the compiler would have inferred if given the same items in a (standard) list, when higher kinded types are involved. In particular, it fixes https://github.com/milessabin/shapeless/issues/32.

Without this fix, we usually get a List[Any] when one would have expected a List[M[...]]. See the added tests.

There are still some cases that do not work well, when dealing with HLists made of existentials in particular. These are also in the tests, but commented out.

Don't hesitate to ask me if you have any question.

Regards,
Alexandre