Skip to content

Commit d2685a5

Browse files
danidiazDaniel Diaz
andauthored
corrected documentation for enumFrom (#94)
Co-authored-by: Daniel Diaz <diaz.carrete@facebook.com>
1 parent 8a7c79e commit d2685a5

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/Streaming/Prelude.hs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -832,19 +832,21 @@ elem_ a' = loop False where
832832

833833
{-| An infinite stream of enumerable values, starting from a given value.
834834
It is the same as @S.iterate succ@.
835-
Because their return type is polymorphic, @enumFrom@, @enumFromThen@
836-
and @iterate@ are useful for example with @zip@
837-
and @zipWith@, which require the same return type in the zipped streams.
838-
With @each [1..]@ the following bit of connect-and-resume would be impossible:
839-
840-
>>> rest <- S.print $ S.zip (S.enumFrom 'a') $ S.splitAt 3 $ S.enumFrom 1
841-
('a',1)
842-
('b',2)
843-
('c',3)
835+
Because their return type is polymorphic, @enumFrom@, @enumFromThen@
836+
and @iterate@ are useful with functions like @zip@ and @zipWith@, which
837+
require the zipped streams to have the same return type.
838+
839+
For example, with
840+
@each [1..]@ the following bit of connect-and-resume would not compile:
841+
842+
>>> rest <- S.print $ S.zip (S.enumFrom 1) $ S.splitAt 3 $ S.each ['a'..'z']
843+
(1,'a')
844+
(2,'b')
845+
(3,'c')
844846
>>> S.print $ S.take 3 rest
845-
4
846-
5
847-
6
847+
'd'
848+
'e'
849+
'f'
848850
849851
-}
850852
enumFrom :: (Monad m, Enum n) => n -> Stream (Of n) m r

0 commit comments

Comments
 (0)