假设我有这个带换行符的字符串文字:
file :: String
file = "the first line\nthe second line\nthe third line"
Run Code Online (Sandbox Code Playgroud)
有没有办法像这样写?
file :: String
file = "the first line
the second line
the third line"
Run Code Online (Sandbox Code Playgroud)
上面的尝试导致了这个错误:
factor.hs:58:33:
lexical error in string/character literal at character '\n'
Failed, modules loaded: none.
Run Code Online (Sandbox Code Playgroud) 我想知道是否有办法从解析.cabal文件中检索cabal包的模块名称.
我曾尝试使用Distribution.PackageDescription.Parse中的parsePackageDescription,但是当我尝试解析Cabal包本身的.cabal时(http://hackage.haskell.org/package/Cabal-1.18.1.2/Cabal.cabal)即使在.cabal文件中有一个包含exposed-modules和other.modules的库部分,PackageDescription的库值也是Nothing.
这是打算还是我做错了什么?此外,如果它是有意的,有没有人知道检索模块名称的任何其他简单方法?
提前致谢!