GADTless Programming in Haskell 98

Generalized algebraic data types (GADTs) allow to write sophisticated, type-safe programs and transformations. But not many languages, respectively their underlying implementations, support GADTs. We show that Pottier’s and Gauthier’s polymorphic typed defunctionalization, which was supposed to rely on GADTs, can actually be represented in Haskell 98. Our results help to get a better understanding of GADTs and we identify sufficient conditions under which we can replace GADTs with features available in standardized languages such as Haskell 98.

[1]  Andrew Kennedy,et al.  Generalized algebraic data types and object-oriented programming , 2005, OOPSLA '05.

[2]  Simon L. Peyton Jones,et al.  Type Classes in Haskell , 1994, ESOP.

[3]  Yann Régis-Gianas,et al.  Towards Efficient, Typed LR Parsers , 2006, Electron. Notes Theor. Comput. Sci..

[4]  Chiyan Chen,et al.  Implementing Cut Elimination: A Case Study of Simulating Dependent Types in Haskell , 2004, PADL.

[5]  Tim Sheard,et al.  WHAT IS A PROOF , 2005 .

[6]  Simon L. Peyton Jones,et al.  System F with type equality coercions , 2007, TLDI '07.

[7]  S. Doaitse Swierstra,et al.  Typing dynamic typing , 2002, ICFP '02.

[8]  Stephanie Weirich,et al.  Type-safe cast: (functional pearl) , 2000, ICFP '00.

[9]  Martin Odersky,et al.  Type Inference with Constrained Types , 1999, Theory Pract. Object Syst..

[10]  S. Griffis EDITOR , 1997, Journal of Navigation.

[11]  James Cheney,et al.  First-Class Phantom Types , 2003 .

[12]  Michael J. Maher,et al.  Unification Revisited , 1988, Foundations of Deductive Databases and Logic Programming..

[13]  Karl Crary,et al.  Flexible type analysis , 1999, ICFP '99.

[14]  Joseph R. Shoenfield,et al.  Mathematical logic , 1967 .

[15]  Henrik Nilsson,et al.  Dynamic optimization for functional reactive programming using generalized algebraic data types , 2005, ICFP '05.

[16]  James Cheney,et al.  A lightweight implementation of generics and dynamics , 2002, Haskell '02.

[17]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.

[18]  Robin Milner,et al.  Definition of standard ML , 1990 .

[19]  François Pottier,et al.  Polymorphic typed defunctionalization , 2004, POPL.

[20]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.

[21]  Zhe Yang Encoding types in ML-like languages , 2004, Theor. Comput. Sci..

[22]  John C. Reynolds,et al.  Definitional Interpreters Revisited , 1998, High. Order Symb. Comput..

[23]  Martin Sulzmann,et al.  A Systematic Translation of Guarded Recursive Data Typesto Existential Types , 2004 .

[24]  Emir Pasalic,et al.  The role of type equality in meta-programming , 2004 .