Type inference and type checking for functional programming languages: A reduced computation approach

It is well recognized that type checking and in fe rence sys tems are very i mpor t a n t to develop correct programs if the p rogramming languages used are typeless such as Backus F'P, Lisp, Prolog and Smalltalk. In these languages it is s o m e t i m e hard to u n d e r s t a n d programs due to the lack of type informat ion , and we have to resort to costly r un t ime debugging ins tead of efficient compi le t ime error checking for finding program errors. To make the compi l e t ime error checking possible even for such type less languages, it is necessary to have means by which we can know the type i n f o r m a t i o n of the programs wi thout execut ing them. This is called a type in fe rence p rob lem and several works have been reported. Morris and Reynolds considered the p rob lem for a func t iona l language [9],[10] and gave a m e t h o d of finding the types. Milner ex tended their resul ts and proposed a type inference m e t h o d based on the unif icat ion algori thm of Robinson [7],[11]. Thei r approach is to assign a type express ion, which is made of type variables, to each func t ion appearing in the program and get equa t ions which hold a mong these variables. Solving these equat ions give the desired types. Several au thers cons idered the p rob lem for k-calculus based func t iona l languages [2],[6] ,[8] ,[13]. As for Backus FP language, F rank tried to build a sys tem for finding domain and range of func t ions defined by VP programs [3]. Gut tag, Horn ing and Wil l iams cons idered how to perform type checking of FP programs algebraically [4]. Suzuki cons ide red type in fe rence of Small talk [12].