TY - JOUR
T1 - Which monads Haskell developers use
T2 - An exploratory study
AU - Figueroa, Ismael
AU - Leger, Paul
AU - Fukuda, Hiroaki
N1 - Funding Information:
This work is partially funded by FONDECYT Postdoctoral Project 3150672 . We thank all the anonymous reviewers for their insightful comments.
Publisher Copyright:
© 2020 Elsevier B.V.
PY - 2021/1/1
Y1 - 2021/1/1
N2 - 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.
AB - 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.
KW - Empirical study
KW - Hackage
KW - Haskell
KW - Mining software repositories
KW - Monads
KW - Use of monads
UR - http://www.scopus.com/inward/record.url?scp=85090160206&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85090160206&partnerID=8YFLogxK
U2 - 10.1016/j.scico.2020.102523
DO - 10.1016/j.scico.2020.102523
M3 - Article
AN - SCOPUS:85090160206
SN - 0167-6423
VL - 201
JO - Science of Computer Programming
JF - Science of Computer Programming
M1 - 102523
ER -