The qm-interpolated-string package

[ Tags: data, library, public-domain ] [ Propose Tags ]

Implementation of interpolated multiline strings that ignores indentation and trailing whitespaces

[Skip to Readme]


Change log
Dependencies base (==4.*), bytestring (==0.10.*), haskell-src-meta (>=0.3 && <0.8), template-haskell (>=2.5 && <3), text (==1.*) [details]
License PublicDomain
Copyright Viacheslav Lotsmanov
Author Viacheslav Lotsmanov
Maintainer Viacheslav Lotsmanov <>
Category Data
Home page
Source repository head: git clone git://
Uploaded Thu Jul 13 20:44:13 UTC 2017 by unclechu
Distributions NixOS:
Downloads 92 total (5 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for qm-interpolated-string-

[back to package description]


Hackage Build Status

Implementation of interpolated multiline string QuasiQuoter that ignores indentation and trailing whitespaces.

Actually it's modification of interpolatedstring-perl6 package. I used it to implemenent my own strings I really like.

This implementation looks just like qc from interpolatedstring-perl6 package but ignores any indentation, line breaks (except explicitly written using \n char) and trailing whitespaces.

'm' in 'qm' means 'multiline'.

You could write a decoratively formatted string and your decorative indentation and line breaks wont go to the string, but when you really need it, you could just escape it using backslash.

Simple usage example

{-# LANGUAGE QuasiQuotes #-}

import Text.InterpolatedString.QM (qm)

main :: IO ()
main = putStrLn [qm| hello
                   \ world |]

More examples

[qm|   hello world,
     \ what's going on here?  |]
-- Result: "hello world, what's going on here?"
      it's actual
      ly ignored
-- Result: "it's actually ignored"
[qm|  \  You could explicitly escape indentation or\n
         line-breaks when you really need it!  \
-- Result: "  You could explicitly escape indentation or\nline-breaks when you really need it!  "
[qm| {1+2} \{3+4} |]
-- Result: "3 {3+4}"

There is also very similar to qm QuasiQuoter named as qn that do the same except interpolation:

[qn| foo {1+2} |]
-- Result: "foo {1+2}"


Viacheslav Lotsmanov


The Unlicense