on master help sign in
Add a comment about "reader" functionality
d78fa87Harendra Kumar
core/src/Streamly/Internal/Data/Unfold.hs+6
@@ -71,6 +71,12 @@
71-- unfolds allow the compiler to statically know the state and optimize it
71-- unfolds allow the compiler to statically know the state and optimize it
72-- using stream fusion whereas it is not possible with the monad bind because
72-- using stream fusion whereas it is not possible with the monad bind because
73-- the state is determined dynamically.
73-- 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'.
74
80
75-- Open control flow style streams can also have two representations. StreamK
81-- Open control flow style streams can also have two representations. StreamK
76-- is a producer style representation. We can also have a consumer style
82-- is a producer style representation. We can also have a consumer style