2021-02-18 16:07:22 +03:00
|
|
|
module StringLiteral
|
2021-01-29 12:11:22 +03:00
|
|
|
|
|
|
|
withWrap : String
|
|
|
|
withWrap = "foo
|
|
|
|
bar"
|
|
|
|
|
|
|
|
withNoWrap : String
|
|
|
|
withNoWrap = "foo \
|
|
|
|
bar"
|
|
|
|
|
|
|
|
withIndent : String
|
|
|
|
withIndent = "foo
|
|
|
|
bar"
|
|
|
|
|
|
|
|
withEscape : String
|
|
|
|
withEscape = #""foo"\#n
|
|
|
|
\bar"#
|
|
|
|
|
|
|
|
withEscapeNoWrap : String
|
|
|
|
withEscapeNoWrap = #""foo" \#
|
|
|
|
\bar"#
|
|
|
|
|
2021-02-18 16:07:22 +03:00
|
|
|
interp : String
|
|
|
|
interp = "\{withNoWrap}"
|
|
|
|
|
|
|
|
interp2 : String
|
|
|
|
interp2 = "hello\{ " " ++ ##"world\##{#"."#}"## }"
|
|
|
|
|
|
|
|
interp3 : String
|
|
|
|
interp3 = "Just 1 + Just 2 = \{
|
|
|
|
show $ do a <- Just 1
|
|
|
|
b <- Just 2
|
|
|
|
Just (a + b)
|
|
|
|
}"
|
|
|
|
|
2021-01-29 12:11:22 +03:00
|
|
|
test : IO ()
|
|
|
|
test =
|
|
|
|
do
|
|
|
|
putStrLn withWrap
|
|
|
|
putStrLn withNoWrap
|
|
|
|
putStrLn withIndent
|
|
|
|
putStrLn withEscape
|
|
|
|
putStrLn withEscapeNoWrap
|
2021-02-18 16:07:22 +03:00
|
|
|
putStrLn interp
|
|
|
|
putStrLn interp2
|
|
|
|
putStrLn interp3
|
|
|
|
let idris = "Idris"
|
|
|
|
putStrLn "Hello \{idris ++ show 2}!"
|
2021-01-29 12:11:22 +03:00
|
|
|
putStrLn ##"
|
|
|
|
name: #"foo"
|
|
|
|
version: "bar"
|
|
|
|
bzs: \#\'a\n\t\\'"##
|