How can I write multiline strings in Haskell? -


let's have string literal line breaks:

file :: string file = "the first line\nthe second line\nthe third line" 

is there way write this?

file :: string file = "the first line         second line         third line" 

the attempt above leads error:

factor.hs:58:33:     lexical error in string/character literal @ character '\n' failed, modules loaded: none. 

you can write multiline strings so

x = "this text escape \       \   , unescape keep writing" 

which prints as

"this text escape   , unescape keep writing" 

if want print 2 lines

x = "this text escape \n\       \   , unescape keep writing" 

which prints as

this text escape     , unescape keep writing 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -