Prior papers have presented a fusion framework called stream fusion for removing intermediate data structures from both lists and arrays in Haskell. Stream fusion is unique in using an explicit datatype to accomplish fusion. We demonstrate how this can be exploited in the creation of a new Haskell string representation Text, which achieves better performance and data density than String. Text uses streams not only to accomplish fusion, but also as a way to abstract away from various underlying representations. This allows the same set of combinators to manipulate Unicode text that is stored in a variety of ways.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Peyton-Jones, S.: The Haskell 98 Report (2002)Google Scholar
  2. 2.
    The GHC Team: The Glorious Glasgow Haskell Compilation System User’s Guide, Version 6.12.1Google Scholar
  3. 3.
    Coutts, D., Stewart, D., Leshchinskiy, R.: Rewriting Haskell Strings. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 50–64. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  4. 4.
    Coutts, D., Leshchinskiy, R., Stewart, D.: Stream Fusion: From Lists to Streams to Nothing At All. In: ICFP 2007. ACM, New York (October 2007)Google Scholar
  5. 5.
    The Unicode Consortium: The Unicode Standard, Version 5.2.0 (2010)Google Scholar
  6. 6.
    Gill, A., Launchbury, J., Peyton-Jones, S.: A Short Cut to Deforestation. In: ICFP 1993, pp. 223–232. ACM, New York (1993)Google Scholar
  7. 7.
    Svenningsson, J.: Shortcut fusion for accumulating parameters & zip-like functions. In: ICFP 2002, pp. 124–132. ACM, New York (2002)Google Scholar
  8. 8.
    Petyon-Jones, S., Tolmach, A., Hoare, T.: Playing by the Rules: Rewriting as a practical optimisation technique in GHC. In: Haskell Workshop, ACM SIGPLAN, pp. 203–233 (2001)Google Scholar
  9. 9.
    Harper, T.: Fusion on Haskell Unicode Strings, Master’s Thesis, University of Oxford (2008)Google Scholar
  10. 10.
    Claessen, K., Hughes, J.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: ICFP 2000. ACM, New York (2000)Google Scholar
  11. 11.
    Hinze, R., Paterson, R.: Finger trees: a simple general-purpose data structure. Journal of Functional Programming 16(2) (2006)Google Scholar
  12. 12.
    Boehm, H.J., Atkinson, R., Plass, M.: Ropes: an Alternative to Strings. Software: Practice and Experience 25(12), 1315–1330 (1995)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Thomas Harper
    • 1
  1. 1.Computing LaboratoryOxford UniversityOxfordUnited Kingdom

Personalised recommendations