Skip to content
String interpolation for Haskell done right!
Haskell
Find file
Latest commit 20fec41 May 24, 2015 @sol Add package.yaml

README.markdown

String interpolation done right!

There is not much here yet. But bellow is an example and links to other string interpolation libraries.

Example

>>> :set -XQuasiQuotes
>>> import Data.String.Interpolate

Interpolates strings

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

or integers

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

or arbitrary Haskell expressions

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

Other string interpolation libraries for Haskell

There are many other string interpolation libraries for Haskell, each with it's own set of limitations. Here is a short list, a more thorough analysis will follow.

There are more at http://www.haskell.org/haskellwiki/Quasiquotation and http://packdeps.haskellers.com/reverse/haskell-src-meta.

Something went wrong with that request. Please try again.