streamly-core-0.2.0: Streaming, parsers, arrays and more
Copyright(c) 2022 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Unicode.String

Contents

Description

Convenient template Haskell quasiquoters to format strings.

Synopsis

Setup

To execute the code examples provided in this module in ghci, please run the following commands first.

>>> :m
>>> :set -XQuasiQuotes
>>> import Streamly.Internal.Unicode.String

str :: QuasiQuoter Source #

A QuasiQuoter that treats the input as a string literal:

>>> [str|x|]
"x"

Any #{symbol} is replaced by the value of the Haskell symbol symbol which is in scope:

>>> x = "hello"
>>> [str|#{x} world!|]
"hello world!"

## means a literal # without the special meaning for referencing haskell symbols:

>>> [str|##{x} world!|]
"#{x} world!"

A # at the end of line means the line continues to the next line without introducing a newline character:

>>> :{
[str|hello#
world!|]
:}
"hello world!"

Bugs: because of a bug in parsers, a lone # at the end of input gets removed.