Skip to content

Commit a98c696

Browse files
authored
Merge pull request #29 from haskell-works/new-fromList-function
New fromList function
2 parents e706517 + ec8322f commit a98c696

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/HaskellWorks/Data/Streams/Stream.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,8 @@ dupMap f g (Stream stepA stateA _) = Stream (mkStepB stepA) (stateA, Nothing) Un
136136
Just w -> Yield w (s, Nothing)
137137
{-# INLINE dupMap #-}
138138

139+
fromList :: [a] -> Stream a
140+
fromList as = Stream step as Unknown
141+
where step [] = Done
142+
step (b:bs) = Yield b bs
143+
{-# INLINE [1] fromList #-}

0 commit comments

Comments
 (0)