I wouldn't call this a hack... this is actually quite common when doing parsing type work; though, it could perhaps be better abstracted into a return/parameter type inspection API.