How can I write multiline strings in Haskell?

后端 未结 6 744
南旧
南旧 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:38

    Quasiquotation examplete presented in Multi-line strings in Haskell.

    {-# LANGUAGE QuasiQuotes #-}
    import Text.RawString.QQ
    
    multiline :: String
    multiline = [r|
    
    Auto-generated html formated source
    
    
    
    

    |]
    

    raw-strings-qq is my favorite for the purpose yet.

提交回复
热议问题