当前位置: X-MOL 学术Sci. Comput. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Which monads Haskell developers use: An exploratory study
Science of Computer Programming ( IF 1.3 ) Pub Date : 2020-08-06 , DOI: 10.1016/j.scico.2020.102523
Ismael Figueroa , Paul Leger , Hiroaki Fukuda

Monads are a mechanism for embedding and reasoning about notions of computation such as mutable state, I/O, exceptions, and many others. Even though monads are technically language-agnostic, they are mostly associated with the Haskell language. Indeed, one could argue that the use of monads is one of the defining characteristic of the Haskell language. In practical terms, monadic programming in Haskell relies on the standard mtl package library, which provides eight core notions of computation: identity, error, list, state, reader, writer, RWS, and continuations. Despite their widespread use, we are not aware of any empirical investigations regarding which monads are the most used by developers. In this paper we present an empirical study that covers a snapshot of available packages in the Hackage repository—covering 85135 packages and more than five million Haskell files. To the best of our knowledge this is the first large-scale analysis of Hackage with regards to monads and their usage as dependencies. Our results show that around 30.8% of the packages depend on the mtl package, whereas only 1.2% depend on alternative, yet compatible implementations. Nevertheless, usage patterns for each specific monad remain similar both for mtl and alternatives. Finally, the state monad is by far the most popular one, although all of them are used. We also report on the distribution of packages that use mtl, regarding their category and stability level.



中文翻译:

Haskell开发人员使用哪些monad:探索性研究

Monad是一种用于嵌入和推理关于诸如可变状态,I / O,异常等许多其他计算概念的机制。即使monad从技术上讲与语言无关,但它们大多与Haskell语言相关联。确实,有人可能会争辩说,使用monad是Haskell语言的定义特征之一。实际上,Haskell中的monadic编程依赖于标准mtl软件包库,提供了八个核心计算概念:身份,错误,列表,状态,读取器,写入器,RWS和延续。尽管已广泛使用它们,但我们尚无任何关于哪一种Monad最常被开发人员使用的实证研究。在本文中,我们提供了一项实证研究,涵盖了Hackage存储库中可用程序包的快照-涵盖85135个程序包和超过500万个Haskell文件。据我们所知,这是首次关于Hackad并将其用作依赖项的大规模分析。我们的结果表明,大约30.8%的软件包依赖于mtl软件包,而只有1.2%取决于替代但兼容的实现。尽管如此,每个特定单子的使用模式在MTL和替代品。最后,虽然使用了所有状态,但状态monad到目前为止是最受欢迎的状态。我们还将报告使用mtl的软件包的分布情况,以及它们的类别和稳定性级别。

更新日期:2020-08-06
down
wechat
bug