HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleinterpolate-0.2.1Haskell2010

Data.String.Interpolate

Contents
  1. String interpolation done right
Synopsis
  • value i

String interpolation done right

The examples in this module use QuasiQuotes. Make sure to enable the corresponding language extension.

Example2 expressions
:set -XQuasiQuotesimport Data.String.Interpolate
valuei :: QuasiQuoter

A QuasiQuoter for string interpolation. Expression enclosed within #{...} are interpolated, the result has to be in the Show class.

It interpolates strings

Example2 expressions
let name = "Marvin"putStrLn [i|name: #{name}|]name: Marvin

or integers

Example2 expressions
let age = 23putStrLn [i|age: #{age}|]age: 23

or arbitrary Haskell expressions

Example2 expressions
let profession = "\955-scientist"putStrLn [i|profession: #{unwords [name, "the", profession]}|]profession: Marvin the λ-scientist