haskell - 如何在 emacs 中对齐函数参数的 Haddock 注释?
问题描述
似乎记录函数参数的唯一方法是使用-- ^ docs here
style。不幸的是,当函数参数的长度不同时,这会变得非常笨拙。例如:
myFunc :: (Int -> String -> Bool -> IO ()) -- ^ documentation string #1
-> Int -- ^ documentation string #2
-> String -- ^ documentation string #3
-> Bool -- ^ documentation string #4
-> IO () -- ^ documentation string #5
将上述转换为以下,需要大量的手动工作:
myFunc :: (Int -> String -> Bool -> IO ()) -- ^ documentation string #1
-> Int -- ^ documentation string #2
-> String -- ^ documentation string #3
-> Bool -- ^ documentation string #4
-> IO () -- ^ documentation string #5
在 Emacs 中是否有任何自动执行此操作的方法?或者还有其他更易于管理的方式来编写此文档吗?
解决方案
它没有回答有关如何自动对齐注释的问题,但是当类型变长时,我通常依赖于不同的格式样式:
myFunc
:: (Int -> String -> Bool -> IO ())
-- ^ documentation string #1
-> Int
-- ^ documentation string #2
-> String
-- ^ documentation string #3
-> Bool
-- ^ documentation string #4
-> IO ()
-- ^ documentation string #5
推荐阅读
- xpath - 如何使用xpath排除某个类中某个位置的标签?
- jquery - 拖放形状后如何在剑道图中获取形状的文本?
- packaging - 为 Ubuntu16 构建 Netdata deb 包
- c# - WCF:服务器没有提供有意义的回复;
- css - 如何使用css更改Bootstrap tablist中活动元素的li标签的背景颜色
- jfreechart - 不遵守 JFreeChart 背景颜色设置
- react-native - 更新 componentWillMount 中的状态
- android - 当我尝试膨胀我的图形片段时出现“膨胀类 com.androidplot.xy.XYPlot 时出错”
- hyperledger-fabric - 重新启动kafka,zookeeper和orderer时在orderer中找不到频道'mychannel'
- vb.net - 如何返回所有线程都在函数中完成?