Haskell Is Not Not ML

  • Ben Rudiak-Gould
  • Alan Mycroft
  • Simon Peyton Jones
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3924)


We present a typed calculus IL (“intermediate language”) which supports the embedding of ML-like (strict, eager) and Haskell-like (non-strict, lazy) languages, without favoring either. IL’s type system includes negation (continuations), but not implication (function arrow). Within IL we find that lifted sums and products can be represented as the double negation of their unlifted counterparts. We exhibit a compilation function from IL to AM—an abstract von Neumann machine—which maps values of ordinary and doubly negated types to heap structures resembling those found in practical implementations of languages in the ML and Haskell families. Finally, we show that a small variation in the design of AM allows us to treat any ML value as a Haskell value at runtime without cost, and project a Haskell value onto an ML type with only the cost of a Haskell deepSeq. This suggests that IL and AM may be useful as a compilation and execution model for a new language which combines the best features of strict and non-strict functional programming.


Operational Semantic Double Negation Instruction Sequence Abstract Machine Intermediate Language 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Appel, A.W.: Compiling With Continuations. Cambridge University Press, Cambridge (1992)Google Scholar
  2. 2.
    Curien, P.-L., Herbelin, H.: The duality of computation. In: Proc. ICFP (2000), http://pauillac.inria.fr/~herbelin/habilitation/icfp-CurHer00-duality+errata.ps
  3. 3.
    Griffin, T.G.: A formulae-as-types notion of control. In: Proc. POPL 1990 (1990)Google Scholar
  4. 4.
    Jones, S.P.: Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Journal of Functional Programming 2(2), 127–202 (1992)MathSciNetCrossRefMATHGoogle Scholar
  5. 5.
    Jones, S.P., Launchbury, J., Shields, M., Tolmach, A.: Bridging the gulf: a common intermediate language for ML and Haskell. In: Proc. POPL (1998), http://www.cartesianclosed.com/pub/intermediate_language/neutral.ps
  6. 6.
    Plotkin, G.D.: Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science 1, 125–159 (1975), http://homepages.inf.ed.ac.uk/gdp/publications/cbn_cbv_lambda.pdf MathSciNetCrossRefMATHGoogle Scholar
  7. 7.
    Rudiak-Gould, B.: The NotNotML project website, http://www.cl.cam.ac.uk/~br276/notnotML/
  8. 8.
    van Bakel, S., Lengrand, S., Lescanne, P.: The language X: circuits, computations and Classical Logic. In: Proc. ICTCS (2005), http://www.doc.ic.ac.uk/~svb/Research/Abstracts/vBLL.html
  9. 9.
    Wadler, P.: Call-by-value is dual to call-by-name. In: Proc. ICFP 2003, pp. 189–201 (2003), http://homepages.inf.ed.ac.uk/wadler/papers/dual/dual.pdf

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Ben Rudiak-Gould
    • 1
  • Alan Mycroft
    • 1
  • Simon Peyton Jones
    • 2
  1. 1.University of Cambridge Computer LaboratoryUK
  2. 2.Microsoft Research CambridgeUK

Personalised recommendations