nowdoc
Here document without variable expansion like PHP Nowdoc
https://github.com/YoshikuniJujo/nowdoc#readme
LTS Haskell 23.27: | 0.1.1.0@rev:1 |
Stackage Nightly 2025-07-13: | 0.1.1.0@rev:1 |
Latest on Hackage: | 0.1.1.0@rev:1 |
BSD-3-Clause licensedbyYoshikuni Jujo
Maintained by[email protected]
This version can be pinned in stack with:
nowdoc-0.1.1.0@sha256:9bad7add93646010b1264e26f50072a7108007b0ca98ae5712d87aa47b7e9d1c,1738
Module documentation for 0.1.1.0
- Text
Depends on 3 packages(full list with versions):
nowdoc
Package nowdoc contain 3 QuasiQuotes.
- nowdoc: Simplest here document with only two transformation.
- txtfile: It incerts text file contents as string.
- binfile: It incerts binary file contents as string.
QuasiQuoter nowdoc
Simplest here document.Only two transformation.
- remove head newline if exist
- remove one space from ‘|’, space, space, …, ‘]’
short examples
hello = [nowdoc|abcdefghi|]
is
hello = "abc\ndef\nghi\n"
,
hello = [nowdoc|hello|]
is
hello = "hello"
and
hello = [nowdoc|hello | ]world | ]! | ]|]
is
hello = "hello |]\nworld| ]\n! | ]"
run perl
{-# LANGUAGE QuasiQuotes #-}import System.Processimport Text.Nowdocmain :: IO ()main = () <$ rawSystem "perl" ["-e", [nowdoc|use strict;use warnings;my $hello = "Hello, world!\n";print $hello;|]]
ASCII art
{-# LANGUAGE QuasiQuotes #-}import Text.Nowdocmain :: IO ()main = putStr [nowdoc| ______ .d$$$******$$$$c. .d$P" "$$c $$$$$. .$$$*$. .$$ 4$L*$$. .$$Pd$ '$b $F *$. "$$e.e$$" 4$F ^$b d$ $$ z$$$e $$ '$. $P `$L$$P` `"$$d$" $$ $$ e$$F 4$$b. $$ $b .$$" $$ .$$ "4$b. $$ $$e$P" $b d$` "$$c$F '$P$$$$$$$$$$$$$$$$$$$$$$$$$$ "$c. 4$. $$ .$$ ^$$. $$ d$" d$P "$$c. `$b$F .d$P" `4$$$c.$$$..e$$P" `^^^^^^^`|]
QuasiQuoter txtfile
It incerts file contents as string without transformation.It read file as text file (with default encoding on your system).
main :: IO ()main = putStr [txtfile|foo.txt|]
QuasiQuoter binfile
It incerts file contents as string without transformation.It read file as binary file.
main :: IO ()main = print [binfile|foo.dat|]
Changes
Changelog for nowdoc
Unreleased changes
- add QuasiQuoter txtfile
- add QuasiQuoter binfile
txtfile
QuasiQuoter txtfile incerts file contents as string without transformation.It read file as text file (with default encoding on your system).
main :: IO ()main = putStr [txtfile|foo.txt|]
binfile
QuasiQuoter txtfile incerts file contents as string without transformation.It read file as binary file.
main :: IO ()main = putStr [binfile|foo.dat|]