I found the patches that introduced this redundancy to the transformers package and the mtl package. The patch/commit descriptions are... not super enlightening. However, in both cases, asks
predates reader
, and in both cases, the same change introduced the state
and writer
primitives.
So, some speculation:
- It was observed that it's handy to have the core semantic thing that the transformer/monad class does as a concept represented in the library.
- For predictability, that new primitives were named after the transformer that supplied that primitive and nothing else (
StateT
-> state
; WriterT
-> writer
; ReaderT
-> reader
). This parallelism makes it easier for users to remember what the thing they want is called.
- Since
asks
already existed, it was kept around for a modicum of backwards-compatibility.
If we wanted a definitive answer, we might have to ask Ed Kmett or Twan van Laarhoven, the apparent originators of the changes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…