相关疑难解决方法(0)

如何在Haskell中编写多行字符串?

假设我有这个带换行符的字符串文字:

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)

haskell

56
推荐指数
6
解决办法
2万
查看次数

从解析.cabal文件中检索cabal包中包含的模块的名称

我想知道是否有办法从解析.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.

这是打算还是我做错了什么?此外,如果它是有意的,有没有人知道检索模块名称的任何其他简单方法?

提前致谢!

haskell cabal

5
推荐指数
0
解决办法
205
查看次数

标签 统计

haskell ×2

cabal ×1