Fixing type-erasure for function entities (Not finished)

See http://stackoverflow.com/questions/22771859/type-erasure-and-lambdas-partial-template-speciallization-matching-lambda-exp