aloiscochard/scalaz-transfigure — pull request #3 by m50d (2014-09-15 10:01:57+00:00)
Title: Reimplement generically in the height of the stack, using Shapeless

This is a complete implementation of a version of transfigure which is generic in the height of the stack. As mentioned on IRC, while I initially thought this would require macros, it's actually possible in pure Scala using Shapeless. (Or we could reimplement HList and Nat if you'd prefer not to depend on Shapeless).

All existing test cases pass and I've added a couple of tests for a 3-deep stack. The code should work for arbitrary stacks, although more test coverage wouldn't hurt (I just haven't had time to add more cases - will try and add some after I've done my talk based on this implementation).

Regressions are:

* need to specify the number of contexts; `.transfigureTo` is now `.transfigureTo1`, `.transfigureTo2` etc. This is necessary since with the generic implementation, all these methods have the same erasure. A workaround might be possible by e.g. defining marker traits that the different `.transfigureTo*` implement, or might be impossible; I haven't looked into this in any detail.
* loss of the `@implicitNotFound` error messages. It's probably possible to get them back, I just haven't figured out how. (IMO they weren't hugely valuable, but obviously you may disagree). I'd welcome a fix to this if you can see one.

A few non-code changes; you're welcome to undo any or all of these:
* removed kind-projector as I'm more comfortable working directly with type lambdas
* moved everything into scalaz.transfigure package as I didn't want to pollute the scalaz namespace with all the extra type-level programming machinery
* moved files into src/*/scala/scalaz/transfigure as eclipse expects filesystem layout to match package layout, and doesn't always find sources when debugging if they're not in the appropriate folder
* added junit dependency and annotations to make it easier to run tests from eclipse
* added a basic readme, mostly as a place to put the todos I came up with