How can I write multiline strings in Haskell?

后端 未结 6 767
南旧
南旧 2021-02-02 05:10

Let\'s say I have this string literal with line breaks:

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

Is there an

6条回答
  •  悲&欢浪女
    2021-02-02 05:41

    In Haskell you can type multiline strings by ending it with a backslash \ and beginning the newline with another \, just like so :

    file :: String
    file = "the first line\n\  
        \the second line\n\  
        \the third line\n"  
    

提交回复
热议问题