Add a comment about "reader" functionality
commitd78fa87d4db99cca669173e680bd423d75fca9ac
authorHarendra Kumar <harendra@composewell.com>
dateSat 20 Feb 2021, 16:07 (6 years ago)
parent3b25583
core/src/Streamly/Internal/Data/Unfold.hs+6
@@ -71,6 +71,12 @@
7171-- unfolds allow the compiler to statically know the state and optimize it
7272-- using stream fusion whereas it is not possible with the monad bind because
7373-- the state is determined dynamically.
74+--
75+-- Reader:
76+--
77+-- An unfold acts as a reader (see 'Reader' monad). The input to an unfold acts
78+-- as the read-only environment. The environment can be extracted using the
79+-- 'identity' unfold (equivalent to 'ask') and transformed using 'lmap'.
7480
7581-- Open control flow style streams can also have two representations. StreamK
7682-- is a producer style representation. We can also have a consumer style