The qm-interpolated-string package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Implementation of interpolated multiline strings that ignores indentation and trailing whitespaces


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0
Change logNone available
Dependenciesbase (==4.*), bytestring (==0.10.*), haskell-src-meta (>=0.3 && <0.8), template-haskell (>=2.5 && <3), text (==1.*) [details]
LicensePublicDomain
CopyrightViacheslav Lotsmanov
AuthorViacheslav Lotsmanov
MaintainerViacheslav Lotsmanov <lotsmanov89@gmail.com>
CategoryData
Home pagehttps://github.com/unclechu/haskell-qm-interpolated-string
Source repositoryhead: git clone git://github.com/unclechu/haskell-qm-interpolated-string.git
UploadedWed Mar 8 18:44:55 UTC 2017 by unclechu

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for qm-interpolated-string-0.1.0.0

[qm|interpolated-string|]

Build Status

Implementation of interpolated multiline strings that ignores indentation and trailing whitespaces.

It's QuasiQuoter.

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?"
[qm|
      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}"

Author

Viacheslav Lotsmanov

License

The Unlicense