我正在尝试使用LaTeX.hs作为指南,为pandoc破解一个新的文件格式编写器。$$
虽然已经广泛使用了运算符,但是我在Haskell语法文档中甚至在其他项目中都找不到它。这是一个例子:
let align dir txt = inCmd "begin" dir $$ txt $$ inCmd "end" dir
这几乎看起来像某种串联运算符,但我无法确定这与其他串联运算有何不同。该运算符是什么?它如何工作?在哪里记录?
Pandoc在内部定义了自己的漂亮打印库,但是操作(以及类型的名称Doc
)是Haskell漂亮打印库中的标准配置。Pandoc也定义其他知交像vcat
,hsep
,<+>
等等; 周围有许多漂亮的打印模块,但它们始终支持这些操作。
> import Text.PrettyPrint
> text "hello" <> text "world"
helloworld
> text "hello" <+> text "world"
hello world
> text "hello" $$ text "world"
hello
world
> text "hello" <+> text "world" $$ text "goodbye" <+> text "world"
hello world
goodbye world
ghci
粗略地说,这里显示“文档的外观”。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句