Type-Safe Code Transformations in Haskell

被引:3
|
作者
Guillemette, Louis-Julien [1 ]
Monnier, Stefan [1 ]
机构
[1] Univ Montreal, Dept Informat & Rech Operat, Montreal, PQ, Canada
关键词
compilation; program verification; type systems; higher-order abstract syntax;
D O I
10.1016/j.entcs.2006.10.036
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
The use of typed intermediate languages can significantly increase the reliability of a compiler. By type-checking the code produced at each transformation stage, one can identify bugs in the compiler that would otherwise be much harder to find. We propose to take the use of types in compilation a step further by verifying that the transformation itself is type correct, in the sense that it is impossible that it produces an ill typed term given a well typed term as input. We base our approach on higher-order abstract syntax (HOAS), a representation of programs where variables in the object language are represented by meta-variables. We use a representation that accounts for the object language's type system using generalized algebraic data types (GADTs). In this way, the full binding and type structure of the object language is exposed to the host language's type system. In this setting we encode a type preservation property of a CPS conversion in Haskell's type system, using witnesses of a type correctness proof encoded in a GADT.
引用
收藏
页码:23 / 39
页数:17
相关论文
共 50 条
  • [1] Type-Safe Observable Sharing in Haskell
    Gill, Andy
    [J]. HASKELL'09: PROCEEDINGS OF THE 2009 ACM SIGPLAN HASKELL SYMPOSIUM, 2009, : 117 - 128
  • [2] WHAT IS TYPE-SAFE CODE REUSE
    PALSBERG, J
    SCHWARTZBACH, MI
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1991, 512 : 325 - 341
  • [3] CCured: Type-safe retrofitting of legacy code
    Necula, GC
    McPeak, S
    Weimer, W
    [J]. ACM SIGPLAN NOTICES, 2002, 37 (01) : 128 - 139
  • [4] Expressive and Strongly Type-Safe Code Generation
    Winant, Thomas
    Cockx, Jesper
    Devriese, Dominique
    [J]. PROCEEDINGS OF THE 19TH INTERNATIONAL SYMPOSIUM ON PRINCIPLES AND PRACTICE OF DECLARATIVE PROGRAMMING (PPDP 2017), 2017, : 199 - 210
  • [5] CCured: Type-Safe Retrofitting of Legacy Code
    Necula, George C.
    McPeak, Scott
    Weimer, Westley
    [J]. ACM SIGPLAN NOTICES, 2012, 47 (04) : 74 - 85
  • [6] Fault-Safe Code Motion for Type-Safe Languages
    Murphy, Brian R.
    Menon, Vijay
    Schneider, Florian T.
    Shpeisman, Tatiana
    Adl-Tabatabai, Ali-Reza
    [J]. CGO 2008: SIXTH INTERNATIONAL SYMPOSIUM ON CODE GENERATION AND OPTIMIZATION, PROCEEDINGS, 2008, : 144 - 154
  • [7] Type-safe Runtime Code Generation: Accelerate to LLVM
    McDonell, Trevor L.
    Chakravarty, Manuel M. T.
    Grover, Vinod
    Newton, Ryan R.
    [J]. ACM SIGPLAN NOTICES, 2015, 50 (12) : 201 - 212
  • [8] Type-safe casting
    Hsieh, Wilson C.
    Fiuczynski, Marc E.
    Pardyak, Przemyslaw
    Bershad, Brian N.
    [J]. Software - Practice and Experience, 1998, 28 (11): : 1245 - 1252
  • [9] Type-safe disks
    Sivathanu, Gopalan
    [J]. USENIX ASSOCIATION 7TH USENIX SYMPOSIUM ON OPERATING SYSTEMS DESIGN AND IMPLEMENTATION, 2006, : 15 - 28
  • [10] Type-safe cast
    Weirich, S
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2004, 14 : 681 - 695