on master help sign in
additional doc for cons (.:) operation
commit5a2ec3592bbedb81975a496b690075312495003f authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 11 Mar 2018, 00:31 (9 years ago) parent662d2f3
1 file changed+15
src/Streamly/Streams.hs+15
src/Streamly/Streams.hs+15
@@ -142,6 +142,21 @@ infixr 5 .:
142142--
143143-- '.:' constructs a stream just like ':' constructs a list.
144144--
145+-- Also note that another equivalent way of building streams from pure values
146+-- is:
147+--
148+-- @
149+-- > let stream = pure 1 <> pure 2 <> pure 3
150+-- > (toList . serially) stream
151+-- [1,2,3]
152+-- @
153+--
154+-- In the first method we construct a stream by adding one element at a time.
155+-- In the second method we first construct singleton streams using 'pure' and
156+-- then compose all those streams together using the 'Semigroup' style
157+-- composition of streams. The former method is a bit more efficient than the
158+-- latter.
159+--
145160(.:) :: (Streaming t) => a -> t m a -> t m a
146161(.:) = cons
147162