Skip to content

Commit d78fa87

Browse files
Add a comment about "reader" functionality
1 parent 3b25583 commit d78fa87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/Streamly/Internal/Data/Unfold.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)