【发布时间】:2014-05-20 01:47:57
【问题描述】:
假设我有这个带换行符的字符串文字:
file :: String
file = "the first line\nthe second line\nthe third line"
有没有办法这样写?
file :: String
file = "the first line
the second line
the third line"
上面的尝试导致了这个错误:
factor.hs:58:33:
lexical error in string/character literal at character '\n'
Failed, modules loaded: none.
【问题讨论】:
-
假设有一种方法,它不会添加空格来实现缩进吗?
-
@JonathanFischoff 见my answer。
标签: haskell