{"title":"对单子在Haskell中如何使用的初步评估","authors":"Ismael Figueroa","doi":"10.1145/3125374.3125385","DOIUrl":null,"url":null,"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.","PeriodicalId":430395,"journal":{"name":"Proceedings of the 21st Brazilian Symposium on Programming Languages","volume":"26 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2017-09-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":"{\"title\":\"A preliminary assessment of how monads are used in Haskell\",\"authors\":\"Ismael Figueroa\",\"doi\":\"10.1145/3125374.3125385\",\"DOIUrl\":null,\"url\":null,\"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.\",\"PeriodicalId\":430395,\"journal\":{\"name\":\"Proceedings of the 21st Brazilian Symposium on Programming Languages\",\"volume\":\"26 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2017-09-21\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"3\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the 21st Brazilian Symposium on Programming Languages\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3125374.3125385\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 21st Brazilian Symposium on Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3125374.3125385","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
A preliminary assessment of how monads are used in Haskell
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.