skip to main content
10.1145/3125374.3125385acmotherconferencesArticle/Chapter ViewAbstractPublication PagessblpConference Proceedingsconference-collections
research-article

A preliminary assessment of how monads are used in Haskell

Published: 21 September 2017 Publication History

Abstract

Monads are a denotational approach to embed and reason 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 to 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 8 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 how developers use monads. In this paper we present preliminary results of an empirical study that quantitatively describe how monads are used in a sample of the Hackage repository. Our results show that around 25% of sampled modules depend on the mtl package, whereas only 1% depend on alternative, yet compatible implementations. Nevertheless, usage patterns for each specific monad remain similar both for mtl and alternatives. Regarding usage, the state monad is by far the most used one, although all of them are used. We also report on the distribution of packages that use mtl, regarding their category and stability level.

References

[1]
Nikolaos Bezirgiannis, Johan Jeuring, and Sean Leather. 2013. Usage of Generic Programming on Hackage: Experience Report. In Proceedings of the 9th ACM SIGPLAN Workshop on Generic Programming (WGP '13). ACM, New York, NY, USA, 47--52.
[2]
Oscar Callaú, Romain Robbes, Éric Tanter, and David Röthlisberger. 2013. How (and Why) Developers Use the Dynamic Features of Programming Languages: the Case of Smalltalk. Empirical Software Engineering 18, 6 (Dec. 2013), 1156--1194.
[3]
Oscar Callaú, Romain Robbes, Éric Tanter, David Röthlisberger, and Alexandre Bergel. 2014. On the Use of Type Predicates in Object-Oriented Software: The Case of Smalltalk. In Proceedings of the 10th ACM Dynamic Languages Symposium (DLS 2014). ACM Press, Portland, OR, USA, 135--146. ACM SIGPLAN Notices, 50(2).
[4]
Casey Casalnuovo, Prem Devanbu, Abilio Oliveira, Vladimir Filkov, and Baishakhi Ray. 2015. Assert Use in GitHub Projects. In Proceedings of the 37th International Conference on Software Engineering - Volume 1 (ICSE '15). IEEE Press, Piscataway, NJ, USA, 755--766. http://dl.acm.org/citation.cfm?id=2818754.2818846
[5]
Edsger W. Dijkstra. 1968. Go To Statement Considered Harmful. Commun. ACM 11, 3 (March 1968), 147--148.
[6]
Ismael Figueroa. 2017. A preliminar asssesment of how monads are used in Haskell. (April 2017). http://zeus.inf.ucv.cl/~ifigueroa/doku.php/research/empirical-monads
[7]
haskell.org. 2017. Hackage. (April 2017). http://hackage.haskell.org
[8]
haskell.org. 2017. Haskell Cabal. (April 2017). http://www.haskell.org/cabal
[9]
haskell.org. 2017. The Haskell Language. (April 2017). http://www.haskell.org
[10]
Hadi Hemmati, Sarah Nadi, Olga Baysal, Oleksii Kononenko, Wei Wang, Reid Holmes, and Michael W. Godfrey. 2013. The MSR Cookbook: Mining a Decade of Research. In Proceedings of the 10th Working Conference on Mining Software Repositories (MSR '13). IEEE Press, Piscataway, NJ, USA, 343--352. http://dl.acm.org/citation.cfm?id=2487085.2487150
[11]
Sheng Liang, Paul Hudak, and Mark Jones. 1995. Monad transformers and modular interpreters. In Proceedings of the 22nd ACM Symposium on Principles of Programming Languages (POPL 95). ACM Press, San Francisco, California, USA, 333--343.
[12]
Eugenio Moggi. 1991. Notions of computation and monads. Information and Computation 93, 1 (July 1991), 55--92.
[13]
J. Garrett Morris. 2010. Experience Report: Using Hackage to Inform Language Design. In Proceedings of the Third ACM Haskell Symposium on Haskell (Haskell '10). ACM, New York, NY, USA, 61--66.
[14]
Meiyappan Nagappan, Romain Robbes, Yasutaka Kamei, Éric Tanter, Shane Mcintosh, Audris Mockus, and Ahmed E. Hassan. 2015. An Empirical Study of GOTO in C Code from GitHub Repositories. (aug-sep 2015), 404--414.
[15]
Romain Robbes, David Röthlisberger, and Éric Tanter. 2012. Extensions during Software Evolution: Do Objects Meet Their Promise?. In Proceedings of the 26th European Conference on Object-oriented Programming (ECOOP 2012) (Lecture Notes in Computer Science), James Noble (Ed.), Vol. 7313. Springer-Verlag, Beijing, China, 28--52.
[16]
Philip Wadler. 1992. The essence of functional programming. In Proceedings of the 19th ACM Symposium on Principles of Programming Languages (POPL 92). ACM Press, Albuquerque, New Mexico, USA, 1--14.
[17]
Philip Wadler and Stephen Blott. 1989. How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM Symposium on Principles of Programming Languages (POPL 89). ACM Press, Austin, TX, USA, 60--76.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
SBLP '17: Proceedings of the 21st Brazilian Symposium on Programming Languages
September 2017
87 pages
ISBN:9781450353892
DOI:10.1145/3125374
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

In-Cooperation

  • SBC: Brazilian Computer Society
  • CNPq: Conselho Nacional de Desenvolvimento Cientifico e Tecn
  • CAPES: Brazilian Higher Education Funding Council

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 21 September 2017

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Hackage
  2. Haskell
  3. empirical study
  4. mining software repositories
  5. monads
  6. use of monads

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Conference

SBLP 2017
SBLP 2017: 21st Brazilian Symposium on Programming Languages
September 21 - 22, 2017
CE, Fortaleza, Brazil

Acceptance Rates

Overall Acceptance Rate 22 of 50 submissions, 44%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 06 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media