clean up type analysis code, fix bug in passing type argument to rules
clean up type analysis code, fix bug in passing type argument to rules

darcs-hash:606450b3a4a79b44212aedf6f1bc3abfe7b485bd

dpwright/jhc,dpwright/jhc,dpwright/jhc,dpwright/jhc